fpm-cookery 0.36.0 → 0.37.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d635234a7161b1b47ba35bf07f4a3c58209482d57ead1d2e7d42e59ead4090f
4
- data.tar.gz: 15c95843c18e2b098236b68fa4249fad32387dfae68b92ae734087379179d337
3
+ metadata.gz: b95014d3c9e85da55e6ba1e46ff1d8b6fddd05ff100afff7d3f26c1440c56845
4
+ data.tar.gz: e2c6c2e73c6816ba2f34e20fa9ad9d25c9a255caf0b2c6fe9b5ba37cc2cd6308
5
5
  SHA512:
6
- metadata.gz: b9c9ef894547aa17415134b1de01ba2cf4b594429f4d7a93fe24166bf0a1eed82961d1cdf155f16edb96907f4a9f36bc3517bae12e384c60fbd126daad953753
7
- data.tar.gz: 79b01c1bb917e0ae2ab6e90c64a521d930d8e3d80512345b6df98ca82ce1ece074229eaff0044c39a8a451c79954b2b84966a9d440b827bbd978f771ae548c70
6
+ metadata.gz: 0c0eaf01306f288ac13a2c0766c1366a6dd79ec3eb5ada9928dbef287232d0f7b5108a0bdd1ff9005b53e1320100c9b70224126e3cebe1ae9dc7d3775de04324
7
+ data.tar.gz: ca59959ebd72f3b8eedbbba3b341a951f0ce816ccf5b383ab3b6013541befccf1da5e8d35f0cdda9bae5c86a8b1434cd4bd336fe8eec2692235ef37d69f0ee25
@@ -8,7 +8,7 @@ jobs:
8
8
  runs-on: ubuntu-latest
9
9
  strategy:
10
10
  matrix:
11
- ruby: ["2.4", "2.5", "2.6", "2.7", "3.0", "3.1"]
11
+ ruby: ["2.7", "3.0", "3.1", "3.2"]
12
12
 
13
13
  steps:
14
14
  - uses: actions/checkout@v1
@@ -19,6 +19,8 @@ jobs:
19
19
  bundler-cache: true
20
20
  - name: Build and test with Rake
21
21
  run: |
22
+ sudo apt-get update -qq
23
+ sudo apt-get install -yqq python3-sphinx
22
24
  gem install bundler
23
25
  bundle install --jobs 4 --retry 3
24
26
  bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v0.37.0 (2023-04-04)
