fpm-cookery 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.9.0 (2012-07-21)
2
+ * Allow architecture specific settings via the `architectures` method.
3
+ * Unbreak RPM creation on RHEL5. (brandonmartin)
4
+
1
5
  # v0.8.0 (2012-05-23)
2
6
  * Add /opt path helper.
3
7
  * Use the new fpm API. (requires at least fpm-0.4.x)
@@ -3,6 +3,10 @@ require 'facter'
3
3
  module FPM
4
4
  module Cookery
5
5
  class Facts
6
+ def self.arch
7
+ @arch ||= Facter.fact(:architecture).value.downcase.to_sym
8
+ end
9
+
6
10
  def self.platform
7
11
  @platform ||= Facter.fact(:operatingsystem).value.downcase.to_sym
8
12
  end
@@ -170,6 +170,11 @@ module FPM
170
170
  input.attributes[:prefix] = '/'
171
171
  input.attributes[:chdir] = recipe.destdir.to_s
172
172
  input.attributes[:excludes] = [] # TODO replace remove_excluded_files() with this
173
+ input.attributes[:rpm_compression] = "gzip"
174
+ input.attributes[:rpm_digest] = "md5"
175
+ input.attributes[:rpm_user] = "root"
176
+ input.attributes[:rpm_group] = "root"
177
+
173
178
  input.input('.')
174
179
 
175
180
  output_class = FPM::Package.types[@target]
@@ -30,6 +30,10 @@ module FPM
30
30
  Array(valid_platforms).member?(self.platform) and block_given? ? yield : false
31
31
  end
32
32
 
33
+ def self.architectures(archs)
34
+ Array(archs).member?(FPM::Cookery::Facts.arch) and block_given? ? yield : false
35
+ end
36
+
33
37
  def self.attr_rw_list(*attrs)
34
38
  attrs.each do |attr|
35
39
  class_eval %Q{
@@ -1,5 +1,5 @@
1
1
  module FPM
2
2
  module Cookery
3
- VERSION = '0.8.0'
3
+ VERSION = '0.9.0'
4
4
  end
5
5
  end
data/spec/facts_spec.rb CHANGED
@@ -7,6 +7,20 @@ describe "Facts" do
7
7
  FPM::Cookery::Facts.reset!
8
8
  end
9
9
 
10
+ describe "arch" do
11
+ before do
12
+ Facter.class_eval do
13
+ def self.fact(v)
14
+ v == :architecture ? OpenStruct.new(:value => 'x86_64') : nil
15
+ end
16
+ end
17
+ end
18
+
19
+ it "is returns the current platform" do
20
+ FPM::Cookery::Facts.arch.must_equal :x86_64
21
+ end
22
+ end
23
+
10
24
  describe "platform" do
11
25
  before do
12
26
  Facter.class_eval do
data/spec/recipe_spec.rb CHANGED
@@ -228,6 +228,56 @@ describe "Recipe" do
228
228
  end
229
229
  end
230
230
 
231
+ describe ".architectures" do
232
+ before do
233
+ FPM::Cookery::Facts.class_eval do
234
+ def self.arch; :x86_64; end
235
+ end
236
+ end
237
+
238
+ describe "with a list of architectures" do
239
+ it "allows arch specific settings" do
240
+ klass.class_eval do
241
+ vendor 'a'
242
+
243
+ architectures [:i386, :x86_64] do
244
+ vendor 'b'
245
+ end
246
+ end
247
+
248
+ klass.new(__FILE__).vendor.must_equal 'b'
249
+ end
250
+ end
251
+
252
+ describe "with a single architecture" do
253
+ it "allows arch specific settings" do
254
+ klass.class_eval do
255
+ vendor 'a'
256
+
257
+ architectures :x86_64 do
258
+ vendor 'b'
259
+ end
260
+ end
261
+
262
+ klass.new(__FILE__).vendor.must_equal 'b'
263
+ end
264
+ end
265
+
266
+ describe "without a matching architecture" do
267
+ it "does not set arch specific settings" do
268
+ klass.class_eval do
269
+ vendor 'a'
270
+
271
+ architectures :i386 do
272
+ vendor 'b'
273
+ end
274
+ end
275
+
276
+ klass.new(__FILE__).vendor.must_equal 'a'
277
+ end
278
+ end
279
+ end
280
+
231
281
 
232
282
  #############################################################################
233
283
  # Directories
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.8.0
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-23 00:00:00.000000000 Z
12
+ date: 2012-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fpm