class Swat::TestWorld::Generators::InstallGenerator

Public Instance Methods

install() click to toggle source
# File lib/swat/test_world/generators/install_generator.rb, line 10
        def install
          create_tw
          if ENV['with_modules']
            create_helpers
            create_methods
            gsub_file main_file, '# You can include your own modules here' do
              <<MODULES
require 'swat/modules/helpers.rb'
require 'swat/modules/methods.rb'
include Methods
MODULES
            end
          end
        end

Private Instance Methods

create_helpers() click to toggle source
# File lib/swat/test_world/generators/install_generator.rb, line 31
def create_helpers
  file = 'lib/swat/modules/helpers.rb'
  template 'helpers.rb', file
  swat_gsub file
end
create_methods() click to toggle source
# File lib/swat/test_world/generators/install_generator.rb, line 37
def create_methods
  file = 'lib/swat/modules/methods.rb'
  template 'methods.rb', file
  swat_gsub file
end
create_tw() click to toggle source
# File lib/swat/test_world/generators/install_generator.rb, line 26
def create_tw
  template 'test_world_subclass.rb', main_file
  swat_gsub main_file
end
main_file() click to toggle source
# File lib/swat/test_world/generators/install_generator.rb, line 49
def main_file
  "lib/swat/#{name}.rb"
end
swat_gsub(file) click to toggle source
# File lib/swat/test_world/generators/install_generator.rb, line 43
def swat_gsub(file)
  gsub_file file, 'TwSubclass' do
    name.camelize
  end
end