Class: Initjs::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Initjs::Generators::InstallGenerator
show all
- Includes:
- ResourceHelpers
- Defined in:
- lib/generators/initjs/install/install_generator.rb
Instance Method Summary
collapse
#application_name, #application_path, #js_app_name
Instance Method Details
#create_app_file ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/generators/initjs/install/install_generator.rb', line 16
def create_app_file
template "app.coffee", "#{application_path}/#{application_name.underscore}.js.coffee"
puts "\n\nInclude the Initjs tag in your application layout (usually found at app/view/layouts/application.html.erb) after the body tag."
puts "<%= initjs_tag '#{application_name}' %>"
end
|
#inject_backbone ⇒ Object
10
11
12
13
14
|
# File 'lib/generators/initjs/install/install_generator.rb', line 10
def inject_backbone
inject_into_file "app/assets/javascripts/application.js", before: "//= require_tree" do
"//= require #{application_name.underscore}/#{application_name.underscore}.js\n//= require init.js\n"
end
end
|