Class: RevealCis::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- RevealCis::Generators::InstallGenerator
- Defined in:
- lib/generators/reveal_cis/install/install_generator.rb,
lib/generators/reveal_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
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/generators/reveal_cis/install/install_generator.rb', line 26 def add_assets if detect_js_format.nil? copy_file "javascripts/jquery-1.4.4.min.js", "app/assets/javascripts/jquery-1.4.4.min.js" copy_file "javascripts/jquery.reveal.js", "app/assets/javascripts/jquery.reveal.js" else insert_into_file "app/assets/javascripts/application#{detect_js_format[0]}", "#{detect_js_format[1]} require jquery-1.4.4.min\n", :after => "jquery_ujs\n" insert_into_file "app/assets/javascripts/application#{detect_js_format[0]}", "#{detect_js_format[1]} require jquery.reveal\n", :after => "jquery-1.4.4.min\n" end if detect_css_format.nil? copy_file "stylesheets/jquery.notifications.css", "app/assets/stylesheets/jquery.notifications.css" copy_file "stylesheets/modal-gloss.png", "app/assets/stylesheets/modal-gloss.png" else insert_into_file "app/assets/stylesheets/application#{detect_css_format[0]}", "#{detect_css_format[1]} require reveal\n", :after => "require_self\n" end end |
#copy_jquery_nested ⇒ Object
11 12 13 14 15 16 |
# File 'lib/generators/reveal_cis/install/install_generator.rb', line 11 def copy_jquery_nested copy_file "javascripts/jquery-1.4.4.min.js", "public/javascripts/jquery-1.4.4.min.js" copy_file "javascripts/jquery.reveal.js", "public/javascripts/jquery.reveal.js" copy_file "stylesheets/reveal.css", "public/stylesheets/reveal.css" copy_file "stylesheets/modal-gloss.png", "public/stylesheets/modal-gloss.png" end |
#detect_css_format ⇒ Object
47 48 49 50 |
# File 'lib/generators/reveal_cis/install/install_generator.rb', line 47 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
43 44 45 46 |
# File 'lib/generators/reveal_cis/install/install_generator.rb', line 43 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 |