class SourceFile
Public Instance Methods
cleanup()
click to toggle source
# File lib/chosen-rails/source_file.rb, line 35 def cleanup self.destination_root = 'vendor/assets' remove_file 'package.json' end
eject_javascript_class_from_closure()
click to toggle source
# File lib/chosen-rails/source_file.rb, line 22 def eject_javascript_class_from_closure self.destination_root = 'vendor/assets' inside destination_root do append_to_file 'javascripts/lib/abstract-chosen.coffee' do "\nwindow.AbstractChosen = AbstractChosen\n" end append_to_file 'javascripts/lib/select-parser.coffee' do "\n\nwindow.SelectParser = SelectParser\n" end end end
fetch(remote, branch)
click to toggle source
# File lib/chosen-rails/source_file.rb, line 8 def fetch remote, branch self.destination_root = 'vendor/assets' get "#{remote}/raw/#{branch}/public/chosen-sprite.png", 'images/chosen-sprite.png' get "#{remote}/raw/#{branch}/public/chosen-sprite@2x.png", 'images/chosen-sprite@2x.png' get "#{remote}/raw/#{branch}/sass/chosen.scss", 'stylesheets/chosen.scss' get "#{remote}/raw/#{branch}/coffee/lib/abstract-chosen.coffee", 'javascripts/lib/abstract-chosen.coffee' get "#{remote}/raw/#{branch}/coffee/lib/select-parser.coffee", 'javascripts/lib/select-parser.coffee' get "#{remote}/raw/#{branch}/coffee/chosen.jquery.coffee", 'javascripts/chosen.jquery.coffee' get "#{remote}/raw/#{branch}/coffee/chosen.proto.coffee", 'javascripts/chosen.proto.coffee' get "#{remote}/raw/#{branch}/package.json", 'package.json' bump_version end
Protected Instance Methods
bump_version()
click to toggle source
# File lib/chosen-rails/source_file.rb, line 42 def bump_version inside destination_root do package_json = JSON.load(File.open('package.json')) version = package_json['version'] gsub_file '../../lib/chosen-rails/version.rb', /CHOSEN_VERSION\s=\s'(\d|\.)+'$/ do |match| %Q{CHOSEN_VERSION = '#{version}'} end end end