Class: DlJusyoJp::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- DlJusyoJp::Generators::InstallGenerator
- Defined in:
- lib/generators/dl_jusyo_jp/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
9 10 11 |
# File 'lib/generators/dl_jusyo_jp/install_generator.rb', line 9 def self.source_root File.("../templates", __FILE__) end |
Instance Method Details
#copy_initializer ⇒ Object
13 14 15 |
# File 'lib/generators/dl_jusyo_jp/install_generator.rb', line 13 def copy_initializer template '../templates/initializers/dl_jusyo_jp.rb', 'config/initializers/dl_jusyo_jp.rb' end |
#create_migrations ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/dl_jusyo_jp/install_generator.rb', line 17 def create_migrations Dir["#{self.class.source_root}/migrations/*.rb"].sort.each do |filepath| name = File.basename(filepath) to_path = 'db/migrate' # TODO: something wrong... if Dir.glob("#{to_path}/[0-9]*_*.rb").grep(/\d+_#{name}$/).blank? template("migrations/#{name}", "#{to_path}/#{Time.zone.now.strftime('%Y%m%d%H%M%S')}_#{name}") end end end |