comrad 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: 65b0763c5febe700ed75a932c1c2dacb44a772c3
4
- data.tar.gz: a5ad52ae173ec08e29a99ce89097eac72ca24a9a
3
+ metadata.gz: 8a9a22acd9b3c8b83814572541f1e01776bfb441
4
+ data.tar.gz: 0f8a3aa36c336afe154cbde1d6975465f5090792
5
5
  SHA512:
6
- metadata.gz: df39545a8e9c536d2d0f33fcaf1bd6e878ca4888f8d733bab7b4626c805cdc795262a87f0ec8dbd866d4c8753334d1b6b895db4a97715caad0dbe3d3e3ee0a97
7
- data.tar.gz: ebf5185b313fb5cacc3591364ef97b5d2fc7b9b8e390142205605df47a9ca22f67f2f2ce4aad9288571ea1da5e41ba3fe5875b265ecc5059a5f6327c1babfc9b
6
+ metadata.gz: fbbdf600e995f32a28a2d6833bfcb2a5995774c4784cdc0f74e2812d4e262543ec182dadb4a2903a02d19cb646b2c4a9e42f270a0e5b40e33cd478e74c6917b4
7
+ data.tar.gz: 3bdb338f840f62f4d1b0f4c68b94f2b3eb188e2f097e615d42895e313d56c5d8c840573a1052892704f39d16cff1bff7f4c347747a0a000e48a92bef11beb9b2
@@ -1,24 +1,12 @@
1
- AllCops:
2
- Exclude:
3
- - vendor/**
4
-
5
- AlignParameters:
6
- Enabled: false
7
- CyclomaticComplexity:
8
- Enabled: false
9
- Encoding:
10
- Enabled: false
11
- HashSyntax:
1
+ AbcSize:
12
2
  Enabled: false
13
- LineLength:
3
+
4
+ Documentation:
14
5
  Enabled: false
6
+
15
7
  MethodLength:
16
8
  Enabled: false
17
- Metrics/AbcSize:
18
- Enabled: false
19
- NumericLiterals:
20
- Enabled: false
21
- SingleSpaceBeforeFirstArg:
22
- Enabled: false
23
- PerceivedComplexity:
9
+
10
+ LineLength:
24
11
  Enabled: false
12
+
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'comrad'
3
- s.version = '0.1.2'
3
+ s.version = '0.1.3'
4
4
  s.date = Date.today.to_s
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.extra_rdoc_files = ['README.md', 'LICENSE']
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.add_dependency 'chef', '>= 11.0'
17
17
  s.add_dependency 'slack-post', '~> 0.3', '>= 0.3.1'
18
18
  s.add_development_dependency 'rake', '~> 10.0'
19
- s.add_development_dependency 'rubocop', '~> 0.30.0'
19
+ s.add_development_dependency 'rubocop', '~> 0.32.0'
20
20
 
21
21
  s.files = `git ls-files -z`.split("\x0")
22
22
  s.executables = s.name
@@ -42,7 +42,7 @@ module Comrad
42
42
  # fetch build data using Jenkins API
43
43
  def self::fetch_build_data
44
44
  j = Config.config['jenkins']
45
- url = j['url'] + '/job/' + j['job_name'] + '/' + ENV['BUILD_NUMBER'] + '/api/json?'
45
+ url = j['url'] + '/job/' + j['job_name'] + '/' + Config.config['buildnum'] + '/api/json?'
46
46
  conn = RestClient::Resource.new(url, j['username'], j['password'])
47
47
  JSON.parse(conn.get)
48
48
  end
@@ -42,19 +42,17 @@ module Comrad
42
42
  end
43
43
  end
44
44
 
45
- # make sure the BUILD_NUMBER Jenkins variable exists. If not force help
46
- def self::check_jenkins_env_variable
47
- if ENV['BUILD_NUMBER'].nil?
48
- puts "Jenkins set BUILD_NUMBER environmental variable not set. Cannot continue.\n\n"
49
- ARGV[0] = '-h'
45
+ # make sure we have a build number
46
+ def self::validate_config(conf)
47
+ if conf['buildnum'].nil?
48
+ puts "Jenkins set BUILD_NUMBER environmental variable not set, and Comrad --buildnum CLI flag not used. Cannot continue without a build number.\n\n"
49
+ exit!
50
50
  end
51
51
  end
52
52
 
53
53
  # grabs the flags passed in via command line
54
54
  def self::parse_flags
55
- check_jenkins_env_variable
56
-
57
- flags = { config: '/etc/comrad.yml', print_config: false, quiet: false }
55
+ flags = { config: '/etc/comrad.yml', print_config: false, quiet: false, buildnum: ENV['BUILD_NUMBER'] }
58
56
  OptionParser.new do |opts|
59
57
  opts.banner = 'Usage: comrad [options]'
60
58
 
@@ -78,6 +76,10 @@ module Comrad
78
76
  flags[:scary] = scary
79
77
  end
80
78
 
79
+ opts.on('-b', '--build-num 123', 'Run comrad against a particular Jenkins build for testing') do |build|
80
+ flags[:buildnum] = build
81
+ end
82
+
81
83
  opts.on('-h', '--help', 'Displays Help') do
82
84
  puts opts
83
85
  exit
@@ -108,6 +110,10 @@ module Comrad
108
110
  config = file_config.dup
109
111
  config['flags'] = {}
110
112
  flags_config.each { |k, v| config['flags'][k.to_s] = v }
113
+
114
+ # massage in either the buildnum CLI flag or the Jenkins provided ENV variable
115
+ config['buildnum'] = config['flags']['buildnum']
116
+ validate_config(config)
111
117
  config
112
118
  end
113
119
  end
metadata CHANGED
@@ -1,91 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comrad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-27 00:00:00.000000000 Z
11
+ date: 2015-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '11.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '11.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: slack-post
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.3'
48
- - - '>='
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: 0.3.1
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - ~>
55
+ - - "~>"
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0.3'
58
- - - '>='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: 0.3.1
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rake
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ~>
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '10.0'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ~>
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '10.0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rubocop
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ~>
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 0.30.0
81
+ version: 0.32.0
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ~>
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 0.30.0
88
+ version: 0.32.0
89
89
  description: Your rad comrade - Sync changes from git to Chef Server via Jenkins
90
90
  email: tim@cozy.co
91
91
  executables:
@@ -94,9 +94,9 @@ extensions: []
94
94
  extra_rdoc_files:
95
95
  - README.md
96
96
  files:
97
- - .gitignore
98
- - .rubocop.yml
99
- - .travis.yml
97
+ - ".gitignore"
98
+ - ".rubocop.yml"
99
+ - ".travis.yml"
100
100
  - Gemfile
101
101
  - LICENSE
102
102
  - README.md
@@ -116,27 +116,27 @@ licenses:
116
116
  metadata: {}
117
117
  post_install_message:
118
118
  rdoc_options:
119
- - --line-numbers
120
- - --inline-source
121
- - --title
119
+ - "--line-numbers"
120
+ - "--inline-source"
121
+ - "--title"
122
122
  - comrad
123
- - --main
123
+ - "--main"
124
124
  - README.md
125
125
  require_paths:
126
126
  - lib
127
127
  required_ruby_version: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: 1.9.3
132
132
  required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - '>='
134
+ - - ">="
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  requirements: []
138
138
  rubyforge_project:
139
- rubygems_version: 2.4.2
139
+ rubygems_version: 2.4.5
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Your rad comrade - Sync changes from git to Chef Server via Jenkins