reagan 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c57ac3d0f9f3664186c3953f46f63821a921bcdb
4
- data.tar.gz: 6397367c982e95994c545d2bf3d79376c884da45
3
+ metadata.gz: 82b26aac734f61733db7108f0987c104cf5f00eb
4
+ data.tar.gz: 93867b5e5b4889286c1a38a910ef8d741fd7b1d6
5
5
  SHA512:
6
- metadata.gz: dec04d8ddf8f29d291b44309421309c65543dbd4dcab87172e1e3fd0628d8f146636eb87c0fb6240facaeeb7766f1bd1416bd62ad3b4c207f040c9b1893919ad
7
- data.tar.gz: 89376a9ddc021258cca2f2752fa81140cf7b372b72c778f2944eced0c06380bbe1c221c4600df9085459a0a6193b315f8af9fc3fc3310691c84813b5f5da3196
6
+ metadata.gz: 8c02e7bb3ddfa4d14fcde1a0c6d7ec34ea96cf70e43efcb74475d7625d7978e768a8c4d2d8915d06b053e0d1ca2cfd285de69cd1ce64f56be99124f334562314
7
+ data.tar.gz: b03136abd428f35af38207375daa2a30f05fd46009d6a12411dd2c3c73f5b8a3c6cedfeef14cf410fe3c4aa8bb866fbd42a033726630bcd7c3fad3724de40cb2
data/lib/reagan/config.rb CHANGED
@@ -96,7 +96,7 @@ module Reagan
96
96
 
97
97
  # make sure the config was properly loaded and contains the various keys we need
98
98
  def self::validate
99
- settings = Config.Settings
99
+ settings = Config.settings
100
100
 
101
101
  if settings == false
102
102
  puts "ERROR: Reagan config at #{cli_flags['config']} does not contain any configuration data".to_red
@@ -105,20 +105,14 @@ module Reagan
105
105
 
106
106
  # make sure a pull request is specified
107
107
  unless settings['flags']['pull']
108
- puts 'Jenkins ghprbPullId environmental variable not set or --pull option not used. Cannot continue'
108
+ puts 'Jenkins ghprbPullId environmental variable not set or --pull option not used. Cannot continue'.to_red
109
109
  exit 1
110
110
  end
111
111
 
112
- # if workstation not defined in the config file try to use the Jenkins workspace variable
113
- unless settings['jenkins'] && loaded_file['jenkins']['workspace_dir']
114
- workspace = ENV['WORKSPACE']
115
- if workspace
116
- settings['jenkins'] = {}
117
- settings['jenkins']['workspace_dir'] = workspace
118
- else
119
- puts 'Jenkins workspace_dir not defined in the config file and $WORKSPACE env variable empty. Exiting'.to_red
120
- exit
121
- end
112
+ # make sure either jenkins gave us a workspace variable or its defined in the config
113
+ unless ENV['WORKSPACE'] || (settings['jenkins'] && settings['jenkins']['workspace_dir'])
114
+ puts 'Jenkins workspace_dir not defined in the config file and $WORKSPACE env variable empty. Exiting'.to_red
115
+ exit 1
122
116
  end
123
117
  end
124
118
 
@@ -133,6 +127,12 @@ module Reagan
133
127
  config['flags']['pull'] = ENV['ghprbPullId']
134
128
  end
135
129
 
130
+ # merge in the jenkins workspace variable on top of the config file
131
+ if ENV['WORKSPACE']
132
+ config['jenkins'] = {} unless config['jenkins'] # create the higher level hash if it doesn't exist
133
+ config['jenkins']['workspace_dir'] = ENV['WORKSPACE']
134
+ end
135
+
136
136
  config
137
137
  end
138
138
  end
@@ -36,7 +36,7 @@ module Reagan
36
36
  rescue JSON::JSONError
37
37
  success = false
38
38
  end
39
- puts success ? 'PASS: JSON parses'.indent : 'FAIL: JSON does NOT parse'.indent
39
+ puts success ? 'PASS: JSON parses'.indent : 'FAIL: JSON does NOT parse'.indent.to_red
40
40
  success
41
41
  end
42
42
  end
@@ -30,7 +30,7 @@ module Reagan
30
30
  result = system "knife cookbook test -o #{File.join(Config.settings['jenkins']['workspace_dir'], 'cookbooks')} #{@cookbook} > /dev/null 2>&1"
31
31
 
32
32
  puts 'Running knife cookbook test:'
33
- puts result ? 'PASS: Knife cookbook test was successful'.indent : 'FAIL: Knife cookbookk test was NOT successful'.indent
33
+ puts result ? 'PASS: Knife cookbook test was successful'.indent : 'FAIL: Knife cookbookk test was NOT successful'.indent.to_red
34
34
  result
35
35
  end
36
36
  end
@@ -41,7 +41,7 @@ module Reagan
41
41
  result = system test
42
42
  status = false if result == false
43
43
  end
44
- puts status ? 'PASS: reagan_test.yml test was successful' : ' FAIL: reagan_test.yml test was NOT successful'.indent
44
+ puts status ? 'PASS: reagan_test.yml test was successful' : ' FAIL: reagan_test.yml test was NOT successful'.indent.to_red
45
45
  status
46
46
  else
47
47
  puts 'SKIP: No reagan_test.yml file found in the cookbook path. Skipping test'.indent
@@ -69,7 +69,7 @@ module Reagan
69
69
  puts "Running cookbook version rev'd test:"
70
70
  puts "Server version: #{serv_v}".indent
71
71
  puts "Commit version: #{commit_v}".indent
72
- puts updated ? "PASS: Metadata version has been rev'd".indent : "FAIL: Metadata version has NOT been rev'd".indent
72
+ puts updated ? "PASS: Metadata version has been rev'd".indent : "FAIL: Metadata version has NOT been rev'd".indent.to_red
73
73
  updated
74
74
  end
75
75
  end
data/lib/reagan.rb CHANGED
@@ -47,6 +47,7 @@ module Reagan
47
47
  # ensure output syncs to the console so jenkins can record it
48
48
  $stdout.sync = $stderr.sync = true
49
49
 
50
+ Config.validate
50
51
  check_print_config
51
52
  check_empty_update
52
53
 
data/reagan.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'reagan'
3
- s.version = '1.0.1'
3
+ s.version = '1.0.2'
4
4
  s.date = Date.today.to_s
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.extra_rdoc_files = ['README.md', 'LICENSE']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reagan
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Smith