Class: JqueryNestedRails::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- JqueryNestedRails::Generators::InstallGenerator
- Defined in:
- lib/generators/jquery_nested_rails/install/install_generator.rb,
lib/generators/jquery_nested_rails/install/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_assets ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/generators/jquery_nested_rails/install/install_generator.rb', line 25 def add_assets if detect_js_format.nil? say_status("copying", "Jquery Nested (#{JqueryNestedRails::Rails::JQUERY_NESTED_VERSION})", :green) copy_file "jquery.nested.min.js", "app/assets/javascripts/jquery.nested.min.js" else insert_into_file "app/assets/javascripts/application#{detect_js_format[0]}", "#{detect_js_format[1]} require jquery.nested\n", :after => "jquery_ujs\n" end end |
#copy_jquery_nested ⇒ Object
12 13 14 15 |
# File 'lib/generators/jquery_nested_rails/install/install_generator.rb', line 12 def copy_jquery_nested say_status("copying", "Jquery Nested (#{JqueryNestedRails::Rails::JQUERY_NESTED_VERSION})", :green) copy_file "jquery.nested.min.js", "public/javascripts/jquery.nested.min.js" end |
#detect_js_format ⇒ Object
34 35 36 37 |
# File 'lib/generators/jquery_nested_rails/install/install_generator.rb', line 34 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 |