Class: SourceFile

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

Instance Method Summary collapse

Instance Method Details

#cleanupObject



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

def cleanup
  self.destination_root = 'vendor/assets'
  remove_file "stylesheets/#{@name}/style.css"
  FileUtils.rm_rf self.class.source_root
end

#convertObject



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

def convert
  self.destination_root = 'vendor/assets'
  inside destination_root do
    run "sass-convert -F css -T sass stylesheets/#{@name}/style.css stylesheets/#{@name}/style.css.sass"
    gsub_file "stylesheets/#{@name}/style.css.sass", "'fonts/", "'#{@name}/"
    gsub_file "stylesheets/#{@name}/style.css.sass", ' url', ' font-url'
  end
end

#fetch(zip, name) ⇒ Object



8
9
10
11
# File 'lib/icomoon-rails/source_file.rb', line 8

def fetch(zip, name)
  fetch_from_path zip
  set_name name
end

#moveObject



14
15
16
17
18
19
20
21
# File 'lib/icomoon-rails/source_file.rb', line 14

def move
  self.destination_root = 'vendor/assets'
  copy_file "#{@extract_path}/style.css", "stylesheets/#{@name}/style.css"
  copy_file "#{@extract_path}/lte-ie7.js", "javascripts/#{@name}/lte-ie7.js"
  copy_file "#{@extract_path}/license.txt", "stylesheets/#{@name}/license.txt"
  empty_directory "fonts/#{@name}"
  directory "#{@extract_path}/fonts", "fonts/#{@name}"
end