class Sammy::Generators::InstallGenerator

Public Instance Methods

download_sammy() click to toggle source
# File lib/generators/sammy/install/install_generator.rb, line 9
def download_sammy
  say_status("fetching", "Sammy #{options.version}", :green)
  get_sammy(options.version)
rescue OpenURI::HTTPError
  say_status("warning", "could not find Sammy #{options.version}", :yellow)
  say_status("fetching", "Sammy #{@@default_version}", :green)
  get_sammy(@@default_version)
end

Private Instance Methods

get_sammy(version) click to toggle source
# File lib/generators/sammy/install/install_generator.rb, line 19
def get_sammy(version)
  js_path   = "public/javascripts"
  sammy_url = "https://github.com/quirkey/sammy/raw/v#{version}/lib"
  
  get "#{sammy_url}/sammy.js", "#{js_path}/sammy.js"
  get "#{sammy_url}/min/sammy-latest.min.js", "#{js_path}/sammy.min.js"
  
  if options.plugin?
    %w{ cache data_location_proxy ejs form googleanalytics haml handlebars json meld mustache nested_params path_location_proxy pure storage template title tmpl }.each do |plugin|
      get "#{sammy_url}/min/plugins/sammy.#{plugin}-latest.min.js", "#{js_path}/sammy/sammy.#{plugin}.min.js"
      get "#{sammy_url}/plugins/sammy.#{plugin}.js", "#{js_path}/sammy/sammy.#{plugin}.js"
    end
  end
end