gem2rpm 0.9.0 → 0.9.1
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/lib/gem2rpm/spec_fetcher.rb +9 -2
- data/lib/gem2rpm.rb +17 -7
- metadata +2 -2
data/lib/gem2rpm/spec_fetcher.rb
CHANGED
@@ -9,9 +9,16 @@ module Gem2Rpm
|
|
9
9
|
def spec_for_dependency(dependency, matching_platform=true)
|
10
10
|
super
|
11
11
|
rescue
|
12
|
-
|
12
|
+
errors = []
|
13
|
+
|
14
|
+
begin
|
15
|
+
spec, source = find_matching(dependency, true, matching_platform).first
|
16
|
+
rescue Gem::Exception => e
|
17
|
+
errors << OpenStruct.new(:error => e)
|
18
|
+
end
|
19
|
+
|
13
20
|
source = OpenStruct.new(:uri => source)
|
14
|
-
[[[spec, source]]]
|
21
|
+
[[[spec, source]], errors]
|
15
22
|
end
|
16
23
|
end
|
17
24
|
end
|
data/lib/gem2rpm.rb
CHANGED
@@ -7,17 +7,27 @@ require 'gem2rpm/spec_fetcher'
|
|
7
7
|
require 'gem2rpm/specification'
|
8
8
|
|
9
9
|
module Gem2Rpm
|
10
|
-
Gem2Rpm::VERSION = "0.9.
|
10
|
+
Gem2Rpm::VERSION = "0.9.1"
|
11
|
+
|
12
|
+
class Exception < RuntimeError; end
|
13
|
+
class DownloadUrlError < Exception; end
|
11
14
|
|
12
15
|
def self.find_download_url(name, version)
|
13
16
|
dep = Gem::Dependency.new(name, "=#{version}")
|
14
17
|
fetcher = Gem2Rpm::SpecFetcher.new(Gem::SpecFetcher.fetcher)
|
15
|
-
dummy, source = fetcher.spec_for_dependency(dep, false).first.first
|
16
18
|
|
17
|
-
|
19
|
+
spec_and_source, errors = fetcher.spec_for_dependency(dep, false)
|
20
|
+
|
21
|
+
raise DownloadUrlError.new(errors.first.error.message) unless errors.empty?
|
22
|
+
|
23
|
+
spec, source = spec_and_source.first
|
24
|
+
|
25
|
+
if source && source.uri
|
26
|
+
download_path = source.uri.to_s
|
27
|
+
download_path += "gems/"
|
28
|
+
end
|
18
29
|
|
19
|
-
download_path
|
20
|
-
return download_path
|
30
|
+
download_path
|
21
31
|
end
|
22
32
|
|
23
33
|
def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout,
|
@@ -30,9 +40,9 @@ module Gem2Rpm
|
|
30
40
|
unless local
|
31
41
|
begin
|
32
42
|
download_path = find_download_url(spec.name, spec.version)
|
33
|
-
rescue
|
43
|
+
rescue DownloadUrlError => e
|
34
44
|
$stderr.puts "Warning: Could not retrieve full URL for #{spec.name}\nWarning: Edit the specfile and enter the full download URL as 'Source0' manually"
|
35
|
-
$stderr.puts
|
45
|
+
$stderr.puts e.inspect
|
36
46
|
end
|
37
47
|
end
|
38
48
|
template = ERB.new(template, 0, '-')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem2rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-04-
|
13
|
+
date: 2013-04-23 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: ! " Generate source rpms and rpm spec files from a Ruby Gem. \n The
|
16
16
|
spec file tries to follow the gem as closely as possible\n"
|