Class: SmartSpinnerCis::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- SmartSpinnerCis::Generators::InstallGenerator
- Defined in:
- lib/generators/smart_spinner_cis/install/install_generator.rb,
lib/generators/smart_spinner_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
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/generators/smart_spinner_cis/install/install_generator.rb', line 24 def add_assets if detect_js_format.nil? copy_file "javascripts/jquery.smart-spinner-cis.js", "app/assets/javascripts/smart-spinner-cis.js" else insert_into_file "app/assets/javascripts/application#{detect_js_format[0]}", "#{detect_js_format[1]} require smart-spinner-cis\n", :after => "jquery_ujs\n" end if detect_css_format.nil? copy_file "stylesheets/jquery.smart-spinner-cis.css", "app/assets/stylesheets/smart-spinner-cis.css" else insert_into_file "app/assets/stylesheets/application#{detect_css_format[0]}", "#{detect_css_format[1]} require smart-spinner-cis\n", :after => "require_self\n" end #copy_file "images/notification_top_alert.png", "app/assets/images/notification_top_alert.png" #copy_file "images/notification_top_error.png", "app/assets/images/notification_top_error.png" #copy_file "images/notification_top_ok.png", "app/assets/images/notification_top_ok.png" end |
#copy_jquery_nested ⇒ Object
11 12 13 14 |
# File 'lib/generators/smart_spinner_cis/install/install_generator.rb', line 11 def copy_jquery_nested copy_file "javascripts/smart-spinner-cis.js", "public/javascripts/smart-spinner-cis.js" copy_file "stylesheets/smart-spinner-cis.css", "public/stylesheets/smart-spinner-cis.css" end |
#detect_css_format ⇒ Object
45 46 47 48 |
# File 'lib/generators/smart_spinner_cis/install/install_generator.rb', line 45 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
41 42 43 44 |
# File 'lib/generators/smart_spinner_cis/install/install_generator.rb', line 41 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 |