Class: Enginex

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/enginex.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.say_step(message) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/enginex.rb', line 17

def self.say_step(message)
  @step = (@step || 0) + 1
  class_eval <<-METHOD, __FILE__, __LINE__ + 1
    def step_#{@step}
      #{"puts" if @step > 1}
      say_status "STEP #{@step}", #{message.inspect}
    end
  METHOD
end

.source_rootObject



13
14
15
# File 'lib/enginex.rb', line 13

def self.source_root
  @_source_root ||= File.expand_path('../templates', __FILE__)
end

Instance Method Details

#change_config_filesObject



62
63
64
65
66
# File 'lib/enginex.rb', line 62

def change_config_files
  store_application_definition!
  template "rails/boot.rb", "#{dummy_path}/config/boot.rb", :force => true
  template "rails/application.rb", "#{dummy_path}/config/application.rb", :force => true
end

#change_gitignoreObject



49
50
51
# File 'lib/enginex.rb', line 49

def change_gitignore
  template "gitignore", ".gitignore"
end

#create_rootObject



37
38
39
40
41
42
43
# File 'lib/enginex.rb', line 37

def create_root
  self.destination_root = File.expand_path(path, destination_root)
  set_accessors!

  directory "root", "."
  FileUtils.cd(destination_root)
end

#create_tests_or_specsObject



45
46
47
# File 'lib/enginex.rb', line 45

def create_tests_or_specs
  directory test_path
end

#invoke_rails_app_generatorObject



55
56
57
58
# File 'lib/enginex.rb', line 55

def invoke_rails_app_generator
  invoke Rails::Generators::AppGenerator,
    [ File.expand_path(dummy_path, destination_root) ]
end

#remove_uneeded_rails_filesObject



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/enginex.rb', line 70

def remove_uneeded_rails_files
  inside dummy_path do
    remove_file ".gitignore"
    remove_file "db/seeds.rb"
    remove_file "doc"
    remove_file "Gemfile"
    remove_file "lib/tasks"
    remove_file "public/images/rails.png"
    remove_file "public/index.html"
    remove_file "public/robots.txt"
    remove_file "README"
    remove_file "test"
    remove_file "vendor"
  end
end