Class: SourceFile
- Inherits:
-
Thor
- Object
- Thor
- SourceFile
- Includes:
- Thor::Actions
- Defined in:
- lib/chosen-rails/source_file.rb
Instance Method Summary collapse
- #add_depend_on_asset ⇒ Object
- #change_url_to_image_url ⇒ Object
- #cleanup ⇒ Object
- #eject_javascript_class_from_closure ⇒ Object
- #fetch(remote, branch) ⇒ Object
Instance Method Details
#add_depend_on_asset ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/chosen-rails/source_file.rb', line 35 def add_depend_on_asset self.destination_root = 'vendor/assets' scss = <<-SCSS.gsub(/^\s{6}/, '') //= depend_on_asset "chosen-sprite.png" //= depend_on_asset "[email protected]" SCSS prepend_to_file 'stylesheets/chosen-base.scss', scss end |
#change_url_to_image_url ⇒ Object
45 46 47 48 |
# File 'lib/chosen-rails/source_file.rb', line 45 def change_url_to_image_url self.destination_root = 'vendor/assets' gsub_file 'stylesheets/chosen-base.scss', /url/, 'image-url' end |
#cleanup ⇒ Object
51 52 53 54 |
# File 'lib/chosen-rails/source_file.rb', line 51 def cleanup self.destination_root = 'vendor/assets' remove_file 'package.json' end |
#eject_javascript_class_from_closure ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# 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) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# 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/[email protected]", 'images/[email protected]' get "#{remote}/raw/#{branch}/sass/chosen.scss", 'stylesheets/chosen-base.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 |