snapa 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -0
- data/lib/snapa.rb +10 -1
- data/lib/snapa/version.rb +1 -1
- data/snapa.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 047be3ec9f84af0fd31e6aa759082137d507a7f9
|
4
|
+
data.tar.gz: 58efa6bf603d5450fed9b34c1132ae74a4c62183
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8956d3e825ac82dff95d78429acb1a833b26ebdec1880be4c779fa99995c85166fff5b0d58da77c4e87bf806a22a94d2a78b553e37427bfd66cdb261c1e14339
|
7
|
+
data.tar.gz: ef5863dec760bfca6f628a0d5e2c8a8ddee67badfce699174f6d11335b75571f405ce6af6068a63e138d183c019660c6b8922c539c11e95f72b5d896b6dbb33d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -31,6 +31,10 @@ To mount under Rails
|
|
31
31
|
config/routes.rb
|
32
32
|
mount Snapa::File.new('public/map.html') => '/map.png'
|
33
33
|
|
34
|
+
The default cache path is /tmp/snapa or public/system/snapa when mounted
|
35
|
+
under a rails app. This can be overridden by passing an optional cache_path
|
36
|
+
param to the initializer.
|
37
|
+
|
34
38
|
## Contributing
|
35
39
|
|
36
40
|
1. Fork it
|
data/lib/snapa.rb
CHANGED
@@ -5,6 +5,11 @@ require 'digest/md5'
|
|
5
5
|
module Snapa
|
6
6
|
class File < Rack::File
|
7
7
|
|
8
|
+
def initialize(root, options={})
|
9
|
+
@cache_path = options[:cache_path]
|
10
|
+
super(root)
|
11
|
+
end
|
12
|
+
|
8
13
|
def cmd
|
9
14
|
'phantomjs'
|
10
15
|
end
|
@@ -21,8 +26,12 @@ module Snapa
|
|
21
26
|
system [cmd, script, "'#{url(request)}'", "'#{@path}'"].join(' ')
|
22
27
|
end
|
23
28
|
|
29
|
+
def cache_path
|
30
|
+
@cache_path ||= defined?(Rails) ? Rails.root.join('public/system') : '/tmp'
|
31
|
+
end
|
32
|
+
|
24
33
|
def path(request)
|
25
|
-
@path ||= F.join('
|
34
|
+
@path ||= F.join(cache_path, 'snapa', ::Digest::MD5.hexdigest(request.query_string) + '.png')
|
26
35
|
end
|
27
36
|
|
28
37
|
def _call(env)
|
data/lib/snapa/version.rb
CHANGED
data/snapa.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
of the rendered body / css selector, usefull for generating an IE friendly
|
14
14
|
version of an svg or html5 canvas. A map example is provided by passing :map
|
15
15
|
to the initializer.}
|
16
|
-
spec.homepage = ""
|
16
|
+
spec.homepage = "https://github.com/crossroads/snapa"
|
17
17
|
spec.license = "MIT"
|
18
18
|
|
19
19
|
spec.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snapa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Tillman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -77,7 +77,7 @@ files:
|
|
77
77
|
- public/map.html
|
78
78
|
- public/topojson.v1.min.js
|
79
79
|
- snapa.gemspec
|
80
|
-
homepage:
|
80
|
+
homepage: https://github.com/crossroads/snapa
|
81
81
|
licenses:
|
82
82
|
- MIT
|
83
83
|
metadata: {}
|