iron_worker_ng 0.11.1 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/iron_worker_ng/fetcher.rb +15 -1
- data/lib/iron_worker_ng/version.rb +1 -1
- metadata +2 -2
@@ -9,8 +9,22 @@ module IronWorkerNG
|
|
9
9
|
url.start_with?('http://') || url.start_with?('https://')
|
10
10
|
end
|
11
11
|
|
12
|
+
def self.fix_github_url(url)
|
13
|
+
if url.start_with?('http://github.com/') || url.start_with?('https://github.com/')
|
14
|
+
fixed_url = url.sub('//github.com/', '//raw.github.com/').sub('/blob/', '/')
|
15
|
+
|
16
|
+
IronCore::Logger.info 'IronWorkerNG', "Fixed github link with url='#{url}' to url='#{fixed_url}'"
|
17
|
+
|
18
|
+
return fixed_url
|
19
|
+
end
|
20
|
+
|
21
|
+
url
|
22
|
+
end
|
23
|
+
|
12
24
|
def self.fetch(url, &block)
|
13
25
|
if IronWorkerNG::Fetcher.remote?(url)
|
26
|
+
url = IronWorkerNG::Fetcher.fix_github_url(url)
|
27
|
+
|
14
28
|
uri = URI.parse(url)
|
15
29
|
|
16
30
|
http = Net::HTTP.new(uri.host, uri.port)
|
@@ -44,7 +58,7 @@ module IronWorkerNG
|
|
44
58
|
if IronWorkerNG::Fetcher.remote?(url)
|
45
59
|
IronWorkerNG::Fetcher.fetch(url) do |data|
|
46
60
|
unless data.nil?
|
47
|
-
tmp_dir_name = ::Dir.tmpdir + '/' + ::Dir::Tmpname.make_tmpname(
|
61
|
+
tmp_dir_name = ::Dir.tmpdir + '/' + ::Dir::Tmpname.make_tmpname('iron-worker-ng-', 'http')
|
48
62
|
|
49
63
|
::Dir.mkdir(tmp_dir_name)
|
50
64
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: iron_worker_ng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.11.
|
5
|
+
version: 0.11.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Andrew Kirilenko
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2012-10-
|
14
|
+
date: 2012-10-09 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: iron_core
|