gem2rpm 0.5.3 → 0.6.0
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/bin/gem2rpm +0 -0
- data/lib/gem2rpm.rb +33 -7
- metadata +42 -35
data/bin/gem2rpm
CHANGED
File without changes
|
data/lib/gem2rpm.rb
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'socket'
|
3
3
|
require 'rubygems/format'
|
4
|
-
|
4
|
+
|
5
|
+
# Adapt to the differences between rubygems < 1.0.0 and after
|
6
|
+
# Once we can be reasonably certain that everybody has version >= 1.0.0
|
7
|
+
# all this logic should be killed
|
8
|
+
GEM_VERSION = Gem::Version.create(Gem::RubyGemsVersion)
|
9
|
+
HAS_REMOTE_INSTALLER = GEM_VERSION < Gem::Version.create("1.0.0")
|
10
|
+
|
11
|
+
if HAS_REMOTE_INSTALLER
|
12
|
+
require 'rubygems/remote_installer'
|
13
|
+
end
|
5
14
|
|
6
15
|
# Extend String with a word_wrap method, which we use in the ERB template
|
7
16
|
# below. Taken with modification from the word_wrap method in ActionPack.
|
@@ -30,9 +39,26 @@ module Gem
|
|
30
39
|
end
|
31
40
|
|
32
41
|
module Gem2Rpm
|
33
|
-
Gem2Rpm::VERSION = "0.
|
42
|
+
Gem2Rpm::VERSION = "0.6.0"
|
43
|
+
|
44
|
+
if HAS_REMOTE_INSTALLER
|
45
|
+
def self.find_download_url(name, version)
|
46
|
+
installer = Gem::RemoteInstaller.new
|
47
|
+
dummy, download_path = installer.find_gem_to_install(name, "=#{version}")
|
48
|
+
download_path += "/gems/" if download_path.to_s != ""
|
49
|
+
return download_path
|
50
|
+
end
|
51
|
+
else
|
52
|
+
def self.find_download_url(name, version)
|
53
|
+
dep = Gem::Dependency.new(name, "=#{version}")
|
54
|
+
fetcher = Gem::SpecFetcher.fetcher
|
55
|
+
dummy, download_path = fetcher.find_matching(dep, false, false).first
|
56
|
+
download_path += "gems/" if download_path.to_s != ""
|
57
|
+
return download_path
|
58
|
+
end
|
59
|
+
end
|
34
60
|
|
35
|
-
def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout,
|
61
|
+
def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout,
|
36
62
|
nongem=true, local=false)
|
37
63
|
format = Gem::Format.from_file_by_path(fname)
|
38
64
|
spec = format.spec
|
@@ -40,10 +66,10 @@ module Gem2Rpm
|
|
40
66
|
download_path = ""
|
41
67
|
unless local
|
42
68
|
begin
|
43
|
-
|
44
|
-
|
45
|
-
rescue Gem::Exception
|
69
|
+
download_path = find_download_url(spec.name, spec.version)
|
70
|
+
rescue Gem::Exception => e
|
46
71
|
$stderr.puts "Warning: Could not retrieve full URL for #{spec.name}\nWarning: Edit the specfile and enter the full download URL as 'Source0' manually"
|
72
|
+
$stderr.puts "#{e.inspect}"
|
47
73
|
end
|
48
74
|
end
|
49
75
|
template = ERB.new(template, 0, '<>')
|
@@ -61,7 +87,7 @@ module Gem2Rpm
|
|
61
87
|
packager
|
62
88
|
end
|
63
89
|
|
64
|
-
TEMPLATE =
|
90
|
+
TEMPLATE =
|
65
91
|
%q{# Generated from <%= File::basename(format.gem_path) %> by gem2rpm -*- rpm-spec -*-
|
66
92
|
%define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
|
67
93
|
%define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
|
metadata
CHANGED
@@ -1,33 +1,28 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
4
2
|
name: gem2rpm
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2008-03-11 00:00:00 -07:00
|
8
|
-
summary: Generate rpm specfiles from gems
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: gem2rpm-devel@rubyforge.org
|
12
|
-
homepage: http://rubyforge.org/projects/gem2rpm/
|
13
|
-
rubyforge_project:
|
14
|
-
description: Generate source rpms and rpm spec files from a Ruby Gem. The spec file tries to follow the gem as closely as possible
|
15
|
-
autorequire:
|
16
|
-
default_executable: gem2rpm
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: false
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 0.6.0
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- David Lutterkort
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-10-06 00:00:00 -07:00
|
13
|
+
default_executable: gem2rpm
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Generate source rpms and rpm spec files from a Ruby Gem. The spec file tries to follow the gem as closely as possible
|
17
|
+
email: gem2rpm-devel@rubyforge.org
|
18
|
+
executables:
|
19
|
+
- gem2rpm
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- AUTHORS
|
24
|
+
- README
|
25
|
+
- LICENSE
|
31
26
|
files:
|
32
27
|
- bin/gem2rpm
|
33
28
|
- lib/gem2rpm.rb
|
@@ -35,19 +30,31 @@ files:
|
|
35
30
|
- README
|
36
31
|
- rubygem-gem2rpm.spec
|
37
32
|
- AUTHORS
|
38
|
-
|
39
|
-
|
33
|
+
has_rdoc: false
|
34
|
+
homepage: http://rubyforge.org/projects/gem2rpm/
|
35
|
+
post_install_message:
|
40
36
|
rdoc_options: []
|
41
37
|
|
42
|
-
|
43
|
-
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
-
|
48
|
-
|
49
|
-
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
version:
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: "0"
|
51
|
+
version:
|
50
52
|
requirements: []
|
51
53
|
|
52
|
-
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 1.2.0
|
56
|
+
signing_key:
|
57
|
+
specification_version: 2
|
58
|
+
summary: Generate rpm specfiles from gems
|
59
|
+
test_files: []
|
53
60
|
|