Class: SourceFile

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/chosen-rails-adding/source_file.rb

Instance Method Summary collapse

Instance Method Details

#cleanupObject



35
36
37
38
# File 'lib/chosen-rails-adding/source_file.rb', line 35

def cleanup
  self.destination_root = 'vendor/assets'
  remove_file 'package.json'
end

#eject_javascript_class_from_closureObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/chosen-rails-adding/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-adding/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.css.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