Class: RemoteResourceLoader

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

Instance Method Summary collapse

Instance Method Details

#cleanupObject



37
38
39
40
# File 'lib/mapbox-rails/remote_resource_loader.rb', line 37

def cleanup
  self.destination_root = 'vendor/assets'
  remove_file 'stylesheets/mapbox.css'
end

#convertObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/mapbox-rails/remote_resource_loader.rb', line 21

def convert
  self.destination_root = 'vendor/assets'
  inside destination_root do
    run('sass-convert -F css -T sass stylesheets/mapbox.css stylesheets/mapbox.css.sass')
    gsub_file 'stylesheets/mapbox.css.sass', 'url(./images/icons-000000.png)', 
      "image-url('assets/icons-000000.png')"
    gsub_file 'stylesheets/mapbox.css.sass', 'url(./images/icons-ffffff.png)', 
      "image-url('assets/icons-ffffff.png')"
    gsub_file 'stylesheets/mapbox.css.sass', 'url(./images/[email protected])', 
      "image-url('assets/[email protected]')"
    gsub_file 'stylesheets/mapbox.css.sass', 'url(./images/[email protected])', 
      "image-url('assets/[email protected]')"
  end
end

#fetchObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/mapbox-rails/remote_resource_loader.rb', line 7

def fetch
  self.destination_root = 'vendor/assets'
  get "http://api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.uncompressed.js", "javascripts/mapbox.js"
  get "http://api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.css", "stylesheets/mapbox.css"
  get "http://api.tiles.mapbox.com/mapbox.js/v1.6.1/images/layers.png", "images/layers.png"
  get "http://api.tiles.mapbox.com/mapbox.js/v1.6.1/images/marker-icon.png", "images/marker-icon.png"
  get "http://api.tiles.mapbox.com/mapbox.js/v1.6.1/images/marker-shadow.png", "images/marker-shadow.png"
  get "http://api.tiles.mapbox.com/mapbox.js/v1.6.1/images/icons-000000.png", "images/icons-000000.png"
  get "http://api.tiles.mapbox.com/mapbox.js/v1.6.1/images/icons-ffffff.png", "images/icons-ffffff.png"
  get "http://api.tiles.mapbox.com/mapbox.js/v1.6.1/images/[email protected]", "images/[email protected]"
  get "http://api.tiles.mapbox.com/mapbox.js/v1.6.1/images/[email protected]", "images/[email protected]"
end