skadategems-dev 0.0.9 → 0.0.10.rc1
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aeda06d748372294c896e96dac819b45a785676
|
4
|
+
data.tar.gz: 755076e850ec95f9653a6954b1111d53fa5e2e51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98b610822efb0b424d3b76da25055c5b9dab776790dc2fb30fc35084022747cf3511c1ca2fc84a82ee23b04c5bb1659b592d69ef481035af10e9b663e2e4516a
|
7
|
+
data.tar.gz: 68eefbb78dda9550e132defb86978b2018ce591b7b93aae8aab99ab7415f8acf6106d54e60783fb2d4f4af93670f7f96229e40c646b83a1a62f162ce0a476080
|
@@ -68,6 +68,27 @@ module SkadateGems::Dev
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
+
context 'when a system call error occurred' do
|
72
|
+
|
73
|
+
it 'retries the request' do
|
74
|
+
counter = 0
|
75
|
+
|
76
|
+
remote_file.request do |_|
|
77
|
+
case (counter += 1)
|
78
|
+
when 1
|
79
|
+
raise Errno::ECONNRESET
|
80
|
+
when 2
|
81
|
+
raise EOFError
|
82
|
+
else
|
83
|
+
# ...
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
expect(counter).to be >= 3
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
71
92
|
end
|
72
93
|
|
73
94
|
end
|
data/integration/spec_helper.rb
CHANGED
@@ -6,11 +6,17 @@ require 'fileutils'
|
|
6
6
|
|
7
7
|
RSpec.configure do |config|
|
8
8
|
|
9
|
+
config.before(:all) do
|
10
|
+
[skadate_tmp_dir, skadate_local_dir, skadate_remote_dir].each do |dir|
|
11
|
+
FileUtils.mkdir(dir, verbose: verbose?) unless File.exists?(dir)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
9
15
|
config.before(:each) do
|
10
16
|
# cleanup sandbox directories
|
11
|
-
[skadate_local_dir, skadate_remote_dir].each do |
|
12
|
-
if
|
13
|
-
FileUtils.rm_r Dir.glob("#{
|
17
|
+
[skadate_local_dir, skadate_remote_dir].each do |dir|
|
18
|
+
if dir.is_a?(String) && (dir['tmp'] || dir['temp']) && dir['skadate']
|
19
|
+
FileUtils.rm_r Dir.glob("#{dir}/{*,.dev,.ht*}"), :verbose => verbose?
|
14
20
|
else
|
15
21
|
raise <<-ERRORMSG
|
16
22
|
Error: bad tmp dir entry "#{path}".
|
@@ -185,7 +185,7 @@ If you want to get another theme specify it using the `--layout-theme` switch as
|
|
185
185
|
/m/application/cache/smarty_compile
|
186
186
|
]
|
187
187
|
|
188
|
-
IGNORED_FILE_EXTENSIONS = %w[.tar .bz2 .gz .zip .rar .iso]
|
188
|
+
IGNORED_FILE_EXTENSIONS = %w[.tar .bz2 .gz .tgz .zip .rar .iso]
|
189
189
|
|
190
190
|
# default values, rewritable by ENV['SKADATE_MAX_*_FILE_SIZE']
|
191
191
|
MAX_SOURCE_FILE_SIZE = 1024 * 1024 * 2 # ~2 megabytes
|
@@ -211,9 +211,9 @@ Remote clone options `--schema`, `--configs` are currently not implemented, plea
|
|
211
211
|
layout_theme = options[:layout_theme]
|
212
212
|
@max_file_size = MAX_SOURCE_FILE_SIZE
|
213
213
|
|
214
|
-
dev_logs_dir =
|
215
|
-
FileUtils.mkdir_p(dev_logs_dir) unless
|
216
|
-
log_filename =
|
214
|
+
dev_logs_dir = File.join(current.root_dir, '.dev', 'log')
|
215
|
+
FileUtils.mkdir_p(dev_logs_dir) unless File.exists?(dev_logs_dir)
|
216
|
+
log_filename = File.join(dev_logs_dir, "remote-clone[#{Time.now.to_i}].log")
|
217
217
|
|
218
218
|
logger.start(log_filename) do |log|
|
219
219
|
if options[:sources]
|
@@ -47,7 +47,7 @@ module SkadateGems
|
|
47
47
|
|
48
48
|
# Request remote file to read it's contents.
|
49
49
|
# @yield [response] passes a http response to the block
|
50
|
-
def request(md5_checksum: nil, &block)
|
50
|
+
def request(md5_checksum: nil, retries: 3, &block)
|
51
51
|
path = self.path.dup
|
52
52
|
path[0] = '' if path[0] == '/'
|
53
53
|
|
@@ -87,19 +87,24 @@ readfile($filename);
|
|
87
87
|
exit;
|
88
88
|
PHPSCRIPT
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
elsif response.is_a?(Net::HTTPOK)
|
94
|
-
if response['content-disposition'] == "attachment; filename=#{basename}" &&
|
95
|
-
response['x-content-md5-checksum']
|
90
|
+
begin
|
91
|
+
@remote.accessor.exec(batch) do |response|
|
92
|
+
if response.is_a?(Net::HTTPNotModified)
|
96
93
|
block.call(response)
|
94
|
+
elsif response.is_a?(Net::HTTPOK)
|
95
|
+
if response['content-disposition'] == "attachment; filename=#{basename}" &&
|
96
|
+
response['x-content-md5-checksum']
|
97
|
+
block.call(response)
|
98
|
+
else
|
99
|
+
raise 'unexpected response headers'
|
100
|
+
end
|
97
101
|
else
|
98
|
-
raise
|
102
|
+
raise "[#{response.code} \"#{response.message}\"]"
|
99
103
|
end
|
100
|
-
else
|
101
|
-
raise "[#{response.code} \"#{response.message}\"]"
|
102
104
|
end
|
105
|
+
rescue SystemCallError, EOFError
|
106
|
+
retry if (retries -= 1) >= 1
|
107
|
+
raise
|
103
108
|
end
|
104
109
|
end
|
105
110
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skadategems-dev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Kerimdzhanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -130,12 +130,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: 2.0.0
|
131
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
132
|
requirements:
|
133
|
-
- - "
|
133
|
+
- - ">"
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
135
|
+
version: 1.3.1
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.2.
|
138
|
+
rubygems_version: 2.2.2
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Skadate Development Toolkit
|