Class: LinkToAction::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/link_to_action/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_initializersObject


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 options[: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_fileObject


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_templatesObject


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 options[:bootstrap]
    source_file = [ source_dir, "#{action}.html.erb"].compact.join('/')
    copy_file source_file, "lib/templates/erb/scaffold/#{action}.html.erb"
  end
end

#info_frameworkObject


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 options.bootstrap?
end