Class: LinkToAction::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- LinkToAction::Generators::InstallGenerator
- Defined in:
- lib/generators/link_to_action/install_generator.rb
Instance Method Summary collapse
- #copy_initializers ⇒ Object
- #copy_locale_file ⇒ Object
- #copy_templates ⇒ Object
- #info_framework ⇒ Object
Instance Method Details
#copy_initializers ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/link_to_action/install_generator.rb', line 18 def copy_initializers copy_file 'link_to_action.rb', 'config/initializers/link_to_action.rb' if [:bootstrap] gsub_file 'config/initializers/link_to_action.rb', %r|# config.use_icons = false|, 'config.use_icons = true' gsub_file 'config/initializers/link_to_action.rb', %r|# config.use_classes = false|, 'config.use_classes = true' end end |
#copy_locale_file ⇒ Object
28 29 30 31 |
# File 'lib/generators/link_to_action/install_generator.rb', line 28 def copy_locale_file copy_file '../../../link_to_action/locale/en.yml', 'config/locales/link_to_action.en.yml' end |
#copy_templates ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/generators/link_to_action/install_generator.rb', line 33 def copy_templates ['edit', 'index', 'new', 'show'].each do |action| source_dir = 'bootstrap' if [:bootstrap] source_file = [ source_dir, "#{action}.html.erb"].compact.join('/') copy_file source_file, "lib/templates/erb/scaffold/#{action}.html.erb" end end |
#info_framework ⇒ Object
12 13 14 15 16 |
# File 'lib/generators/link_to_action/install_generator.rb', line 12 def info_framework puts "link_to_action supports Twitter Bootstrap. If you want a " \ "configuration that is compatible with this framework, then please " \ "re-run this generator with --bootstrap option." unless .bootstrap? end |