Class: Labjs::Generators::InstallGenerator

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

Constant Summary collapse

@@default_version =
"master"
@@dist_url =
"https://github.com/getify/LABjs/raw/{version}/{file}"

Instance Method Summary collapse

Instance Method Details

#download_labjsObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/generators/labjs/install/install_generator.rb', line 15

def download_labjs
  say_status("fetching", "LABjs (#{options.version})", :green)
  get_labjs(options.version)
rescue OpenURI::HTTPError
  say_status("warning", "could not find LABjs (#{options.version})", :yellow)
  say_status("warning", labjs_url(options.version, 'LAB.src.js'), :yellow)
  say_status("warning", labjs_url(options.version, 'LAB.min.js'), :yellow)
  
  if @@default_version != options.version
    say_status("fetching", "LABjs (#{@@default_version})", :green)
    get_labjs(@@default_version)
  end
end

#remove_labjsObject



9
10
11
12
13
# File 'lib/generators/labjs/install/install_generator.rb', line 9

def remove_labjs
  %w(LAB.src.js LAB.min.js).each do |js|
    remove_file "public/javascripts/#{js}"
  end
end