singularity_dsl 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjIxMjE1MTRiOTY0ZDdiODRhOTYzMmY4NjFhNmEwN2M5NTkwNTI3NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTMzZThjMjc5NTA1MzlhY2IxM2NhYjEzMTRkZjdjMzk5MDViMWIyNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDYzOTU5NDgxNmNmMzFjNDY2ZGUyN2Q3ZjkxZGUxZmQzODRmYjI5Y2UyOTUy
|
10
|
+
ZDQ4MmM2YWQ0NDYxMWNkODAxM2JkZjViMDBmYzE5YTY4MmI5NjBiYjEwMzIw
|
11
|
+
N2YxMGU4ZDBkZDUwMzJmNzNkNDIzNTdlOWQzMjM1YzczZjY3ODY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDE1ZDUxNDYyOTc4MjdlMzEzNzBhMzI2NmFiZWJmOWUwOGUxODE1NDZmNDk2
|
14
|
+
Y2RiOThmOTQxOGU5ZDE1YTM1NzI0NzQ5N2M0NzA2YmI5NDYyNWU2N2ZjMjNm
|
15
|
+
MjY3NzA1NzczZWMyN2Q4MDYwNzFmOTE5MDM5NWY4NGFmNDkzMjA=
|
data/Gemfile.lock
CHANGED
@@ -23,6 +23,7 @@ module SingularityDsl
|
|
23
23
|
super
|
24
24
|
@diff_list = nil
|
25
25
|
@git = GitHelper.new
|
26
|
+
@git.verbosity options[:verbose]
|
26
27
|
env_vars(options[:env] || [])
|
27
28
|
end
|
28
29
|
|
@@ -43,6 +44,9 @@ module SingularityDsl
|
|
43
44
|
class_option :env,
|
44
45
|
type: :array,
|
45
46
|
desc: 'EnvVars to set, formatted as VAR:VAL'
|
47
|
+
class_option :verbose,
|
48
|
+
type: :boolean,
|
49
|
+
desc: 'Turn on verbose logging.'
|
46
50
|
class_option :flags,
|
47
51
|
type: :array,
|
48
52
|
desc: <<-EOD
|
@@ -1,14 +1,18 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require 'mixlib/shellout'
|
4
|
+
require 'singularity_dsl/stdout'
|
4
5
|
|
5
6
|
module SingularityDsl
|
6
7
|
# wrapper class for rugged
|
7
8
|
class GitHelper
|
8
|
-
|
9
|
+
include SingularityDsl::Stdout
|
10
|
+
|
11
|
+
attr_reader :dir, :verbose
|
9
12
|
|
10
13
|
def initialize
|
11
14
|
throw 'git not installed' unless git_installed
|
15
|
+
@verbose = false
|
12
16
|
end
|
13
17
|
|
14
18
|
def clean_reset
|
@@ -37,7 +41,7 @@ module SingularityDsl
|
|
37
41
|
|
38
42
|
def add_remote(url)
|
39
43
|
remote = remote_from_url url
|
40
|
-
exec("git remote add #{remote} #{url}")
|
44
|
+
exec("git remote add #{remote} #{url}") if url
|
41
45
|
fetch_all
|
42
46
|
end
|
43
47
|
|
@@ -56,6 +60,11 @@ module SingularityDsl
|
|
56
60
|
install_submodules
|
57
61
|
end
|
58
62
|
|
63
|
+
def verbosity(level)
|
64
|
+
@verbose = level.is_a?(Fixnum) && level > 0
|
65
|
+
@verbose = level if level.is_a? TrueClass
|
66
|
+
end
|
67
|
+
|
59
68
|
private
|
60
69
|
|
61
70
|
def remote_cmd(branch, url, action)
|
@@ -100,6 +109,10 @@ module SingularityDsl
|
|
100
109
|
|
101
110
|
def exec(cmd)
|
102
111
|
task = Mixlib::ShellOut.new cmd
|
112
|
+
if @verbose
|
113
|
+
info cmd
|
114
|
+
task.live_stream = STDOUT
|
115
|
+
end
|
103
116
|
task.run_command
|
104
117
|
task.exitstatus
|
105
118
|
end
|
@@ -11,6 +11,10 @@ describe 'GitHelper' do
|
|
11
11
|
let(:git) { SingularityDsl::GitHelper.new }
|
12
12
|
|
13
13
|
context '#initialize' do
|
14
|
+
it 'sets verbose off' do
|
15
|
+
expect(git.verbose).to eql false
|
16
|
+
end
|
17
|
+
|
14
18
|
it 'throws if git is not installed' do
|
15
19
|
allow_any_instance_of(SingularityDsl::GitHelper)
|
16
20
|
.to receive(:git_installed)
|
@@ -20,6 +24,28 @@ describe 'GitHelper' do
|
|
20
24
|
end
|
21
25
|
end
|
22
26
|
|
27
|
+
context '#verbosity' do
|
28
|
+
it 'sets verbose to true when number > 0 given' do
|
29
|
+
git.verbosity 1
|
30
|
+
expect(git.verbose).to eql true
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'sets verbose to true when true given' do
|
34
|
+
git.verbosity true
|
35
|
+
expect(git.verbose).to eql true
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'sets verbose to false when number == 0 given' do
|
39
|
+
git.verbosity 0
|
40
|
+
expect(git.verbose).to eql false
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'sets verbose to false when non-Fixnum given' do
|
44
|
+
git.verbosity 'wat'
|
45
|
+
expect(git.verbose).to eql false
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
23
49
|
context '#clean_reset' do
|
24
50
|
it 'fails when reset fails' do
|
25
51
|
allow(git).to receive(:reset).and_return(1)
|