Class: SourceFile

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

Instance Method Summary collapse

Instance Method Details

#cleanupObject



11
12
13
# File 'lib/adminlte-rails/source_file.rb', line 11

def cleanup
  FileUtils.rm_rf %w(vendor/assets/fonts vendor/assets/images vendor/assets/stylesheets vendor/assets/javascripts)
end

#convertObject



39
40
41
42
43
44
45
46
47
# File 'lib/adminlte-rails/source_file.rb', line 39

def convert
  self.destination_root = 'vendor/assets'
  inside destination_root do
    #gsub_file 'stylesheets/bootstrap.scss', %r/url\(([^\)]*)\)/, 'image-url(\1)'
    gsub_file 'stylesheets/bootstrap.scss', %r/url\('(\.\.\/fonts\/)([^\)]*)'\)/, 'url(font-path(\'\2\'))'
    gsub_file 'stylesheets/font-awesome.scss', %r/url\('(\.\.\/fonts\/)([^\)]*)'\)/, 'url(font-path(\'\2\'))'
    gsub_file 'stylesheets/ionicons.scss', %r/url\("(\.\.\/fonts\/)([^\)]*)"\)/, 'url(font-path(\'\2\'))'
  end
end

#fetchObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/adminlte-rails/source_file.rb', line 17

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/almasaeed2010/AdminLTE'

  # Fetch javascripts
  fetch_javascripts(remote, tag)

  # Fetch fonts
  fetch_fonts(remote, tag)

  # Fetch stylesheets
  fetch_stylesheets(remote, tag)

  # Fetch images
  fetch_images(remote, tag)

end