Class: SourceFile

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

Instance Method Summary collapse

Instance Method Details

#convertObject



29
30
31
32
33
34
35
# File 'lib/jstree-rails-4/source_file.rb', line 29

def convert
  self.destination_root = 'vendor/assets'
  inside destination_root do
    gsub_file 'stylesheets/jstree-default.scss', %r/url\((?:\"|\')([^\)]+\.(?:gif|png))(?:\"|\')\)/, 'image-url("default/\1")'
    gsub_file 'stylesheets/jstree-default-dark.scss', %r/url\((?:\"|\')([^\)]+\.(?:gif|png))(?:\"|\')\)/, 'image-url("default-dark/\1")'
  end
end

#fetchObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/jstree-rails-4/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/vakata/jstree'
  # IMAGES
  get "#{remote}/raw/#{tag}/dist/themes/default/32px.png", 'images/default/32px.png'
  get "#{remote}/raw/#{tag}/dist/themes/default/40px.png", 'images/default/40px.png'
  get "#{remote}/raw/#{tag}/dist/themes/default/throbber.gif", 'images/default/throbber.gif'
  get "#{remote}/raw/#{tag}/dist/themes/default-dark/32px.png", 'images/default-dark/32px.png'
  get "#{remote}/raw/#{tag}/dist/themes/default-dark/40px.png", 'images/default-dark/40px.png'
  get "#{remote}/raw/#{tag}/dist/themes/default-dark/throbber.gif", 'images/default-dark/throbber.gif'
  # CSS
  get "#{remote}/raw/#{tag}/dist/themes/default/style.css", 'stylesheets/jstree-default.scss'
  get "#{remote}/raw/#{tag}/dist/themes/default-dark/style.css", 'stylesheets/jstree-default-dark.scss'
  # JS
  get "#{remote}/raw/#{tag}/dist/jstree.js", 'javascripts/jstree.js'
end