fpm-cookery 0.19.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +1 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +6 -0
- data/Rakefile +4 -7
- data/fpm-cookery.gemspec +1 -1
- data/lib/fpm/cookery/book.rb +1 -1
- data/lib/fpm/cookery/cli.rb +8 -1
- data/lib/fpm/cookery/config.rb +2 -1
- data/lib/fpm/cookery/package/package.rb +1 -0
- data/lib/fpm/cookery/recipe.rb +16 -8
- data/lib/fpm/cookery/version.rb +1 -1
- data/spec/config_spec.rb +48 -20
- data/spec/facts_spec.rb +11 -11
- data/spec/package_maintainer_spec.rb +22 -44
- data/spec/package_spec.rb +34 -26
- data/spec/package_version_spec.rb +20 -20
- data/spec/path_helper_spec.rb +19 -19
- data/spec/path_spec.rb +17 -17
- data/spec/recipe_spec.rb +95 -56
- data/spec/source_integrity_check_spec.rb +39 -52
- data/spec/source_spec.rb +7 -7
- data/spec/spec_helper.rb +11 -8
- metadata +23 -24
- data/.autotest +0 -21
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
OGM1ZGNlOTc1YTcxYTdmMDBlOWM2ZWRiNzBiNGIwMjcyMjZlNmU5ZA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eb9277f23528fc7aeb48ba0a8a10d9861c70917b
|
4
|
+
data.tar.gz: e1379467c6ffe436d779e6d32ed472352aa31e43
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MzQxYzc0NmY2YjRkMTIxZWEwZDliZTU3OGE3ZjQ0MjVhNjg3OGU5MDQzMWJh
|
11
|
-
NzQ4ZDhmOGY2MGNiNTU5ODhiOWExZTFlODZkYTZlYmI5ODZjN2E=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MGQwMWJhMjYyZWQwODExMzM3MmU1NDc5YWQ4OThlNDkwNjY1MWRjNTkzZjI4
|
14
|
-
ODMwNzM0NzcyZDc2YjQ1OTBhMWQ3ZjNjNmVhNjk5ODBjZTQ0ZjczNTIwZmQw
|
15
|
-
MjI3MDVlMzRkNTg0Y2JlYmE4ZWM5YWZkMTEwMzkyMGUzNTVmZTA=
|
6
|
+
metadata.gz: c703e14db35cff6e1a95778a7d7e0abc0519ff1f1ede27c11daf6d27bd8128cb18e1a36960187c3bcee0c4450af41939817706fbfc0d0fbad9bb839a7aa4d810
|
7
|
+
data.tar.gz: 1a833e697752e67acb1b0eda8a44ec825cc1d8e084ebd72ea72462e0b5ef3890a554f4d2397371cc61a4faabf170e96e4992326165c7115d8ec29b1ea3b6eb27
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# v0.20.0 (2014-03-07)
|
2
|
+
* Add `--tmp-root` command line option.
|
3
|
+
* Add `--pkg-dir` command line option.
|
4
|
+
* Add `--cache-dir` command line option.
|
5
|
+
* Fix `%files` section in rpms. (unakatsuo / #67)
|
6
|
+
|
1
7
|
# v0.19.0 (2014-03-03)
|
2
8
|
* Correctly set version, iteration and vendor on the FPM object.
|
3
9
|
__WARNING__: This changes the default package names!
|
data/Rakefile
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'rspec/core/rake_task'
|
2
2
|
require 'bundler/gem_tasks'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
t.libs << 'spec'
|
7
|
-
t.verbose = false
|
8
|
-
end
|
4
|
+
desc 'Run all specs'
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
6
|
|
10
|
-
task :default => :
|
7
|
+
task :default => :spec
|
data/fpm-cookery.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
s.add_development_dependency "
|
21
|
+
s.add_development_dependency "rspec", "~> 2.14"
|
22
22
|
s.add_development_dependency "rake"
|
23
23
|
s.add_runtime_dependency "fpm", "~> 1.0.0"
|
24
24
|
s.add_runtime_dependency "facter"
|
data/lib/fpm/cookery/book.rb
CHANGED
data/lib/fpm/cookery/cli.rb
CHANGED
@@ -21,6 +21,12 @@ module FPM
|
|
21
21
|
option ['-V', '--version'], :flag, 'show fpm-cookery and fpm version'
|
22
22
|
option '--[no-]deps', :flag, 'enable/disable dependency checking',
|
23
23
|
:attribute_name => 'dependency_check'
|
24
|
+
option '--tmp-root', 'DIR', 'directory root for temporary files',
|
25
|
+
:attribute_name => 'tmp_root'
|
26
|
+
option '--pkg-dir', 'DIR', 'directory for built packages',
|
27
|
+
:attribute_name => 'pkg_dir'
|
28
|
+
option '--cache-dir', 'DIR', 'directory for downloaded sources',
|
29
|
+
:attribute_name => 'cache_dir'
|
24
30
|
|
25
31
|
class Command < self
|
26
32
|
def recipe_file
|
@@ -62,7 +68,8 @@ module FPM
|
|
62
68
|
|
63
69
|
FPM::Cookery::BaseRecipe.send(:include, FPM::Cookery::BookHook)
|
64
70
|
|
65
|
-
FPM::Cookery::Book.instance.load_recipe(recipe_file) do |
|
71
|
+
FPM::Cookery::Book.instance.load_recipe(recipe_file) do |recipe_class|
|
72
|
+
recipe = recipe_class.new(recipe_file, config)
|
66
73
|
packager = FPM::Cookery::Packager.new(recipe, config.to_hash)
|
67
74
|
packager.target = FPM::Cookery::Facts.target.to_s
|
68
75
|
|
data/lib/fpm/cookery/config.rb
CHANGED
@@ -6,7 +6,8 @@ module FPM
|
|
6
6
|
class Config
|
7
7
|
ATTRIBUTES = [
|
8
8
|
:color, :debug, :target, :platform, :maintainer, :vendor,
|
9
|
-
:skip_package, :keep_destdir, :dependency_check, :quiet
|
9
|
+
:skip_package, :keep_destdir, :dependency_check, :quiet,
|
10
|
+
:tmp_root, :pkg_dir, :cache_dir
|
10
11
|
].freeze
|
11
12
|
|
12
13
|
DEFAULTS = {
|
@@ -33,6 +33,7 @@ module FPM
|
|
33
33
|
@fpm.attributes[:rpm_group] = 'root'
|
34
34
|
@fpm.attributes[:rpm_defattrfile] = '-'
|
35
35
|
@fpm.attributes[:rpm_defattrdir] = '-'
|
36
|
+
@fpm.attributes[:rpm_auto_add_directories?] = true
|
36
37
|
|
37
38
|
# TODO replace remove_excluded_files() in packager with this.
|
38
39
|
@fpm.attributes[:excludes] = []
|
data/lib/fpm/cookery/recipe.rb
CHANGED
@@ -77,24 +77,32 @@ module FPM
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
def initialize(filename)
|
80
|
+
def initialize(filename, config)
|
81
81
|
@filename = Path.new(filename).expand_path
|
82
|
+
@config = config
|
83
|
+
|
84
|
+
@workdir = @filename.dirname
|
85
|
+
@tmp_root = @config.tmp_root ? Path.new(@config.tmp_root) : @workdir
|
86
|
+
@pkgdir = @config.pkg_dir && Path.new(@config.pkg_dir)
|
87
|
+
@cachedir = @config.cache_dir && Path.new(@config.cache_dir)
|
82
88
|
|
83
89
|
# Set some defaults.
|
84
90
|
revision || self.class.revision(1)
|
85
91
|
end
|
86
92
|
|
87
93
|
def workdir=(value) @workdir = Path.new(value) end
|
94
|
+
def tmp_root=(value) @tmp_root = Path.new(value) end
|
88
95
|
def destdir=(value) @destdir = Path.new(value) end
|
89
96
|
def builddir=(value) @builddir = Path.new(value) end
|
90
97
|
def pkgdir=(value) @pkgdir = Path.new(value) end
|
91
98
|
def cachedir=(value) @cachedir = Path.new(value) end
|
92
99
|
|
93
|
-
def workdir(path = nil)
|
94
|
-
def
|
95
|
-
def
|
96
|
-
def
|
97
|
-
def
|
100
|
+
def workdir(path = nil) @workdir/path end
|
101
|
+
def tmp_root(path = nil) @tmp_root/path end
|
102
|
+
def destdir(path = nil) (@destdir || tmp_root('tmp-dest'))/path end
|
103
|
+
def builddir(path = nil) (@builddir || tmp_root('tmp-build'))/path end
|
104
|
+
def pkgdir(path = nil) (@pkgdir || workdir('pkg'))/path end
|
105
|
+
def cachedir(path = nil) (@cachedir || workdir('cache'))/path end
|
98
106
|
|
99
107
|
# Resolve dependencies from omnibus package.
|
100
108
|
def depends_all
|
@@ -116,8 +124,8 @@ module FPM
|
|
116
124
|
FPM::Cookery::Package::Dir.new(self, config)
|
117
125
|
end
|
118
126
|
|
119
|
-
def initialize(filename)
|
120
|
-
super(filename)
|
127
|
+
def initialize(filename, config)
|
128
|
+
super(filename, config)
|
121
129
|
@source_handler = SourceHandler.new(Source.new(source, spec), cachedir, builddir)
|
122
130
|
end
|
123
131
|
|
data/lib/fpm/cookery/version.rb
CHANGED
data/spec/config_spec.rb
CHANGED
@@ -11,24 +11,25 @@ describe 'Config' do
|
|
11
11
|
it 'can be set on init' do
|
12
12
|
data[name.to_sym] = '__set__'
|
13
13
|
|
14
|
-
config.__send__(name).
|
14
|
+
expect(config.__send__(name)).to eq('__set__')
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'can be set' do
|
18
18
|
config.__send__("#{name}=", '__SET__')
|
19
|
-
|
19
|
+
|
20
|
+
expect(config.__send__(name)).to eq('__SET__')
|
20
21
|
end
|
21
22
|
|
22
23
|
it 'provides a ? method' do
|
23
24
|
data[name.to_sym] = false
|
24
25
|
|
25
|
-
config.__send__("#{name}?").
|
26
|
+
expect(config.__send__("#{name}?")).to eq(false)
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
29
30
|
describe '#color' do
|
30
31
|
it 'defaults to true' do
|
31
|
-
default_config.color.
|
32
|
+
expect(default_config.color).to eq(true)
|
32
33
|
end
|
33
34
|
|
34
35
|
common_tests(:color)
|
@@ -36,7 +37,7 @@ describe 'Config' do
|
|
36
37
|
|
37
38
|
describe '#debug' do
|
38
39
|
it 'defaults to true' do
|
39
|
-
default_config.debug.
|
40
|
+
expect(default_config.debug).to eq(false)
|
40
41
|
end
|
41
42
|
|
42
43
|
common_tests(:debug)
|
@@ -44,7 +45,7 @@ describe 'Config' do
|
|
44
45
|
|
45
46
|
describe '#target' do
|
46
47
|
it 'defaults to nil' do
|
47
|
-
default_config.target.
|
48
|
+
expect(default_config.target).to eq(nil)
|
48
49
|
end
|
49
50
|
|
50
51
|
common_tests(:target)
|
@@ -52,7 +53,7 @@ describe 'Config' do
|
|
52
53
|
|
53
54
|
describe '#platform' do
|
54
55
|
it 'defaults to nil' do
|
55
|
-
default_config.platform.
|
56
|
+
expect(default_config.platform).to eq(nil)
|
56
57
|
end
|
57
58
|
|
58
59
|
common_tests(:platform)
|
@@ -60,7 +61,7 @@ describe 'Config' do
|
|
60
61
|
|
61
62
|
describe '#maintainer' do
|
62
63
|
it 'defaults to nil' do
|
63
|
-
default_config.maintainer.
|
64
|
+
expect(default_config.maintainer).to eq(nil)
|
64
65
|
end
|
65
66
|
|
66
67
|
common_tests(:maintainer)
|
@@ -68,7 +69,7 @@ describe 'Config' do
|
|
68
69
|
|
69
70
|
describe '#vendor' do
|
70
71
|
it 'defaults to nil' do
|
71
|
-
default_config.vendor.
|
72
|
+
expect(default_config.vendor).to eq(nil)
|
72
73
|
end
|
73
74
|
|
74
75
|
common_tests(:vendor)
|
@@ -76,7 +77,7 @@ describe 'Config' do
|
|
76
77
|
|
77
78
|
describe '#quiet' do
|
78
79
|
it 'defaults to false' do
|
79
|
-
default_config.quiet.
|
80
|
+
expect(default_config.quiet).to eq(false)
|
80
81
|
end
|
81
82
|
|
82
83
|
common_tests(:quiet)
|
@@ -84,7 +85,7 @@ describe 'Config' do
|
|
84
85
|
|
85
86
|
describe '#skip_package' do
|
86
87
|
it 'defaults to false' do
|
87
|
-
default_config.skip_package.
|
88
|
+
expect(default_config.skip_package).to eq(false)
|
88
89
|
end
|
89
90
|
|
90
91
|
common_tests(:skip_package)
|
@@ -92,7 +93,7 @@ describe 'Config' do
|
|
92
93
|
|
93
94
|
describe '#keep_destdir' do
|
94
95
|
it 'defaults to false' do
|
95
|
-
default_config.keep_destdir.
|
96
|
+
expect(default_config.keep_destdir).to eq(false)
|
96
97
|
end
|
97
98
|
|
98
99
|
common_tests(:keep_destdir)
|
@@ -100,20 +101,47 @@ describe 'Config' do
|
|
100
101
|
|
101
102
|
describe '#dependency_check' do
|
102
103
|
it 'defaults to false' do
|
103
|
-
default_config.dependency_check.
|
104
|
+
expect(default_config.dependency_check).to eq(true)
|
104
105
|
end
|
105
106
|
|
106
107
|
common_tests(:dependency_check)
|
107
108
|
end
|
108
109
|
|
110
|
+
describe '#tmp_root' do
|
111
|
+
it 'defaults to nil' do
|
112
|
+
expect(default_config.tmp_root).to be_nil
|
113
|
+
end
|
114
|
+
|
115
|
+
common_tests(:tmp_root)
|
116
|
+
end
|
117
|
+
|
118
|
+
describe '#pkg_dir' do
|
119
|
+
it 'defaults to nil' do
|
120
|
+
expect(default_config.pkg_dir).to be_nil
|
121
|
+
end
|
122
|
+
|
123
|
+
common_tests(:pkg_dir)
|
124
|
+
end
|
125
|
+
|
126
|
+
describe '#cache_dir' do
|
127
|
+
it 'defaults to nil' do
|
128
|
+
expect(default_config.cache_dir).to be_nil
|
129
|
+
end
|
130
|
+
|
131
|
+
common_tests(:cache_dir)
|
132
|
+
end
|
133
|
+
|
109
134
|
describe '#to_hash' do
|
110
135
|
it 'returns a hash representation of the object' do
|
111
|
-
default_config.to_hash.
|
136
|
+
expect(default_config.to_hash).to eq({
|
112
137
|
:color => true,
|
113
138
|
:debug => false,
|
114
139
|
:target => nil,
|
115
140
|
:platform => nil,
|
116
141
|
:maintainer => nil,
|
142
|
+
:tmp_root => nil,
|
143
|
+
:pkg_dir => nil,
|
144
|
+
:cache_dir => nil,
|
117
145
|
:vendor => nil,
|
118
146
|
:skip_package => false,
|
119
147
|
:keep_destdir => false,
|
@@ -127,7 +155,7 @@ describe 'Config' do
|
|
127
155
|
it 'raises an error' do
|
128
156
|
data[:__foo__] = true
|
129
157
|
|
130
|
-
|
158
|
+
expect { config }.to raise_error(FPM::Cookery::Error::InvalidConfigKey)
|
131
159
|
end
|
132
160
|
|
133
161
|
it 'adds the invalid keys' do
|
@@ -138,13 +166,13 @@ describe 'Config' do
|
|
138
166
|
begin; config; rescue => e; error = e; end
|
139
167
|
|
140
168
|
# Sort array for Ruby 1.8.7 compat.
|
141
|
-
error.invalid_keys.sort.
|
169
|
+
expect(error.invalid_keys.sort).to eq([:__bar__, :__foo__])
|
142
170
|
end
|
143
171
|
|
144
172
|
it 'works with strings' do
|
145
173
|
data['maintainer'] = 'John'
|
146
174
|
|
147
|
-
config.maintainer.
|
175
|
+
expect(config.maintainer).to eq('John')
|
148
176
|
end
|
149
177
|
end
|
150
178
|
|
@@ -159,7 +187,7 @@ describe 'Config' do
|
|
159
187
|
it 'loads first found file' do
|
160
188
|
config = FPM::Cookery::Config.load_file(paths)
|
161
189
|
|
162
|
-
config.maintainer.
|
190
|
+
expect(config.maintainer).to eq('John Doe <john@example.com>')
|
163
191
|
end
|
164
192
|
end
|
165
193
|
|
@@ -170,8 +198,8 @@ describe 'Config' do
|
|
170
198
|
|
171
199
|
config = FPM::Cookery::Config.from_cli(cli)
|
172
200
|
|
173
|
-
config.debug.
|
174
|
-
config.target.
|
201
|
+
expect(config.debug).to eq(true)
|
202
|
+
expect(config.target).to eq('rpm')
|
175
203
|
end
|
176
204
|
end
|
177
205
|
end
|
data/spec/facts_spec.rb
CHANGED
@@ -17,7 +17,7 @@ describe "Facts" do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it "is returns the current platform" do
|
20
|
-
FPM::Cookery::Facts.arch.
|
20
|
+
expect(FPM::Cookery::Facts.arch).to eq(:x86_64)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -31,12 +31,12 @@ describe "Facts" do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "is using Facter to autodetect the platform" do
|
34
|
-
FPM::Cookery::Facts.platform.
|
34
|
+
expect(FPM::Cookery::Facts.platform).to eq(:centos)
|
35
35
|
end
|
36
36
|
|
37
37
|
it "can be set" do
|
38
38
|
FPM::Cookery::Facts.platform = 'CentOS'
|
39
|
-
FPM::Cookery::Facts.platform.
|
39
|
+
expect(FPM::Cookery::Facts.platform).to eq(:centos)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -44,55 +44,55 @@ describe "Facts" do
|
|
44
44
|
describe "with platform CentOS" do
|
45
45
|
it "returns rpm" do
|
46
46
|
FPM::Cookery::Facts.platform = 'CentOS'
|
47
|
-
FPM::Cookery::Facts.target.
|
47
|
+
expect(FPM::Cookery::Facts.target).to eq(:rpm)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "with platform RedHat" do
|
52
52
|
it "returns rpm" do
|
53
53
|
FPM::Cookery::Facts.platform = 'RedHat'
|
54
|
-
FPM::Cookery::Facts.target.
|
54
|
+
expect(FPM::Cookery::Facts.target).to eq(:rpm)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
describe "with platform Fedora" do
|
59
59
|
it "returns rpm" do
|
60
60
|
FPM::Cookery::Facts.platform = 'Fedora'
|
61
|
-
FPM::Cookery::Facts.target.
|
61
|
+
expect(FPM::Cookery::Facts.target).to eq(:rpm)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
describe "with platform Debian" do
|
66
66
|
it "returns rpm" do
|
67
67
|
FPM::Cookery::Facts.platform = 'Debian'
|
68
|
-
FPM::Cookery::Facts.target.
|
68
|
+
expect(FPM::Cookery::Facts.target).to eq(:deb)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
describe "with platform Ubuntu" do
|
73
73
|
it "returns rpm" do
|
74
74
|
FPM::Cookery::Facts.platform = 'Ubuntu'
|
75
|
-
FPM::Cookery::Facts.target.
|
75
|
+
expect(FPM::Cookery::Facts.target).to eq(:deb)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
79
|
describe "with platform Darwin" do
|
80
80
|
it "returns osxpkg" do
|
81
81
|
FPM::Cookery::Facts.platform = 'Darwin'
|
82
|
-
FPM::Cookery::Facts.target.
|
82
|
+
expect(FPM::Cookery::Facts.target).to eq(:osxpkg)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
86
|
describe "with an unknown platform" do
|
87
87
|
it "returns nil" do
|
88
88
|
FPM::Cookery::Facts.platform = '___X___'
|
89
|
-
FPM::Cookery::Facts.target.
|
89
|
+
expect(FPM::Cookery::Facts.target).to eq(nil)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
it "can be set" do
|
94
94
|
FPM::Cookery::Facts.target = 'rpm'
|
95
|
-
FPM::Cookery::Facts.target.
|
95
|
+
expect(FPM::Cookery::Facts.target).to eq(:rpm)
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|