gem2rpm 0.5.0 → 0.5.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.
Files changed (3) hide show
  1. data/bin/gem2rpm +7 -2
  2. data/lib/gem2rpm.rb +12 -4
  3. metadata +2 -2
data/bin/gem2rpm CHANGED
@@ -15,6 +15,7 @@ opts.separator(" from the Gem spec")
15
15
 
16
16
  template_file = nil
17
17
  output_file = nil
18
+ local = false
18
19
  srpm = false
19
20
  deps = false
20
21
  nongem = false
@@ -36,6 +37,10 @@ end
36
37
  opts.on("-s", "--srpm", "Create a source RPM") do |val|
37
38
  srpm = true
38
39
  end
40
+ opts.on("-l", "--local", "Do not retrieve Gem information over
41
+ #{' '*36} the network. Use on disconnected machines") do |val|
42
+ local = true
43
+ end
39
44
  opts.on("-d", "--dependencies", "Print the dependencies of the gem") do |val|
40
45
  deps = true
41
46
  end
@@ -80,11 +85,11 @@ end
80
85
 
81
86
  # Produce a specfile
82
87
  if output_file.nil?
83
- Gem2Rpm::convert(gemfile, template, $stdout, nongem) unless deps
88
+ Gem2Rpm::convert(gemfile, template, $stdout, nongem, local) unless deps
84
89
  else
85
90
  begin
86
91
  out = open(output_file, "w")
87
- Gem2Rpm::convert(gemfile, template, out, nongem)
92
+ Gem2Rpm::convert(gemfile, template, out, nongem, local)
88
93
  ensure
89
94
  out.close()
90
95
  end
data/lib/gem2rpm.rb CHANGED
@@ -26,14 +26,22 @@ module Gem
26
26
  end
27
27
 
28
28
  module Gem2Rpm
29
- Gem2Rpm::VERSION = "0.5.0"
29
+ Gem2Rpm::VERSION = "0.5.1"
30
30
 
31
- def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout, nongem=true)
31
+ def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout,
32
+ nongem=true, local=false)
32
33
  format = Gem::Format.from_file_by_path(fname)
33
34
  spec = format.spec
34
35
  spec.description ||= spec.summary
35
- dummy, download_path = Gem::RemoteInstaller.new.find_gem_to_install(spec.name, "=#{spec.version}")
36
- download_path += "/gems/" if download_path.to_s != ""
36
+ download_path = ""
37
+ unless local
38
+ begin
39
+ dummy, download_path = Gem::RemoteInstaller.new.find_gem_to_install(spec.name, "=#{spec.version}")
40
+ download_path += "/gems/" if download_path.to_s != ""
41
+ rescue Gem::Exception
42
+ $stderr.puts "Warning: Could not retrieve full URL for #{spec.name}\nWarning: Edit the specfile and enter the full download URL as 'Source0' manually"
43
+ end
44
+ end
37
45
  template = ERB.new(template, 0, '<>')
38
46
  out.puts template.result(binding)
39
47
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: gem2rpm
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.0
7
- date: 2007-07-12 00:00:00 -07:00
6
+ version: 0.5.1
7
+ date: 2007-07-13 00:00:00 -07:00
8
8
  summary: Generate rpm specfiles from gems
9
9
  require_paths:
10
10
  - lib