iron_worker_ng 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/iron_worker_ng/code/initializer.rb +4 -2
- data/lib/iron_worker_ng/feature/base.rb +9 -1
- data/lib/iron_worker_ng/fetcher.rb +50 -0
- data/lib/iron_worker_ng.rb +1 -0
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.2
|
@@ -45,8 +45,10 @@ module IronWorkerNG
|
|
45
45
|
wfiles << 'Workerfile'
|
46
46
|
|
47
47
|
wfiles.each do |wfile|
|
48
|
-
|
49
|
-
|
48
|
+
src, clean = IronWorkerNG::Fetcher.fetch(wfile)
|
49
|
+
|
50
|
+
unless src.nil?
|
51
|
+
eval(src)
|
50
52
|
|
51
53
|
@base_dir = File.dirname(wfile) == '.' ? '' : File.dirname(wfile) + '/'
|
52
54
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
module IronWorkerNG
|
2
4
|
module Feature
|
3
5
|
class Base
|
@@ -6,10 +8,12 @@ module IronWorkerNG
|
|
6
8
|
end
|
7
9
|
|
8
10
|
def rebase(path)
|
9
|
-
|
11
|
+
@code.base_dir + path
|
10
12
|
end
|
11
13
|
|
12
14
|
def zip_add(zip, dest, src)
|
15
|
+
src, clean = IronWorkerNG::Fetcher.fetch(src, true)
|
16
|
+
|
13
17
|
src = File.expand_path(src)
|
14
18
|
|
15
19
|
unless File.exists?(src)
|
@@ -24,6 +28,10 @@ module IronWorkerNG
|
|
24
28
|
else
|
25
29
|
zip.add(@code.dest_dir + dest, src)
|
26
30
|
end
|
31
|
+
|
32
|
+
unless clean.nil?
|
33
|
+
FileUtils.rm_f(clean)
|
34
|
+
end
|
27
35
|
end
|
28
36
|
|
29
37
|
def hash_string
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'net/https'
|
3
|
+
require 'tmpdir'
|
4
|
+
|
5
|
+
module IronWorkerNG
|
6
|
+
class Fetcher
|
7
|
+
def self.fetch(url, to_file = false)
|
8
|
+
if url.start_with?('http://') || url.start_with?('https://')
|
9
|
+
uri = URI.parse(url)
|
10
|
+
|
11
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
12
|
+
|
13
|
+
if uri.scheme == 'https'
|
14
|
+
http.use_ssl = true
|
15
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
16
|
+
end
|
17
|
+
|
18
|
+
response = http.request(Net::HTTP::Get.new(uri.request_uri))
|
19
|
+
|
20
|
+
if response.kind_of?(Net::HTTPRedirection)
|
21
|
+
IronWorkerNG::Fetcher.fetch(response['location'], to_file)
|
22
|
+
end
|
23
|
+
|
24
|
+
if to_file
|
25
|
+
tmp_dir_name = Dir.tmpdir + '/' + Dir::Tmpname.make_tmpname("iron-worker-ng-", "http")
|
26
|
+
|
27
|
+
Dir.mkdir(tmp_dir_name)
|
28
|
+
|
29
|
+
File.open(tmp_dir_name + '/' + File.basename(url), 'wb') do |f|
|
30
|
+
f.write(response.body)
|
31
|
+
end
|
32
|
+
|
33
|
+
[tmp_dir_name + '/' + File.basename(url), tmp_dir_name]
|
34
|
+
else
|
35
|
+
[response.body, nil]
|
36
|
+
end
|
37
|
+
else
|
38
|
+
unless File.exists?(url)
|
39
|
+
return [nil, nil]
|
40
|
+
end
|
41
|
+
|
42
|
+
if to_file
|
43
|
+
[url, nil]
|
44
|
+
else
|
45
|
+
[File.read(url), nil]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/iron_worker_ng.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_worker_ng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- lib/iron_worker_ng/feature/ruby/merge_exec.rb
|
129
129
|
- lib/iron_worker_ng/feature/ruby/merge_gem.rb
|
130
130
|
- lib/iron_worker_ng/feature/ruby/merge_gemfile.rb
|
131
|
+
- lib/iron_worker_ng/fetcher.rb
|
131
132
|
- lib/iron_worker_ng/version.rb
|
132
133
|
- ng_tests_worker.rb
|
133
134
|
- remote_test.rb
|
@@ -145,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
146
|
version: '0'
|
146
147
|
segments:
|
147
148
|
- 0
|
148
|
-
hash:
|
149
|
+
hash: 787590099
|
149
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
151
|
none: false
|
151
152
|
requirements:
|