File tree 7 files changed +98
-11
lines changed
7 files changed +98
-11
lines changed Original file line number Diff line number Diff line change 1
1
/.bundle /
2
2
/.yardoc
3
- /Gemfile.lock
4
3
/_yardoc /
5
4
/coverage /
6
5
/doc /
7
6
/pkg /
8
7
/spec /reports /
9
8
/tmp /
9
+ /vendor /
Original file line number Diff line number Diff line change 1
1
gemspec
2
2
source 'https://rubygems.org' do
3
- gem 'rake '
3
+ gem 'sensu-plugin '
4
4
group :development do
5
5
gem 'rubocop'
6
6
gem 'rspec'
7
7
gem 'coveralls'
8
+ gem 'bundler' , '~> 1.11'
9
+ gem 'rake' , '~> 10.0'
8
10
end
9
11
group :docs do
10
12
gem 'yard'
Original file line number Diff line number Diff line change
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ puppetfiles (0.1.0 )
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.3.0 )
10
+ coveralls (0.8.13 )
11
+ json (~> 1.8 )
12
+ simplecov (~> 0.11.0 )
13
+ term-ansicolor (~> 1.3 )
14
+ thor (~> 0.19.1 )
15
+ tins (~> 1.6.0 )
16
+ diff-lcs (1.2.5 )
17
+ docile (1.1.5 )
18
+ json (1.8.3 )
19
+ mixlib-cli (1.6.0 )
20
+ parser (2.3.1.2 )
21
+ ast (~> 2.2 )
22
+ powerpack (0.1.1 )
23
+ rainbow (2.1.0 )
24
+ rake (10.5.0 )
25
+ rspec (3.4.0 )
26
+ rspec-core (~> 3.4.0 )
27
+ rspec-expectations (~> 3.4.0 )
28
+ rspec-mocks (~> 3.4.0 )
29
+ rspec-core (3.4.4 )
30
+ rspec-support (~> 3.4.0 )
31
+ rspec-expectations (3.4.0 )
32
+ diff-lcs (>= 1.2.0 , < 2.0 )
33
+ rspec-support (~> 3.4.0 )
34
+ rspec-mocks (3.4.1 )
35
+ diff-lcs (>= 1.2.0 , < 2.0 )
36
+ rspec-support (~> 3.4.0 )
37
+ rspec-support (3.4.1 )
38
+ rubocop (0.40.0 )
39
+ parser (>= 2.3.1.0 , < 3.0 )
40
+ powerpack (~> 0.1 )
41
+ rainbow (>= 1.99.1 , < 3.0 )
42
+ ruby-progressbar (~> 1.7 )
43
+ unicode-display_width (~> 1.0 , >= 1.0.1 )
44
+ ruby-progressbar (1.8.1 )
45
+ sensu-plugin (1.3.0 )
46
+ json
47
+ mixlib-cli (>= 1.5.0 )
48
+ simplecov (0.11.2 )
49
+ docile (~> 1.1.0 )
50
+ json (~> 1.8 )
51
+ simplecov-html (~> 0.10.0 )
52
+ simplecov-html (0.10.0 )
53
+ term-ansicolor (1.3.2 )
54
+ tins (~> 1.0 )
55
+ thor (0.19.1 )
56
+ tins (1.6.0 )
57
+ unicode-display_width (1.1.0 )
58
+ yard (0.8.7.6 )
59
+
60
+ PLATFORMS
61
+ ruby
62
+
63
+ DEPENDENCIES
64
+ bundler (~> 1.11 )!
65
+ coveralls !
66
+ puppetfiles !
67
+ rake (~> 10.0 )!
68
+ rspec !
69
+ rubocop !
70
+ sensu-plugin !
71
+ yard !
72
+
73
+ BUNDLED WITH
74
+ 1.12.5
Original file line number Diff line number Diff line change 1
- # rubocop:disable Style/FileName
1
+ #!ruby
2
2
# @author Luca De Vitis <luca.devitis at moneysupermarket.com>
3
3
require 'sensu-plugin/check/cli'
4
4
require 'puppetfiles/bin/update_module'
@@ -23,4 +23,18 @@ class PuppetfilesUpdateModule < Sensu::Plugin::CLI
23
23
long : '--set-option-ref REF' ,
24
24
description : 'Set module git ref string' ,
25
25
required : false
26
+
27
+ option :help ,
28
+ long : '--help' ,
29
+ description : 'Show this message' ,
30
+ on : :tail ,
31
+ boolean : true ,
32
+ show_options : true ,
33
+ exit : 0
34
+ def output ( *args )
35
+ puts "#{ self . class . name } : " + args . join ( ' ' )
36
+ end
37
+ def run
38
+ main
39
+ end
26
40
end
Original file line number Diff line number Diff line change @@ -9,18 +9,18 @@ module Bin
9
9
# Update 1 module details in all provided puppetfiles that contain it
10
10
module UpdateModule
11
11
# Run the module update
12
- def run
12
+ def main
13
13
mod = argv . first
14
14
files = argv . drop ( 1 )
15
15
version = config [ :version ]
16
16
keys = [ :git , :ref ]
17
17
options = keys . map { |k | [ k , config [ k ] ] if config [ k ] } . compact . to_h
18
18
::Puppetfiles . load files
19
19
::Puppetfiles . update mod , version , options
20
- loaded = ::Puppetfiles . loaded . count
20
+ count = ::Puppetfiles . loaded . count
21
21
updated = ::Puppetfiles . loaded . count
22
22
::Puppetfiles . save
23
- ok "#{ loaded } Puppetfiles, `#{ mod } ' updated on #{ updated } "
23
+ ok "#{ count } Puppetfiles loaded , `#{ mod } ' updated on #{ updated } "
24
24
end
25
25
end
26
26
end
Original file line number Diff line number Diff line change @@ -24,7 +24,4 @@ Gem::Specification.new do |spec|
24
24
spec . bindir = 'bin'
25
25
spec . executables = spec . files . grep ( %r{^bin/} ) { |f | File . basename ( f ) }
26
26
spec . require_paths = [ 'lib' ]
27
-
28
- spec . add_development_dependency 'bundler' , '~> 1.11'
29
- spec . add_development_dependency 'rake' , '~> 10.0'
30
27
end
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ def output(msg = nil)
45
45
UpdateModule . new ( [ mod1 [ :name ] , puppetfile . path ] , version : value )
46
46
end
47
47
it 'should update module version' do
48
- expect { script . run } . to raise_error ( SystemExit )
48
+ expect { script . main } . to raise_error ( SystemExit )
49
49
expect ( script . status ) . to eq ( 0 )
50
50
loaded = ::Puppetfiles . load [ puppetfile . path ]
51
51
found = loaded . first [ :modules ] . find { |m | m [ :name ] == mod1 [ :name ] }
@@ -59,7 +59,7 @@ def output(msg = nil)
59
59
UpdateModule . new ( [ mod2 [ :name ] , puppetfile . path ] , name => value )
60
60
end
61
61
it "should update module option `:#{ name } `" do
62
- expect { script . run } . to raise_error ( SystemExit )
62
+ expect { script . main } . to raise_error ( SystemExit )
63
63
expect ( script . status ) . to eq ( 0 )
64
64
loaded = ::Puppetfiles . load [ puppetfile . path ]
65
65
found = loaded . first [ :modules ] . find { |m | m [ :name ] == mod2 [ :name ] }
You can’t perform that action at this time.
0 commit comments