fpm-cookery 0.21.0 → 0.22.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf8725d7f5c012b6be0b89abc7209dffbf02be84
4
- data.tar.gz: 1dca9003a4f4100cb5e09e139845a3d0ffdfc506
3
+ metadata.gz: ca1bc459382a35ea29c576382a16a6ff45db5892
4
+ data.tar.gz: 225becfa5a63531f7cc40fe697ddfcc58225a936
5
5
  SHA512:
6
- metadata.gz: a15c22968d8e574370a13b09a8b4609d6fc6faf5430b5f618b15d8a7c7821624d994bd2f3405acd298489b165372e5b5943100977a3611cf64b96899334bbbe4
7
- data.tar.gz: 267f5de36d79f2bb3b52e038cada34086c2e88b8ae729074ed93866d8e9988d8c6826b8079ed0ca3c78a31bf2204416aac0c47a12d70a8ffdc8eaefa3dd5552a
6
+ metadata.gz: ee50ff26886d0550452f6ca8f82f771f7da0bf16c0a704b4ac05ef7aa71e039cf66737a1114cdf15bbf14fa127a466c453a74ff733242c4f7190f79471b0b4e8
7
+ data.tar.gz: e6e47f70041d2a30beddca5dd50c28194352ed8af314fa26c08f536bb114bcceb8a7605c620006bee9fdd66f4db553890621f14926a432f0996a43f4a4ae0abc
@@ -1,3 +1,8 @@
1
+ # v0.22.0 (2014-05-26)
2
+ * Add support to set arbitrary fpm attributes via `fpm_attributes`.
3
+ (unakatsuo / #75, #80)
4
+ * Require fpm `~> 1.1.0`. (ryansch / #84)
5
+
1
6
  # v0.21.0 (2014-04-07)
2
7
  * Unbreak rpm packages by reverting the `%files` change from #67.
3
8
  * Remove default revision. (smasset / #76)
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_development_dependency "rspec", "~> 2.14"
22
22
  s.add_development_dependency "rake"
23
- s.add_runtime_dependency "fpm", "~> 1.0.0"
23
+ s.add_runtime_dependency "fpm", "~> 1.1.0"
24
24
  s.add_runtime_dependency "facter"
25
25
  s.add_runtime_dependency "puppet", ">= 3.4.3"
26
26
  s.add_runtime_dependency "addressable"
@@ -40,6 +40,10 @@ module FPM
40
40
  # Package type specific code should be called in package_setup.
41
41
  package_setup
42
42
 
43
+ # combine recipe specific fpm attributes. here allows to
44
+ # overwrite the values from package_setup().
45
+ @fpm.attributes.merge!(recipe.fpm_attributes)
46
+
43
47
  # The input for the FPM package will be set here.
44
48
  package_input
45
49
 
@@ -31,6 +31,13 @@ module FPM
31
31
  end
32
32
  end
33
33
 
34
+ def self.inherited(klass)
35
+ super
36
+ # Apply class data inheritable pattern to @fpm_attributes
37
+ # class variable.
38
+ klass.instance_variable_set(:@fpm_attributes, self.fpm_attributes.dup)
39
+ end
40
+
34
41
  def self.platforms(valid_platforms)
35
42
  Array(valid_platforms).member?(self.platform) and block_given? ? yield : false
36
43
  end
@@ -76,7 +83,18 @@ module FPM
76
83
  def depends_all
77
84
  (depends + build_depends).uniq
78
85
  end
86
+
87
+ # Supports both hash and argument assignment
88
+ # fpm_attributes[:attr1] = xxxx
89
+ # fpm_attributes :xxxx=>1, :yyyy=>2
90
+ def fpm_attributes(args=nil)
91
+ if args.is_a?(Hash)
92
+ @fpm_attributes.merge!(args)
93
+ end
94
+ @fpm_attributes
95
+ end
79
96
  end
97
+ @fpm_attributes = {}
80
98
 
81
99
  def initialize(filename, config)
82
100
  @filename = Path.new(filename).expand_path
@@ -101,6 +119,7 @@ module FPM
101
119
  def builddir(path = nil) (@builddir || tmp_root('tmp-build'))/path end
102
120
  def pkgdir(path = nil) (@pkgdir || workdir('pkg'))/path end
103
121
  def cachedir(path = nil) (@cachedir || workdir('cache'))/path end
122
+ def fpm_attributes() self.class.fpm_attributes end
104
123
 
105
124
  # Resolve dependencies from omnibus package.
106
125
  def depends_all
@@ -1,5 +1,5 @@
1
1
  module FPM
2
2
  module Cookery
3
- VERSION = '0.21.0'
3
+ VERSION = '0.22.0'
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  class PuppetRubyGem < FPM::Cookery::RubyGemRecipe
2
2
  name "puppet"
3
- version "3.2.2"
3
+ version "3.4.3"
4
4
 
5
5
  chain_package true
6
6
  chain_recipes "hiera", "rgen"
@@ -150,6 +150,21 @@ describe 'Package' do
150
150
  end
151
151
  end
152
152
 
153
+ describe '.fpm_attributes' do
154
+ let(:recipe) do
155
+ # Ensure Recipe.inherited() to be called before handling fpm_attributes.
156
+ recipe_class = Class.new(FPM::Cookery::Recipe)
157
+ recipe_class.instance_eval do
158
+ fpm_attributes :deb_user=>'deb_user', :rpm_user=>'rpm_user'
159
+ end
160
+ recipe_class
161
+ end
162
+
163
+ it 'overwrites default fpm attributes in Package class' do
164
+ expect(package.fpm.attributes).to include({:deb_user=>'deb_user', :rpm_user=>'rpm_user'})
165
+ end
166
+ end
167
+
153
168
  it 'calls the package_setup method' do
154
169
  expect(package.test_package_setup_run).to eq(true)
155
170
  end
@@ -516,4 +516,27 @@ describe "Recipe" do
516
516
  }).to eq(true)
517
517
  end
518
518
  end
519
+
520
+ describe ".fpm_attributes" do
521
+ it "returns hash object as default" do
522
+ expect(klass.fpm_attributes).to be_a(Hash)
523
+ end
524
+
525
+ it "returns same value from instance method with hash assignment" do
526
+ expect(recipe.fpm_attributes).to include({})
527
+
528
+ klass.fpm_attributes[:rpm_user] = 'httpd'
529
+ klass.fpm_attributes[:deb_user] = 'apache'
530
+
531
+ expect(recipe.fpm_attributes).to include({:rpm_user=>'httpd', :deb_user=>'apache'})
532
+ end
533
+
534
+ it "returns same value from instance method with argument assignment" do
535
+ expect(recipe.fpm_attributes).to include({})
536
+
537
+ klass.fpm_attributes :rpm_user => 'httpd', :deb_user => 'apache'
538
+
539
+ expect(recipe.fpm_attributes).to include({:rpm_user=>'httpd', :deb_user=>'apache'})
540
+ end
541
+ end
519
542
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm-cookery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernd Ahlers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-07 00:00:00.000000000 Z
11
+ date: 2014-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.0
47
+ version: 1.1.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.0
54
+ version: 1.1.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: facter
57
57
  requirement: !ruby/object:Gem::Requirement