Class: Mercury::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_routesObject



18
19
20
# File 'lib/generators/mercury/install/install_generator.rb', line 18

def add_routes
  route %Q{Mercury::Engine.routes}
end

#copy_authentication_overridesObject



37
38
39
40
41
# File 'lib/generators/mercury/install/install_generator.rb', line 37

def copy_authentication_overrides
  if options[:full] || yes?("Install the authentication file so you can restrict access to editing? [yN]")
    copy_file 'lib/mercury/authentication.rb'
  end
end

#copy_configObject



14
15
16
# File 'lib/generators/mercury/install/install_generator.rb', line 14

def copy_config
  copy_file 'vendor/assets/javascripts/mercury.js', 'app/assets/javascripts/mercury.js'
end

#copy_layout_and_css_overridesObject



30
31
32
33
34
35
# File 'lib/generators/mercury/install/install_generator.rb', line 30

def copy_layout_and_css_overrides
  if options[:full] || yes?("Install the layout and CSS overrides files? [yN]")
    copy_file 'app/views/layouts/mercury.html.erb', 'app/views/layouts/mercury.html.erb'
    copy_file 'vendor/assets/stylesheets/mercury_overrides.css', 'app/assets/stylesheets/mercury_overrides.css'
  end
end

#copy_modelsObject



22
23
24
25
26
27
28
# File 'lib/generators/mercury/install/install_generator.rb', line 22

def copy_models
  if options[:orm] == 'mongoid'
    copy_file 'lib/generators/mercury/install/templates/mongoid_paperclip_image.rb', 'app/models/mercury/image.rb'
  else
    copy_file 'app/models/mercury/image.rb' if options[:full]
  end
end

#display_readmeObject



43
44
45
# File 'lib/generators/mercury/install/install_generator.rb', line 43

def display_readme
  readme 'POST_INSTALL' if behavior == :invoke
end