Class: Matrioshka::Generator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Matrioshka::Generator
- Defined in:
- lib/matrioshka/generator.rb
Instance Method Summary collapse
- #copy_gemfile_from(location, name) ⇒ Object
- #prepend_gemfile(name) ⇒ Object
- #prepend_seeds(name) ⇒ Object
Instance Method Details
#copy_gemfile_from(location, name) ⇒ Object
5 6 7 8 |
# File 'lib/matrioshka/generator.rb', line 5 def copy_gemfile_from(location, name) copy_file Pathname.new(location).join('Gemfile'), "Gemfile.#{name.underscore.gsub('/', '-')}" prepend_gemfile name end |
#prepend_gemfile(name) ⇒ Object
10 11 12 |
# File 'lib/matrioshka/generator.rb', line 10 def prepend_gemfile(name) prepend_file 'Gemfile', "eval_gemfile 'Gemfile.#{name.underscore.gsub('/', '-')}'\n" end |
#prepend_seeds(name) ⇒ Object
14 15 16 |
# File 'lib/matrioshka/generator.rb', line 14 def prepend_seeds(name) prepend_file 'db/seeds.rb', "load #{name}::Engine.root.join(*%w(db seeds.rb))\n" end |