Class: Judge::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#execObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/generators/judge/install/install_generator.rb', line 23

def exec
  unless !::Rails.application.config.assets.enabled
    say_status("deprecated", "You don't need to use this generator as your app is running on Rails >= 3.1 with the asset pipeline enabled")
    return
  end
  say_status("copying", "judge.js", :green)
  copy_file("app/assets/javascripts/judge.js", "#{path}/judge.js")
  if options.underscore?
    say_status("copying", "underscore.js", :green)
    copy_file("vendor/assets/javascripts/underscore.js", "#{path}/underscore.js")
  end
  if options.json2?
    say_status("copying", "json2.js", :green)
    copy_file("vendor/assets/javascripts/json2.js", "#{path}/json2.js")
  end
end