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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b1a3768a78b868e91084f933b59e48436ff6c91
4
- data.tar.gz: f44e8582e8efb09956c0bd184c52ed19b1917c3b
3
+ metadata.gz: 047be3ec9f84af0fd31e6aa759082137d507a7f9
4
+ data.tar.gz: 58efa6bf603d5450fed9b34c1132ae74a4c62183
5
5
  SHA512:
6
- metadata.gz: 87d9d709b8338f8a604c06d4ab4bb7b2f600a4d7f3f9ef9974791fafcaa3f918c44d5c97541af51a848ccefe107a798066e8729c5358733dc98ba68d6058989d
7
- data.tar.gz: a9b9818d79b03e81dfbbd9e5d6c936281fe47b7a7081308ba136eb74022dd0a1c0fb8b499a3a9cab1a8184684e5b82011754216f8565ef0c589855884a9fc561
6
+ metadata.gz: 8956d3e825ac82dff95d78429acb1a833b26ebdec1880be4c779fa99995c85166fff5b0d58da77c4e87bf806a22a94d2a78b553e37427bfd66cdb261c1e14339
7
+ data.tar.gz: ef5863dec760bfca6f628a0d5e2c8a8ddee67badfce699174f6d11335b75571f405ce6af6068a63e138d183c019660c6b8922c539c11e95f72b5d896b6dbb33d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snapa (0.0.6)
4
+ snapa (0.0.8)
5
5
  rack
6
6
 
7
7
  GEM
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
@@ -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('/tmp/snapa', ::Digest::MD5.hexdigest(request.query_string) + '.png')
34
+ @path ||= F.join(cache_path, 'snapa', ::Digest::MD5.hexdigest(request.query_string) + '.png')
26
35
  end
27
36
 
28
37
  def _call(env)
@@ -1,3 +1,3 @@
1
1
  module Snapa
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -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.7
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-09-13 00:00:00.000000000 Z
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: {}