Class: RequirejsOptimizer::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#installObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/install_generator.rb', line 8

def install
  @main_name = ask("What is the name of your main module without the extension? (Leave blank for \"main\"):").tap { |s| s.replace "main" if s.blank? }
  template "require.build.js", "app/assets/javascripts/modules/require.build.js"
  copy_file "main.js.coffee", "app/assets/javascripts/modules/#{@main_name}.js.coffee"
  copy_file "README", "app/assets/javascripts/modules/README"

  say <<-README

requirejs_optimzier doesn't include require.js for use in you're app. If you
need it, you can get it via:

$ curl http://requirejs.org/docs/release/1.0.7/comments/require.js > vendor/assets/javascripts/require.js

  README
end