fpm-cookery 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.3.0 (2011-10-25)
2
+ * Select vendor string delimiter based on the package target. (lusis)
3
+ * Add pre/post install/uninstall script support. (lusis)
4
+
1
5
  # v0.2.0 (2011-10-22)
2
6
  * Add flag for package target. (deb, rpm) (jordansissel)
3
7
  * Improve recipe detection. (jordansissel)
@@ -113,7 +113,15 @@ Filename: #{check.filename}
113
113
  # Build a version including vendor and revision.
114
114
  vendor = config[:vendor] || recipe.vendor
115
115
  vendor_rev = "#{vendor}#{recipe.revision}"
116
- version = [ver, vendor_rev].join('+')
116
+ case @target
117
+ when "deb"
118
+ vendor_delimiter = "+"
119
+ when "rpm"
120
+ vendor_delimiter = "."
121
+ else
122
+ vendor_delimiter = "-"
123
+ end
124
+ version = [ver, vendor_rev].join(vendor_delimiter)
117
125
 
118
126
  maintainer = recipe.maintainer || begin
119
127
  username = `git config --get user.name`.strip
@@ -147,20 +155,19 @@ Filename: #{check.filename}
147
155
  '--architecture', recipe.arch.to_s
148
156
  ] if recipe.arch
149
157
 
150
- # if self.postinst
151
- # postinst_file = Tempfile.open('postinst')
152
- # postinst_file.puts(postinst)
153
- # chmod 0755, postinst_file.path
154
- # postinst_file.close
155
- # opts += ['--post-install', postinst_file.path]
156
- # end
157
- # if self.postrm
158
- # postrm_file = Tempfile.open('postrm')
159
- # postrm_file.puts(postrm)
160
- # chmod 0755, postrm_file.path
161
- # postrm_file.close
162
- # opts += ['--post-uninstall', postrm_file.path]
163
- # end
158
+ script_map = {"pre_install" => "--pre-install", "post_install" => "--post-install", "pre_uninstall" => "--pre-uninstall", "post_uninstall" => "--post-uninstall"}
159
+ %w[pre_install post_install pre_uninstall post_uninstall].each do |script|
160
+ unless recipe.send(script).nil?
161
+ script_file = File.expand_path("../#{recipe.send(script)}", recipe.filename)
162
+
163
+ if File.exists?(script_file)
164
+ p_opt = script_map[script]
165
+ opts += ["#{p_opt}", script_file]
166
+ else
167
+ raise "#{script} script '#{script_file}' is missing"
168
+ end
169
+ end
170
+ end
164
171
 
165
172
  %w[ depends exclude provides replaces conflicts config_files ].each do |type|
166
173
  if recipe.send(type).any?
@@ -44,7 +44,8 @@ module FPM
44
44
  end
45
45
 
46
46
  attr_rw :arch, :description, :homepage, :maintainer, :md5, :name,
47
- :revision, :section, :sha1, :sha256, :spec, :vendor, :version
47
+ :revision, :section, :sha1, :sha256, :spec, :vendor, :version,
48
+ :pre_install, :post_install, :pre_uninstall, :post_uninstall
48
49
 
49
50
  attr_rw_list :build_depends, :config_files, :conflicts, :depends,
50
51
  :exclude, :patches, :provides, :replaces
@@ -1,5 +1,5 @@
1
1
  module FPM
2
2
  module Cookery
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
data/spec/recipe_spec.rb CHANGED
@@ -75,6 +75,10 @@ describe "Recipe" do
75
75
  spec_recipe_attribute(:spec, {:foo => true})
76
76
  spec_recipe_attribute(:vendor, 'myvendor')
77
77
  spec_recipe_attribute(:version, '1.2')
78
+ spec_recipe_attribute(:pre_install, 'preinstall')
79
+ spec_recipe_attribute(:post_install, 'postinstall')
80
+ spec_recipe_attribute(:pre_uninstall, 'preuninstall')
81
+ spec_recipe_attribute(:post_uninstall, 'postuninstall')
78
82
 
79
83
  describe "#revision" do
80
84
  it "sets a default revision" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm-cookery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-22 00:00:00.000000000 Z
12
+ date: 2011-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fpm
16
- requirement: &84285390 !ruby/object:Gem::Requirement
16
+ requirement: &71291120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *84285390
24
+ version_requirements: *71291120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &84285150 !ruby/object:Gem::Requirement
27
+ requirement: &71290880 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *84285150
35
+ version_requirements: *71290880
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &84284930 !ruby/object:Gem::Requirement
38
+ requirement: &71290650 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *84284930
46
+ version_requirements: *71290650
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: fpm
49
- requirement: &84284710 !ruby/object:Gem::Requirement
49
+ requirement: &71290430 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *84284710
57
+ version_requirements: *71290430
58
58
  description: A tool for building software packages with fpm.
59
59
  email:
60
60
  - bernd@tuneafish.de