concord_cacher 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- data/concord_cacher.gemspec +4 -5
- data/lib/concord/cacher.rb +4 -0
- data/lib/concord/resource.rb +8 -3
- data/lib/concord_cacher.rb +3 -0
- data/spec/diy_local_cacher_spec.rb +9 -11
- data/spec/java_proxy_cacher_spec.rb +22 -4
- metadata +28 -64
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -1
data/concord_cacher.gemspec
CHANGED
@@ -2,22 +2,21 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{concord_cacher}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.14"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.required_ruby_version = '~> 1.8.7'
|
8
9
|
s.authors = ["Aaron Unger"]
|
9
|
-
s.
|
10
|
-
s.date = %q{2010-11-04}
|
10
|
+
s.date = %q{2013-03-28}
|
11
11
|
s.description = %q{concord_cacher provides support for locally caching a resource and all referenced resources in multiple different ways. It is intended for using with other Concord Consortium projects and not necessarily for outside projects.}
|
12
12
|
s.email = %q{aunger @nospam@ concord.org}
|
13
13
|
s.extra_rdoc_files = ["README.textile", "lib/concord/cacher.rb", "lib/concord/diy_local_cacher.rb", "lib/concord/filename_generators.rb", "lib/concord/filename_generators/default_generator.rb", "lib/concord/filename_generators/diy_generator.rb", "lib/concord/filename_generators/java_proxy_generator.rb", "lib/concord/helper.rb", "lib/concord/java_proxy_cacher.rb", "lib/concord/resource.rb", "lib/concord_cacher.rb"]
|
14
14
|
s.files = ["Manifest", "README.textile", "Rakefile", "concord_cacher.gemspec", "lib/concord/cacher.rb", "lib/concord/diy_local_cacher.rb", "lib/concord/filename_generators.rb", "lib/concord/filename_generators/default_generator.rb", "lib/concord/filename_generators/diy_generator.rb", "lib/concord/filename_generators/java_proxy_generator.rb", "lib/concord/helper.rb", "lib/concord/java_proxy_cacher.rb", "lib/concord/resource.rb", "lib/concord_cacher.rb", "spec/data/always_skip.otml", "spec/data/bad_url.otml", "spec/data/codebase.otml", "spec/data/element_reference.otml", "spec/data/empty.otml", "spec/data/empty_url.otml", "spec/data/mw_model_absolute.otml", "spec/data/mw_model_relative.otml", "spec/data/nlogo_absolute.otml", "spec/data/nlogo_relative.otml", "spec/data/recursion.otml", "spec/data/recursive_loop.otml", "spec/data/resources/chart_line.png", "spec/data/resources/delete.png", "spec/data/resources/loop1.otml", "spec/data/resources/loop2.otml", "spec/data/resources/nlogo/SpaceRescue.Practice1.nlogo", "spec/data/resources/recurse1.otml", "spec/data/resources/recurse2.otml", "spec/data/resources/statesofmatter/bench.gif", "spec/data/resources/statesofmatter/downHighlightMol1.gif", "spec/data/resources/statesofmatter/downHighlightMol2.gif", "spec/data/resources/statesofmatter/eightBall.gif", "spec/data/resources/statesofmatter/eightBall.html", "spec/data/resources/statesofmatter/eightBall.mml", "spec/data/resources/statesofmatter/eightBallZoom.gif", "spec/data/resources/statesofmatter/gold.gif", "spec/data/resources/statesofmatter/gold.html", "spec/data/resources/statesofmatter/gold.mml", "spec/data/resources/statesofmatter/goldZoom.gif", "spec/data/resources/statesofmatter/helium.gif", "spec/data/resources/statesofmatter/helium.html", "spec/data/resources/statesofmatter/helium.mml", "spec/data/resources/statesofmatter/heliumZoom.gif", "spec/data/resources/statesofmatter/hydrogen.gif", "spec/data/resources/statesofmatter/hydrogen.html", "spec/data/resources/statesofmatter/hydrogen.mml", "spec/data/resources/statesofmatter/hydrogenZoom.gif", "spec/data/resources/statesofmatter/rootBeer.gif", "spec/data/resources/statesofmatter/rootBeer.html", "spec/data/resources/statesofmatter/rootBeer.mml", "spec/data/resources/statesofmatter/rootBeerZoom.gif", "spec/data/resources/statesofmatter/statesOfMatter$0.mml", "spec/data/resources/statesofmatter/statesOfMatter.cml", "spec/data/resources/statesofmatter/statesOfMatterPage1$0.mml", "spec/data/resources/statesofmatter/statesOfMatterPage1.cml", "spec/data/resources/statesofmatter/unknown.gif", "spec/data/resources/statesofmatter/unknown.html", "spec/data/resources/statesofmatter/unknown.mml", "spec/data/resources/statesofmatter/unknownZoom.gif", "spec/data/resources/statesofmatter/upHighlightMol1.gif", "spec/data/resources/statesofmatter/upHighlightMol2.gif", "spec/data/resources/statesofmatter/water.gif", "spec/data/resources/statesofmatter/water.html", "spec/data/resources/statesofmatter/water.mml", "spec/data/resources/statesofmatter/waterZoom.gif", "spec/data/resources/text.txt", "spec/data/standard_uri.otml", "spec/data/url_with_space.otml", "spec/data/xml_entities.otml", "spec/diy_local_cacher_spec.rb", "spec/helpers/cache_helper.rb", "spec/java_proxy_cacher_spec.rb", "xml_entities.otml", "spec/data/urls_in_resourcelist.otml"]
|
15
|
-
s.homepage = %q{http://github.com/
|
15
|
+
s.homepage = %q{http://github.com/concord-consortium/concord_cacher}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Concord_cacher", "--main", "README.textile"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = %q{concord_cacher}
|
19
19
|
s.rubygems_version = %q{1.3.6}
|
20
|
-
s.signing_key = %q{/Users/aunger/gem-private_key.pem}
|
21
20
|
s.summary = %q{Support for locally caching a resource and all referenced resources in multiple different ways}
|
22
21
|
|
23
22
|
if s.respond_to? :specification_version then
|
data/lib/concord/cacher.rb
CHANGED
@@ -25,6 +25,10 @@ class ::Concord::Cacher
|
|
25
25
|
relative_hosts = [] if relative_hosts.nil?
|
26
26
|
relative_hosts = [relative_hosts] unless relative_hosts.kind_of? Array
|
27
27
|
::Concord::Resource.relative_hosts = relative_hosts
|
28
|
+
|
29
|
+
custom_skips = opts.delete(:skip) || []
|
30
|
+
custom_skips = [custom_skips] unless custom_skips.kind_of?(Array)
|
31
|
+
::Concord::Resource.custom_skips = custom_skips
|
28
32
|
|
29
33
|
@main_resource = Concord::Resource.new
|
30
34
|
@main_resource.url = opts.delete(:url)
|
data/lib/concord/resource.rb
CHANGED
@@ -55,6 +55,7 @@ class ::Concord::Resource
|
|
55
55
|
@cacher = nil
|
56
56
|
@filename_generator = ::Concord::FilenameGenerators::DefaultGenerator
|
57
57
|
@relative_hosts = []
|
58
|
+
@custom_skips = []
|
58
59
|
class << self
|
59
60
|
attr_accessor :debug
|
60
61
|
attr_accessor :verbose
|
@@ -66,6 +67,7 @@ class ::Concord::Resource
|
|
66
67
|
attr_accessor :cacher
|
67
68
|
attr_accessor :filename_generator
|
68
69
|
attr_accessor :relative_hosts
|
70
|
+
attr_accessor :custom_skips
|
69
71
|
end
|
70
72
|
|
71
73
|
def self.map(k,v)
|
@@ -149,8 +151,11 @@ class ::Concord::Resource
|
|
149
151
|
self.uri.scheme == 'file' ? self.uri.path : self.uri.to_s
|
150
152
|
end
|
151
153
|
|
152
|
-
def
|
153
|
-
return
|
154
|
+
def skip?
|
155
|
+
return true if self.url.length < 1
|
156
|
+
return true if self.class.custom_skips.detect{|r| r.match(self.url) }
|
157
|
+
return true if ALWAYS_SKIP_REGEXES.detect{|r| r.match(self.url) }
|
158
|
+
return false
|
154
159
|
end
|
155
160
|
|
156
161
|
def remote_filename
|
@@ -227,7 +232,7 @@ class ::Concord::Resource
|
|
227
232
|
resource.headers = {}
|
228
233
|
_cleanup_uri(resource)
|
229
234
|
|
230
|
-
if resource.
|
235
|
+
if resource.skip?
|
231
236
|
print "S" if self.class.verbose
|
232
237
|
throw :nextResource
|
233
238
|
end
|
data/lib/concord_cacher.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
$:.unshift(File.expand_path(File.dirname(__FILE__))) unless
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
|
+
|
5
|
+
raise "concord_cacher is incompatible with your version of ruby (#{RUBY_VERSION})" unless RUBY_VERSION =~ /^1\.8\.[67]/
|
6
|
+
|
4
7
|
module Concord
|
5
8
|
require 'concord/filename_generators'
|
6
9
|
require 'concord/diy_local_cacher'
|
@@ -17,14 +17,11 @@ describe 'DIY Local Cacher' do
|
|
17
17
|
@klass = Concord::DiyLocalCacher
|
18
18
|
@spec_root = File.expand_path(File.dirname(__FILE__))
|
19
19
|
@cache = File.join(@spec_root, '..', 'tmp','diy_local')
|
20
|
+
rm_rf(@cache)
|
20
21
|
mkdir_p(@cache)
|
21
22
|
@cache += '/'
|
22
23
|
end
|
23
24
|
|
24
|
-
after(:each) do
|
25
|
-
rm_rf(@cache)
|
26
|
-
end
|
27
|
-
|
28
25
|
def mockup(file)
|
29
26
|
return mock('activity',{:uuid => 'hash', :url => file})
|
30
27
|
end
|
@@ -286,7 +283,7 @@ describe 'DIY Local Cacher' do
|
|
286
283
|
end
|
287
284
|
end
|
288
285
|
|
289
|
-
|
286
|
+
xit 'should correctly download resources referenced from within netlogo model files'
|
290
287
|
end
|
291
288
|
|
292
289
|
describe 'embedded mw files' do
|
@@ -323,8 +320,8 @@ describe 'DIY Local Cacher' do
|
|
323
320
|
end
|
324
321
|
end
|
325
322
|
|
326
|
-
|
327
|
-
|
323
|
+
xit 'should correctly download images referenced from within mw cml files'
|
324
|
+
xit 'should correctly download images referenced from within mml files'
|
328
325
|
end
|
329
326
|
|
330
327
|
describe 'never cache' do
|
@@ -338,8 +335,8 @@ describe 'DIY Local Cacher' do
|
|
338
335
|
end
|
339
336
|
|
340
337
|
describe 'recursion limits' do
|
341
|
-
|
342
|
-
|
338
|
+
xit 'should only recurse html files once'
|
339
|
+
xit 'should recurse otml,cml,mml and nlogo files forever'
|
343
340
|
end
|
344
341
|
|
345
342
|
describe 'special cases' do
|
@@ -374,11 +371,12 @@ describe 'DIY Local Cacher' do
|
|
374
371
|
|
375
372
|
it 'should not include trailing </string> when url is part of resource list or map' do
|
376
373
|
expected_files = []
|
374
|
+
expected_files << "hash.otml"
|
377
375
|
expected_files << filename_for('http://portal.concord.org/images/icons/chart_line.png')
|
378
376
|
|
379
|
-
cache('
|
377
|
+
cache('urls_in_resourcelist.otml', :activity => mockup('urls_in_resourcelist.otml'))
|
380
378
|
|
381
|
-
cache_size.should ==
|
379
|
+
cache_size.should == 2
|
382
380
|
expected_files.each do |f|
|
383
381
|
exists?(f)
|
384
382
|
end
|
@@ -187,11 +187,11 @@ describe 'Java Proxy Cacher' do
|
|
187
187
|
end
|
188
188
|
|
189
189
|
describe 'embedded nlogo files' do
|
190
|
-
|
190
|
+
xit 'should correctly download resources referenced from within netlogo model files'
|
191
191
|
end
|
192
192
|
|
193
193
|
describe 'embedded mw files' do
|
194
|
-
|
194
|
+
xit 'should correctly download resources referenced from within mw model files'
|
195
195
|
end
|
196
196
|
|
197
197
|
describe 'never cache' do
|
@@ -201,11 +201,29 @@ describe 'Java Proxy Cacher' do
|
|
201
201
|
cache('always_skip.otml')
|
202
202
|
cache_size.should == 3
|
203
203
|
end
|
204
|
+
|
205
|
+
it 'should skip files when instructed to' do
|
206
|
+
expected_files = []
|
207
|
+
expected_files << 'dbbd46b446a205047cfbf32e7af350a73c38848d' # recursion.otml
|
208
|
+
expected_files << 'cdc3d425b0ac9c3e89e1b79e0ad8a07c09bcedbd' # resources/recurse1.otml
|
209
|
+
expected_files << '8f0ebcb45d7ba71a541d4781329f4a6900c7ee65' # resources/delete.png
|
210
|
+
expected_files << expected_files.collect{|f| f+".hdrs" } # headers for each file
|
211
|
+
expected_files.flatten!
|
212
|
+
expected_files << 'url_map.xml'
|
213
|
+
|
214
|
+
cache('recursion.otml', :skip => [/recurse2\.otml$/])
|
215
|
+
|
216
|
+
cache_size.should == 7
|
217
|
+
expected_files.each do |f|
|
218
|
+
exists?(f)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
204
222
|
end
|
205
223
|
|
206
224
|
describe 'recursion limits' do
|
207
|
-
|
208
|
-
|
225
|
+
xit 'should only recurse html files once'
|
226
|
+
xit 'should recurse otml,cml,mml and nlogo files forever'
|
209
227
|
end
|
210
228
|
|
211
229
|
describe 'special cases' do
|
metadata
CHANGED
@@ -1,51 +1,23 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: concord_cacher
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 13
|
9
|
-
version: 0.1.13
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.14
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Aaron Unger
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
|
-
cert_chain:
|
16
|
-
-
|
17
|
-
-----BEGIN CERTIFICATE-----
|
18
|
-
MIIDMjCCAhqgAwIBAgIBADANBgkqhkiG9w0BAQUFADA/MQ8wDQYDVQQDDAZhdW5n
|
19
|
-
ZXIxFzAVBgoJkiaJk/IsZAEZFgdjb25jb3JkMRMwEQYKCZImiZPyLGQBGRYDb3Jn
|
20
|
-
MB4XDTEwMDMyNTE1NDM0MloXDTExMDMyNTE1NDM0MlowPzEPMA0GA1UEAwwGYXVu
|
21
|
-
Z2VyMRcwFQYKCZImiZPyLGQBGRYHY29uY29yZDETMBEGCgmSJomT8ixkARkWA29y
|
22
|
-
ZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMcObwOz2qlPRc/6PVHq
|
23
|
-
7rrPxt+Ltc9shUtXrIjD0mQMqZtln6TkFnilPAXUd/NbxLrvZqrpPL5GeE5SlKA6
|
24
|
-
Hy2J5cj1A0c3qHmskaPnVma6NpnHmlWkIj1u//yCjz2ktaFYV7dHN2IlRK9M8t7F
|
25
|
-
Wt8DeVclSOeq3jOhjoOsSX5rIN8/MsWZcq42deHHiHQ0R5htLb1rmZTFKJynKA+m
|
26
|
-
Is6vytLGO/2iDeuiW8FQxBUwDEc7LNpfANCNk4WudUGi6K1WeteqTpyzJcso2yVZ
|
27
|
-
aMLpviD8WUxUZahz226ThwVLoTJB70GM8BVOFXApNdvbM0b45d1neyeHyU2f2ZeF
|
28
|
-
9g8CAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFGQn
|
29
|
-
5Lsh1f/5AryTzU2cmoKsh6XqMA0GCSqGSIb3DQEBBQUAA4IBAQAfrvFWSUZPQnWg
|
30
|
-
5JxdAaHDMdVRlJGOTTpL/2L9GcDr8jaG32AOMcRDzhcCwKE5oBQZixUCidcvlh1y
|
31
|
-
8diuKpwKZrFtZT3RVwZm3wNHk9TaSprCJkhjhATLWZ2h9bGoTA2FH7VLpacUcG9r
|
32
|
-
L7W8Y8jL7G4+TZYCLcnH5O3XQ7AkAYVYogt4DLYN9Ma7xwN3MAFfuCRJhY49XLYd
|
33
|
-
Wv+hK/ewN+n0Uub+jPpW1Ahi7Ah67RVIRpsWfNpEjx+CB4hPY2GwjpmIKhgt4Fyg
|
34
|
-
c90zsqVWrMWBRgRiSl0yYsmuGSPmllNn2m9Vq4ZAHpjCBv5E0AObBv0g/WQgiMjX
|
35
|
-
8kT2T2VF
|
36
|
-
-----END CERTIFICATE-----
|
37
|
-
|
38
|
-
date: 2010-11-04 00:00:00 -04:00
|
39
|
-
default_executable:
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-28 00:00:00.000000000 Z
|
40
13
|
dependencies: []
|
41
|
-
|
42
|
-
|
14
|
+
description: concord_cacher provides support for locally caching a resource and all
|
15
|
+
referenced resources in multiple different ways. It is intended for using with other
|
16
|
+
Concord Consortium projects and not necessarily for outside projects.
|
43
17
|
email: aunger @nospam@ concord.org
|
44
18
|
executables: []
|
45
|
-
|
46
19
|
extensions: []
|
47
|
-
|
48
|
-
extra_rdoc_files:
|
20
|
+
extra_rdoc_files:
|
49
21
|
- README.textile
|
50
22
|
- lib/concord/cacher.rb
|
51
23
|
- lib/concord/diy_local_cacher.rb
|
@@ -57,7 +29,7 @@ extra_rdoc_files:
|
|
57
29
|
- lib/concord/java_proxy_cacher.rb
|
58
30
|
- lib/concord/resource.rb
|
59
31
|
- lib/concord_cacher.rb
|
60
|
-
files:
|
32
|
+
files:
|
61
33
|
- Manifest
|
62
34
|
- README.textile
|
63
35
|
- Rakefile
|
@@ -137,43 +109,35 @@ files:
|
|
137
109
|
- spec/java_proxy_cacher_spec.rb
|
138
110
|
- xml_entities.otml
|
139
111
|
- spec/data/urls_in_resourcelist.otml
|
140
|
-
|
141
|
-
homepage: http://github.com/psndcsrv/concord_cacher
|
112
|
+
homepage: http://github.com/concord-consortium/concord_cacher
|
142
113
|
licenses: []
|
143
|
-
|
144
114
|
post_install_message:
|
145
|
-
rdoc_options:
|
115
|
+
rdoc_options:
|
146
116
|
- --line-numbers
|
147
117
|
- --inline-source
|
148
118
|
- --title
|
149
119
|
- Concord_cacher
|
150
120
|
- --main
|
151
121
|
- README.textile
|
152
|
-
require_paths:
|
122
|
+
require_paths:
|
153
123
|
- lib
|
154
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
155
125
|
none: false
|
156
|
-
requirements:
|
157
|
-
- -
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
|
160
|
-
|
161
|
-
version: "0"
|
162
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ~>
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: 1.8.7
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
131
|
none: false
|
164
|
-
requirements:
|
165
|
-
- -
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
|
168
|
-
- 1
|
169
|
-
- 2
|
170
|
-
version: "1.2"
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '1.2'
|
171
136
|
requirements: []
|
172
|
-
|
173
137
|
rubyforge_project: concord_cacher
|
174
|
-
rubygems_version: 1.
|
138
|
+
rubygems_version: 1.8.25
|
175
139
|
signing_key:
|
176
140
|
specification_version: 3
|
177
|
-
summary: Support for locally caching a resource and all referenced resources in multiple
|
141
|
+
summary: Support for locally caching a resource and all referenced resources in multiple
|
142
|
+
different ways
|
178
143
|
test_files: []
|
179
|
-
|
data.tar.gz.sig
DELETED
Binary file
|
metadata.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
!�@�X��$�f�$LDUZ*���|������sn��_jP=έd8-��
|