fpm 0.2.3 → 0.2.4

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.
@@ -54,7 +54,8 @@ class FPM::Builder
54
54
 
55
55
  # Assemble the package
56
56
  def assemble!
57
- output.gsub!(/VERSION/, "#{@source[:version]}-#{@package.iteration}")
57
+ version_a = [ @source[:version], @package.iteration ].compact
58
+ output.gsub!(/VERSION/, version_a.join('-'))
58
59
  output.gsub!(/ARCH/, @package.architecture)
59
60
 
60
61
  File.delete(output) if File.exists?(output) && !File.directory?(output)
@@ -48,30 +48,32 @@ class FPM::Package
48
48
  @version = source[:version] # || fail
49
49
 
50
50
  @dependencies = source[:dependencies] || []
51
- @iteration = source[:iteration] || 1
51
+ # Iteration can be nil. If nil, the fpm package implementation is expected
52
+ # to handle any default value that should be instead.
53
+ @iteration = source[:iteration]
52
54
  @url = source[:url] || "http://nourlgiven.example.com/no/url/given"
53
55
  @category = source[:category] || "default"
54
56
  @license = source[:license] || "unknown"
55
57
  @maintainer = source[:maintainer] || "<#{ENV["USER"]}@#{Socket.gethostname}>"
56
58
  @architecture = source[:architecture] || %x{uname -m}.chomp
57
59
  @summary = source[:summary] || "no summary given"
58
- end
60
+ end # def initialize
59
61
 
60
62
  def generate_specfile(builddir, paths)
61
63
  spec = template.result(binding)
62
64
  File.open(specfile(builddir), "w") { |f| f.puts spec }
63
- end
65
+ end # def generate_specfile
64
66
 
65
67
  def generate_md5sums(builddir, paths)
66
68
  md5sums = self.checksum(paths)
67
69
  File.open("#{builddir}/md5sums", "w") { |f| f.puts md5sums }
68
70
  md5sums
69
- end
71
+ end # def generate_md5sums
70
72
 
71
73
  # TODO [Jay]: make this better...?
72
74
  def type
73
75
  self.class.name.split(':').last.downcase
74
- end
76
+ end # def type
75
77
 
76
78
  def template
77
79
  @template ||= begin
@@ -80,13 +82,17 @@ class FPM::Package
80
82
  )
81
83
  ERB.new(tpl, nil, "<>")
82
84
  end
83
- end
85
+ end # def template
84
86
 
85
87
  def render_spec
86
88
  template.result(binding)
87
- end
89
+ end # def render_spec
88
90
 
89
91
  def default_output
90
- "#{name}-#{version}-#{iteration}.#{architecture}.#{type}"
91
- end
92
+ if iteration
93
+ "#{name}-#{version}-#{iteration}.#{architecture}.#{type}"
94
+ else
95
+ "#{name}-#{version}.#{architecture}.#{type}"
96
+ end
97
+ end # def default_output
92
98
  end
@@ -1,5 +1,5 @@
1
1
  Package: <%= name %>
2
- Version: <%= version %>-<%= iteration %>
2
+ Version: <%= version %><%= iteration && '-'+iteration.to_s %>
3
3
  Architecture: <%= architecture %>
4
4
  Maintainer: <%= maintainer or "<unknown>" %>
5
5
  <% if dependencies.size > 0 %>
@@ -1,6 +1,6 @@
1
1
  Name: <%= @name %>
2
2
  Version: <%= @version %>
3
- Release: <%= @iteration %>
3
+ Release: <%= @iteration or 1 %>
4
4
  Summary: <%= @summary %>
5
5
  BuildArch: <%= architecture %>
6
6
  AutoReqProv: no
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: 17
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jordan Sissel