fpm 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/bin/fpm CHANGED
@@ -68,7 +68,9 @@ def main(args)
68
68
 
69
69
  opts.parse!(args)
70
70
 
71
- FPM::Builder.new(settings, args).assemble!
71
+ builder = FPM::Builder.new(settings, args)
72
+ builder.assemble!
73
+ puts "Created #{builder.output}"
72
74
 
73
75
  return 0
74
76
  end # def main
@@ -40,12 +40,12 @@ class FPM::Builder
40
40
  @paths = paths
41
41
  @package = package_class_for(settings.package_type).new(@source)
42
42
  # Append dependencies given from settings (-d flag for fpm)
43
- @package.dependencies += settings.dependencies
43
+ @package.dependencies += settings.dependencies if settings.dependencies
44
44
 
45
45
  @output = settings.package_path
46
46
  @recurse_dependencies = settings.recurse_dependencies
47
47
  end # def initialize
48
-
48
+
49
49
  def tar_path
50
50
  @tar_path ||= "#{builddir}/data.tar"
51
51
  end
@@ -31,11 +31,16 @@ class FPM::Source::Gem < FPM::Source
31
31
  # How to handle prerelease? Some extra magic options?
32
32
  #dep.prerelease = options[:prerelease]
33
33
 
34
- specs_and_sources, errors =
35
- ::Gem::SpecFetcher.fetcher.fetch_with_errors(dep, false, true, false)
34
+ if ::Gem::SpecFetcher.fetcher.respond_to?(:fetch_with_errors)
35
+ specs_and_sources, errors =
36
+ ::Gem::SpecFetcher.fetcher.fetch_with_errors(dep, true, true, false)
37
+ else
38
+ specs_and_sources =
39
+ ::Gem::SpecFetcher.fetcher.fetch(dep, true)
40
+ errors = "???"
41
+ end
36
42
  spec, source_uri = specs_and_sources.sort_by { |s,| s.version }.last
37
43
 
38
-
39
44
  if spec.nil? then
40
45
  raise "Invalid gem? Name: #{gem_name}, Version: #{version}, Errors: #{errors}"
41
46
  end
@@ -67,14 +72,19 @@ class FPM::Source::Gem < FPM::Source
67
72
  self[:category] = 'Languages/Development/Ruby'
68
73
 
69
74
  self[:dependencies] = spec.runtime_dependencies.map do |dep|
70
- reqs = dep.requirement.to_s.gsub(/,/, '')
75
+ # rubygems 1.3.5 doesn't have 'Gem::Dependency#requirement'
76
+ if dep.respond_to?(:requirement)
77
+ reqs = dep.requirement.to_s.gsub(/,/, '')
78
+ else
79
+ reqs = dep.version_requirements
80
+ end
71
81
  "rubygem-#{dep.name} #{reqs}"
72
82
  end
73
83
  end # ::Gem::Package
74
84
  end # File.open (the gem)
75
85
  end # def get_metadata
76
86
 
77
- def make_tarball!(tar_path)
87
+ def make_tarball!(tar_path, builddir)
78
88
  tmpdir = "#{tar_path}.dir"
79
89
  installdir = "#{tmpdir}/#{::Gem::dir}"
80
90
  ::FileUtils.mkdir_p(installdir)
@@ -16,7 +16,7 @@ class FPM::Source::RPM < FPM::Source
16
16
 
17
17
  end
18
18
 
19
- def make_tarball!(tar_path)
19
+ def make_tarball!(tar_path, builddir)
20
20
  tmpdir = "#{tar_path}.dir"
21
21
  ::Dir.mkdir(tmpdir)
22
22
  system("rpm2cpio #{@rpm} | (cd #{tmpdir}; cpio -i --make-directories)")
@@ -5,15 +5,27 @@ Maintainer: <%= maintainer or "<unknown>" %>
5
5
  <% if dependencies.size > 0 %>
6
6
  <%
7
7
  properdeps = dependencies.collect do |d|
8
+ # Convert strings 'foo >= bar' to 'foo (>= bar)'
8
9
  if d =~ /\(/
9
- d
10
+ # nothing
10
11
  else
11
- # Convert strings 'foo >= bar' to 'foo (>= bar)'
12
12
  da = d.split(/ +/)
13
- "#{da[0]} (#{da[1]} #{da[2]})"
13
+ d = "#{da[0]} (#{da[1]} #{da[2]})"
14
+ end
15
+
16
+ # Convert gem ~> X.Y.Z to '>= X.Y.Z' and << X.Y+1.0
17
+ if d =~ /\(~>/
18
+ name, version = d.gsub(/[()~>]/, "").split(/ +/)[0..1]
19
+ nextversion = version.split(".").collect { |v| v.to_i }
20
+ nextversion[1] += 1
21
+ nextversion[2] = 0
22
+ nextversion = nextversion.join(".")
23
+ ["#{name} (>= #{version})", "#{name} (<< #{nextversion})"]
24
+ else
25
+ d
14
26
  end
15
27
  end
16
- %>Depends: <%= properdeps.join(", ") %>
28
+ %>Depends: <%= properdeps.flatten.join(", ") %>
17
29
  <% end %>
18
30
  Standards-Version: 3.9.1
19
31
  Section: <%= category or "unknown" %>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease: false
4
+ hash: 9
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 7
10
- version: 0.1.7
9
+ - 9
10
+ version: 0.1.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jordan Sissel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-13 00:00:00 -08:00
18
+ date: 2011-01-20 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  requirements: []
88
88
 
89
89
  rubyforge_project:
90
- rubygems_version: 1.3.7
90
+ rubygems_version: 1.4.2
91
91
  signing_key:
92
92
  specification_version: 3
93
93
  summary: fpm - package building and mangling