concord_cacher 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- ��j��oZ=y��/��A���d@��ǃ($ ��*] >Zv�r�� �&V�c��Csأ���n��f�'���9yw�d��G�������.��E�����âf�I�J�єe)V��N[1�
1
+ #<�Ah��"�+�YQ��Z5��ɂ|���lI;�#���!+���k�&p$�t�~���-�5�Y�;�Q��Pq{!��6�����*�4����M�����<Zv�d�ڄ2!��sv��S;�T�#��[�&��a���qF�
2
+ F�z�m��H1X�&>&d�H)`O,��� �j@{tS��q%�3=w��ogePHtv`E�rb[N��w�u�N��A4�֯K��h��qT5R��e�%����Yh3щ
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'spec/rake/spectask'
6
6
  require './lib/concord_cacher.rb'
7
7
 
8
8
  require 'echoe'
9
- Echoe.new('concord_cacher', '0.0.1') do |p|
9
+ Echoe.new('concord_cacher', '0.0.2') do |p|
10
10
  p.description = "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."
11
11
  p.summary = "Support for locally caching a resource and all referenced resources in multiple different ways"
12
12
  p.url = "http://github.com/psndcsrv/concord_cacher"
@@ -26,7 +26,7 @@ namespace :hudson do
26
26
 
27
27
  namespace :setup do
28
28
  task :pre_ci do
29
- ENV["CI_REPORTS"] = 'spec/reports/'
29
+ ENV["CI_REPORTS"] = 'hudson/reports/'
30
30
  gem 'ci_reporter'
31
31
  require 'ci/reporter/rake/rspec'
32
32
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{concord_cacher}
5
- s.version = "0.0.1"
5
+ s.version = "0.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Aaron Unger"]
@@ -158,7 +158,7 @@ class ::Concord::Cacher
158
158
 
159
159
  # skip downloading already existing files.
160
160
  # because we're working with sha1 hashes we can be reasonably certain the content is a complete match
161
- if File.exist?(cache_dir + localFile)
161
+ if File.exists?(cache_dir + localFile)
162
162
  print 's' if @verbose
163
163
  else
164
164
  # if it's an otml/html file, we should parse it too (only one level down)
@@ -169,6 +169,7 @@ class ::Concord::Cacher
169
169
  recurse_further = true
170
170
  end
171
171
  begin
172
+ write_resource(cache_dir + localFile, "") # touch the file so that we avoid recursion
172
173
  resource_content = parse_file(cache_dir + resourceFile, resource_content, cache_dir, resource_url, recurse_further)
173
174
  rescue OpenURI::HTTPError => e
174
175
  @errors[parent_url] ||= []
@@ -204,6 +204,24 @@ describe 'DIY Local Cacher' do
204
204
  file_content.should match(Regexp.new(url))
205
205
  end
206
206
  end
207
+
208
+ it 'should not get stuck when handling circular loops' do
209
+ expected_files = []
210
+ expected_files << 'hash.otml' # recursion.otml
211
+ expected_files << ::Digest::SHA1.hexdigest(File.join(SPEC_ROOT,'data','resources','loop1.otml'))
212
+ expected_files << ::Digest::SHA1.hexdigest(File.join(SPEC_ROOT,'data','resources','delete.png'))
213
+ expected_files << ::Digest::SHA1.hexdigest(File.join(SPEC_ROOT,'data','resources','loop2.otml'))
214
+ expected_files << ::Digest::SHA1.hexdigest(File.join(SPEC_ROOT,'data','resources','chart_line.png'))
215
+
216
+ lambda {
217
+ cache('recursive_loop.otml', :activity => mockup('recursive_loop.otml'))
218
+ }.should_not raise_error(SystemStackError)
219
+
220
+ cache_size.should == 5
221
+ expected_files.each do |f|
222
+ exists?(f)
223
+ end
224
+ end
207
225
  end
208
226
 
209
227
  describe 'embedded nlogo files' do
@@ -117,6 +117,27 @@ describe 'Java Proxy Cacher' do
117
117
  exists?(f)
118
118
  end
119
119
  end
120
+
121
+ it 'should not get stuck when handling circular loops' do
122
+ expected_files = []
123
+ expected_files << '14a11cc1ba19ce76d651c93f8294009e3e46f0db' # recursive_loop.otml
124
+ expected_files << '2a564e6997c4a43bdfa3b0314e5bed7f9a5673ec' # resources/loop1.otml
125
+ expected_files << '8f0ebcb45d7ba71a541d4781329f4a6900c7ee65' # resources/delete.png
126
+ expected_files << '156b6f0a8885251ea5853cbebd1e9da5fedc00e0' # resources/loop2.otml
127
+ expected_files << 'd1cea238486aeeba9215d56bf71efc243754fe48' # resources/chart_line.png
128
+ expected_files << expected_files.collect{|f| f+".hdrs" } # headers for each file
129
+ expected_files.flatten!
130
+ expected_files << 'url_map.xml'
131
+
132
+ lambda {
133
+ cache('recursive_loop.otml')
134
+ }.should_not raise_error(SystemStackError)
135
+
136
+ cache_size.should == 11
137
+ expected_files.each do |f|
138
+ exists?(f)
139
+ end
140
+ end
120
141
  end
121
142
 
122
143
  describe 'embedded nlogo files' do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Aaron Unger
metadata.gz.sig CHANGED
Binary file