2
+ * Add `osfamily` fact and choose package target based on it. (FooBarQuaxx / #216)
3
+ * Install Sphinx toolchain for GitHub Action workflow. (FooBarQuaxx / #217)
4
+ * Add support for Ruby 3.2. (FooBarQuaxx / #218, bernd / #219)
5
+
1
6
  # v0.36.0 (2022-07-13)
2
7
  * Add Dockerfile for Ubuntu 18.04.
3
8
  * Allow newer versions of Puppet (gmathes / #211)
@@ -20,7 +20,7 @@ module FPM
20
20
  DependencyInspector.verify!([], recipe.build_depends)
21
21
  recipe.chain_recipes.each do |name|
22
22
  recipe_file = build_recipe_file_path(name)
23
- unless File.exists?(recipe_file)
23
+ unless File.exist?(recipe_file)
24
24
  error_message = "Cannot find a recipe for #{name} at #{recipe_file}"
25
25
  Log.fatal error_message
26
26
  raise Error::ExecutionFailure, error_message
@@ -49,7 +49,7 @@ module FPM
49
49
  recipe.chain_recipes.each do |name|
50
50
  recipe_file = build_recipe_file_path(name)
51
51
 
52
- unless File.exists?(recipe_file)
52
+ unless File.exist?(recipe_file)
53
53
  Log.fatal "Cannot find a recipe for #{name} at #{recipe_file}"
54
54
  exit 1
55
55
  end
@@ -60,7 +60,7 @@ module FPM
60
60
  file = File.expand_path(recipe)
61
61
 
62
62
  # Allow giving the directory containing a recipe.rb
63
- if File.directory?(file) && File.exists?(File.join(file, 'recipe.rb'))
63
+ if File.directory?(file) && File.exist?(File.join(file, 'recipe.rb'))
64
64
  file = File.join(file, 'recipe.rb')
65
65
  end
66
66
 
@@ -68,7 +68,7 @@ module FPM
68
68
  end
69
69
 
70
70
  def validate
71
- unless File.exists?(recipe_file)
71
+ unless File.exist?(recipe_file)
72
72
  Log.error 'No recipe.rb found in the current directory, abort.'
73
73
  exit 1
74
74
  end
@@ -28,13 +28,20 @@ module FPM
28
28
  @osmajorrelease ||= value(:operatingsystemmajrelease, false)
29
29
  end
30
30
 
31
+ def osfamily
32
+ @osfamily ||= value(:osfamily)
33
+ end
34
+
35
+ def osfamily=(value)
36
+ @osfamily = value.downcase.to_sym
37
+ end
38
+
31
39
  def target
32
- @target ||= case platform
33
- when :centos, :redhat, :fedora, :amazon,
34
- :scientific, :oraclelinux, :sles then :rpm
35
- when :debian, :ubuntu then :deb
36
- when :darwin then :osxpkg
37
- when :alpine then :apk
40
+ @target ||= case osfamily
41
+ when :redhat, :suse then :rpm
42
+ when :debian then :deb
43
+ when :darwin then :osxpkg
44
+ when :alpine then :apk
38
45
  end
39
46
  end
40
47
 
@@ -27,9 +27,6 @@ module FPM
27
27
  # Provides a default scope, and attempts to look up the key both as a
28
28
  # string and as a symbol.
29
29
  def lookup(key, default = nil, scope = self.scope, *rest)
30
-
31
- (Gem::Version.new(::Hiera.version) < Gem::Version.new('2.0.0') &&
32
- super(key.to_sym, default, scope, *rest)) ||
33
30
  super(key.to_s, default, scope, *rest)
34
31
  end
35
32
  alias_method :[], :lookup
@@ -21,7 +21,7 @@ module FPM
21
21
  _recipe.omnibus_recipes.each do |name|
22
22
  recipe_file = build_recipe_file_path(name)
23
23
  Log.info "Loading dependency recipe #{name} from #{recipe_file}"
24
- unless File.exists?(recipe_file)
24
+ unless File.exist?(recipe_file)
25
25
  error_message = "Cannot find a recipe for #{name} at #{recipe_file}"
26
26
  Log.fatal error_message
27
27
  raise Error::ExecutionFailure, error_message
@@ -119,7 +119,7 @@ module FPM
119
119
 
120
120
  # Do not extract source again because it might destroy changes
121
121
  # that have been made to the source. (like patches)
122
- if File.exists?(extract_cookie)
122
+ if File.exist?(extract_cookie)
123
123
  extracted_source = File.read(extract_cookie).chomp
124
124
  Log.debug "Extract cookie exists, using existing source directory: #{extracted_source}"
125
125
  else
@@ -149,7 +149,7 @@ module FPM
149
149
 
150
150
  build_cookie = build_cookie_name(package_name)
151
151
 
152
- if File.exists?(build_cookie)
152
+ if File.exist?(build_cookie)
153
153
  Log.warn "Skipping build of #{recipe.name} because build cookie found (#{build_cookie})," \
154
154
  " use \"fpm-cook clean\" to rebuild!"
155
155
  else
@@ -161,7 +161,7 @@ module FPM
161
161
  end
162
162
 
163
163
  FileUtils.rm_rf(recipe.destdir) unless keep_destdir?
164
- recipe.destdir.mkdir unless File.exists?(recipe.destdir)
164
+ recipe.destdir.mkdir unless File.exist?(recipe.destdir)
165
165
 
166
166
  begin
167
167
  recipe.installing = true
@@ -243,7 +243,7 @@ module FPM
243
243
  script_file = File.expand_path("../#{script_file.to_s}", recipe.filename)
244
244
  end
245
245
 
246
- if File.exists?(script_file)
246
+ if File.exist?(script_file)
247
247
  input.add_script(script, File.read(script_file.to_s))
248
248
  else
249
249
  Log.error "#{script} script '#{script_file}' is missing"
@@ -1,5 +1,5 @@
1
1
  module FPM
2
2
  module Cookery
3
- VERSION = '0.36.0'
3
+ VERSION = '0.37.0'
4
4
  end
5
5
  end
data/spec/facts_spec.rb CHANGED
@@ -69,81 +69,59 @@ describe "Facts" do
69
69
  end
70
70
  end
71
71
 
72
- describe "target" do
73
-
74
- describe "with platform Scientific" do
75
- it "returns rpm" do
76
- FPM::Cookery::Facts.platform = 'Scientific'
77
- expect(FPM::Cookery::Facts.target).to eq(:rpm)
78
- end
79
- end
72
+ describe "osfamily" do
73
+ include_context "mock facts", { :osfamily => 'RedHat' }
80
74
 
81
- describe "with platform CentOS" do
82
- it "returns rpm" do
83
- FPM::Cookery::Facts.platform = 'CentOS'
84
- expect(FPM::Cookery::Facts.target).to eq(:rpm)
85
- end
75
+ it "is using Facter to autodetect the osfamily" do
76
+ expect(FPM::Cookery::Facts.osfamily).to eq(:redhat)
86
77
  end
87
78
 
88
- describe "with platform RedHat" do
89
- it "returns rpm" do
90
- FPM::Cookery::Facts.platform = 'RedHat'
91
- expect(FPM::Cookery::Facts.target).to eq(:rpm)
92
- end
79
+ it "can be set" do
80
+ FPM::Cookery::Facts.platform = 'RedHat'
81
+ expect(FPM::Cookery::Facts.osfamily).to eq(:redhat)
93
82
  end
83
+ end
94
84
 
95
- describe "with platform Fedora" do
96
- it "returns rpm" do
97
- FPM::Cookery::Facts.platform = 'Fedora'
98
- expect(FPM::Cookery::Facts.target).to eq(:rpm)
99
- end
100
- end
85
+ describe "target" do
101
86
 
102
- describe "with platform Amazon" do
87
+ describe "with os family RedHat" do
103
88
  it "returns rpm" do
104
- FPM::Cookery::Facts.platform = 'Amazon'
89
+ FPM::Cookery::Facts.osfamily = 'RedHat'
105
90
  expect(FPM::Cookery::Facts.target).to eq(:rpm)
106
91
  end
107
92
  end
108
93
 
109
- describe "with platform OracleLinux" do
94
+ describe "with os family Suse" do
110
95
  it "returns rpm" do
111
- FPM::Cookery::Facts.platform = 'OracleLinux'
96
+ FPM::Cookery::Facts.osfamily = 'Suse'
112
97
  expect(FPM::Cookery::Facts.target).to eq(:rpm)
113
98
  end
114
99
  end
115
100
 
116
- describe "with platform Debian" do
117
- it "returns deb" do
118
- FPM::Cookery::Facts.platform = 'Debian'
119
- expect(FPM::Cookery::Facts.target).to eq(:deb)
120
- end
121
- end
122
-
123
- describe "with platform Ubuntu" do
101
+ describe "with os family Debian" do
124
102
  it "returns deb" do
125
- FPM::Cookery::Facts.platform = 'Ubuntu'
103
+ FPM::Cookery::Facts.osfamily = 'Debian'
126
104
  expect(FPM::Cookery::Facts.target).to eq(:deb)
127
105
  end
128
106
  end
129
107
 
130
- describe "with platform Darwin" do
108
+ describe "with os family Darwin" do
131
109
  it "returns osxpkg" do
132
- FPM::Cookery::Facts.platform = 'Darwin'
110
+ FPM::Cookery::Facts.osfamily = 'Darwin'
133
111
  expect(FPM::Cookery::Facts.target).to eq(:osxpkg)
134
112
  end
135
113
  end
136
114
 
137
- describe "with platform Alpine" do
115
+ describe "with os family Alpine" do
138
116
  it "returns apk" do
139
- FPM::Cookery::Facts.platform = 'Alpine'
117
+ FPM::Cookery::Facts.osfamily = 'Alpine'
140
118
  expect(FPM::Cookery::Facts.target).to eq(:apk)
141
119
  end
142
120
  end
143
121
 
144
- describe "with an unknown platform" do
122
+ describe "with an unknown os family" do
145
123
  it "returns nil" do
146
- FPM::Cookery::Facts.platform = '___X___'
124
+ FPM::Cookery::Facts.osfamily = '___X___'
147
125
  expect(FPM::Cookery::Facts.target).to eq(nil)
148
126
  end
149
127
  end
data/spec/path_spec.rb CHANGED
@@ -91,10 +91,10 @@ describe "Path" do
91
91
  it "creates the directory" do
92
92
  dir = Dir.mktmpdir
93
93
  FileUtils.rm_rf(dir)
94
- expect(File.exists?(dir)).to eq(false)
94
+ expect(File.exist?(dir)).to eq(false)
95
95
 
96
96
  FPM::Cookery::Path.new(dir).mkdir
97
- expect(File.exists?(dir)).to eq(true)
97
+ expect(File.exist?(dir)).to eq(true)
98
98
 
99
99
  FileUtils.rm_rf(dir)
100
100
  end
@@ -102,7 +102,7 @@ describe "Path" do
102
102
  describe "directory exists" do
103
103
  it "does not throw an error" do
104
104
  dir = Dir.mktmpdir
105
- expect(File.exists?(dir)).to eq(true)
105
+ expect(File.exist?(dir)).to eq(true)
106
106
 
107
107
  expect(FPM::Cookery::Path.new(dir).mkdir).to eq([dir])
108
108
 
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.36.0
4
+ version: 0.37.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: 2022-07-13 00:00:00.000000000 Z
11
+ date: 2023-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec