fpm-cookery 0.16.1 → 0.16.2
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# v0.16.2 (2013-10-19)
|
2
|
+
* Add support for submodules in git provider. (narkisr / #50)
|
3
|
+
* Set a default maintainer.
|
4
|
+
* Fix problems with setting epoch. (#51)
|
5
|
+
|
1
6
|
# v0.16.1 (2013-09-26)
|
2
7
|
* Unbreak package building with broken symlinks.
|
3
8
|
* Do not fail if git is not installed.
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'fpm/cookery/shellout'
|
2
|
+
require 'socket'
|
2
3
|
|
3
4
|
module FPM
|
4
5
|
module Cookery
|
5
6
|
module Package
|
6
7
|
class Maintainer < Struct.new(:recipe, :config)
|
7
8
|
def maintainer
|
8
|
-
config_maintainer || recipe_maintainer || git_maintainer
|
9
|
+
config_maintainer || recipe_maintainer || git_maintainer || default_maintainer
|
9
10
|
end
|
10
11
|
|
11
12
|
def to_s
|
@@ -37,6 +38,10 @@ module FPM
|
|
37
38
|
def git_config(key)
|
38
39
|
FPM::Cookery::Shellout.git_config_get(key)
|
39
40
|
end
|
41
|
+
|
42
|
+
def default_maintainer
|
43
|
+
"<#{ENV['USER']}@#{Socket.gethostname}>"
|
44
|
+
end
|
40
45
|
end
|
41
46
|
end
|
42
47
|
end
|
data/lib/fpm/cookery/path.rb
CHANGED
@@ -62,6 +62,9 @@ module FPM
|
|
62
62
|
raise "#{src} does not exist" unless File.symlink? src or File.exist? src
|
63
63
|
|
64
64
|
mkpath
|
65
|
+
|
66
|
+
# We used to use :preserve => true here, but that broke package
|
67
|
+
# building when the file tree contains broken symlinks.
|
65
68
|
FileUtils.cp_r src, dst
|
66
69
|
|
67
70
|
# if File.symlink? src
|
@@ -24,6 +24,9 @@ module FPM
|
|
24
24
|
Dir.chdir(cachedir) do
|
25
25
|
git('clone', url, local_path)
|
26
26
|
end
|
27
|
+
Dir.chdir(local_path) do
|
28
|
+
git('submodule', 'update', '--init') if options[:submodule]
|
29
|
+
end
|
27
30
|
end
|
28
31
|
|
29
32
|
local_path
|
@@ -49,6 +52,10 @@ module FPM
|
|
49
52
|
|
50
53
|
# Trailing '/' is important! (see git-checkout-index(1))
|
51
54
|
git('checkout-index', '-a', '-f', "--prefix=#{extracted_source}/")
|
55
|
+
|
56
|
+
if options[:submodule]
|
57
|
+
git('submodule', 'foreach', "mkdir -p #{extracted_source}/$path && cp -r . #{extracted_source}/$path")
|
58
|
+
end
|
52
59
|
end
|
53
60
|
|
54
61
|
extracted_source
|
data/lib/fpm/cookery/version.rb
CHANGED
@@ -10,8 +10,10 @@ describe 'Maintainer' do
|
|
10
10
|
|
11
11
|
let(:maintainer) { klass.new(recipe, config) }
|
12
12
|
|
13
|
-
def with_shellout_stub(&spec)
|
13
|
+
def with_shellout_stub(opts = {}, &spec)
|
14
14
|
callable = lambda do |key|
|
15
|
+
return if opts[:nil]
|
16
|
+
|
15
17
|
case key
|
16
18
|
when 'user.name'
|
17
19
|
'John Doe'
|
@@ -25,6 +27,16 @@ describe 'Maintainer' do
|
|
25
27
|
FPM::Cookery::Shellout.stub(:git_config_get, callable, &spec)
|
26
28
|
end
|
27
29
|
|
30
|
+
def with_env_stub(env)
|
31
|
+
old_env = ENV.to_hash
|
32
|
+
env.each do |key, value|
|
33
|
+
ENV[key] = value
|
34
|
+
end
|
35
|
+
yield
|
36
|
+
ensure
|
37
|
+
ENV.replace(old_env)
|
38
|
+
end
|
39
|
+
|
28
40
|
describe '#to_s' do
|
29
41
|
context 'with maintainer set in recipe' do
|
30
42
|
it 'returns the recipe maintainer' do
|
@@ -63,7 +75,18 @@ describe 'Maintainer' do
|
|
63
75
|
maintainer.to_s.must_equal 'John Doe <john@example.com>'
|
64
76
|
end
|
65
77
|
end
|
78
|
+
end
|
66
79
|
|
80
|
+
context 'without valid git data' do
|
81
|
+
it 'returns a default maintainer' do
|
82
|
+
Socket.stub(:gethostname, lambda { 'hostname' }) do
|
83
|
+
with_shellout_stub(:nil => true) do
|
84
|
+
with_env_stub('USER' => 'john') do
|
85
|
+
maintainer.to_s.must_equal '<john@hostname>'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
67
90
|
end
|
68
91
|
end
|
69
92
|
|
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.16.
|
4
|
+
version: 0.16.2
|
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: 2013-
|
12
|
+
date: 2013-10-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -238,7 +238,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
238
238
|
version: '0'
|
239
239
|
segments:
|
240
240
|
- 0
|
241
|
-
hash:
|
241
|
+
hash: 2714022872265180185
|
242
242
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
243
|
none: false
|
244
244
|
requirements:
|
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
247
|
version: '0'
|
248
248
|
segments:
|
249
249
|
- 0
|
250
|
-
hash:
|
250
|
+
hash: 2714022872265180185
|
251
251
|
requirements: []
|
252
252
|
rubyforge_project: fpm-cookery
|
253
253
|
rubygems_version: 1.8.25
|