Class: EngineGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/engine/engine_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_to_gemfileObject


28
29
30
# File 'lib/generators/engine/engine_generator.rb', line 28

def add_to_gemfile
  gem file_name, :path => file_name, :require => file_name
end

#create_application_filesObject


7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/generators/engine/engine_generator.rb', line 7

def create_application_files
  empty_directory file_name
  empty_directory engine_dir('app')
  %w(controllers helpers models views).each do |app_dir|
    empty_directory engine_dir("app/#{app_dir}")
  end
  empty_directory "#{file_name}/config"
  empty_directory "#{file_name}/public"
  template "Gemfile", "#{file_name}/Gemfile"
  template "gitignore.tt", "#{file_name}/.gitignore"
  template "engine.gemspec.tt", "#{file_name}/#{file_name}.gemspec"    
end

#create_lib_filesObject


24
25
26
# File 'lib/generators/engine/engine_generator.rb', line 24

def create_lib_files
  directory "lib", "#{file_name}/lib"
end

#create_routesObject


20
21
22
# File 'lib/generators/engine/engine_generator.rb', line 20

def create_routes
  template "routes.rb", "#{file_name}/config/routes.rb"
end