Class: PaceCis::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- PaceCis::Generators::InstallGenerator
- Defined in:
- lib/generators/pace_cis/install/install_generator.rb,
lib/generators/pace_cis/install/install_generator.rb
Instance Method Summary collapse
- #add_assets ⇒ Object
- #copy_jquery_nested ⇒ Object
- #detect_css_format ⇒ Object
- #detect_js_format ⇒ Object
Instance Method Details
#add_assets ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/pace_cis/install/install_generator.rb', line 23 def add_assets if detect_js_format.nil? copy_file "javascripts/pace.js", "app/assets/javascripts/pace.js" else insert_into_file "app/assets/javascripts/application#{detect_js_format[0]}", "#{detect_js_format[1]} require pace\n", :after => "jquery_ujs\n" end if detect_css_format.nil? copy_file "stylesheets/jquery.notifications.css", "app/assets/stylesheets/jquery.notifications.css" else insert_into_file "app/assets/stylesheets/application#{detect_css_format[0]}", "#{detect_css_format[1]} require pace-theme-corner-indicator\n", :after => "require_self\n" end end |
#copy_jquery_nested ⇒ Object
11 12 13 |
# File 'lib/generators/pace_cis/install/install_generator.rb', line 11 def copy_jquery_nested copy_file "javascripts/pace.js", "public/javascripts/pace.js" end |
#detect_css_format ⇒ Object
41 42 43 44 |
# File 'lib/generators/pace_cis/install/install_generator.rb', line 41 def detect_css_format return ['.css.scss', '*='] if File.exist?('app/assets/stylesheets/application.css.scss') return ['.css', '*='] if File.exist?('app/assets/stylesheets/application.css') end |
#detect_js_format ⇒ Object
37 38 39 40 |
# File 'lib/generators/pace_cis/install/install_generator.rb', line 37 def detect_js_format return ['.js.coffee', '#='] if File.exist?('app/assets/javascripts/application.js.coffee') return ['.js', '//='] if File.exist?('app/assets/javascripts/application.js') end |