Class: SourceFile

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

Instance Method Summary collapse

Instance Method Details

#convertObject



26
27
28
29
30
31
# File 'lib/select2-rails/source_file.rb', line 26

def convert
  self.destination_root = "vendor/assets"
  inside destination_root do
    gsub_file 'stylesheets/select2.scss', %r/url\(([^\)]*)\)/, 'image-url(\1)'
  end
end

#fetchObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/select2-rails/source_file.rb', line 9

def fetch
  filtered_tags = fetch_tags
  tag = select("Which tag do you want to fetch?", filtered_tags)
  self.destination_root = "vendor/assets"
  remote = "https://github.com/ivaynberg/select2"
  get "#{remote}/raw/#{tag}/select2.png", "images/select2.png"
  get "#{remote}/raw/#{tag}/select2x2.png", "images/select2x2.png"
  get "#{remote}/raw/#{tag}/select2-spinner.gif", "images/select2-spinner.gif"
  get "#{remote}/raw/#{tag}/select2.css", "stylesheets/select2.scss"
  get "#{remote}/raw/#{tag}/select2-bootstrap.css", "stylesheets/select2-bootstrap.css"
  get "#{remote}/raw/#{tag}/select2.js", "javascripts/select2.js"
  languages.each do |lang|
    get "#{remote}/raw/#{tag}/select2_locale_#{lang}.js", "javascripts/select2_locale_#{lang}.js"
  end
end