jujube 0.11.0 → 0.12.0

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: 2a93daba9cc8d6302ae5cf0df9ade6a415405804
4
- data.tar.gz: a2a5390ec3062f5016d78c3d8b9d539ce679d8be
3
+ metadata.gz: d1899d2c440e2e60202c88f29a5d90aaa45777aa
4
+ data.tar.gz: 25b2892d7bccb5b856025e826fac787dd917527f
5
5
  SHA512:
6
- metadata.gz: 184ac4698dafbd082ad8cdd17e47554f7f179fb7936b39875e635348179eabf08c843f45ad18e31e27e56e04f3f424d920530ccbf064f47c99a5dbb9d1abbe1f
7
- data.tar.gz: 9b410b8795b126e6ab4c73317f612aef264af70acd5cf44ad04b978903327f01ff1307180b1d97bcf62b6827d6e89d1eacee18c8f25cb8b7895ec55b5c681f9f
6
+ metadata.gz: ace24b0117da72efc6548ff513a3eec219cfaca63a623287f05644f83c74e69afba1bec1a0196c2e0504e5b2763c065f9b42d6875fcc41d64b75a0e1216281d3
7
+ data.tar.gz: 0676524d33bd24cfad3bc54338cb29ec2a8b7a4d0bfc8dd8ca6f4793dcb3bf14218abcd24e29552ee82217144aee9c6e5de78a4d7f19ac14fac7d7616a58dc16
data/.travis.yml CHANGED
@@ -9,6 +9,7 @@ rvm:
9
9
  - rbx-2
10
10
  matrix:
11
11
  allow_failures:
12
- - jruby-9
13
- - jruby-head
12
+ - rvm: jruby-9
13
+ - rvm: jruby-head
14
+ fast_finish: true
14
15
  script: "bundle exec rake"
data/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased][unreleased]
7
7
 
8
+ ## [0.12.0][0.12.0]
9
+
10
+ ### Added
11
+
12
+ * Support the `string` parameter (see http://docs.openstack.org/infra/jenkins-job-builder/parameters.html#parameters.string) ([#3](https://github.com/randycoulman/jujube/pull/3)) (@jgeysens)
13
+ * Support Rake 11.x versions ([#4](https://github.com/randycoulman/jujube/pull/4))
14
+ * Support the `validating_string` parameter (see http://docs.openstack.org/infra/jenkins-job-builder/parameters.html#parameters.validating-string) ([#7](https://github.com/randycoulman/jujube/pull/7))
15
+ * Support the `trigger_parameterized_builds` publisher (see http://docs.openstack.org/infra/jenkins-job-builder/publishers.html#publishers.trigger-parameterized-builds) ([#9](https://github.com/randycoulman/jujube/pull/9))
16
+
8
17
  ## [0.11.0][0.11.0]
9
18
 
10
19
  ### Breaking Changes
@@ -25,7 +34,7 @@ adheres to [Semantic Versioning](http://semver.org/).
25
34
 
26
35
  ### Added
27
36
 
28
- * Support the `priority_sorter` property. (see http://docs.openstack.org/infra/jenkins-job-builder/properties.html#properties.priority-sorter).
37
+ * Support the `priority_sorter` property (see http://docs.openstack.org/infra/jenkins-job-builder/properties.html#properties.priority-sorter).
29
38
  * Links to documentation for the `fitnesse` publisher and `store` SCM that have now been merged into jenkins-job-builder.
30
39
  * This CHANGELOG.
31
40
 
@@ -70,7 +79,8 @@ adheres to [Semantic Versioning](http://semver.org/).
70
79
 
71
80
  * Initial public release.
72
81
 
73
- [unreleased]: https://github.com/randycoulman/jujube/compare/v0.11.0...HEAD
82
+ [unreleased]: https://github.com/randycoulman/jujube/compare/v0.12.0...HEAD
83
+ [0.12.0]: https://github.com/randycoulman/jujube/compare/v0.11.0...v0.12.0
74
84
  [0.11.0]: https://github.com/randycoulman/jujube/compare/v0.10.0...v0.11.0
75
85
  [0.10.0]: https://github.com/randycoulman/jujube/compare/v0.9.0...v0.10.0
76
86
  [0.9.0]: https://github.com/randycoulman/jujube/compare/v0.8.0...v0.9.0
data/README.md CHANGED
@@ -94,7 +94,6 @@ end
94
94
 
95
95
  The following job attributes are supported:
96
96
 
97
- * `description`
98
97
  * `project_type` -- doesn't normally need to be specified. If any `axes` are added to the
99
98
  job, then `project_type` is automatically inferred to be `matrix`
100
99
  * `description`
@@ -107,13 +106,14 @@ The following job attributes are supported:
107
106
  The following sections and components are supported:
108
107
 
109
108
  * `axes`: (`label_expression`, `slave`)
109
+ * `parameters`: (`string`, `validating_string`)
110
110
  * `properties`: (`throttle`)
111
111
  * `scm`: (`git`, `store`)
112
112
  * `triggers`: (`pollscm`, `pollurl`, `reverse`)
113
113
  * `wrappers`: (`timeout`, `timestamps`)
114
114
  * `builders`: (`shell`)
115
115
  * `publishers`: (`archive`, `cppcheck`, `email_ext`, `fitnesse`, `ircbot`, `junit`,
116
- `trigger`, `unittest`, `xunit`)
116
+ `trigger`, `trigger_parameterized_builds`, `unittest`, `xunit`)
117
117
  * `notifications`: None defined yet
118
118
 
119
119
  See [the end-to-end example job](examples/fixtures/endToEnd/endToEnd.job) for example
@@ -8,11 +8,18 @@ job "endToEnd" do |j|
8
8
 
9
9
  j.axes << slave(:arch, %w{i386 amd64})
10
10
 
11
+ j.parameters << string(name: "STRING_PARAM", default: "DEFAULT VALUE", description: "DESCRIPTION")
12
+ j.parameters << validating_string(name: "VALIDATING",
13
+ default: "DEFAULT",
14
+ description: "DESCRIPTION",
15
+ regex: "REGEX",
16
+ msg: "MESSAGE")
17
+
18
+ j.properties << priority_sorter(priority: 150)
11
19
  j.properties << throttle(max_per_node: 2,
12
20
  max_total: 4,
13
21
  option: "category",
14
22
  categories: %w{CAT1 CAT2})
15
- j.properties << priority_sorter(priority: 150)
16
23
 
17
24
  j.scm << git(url: "URL", branches: %w{master dev}, wipe_workspace: false)
18
25
  j.scm << store(script: "SCRIPT",
@@ -53,6 +60,29 @@ job "endToEnd" do |j|
53
60
  j.publishers << ircbot(notify_start: true)
54
61
  j.publishers << junit(results: "RESULTS", keep_long_stdio: false)
55
62
  j.publishers << trigger(project: "PROJECT")
63
+ j.publishers << trigger_parameterized_builds do |builds|
64
+ builds << build(project: %w[PROJECT1 PROJECT2],
65
+ predefined_parameters: { param1: "VALUE1", param2: "VALUE2" },
66
+ current_parameters: true,
67
+ node_parameters: false,
68
+ svn_revision: true,
69
+ include_upstream: false,
70
+ git_revision: { combine_queued_commits: true },
71
+ boolean_parameters: { bool1: true, bool2: false },
72
+ condition: "FAILED_OR_BETTER",
73
+ property_file: "FILE.properties",
74
+ fail_on_missing: true,
75
+ use_matrix_child_files: false,
76
+ only_exact_matrix_child_runs: true,
77
+ file_encoding: "UTF-8",
78
+ trigger_with_no_params: false,
79
+ restrict_matrix_project: 'label=="x86"',
80
+ node_label_name: "LABEL_NAME",
81
+ node_label: "LABEL")
82
+ builds << build(project: "SINGLE_PROJECT",
83
+ predefined_parameters: { param: "VALUE" },
84
+ git_revision: true)
85
+ end
56
86
  j.publishers << xunit do |types|
57
87
  types << unittest(pattern: "PATTERN", deleteoutput: false)
58
88
  end
@@ -15,7 +15,20 @@
15
15
  values:
16
16
  - i386
17
17
  - amd64
18
+ parameters:
19
+ - string:
20
+ name: STRING_PARAM
21
+ default: "DEFAULT VALUE"
22
+ description: DESCRIPTION
23
+ - validating-string:
24
+ name: VALIDATING
25
+ default: DEFAULT
26
+ description: DESCRIPTION
27
+ regex: REGEX
28
+ msg: MESSAGE
18
29
  properties:
30
+ - priority-sorter:
31
+ priority: 150
19
32
  - throttle:
20
33
  max-per-node: 2
21
34
  max-total: 4
@@ -23,8 +36,6 @@
23
36
  categories:
24
37
  - CAT1
25
38
  - CAT2
26
- - priority-sorter:
27
- priority: 150
28
39
  scm:
29
40
  - git:
30
41
  url: URL
@@ -100,6 +111,35 @@
100
111
  keep-long-stdio: false
101
112
  - trigger:
102
113
  project: PROJECT
114
+ - trigger-parameterized-builds:
115
+ - project:
116
+ - PROJECT1
117
+ - PROJECT2
118
+ predefined-parameters: |
119
+ param1=VALUE1
120
+ param2=VALUE2
121
+ current-parameters: true
122
+ node-parameters: false
123
+ svn-revision: true
124
+ include-upstream: false
125
+ git-revision:
126
+ combine-queued-commits: true
127
+ boolean-parameters:
128
+ bool1: true
129
+ bool2: false
130
+ condition: FAILED_OR_BETTER
131
+ property-file: FILE.properties
132
+ fail-on-missing: true
133
+ use-matrix-child-files: false
134
+ only-exact-matrix-child-runs: true
135
+ file-encoding: UTF-8
136
+ trigger-with-no-params: false
137
+ restrict-matrix-project: label=="x86"
138
+ node-label-name: LABEL_NAME
139
+ node-label: LABEL
140
+ - project: SINGLE_PROJECT
141
+ predefined-parameters: param=VALUE
142
+ git-revision: true
103
143
  - xunit:
104
144
  types:
105
145
  - unittest:
@@ -26,11 +26,11 @@ class AcceptanceTest < Minitest::Test
26
26
  end
27
27
 
28
28
  def assert_file_exists(filename)
29
- assert(File.exists?(filename), "File #{filename} does not exist")
29
+ assert(File.exist?(filename), "File #{filename} does not exist")
30
30
  end
31
31
 
32
32
  def assert_directory_exists(filename)
33
- assert(Dir.exists?(filename), "Directory #{filename} does not exist")
33
+ assert(Dir.exist?(filename), "Directory #{filename} does not exist")
34
34
  end
35
35
 
36
36
  def fixture_root
data/jujube.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'jujube/version'
4
+ require "jujube/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "jujube"
@@ -22,7 +22,7 @@ EOF
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
25
- spec.add_development_dependency "rake", "~> 10.1"
25
+ spec.add_development_dependency "rake", ">= 10.1", "< 12"
26
26
  spec.add_development_dependency "minitest", "~> 5.3"
27
27
  spec.add_development_dependency "flexmock", "~> 2.0"
28
28
  spec.add_development_dependency "yard", "~>0.8.7"
@@ -1,5 +1,6 @@
1
1
  require_relative "components/macros"
2
2
  require_relative "components/helpers"
3
+ require_relative "components/axes"
3
4
  require_relative "components/parameters"
4
5
  require_relative "components/properties"
5
6
  require_relative "components/scm"
@@ -13,6 +14,7 @@ module Jujube
13
14
  # Helper methods for creating jenkins-job-builder components.
14
15
  module Components
15
16
  include Helpers
17
+ include Axes
16
18
  include Parameters
17
19
  include Properties
18
20
  include Scm
@@ -0,0 +1,46 @@
1
+ module Jujube
2
+ module Components
3
+
4
+ # Helper methods for creating matrix axes components.
5
+ module Axes
6
+ extend Macros
7
+
8
+ # Specify a `label-expression` axis for a matrix job.
9
+ #
10
+ # See {http://docs.openstack.org/infra/jenkins-job-builder/project_matrix.html}.
11
+ #
12
+ # @param name [Symbol, String] The name of the axis.
13
+ # @param values [Array<String>] The values of the axis.
14
+ # @return [Hash] The specification for the axis.
15
+ def label_expression(name, values)
16
+ axis(name, values, :label_expression)
17
+ end
18
+
19
+ # Specify a `slave` axis for a matrix job.
20
+ #
21
+ # See {http://docs.openstack.org/infra/jenkins-job-builder/project_matrix.html}.
22
+ #
23
+ # @param name [Symbol, String] The name of the axis.
24
+ # @param values [Array<String>] The values of the axis.
25
+ # @return [Hash] The specification for the axis.
26
+ def slave(name, values)
27
+ axis(name, values, :slave)
28
+ end
29
+
30
+ private
31
+
32
+ # Specify an axis for a matrix job.
33
+ #
34
+ # See {http://docs.openstack.org/infra/jenkins-job-builder/project_matrix.html}.
35
+ #
36
+ # @param name [Symbol, String] The name of the axis.
37
+ # @param values [Array<String>] The values of the axis.
38
+ # @param type [Symbol, String] The axis type.
39
+ # @return [Hash] The specification for the axis.
40
+ def axis(name, values, type)
41
+ options = {type: canonicalize(type), name: canonicalize(name), values: values}
42
+ to_config("axis", options)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -3,48 +3,25 @@ module Jujube
3
3
 
4
4
  # Helper methods for creating job parameter components.
5
5
  module Parameters
6
+ extend Macros
6
7
 
7
- # @!group Matrix Axes
8
-
9
- # Specify a `label-expression` axis for a matrix job.
8
+ # @!method string(options = {})
9
+ # Specify a `string` parameter for a job.
10
10
  #
11
- # See {http://docs.openstack.org/infra/jenkins-job-builder/project_matrix.html}.
11
+ # See {http://docs.openstack.org/infra/jenkins-job-builder/parameters.html#parameters.string}.
12
12
  #
13
- # @param name [Symbol, String] The name of the axis.
14
- # @param values [Array<String>] The values of the axis.
15
- # @return [Hash] The specification for the axis.
16
- def label_expression(name, values)
17
- axis(name, values, :label_expression)
18
- end
13
+ # @param options [Hash] The configuration options for the component.
14
+ # @return [Hash] The specification for the component.
15
+ standard_component :string
19
16
 
20
- # Specify a `slave` axis for a matrix job.
21
- #
22
- # See {http://docs.openstack.org/infra/jenkins-job-builder/project_matrix.html}.
17
+ # @!method validating_string(options = {})
18
+ # Specify a `validating-string` parameter for a job.
23
19
  #
24
- # @param name [Symbol, String] The name of the axis.
25
- # @param values [Array<String>] The values of the axis.
26
- # @return [Hash] The specification for the axis.
27
- def slave(name, values)
28
- axis(name, values, :slave)
29
- end
30
-
31
- private
32
-
33
- # Specify an axis for a matrix job.
20
+ # See {http://docs.openstack.org/infra/jenkins-job-builder/parameters.html#parameters.validating-string}.
34
21
  #
35
- # See {http://docs.openstack.org/infra/jenkins-job-builder/project_matrix.html}.
36
- #
37
- # @param name [Symbol, String] The name of the axis.
38
- # @param values [Array<String>] The values of the axis.
39
- # @param type [Symbol, String] The axis type.
40
- # @return [Hash] The specification for the axis.
41
- def axis(name, values, type)
42
- options = {type: canonicalize(type), name: canonicalize(name), values: values}
43
- to_config("axis", options)
44
- end
45
-
46
- # @!endgroup
47
-
22
+ # @param options [Hash] The configuration options for the component.
23
+ # @return [Hash] The specification for the component.
24
+ standard_component :validating_string
48
25
  end
49
26
  end
50
27
  end
@@ -68,6 +68,31 @@ module Jujube
68
68
  # @return [Hash] The specification for the component.
69
69
  standard_component :trigger
70
70
 
71
+ # Specify a `trigger-parameterized-builds` publisher for a job.
72
+ #
73
+ # See {http://docs.openstack.org/infra/jenkins-job-builder/publishers.html#publishers.trigger-parameterized-builds}.
74
+ #
75
+ # `trigger-parameterized-builds` can trigger multiple sets of builds,
76
+ # each with their own configuration. Each build specification is added
77
+ # in a nested configuration block using the {#build} method.
78
+ #
79
+ # @example
80
+ # job "trigger-parameterized-builds-example" do |j|
81
+ # j.publishers << trigger_parameterized_builds do |builds|
82
+ # builds << build(project: %w[PROJECT1 PROJECT2], condition: "SUCCESS")
83
+ # builds << build(project: "SINGLE_PROJECT", current_parameters: true)
84
+ # end
85
+ # end
86
+ #
87
+ # @yieldparam builds [Array] An array to which nested build specifications
88
+ # should be added by the block.
89
+ # @return [Hash] The specification for the component.
90
+ def trigger_parameterized_builds
91
+ builds = []
92
+ yield(builds) if block_given?
93
+ {"trigger-parameterized-builds" => builds}
94
+ end
95
+
71
96
  # Specify an `xunit` publisher for a job.
72
97
  #
73
98
  # See {http://docs.openstack.org/infra/jenkins-job-builder/publishers.html#publishers.xunit}.
@@ -90,6 +115,38 @@ module Jujube
90
115
  to_config("xunit", nested_options(:types, options, &block))
91
116
  end
92
117
 
118
+ # @!group trigger_parameterized_builds Builds
119
+
120
+ # Configure a `build` for a {#trigger_parameterized_builds} publisher.
121
+ #
122
+ # See {http://docs.openstack.org/infra/jenkins-job-builder/publishers.html#publishers.trigger-parameterized-builds}.
123
+ #
124
+ # @param options [Hash] The configuration options for the build.
125
+ # @return [Hash] The specification for the build.
126
+ def build(options = {})
127
+ identity = ->(value) { value }
128
+ transforms = {
129
+ predefined_parameters: ->(value) do
130
+ result = value.map { |k,v| "#{k}=#{v}" }.join("\n")
131
+ value.size > 1 ? result + "\n" : result
132
+ end,
133
+ boolean_parameters: ->(value) do
134
+ Hash[value.map { |k,v| [k.to_s, v] }]
135
+ end,
136
+ git_revision: ->(value) do
137
+ value.is_a?(Hash) ? canonicalize_options(value) : value
138
+ end
139
+ }
140
+ transformed_options = options.map do |k, v|
141
+ transform = transforms.fetch(k) { identity }
142
+ [k, transform.call(v)]
143
+ end
144
+
145
+ canonicalize_options(Hash[transformed_options])
146
+ end
147
+
148
+ # @!endgroup
149
+
93
150
  # @!group xunit Test Types
94
151
 
95
152
  # @!method unittest(options = {})
@@ -101,6 +158,7 @@ module Jujube
101
158
  # @return [Hash] The specification for the test type.
102
159
  named_config :unittest
103
160
 
161
+ # @!endgroup
104
162
  end
105
163
  end
106
164
  end
@@ -5,6 +5,7 @@ module Jujube
5
5
  module Triggers
6
6
  extend Macros
7
7
 
8
+ # @!method pollscm(options = {})
8
9
  # Specify a `pollscm` trigger for a job.
9
10
  #
10
11
  # This trigger requires jenkins-job-builder 1.3.0 or later.
data/lib/jujube/job.rb CHANGED
@@ -93,6 +93,11 @@ module Jujube
93
93
 
94
94
  # @!group Sections
95
95
 
96
+ # Sections are listed in the order specified under Module Execution in the
97
+ # Jenkins Job Builder documentation.
98
+ #
99
+ # See {http://docs.openstack.org/infra/jenkins-job-builder/definition.html#module-execution}.
100
+
96
101
  # @!method axes
97
102
  # The matrix axes for the job.
98
103
  #
@@ -104,6 +109,17 @@ module Jujube
104
109
  # @return [Array]
105
110
  section :axes
106
111
 
112
+ # @!method parameters
113
+ # The parameters for the job.
114
+ #
115
+ # Add parameters in the job's configuration block using helper methods defined in
116
+ # {Components::Parameters}.
117
+ #
118
+ # See {http://docs.openstack.org/infra/jenkins-job-builder/parameters.html}.
119
+ #
120
+ # @return [Array]
121
+ section :parameters
122
+
107
123
  # @!method properties
108
124
  # The Properties for the job.
109
125
  #
@@ -194,6 +210,8 @@ module Jujube
194
210
  {'job' => config}
195
211
  end
196
212
 
213
+ @registry = nil
214
+
197
215
  # Keep track of all `Job`s defined during the execution of the passed block.
198
216
  #
199
217
  # This is used during job loading so that no extra syntax is required in the job
@@ -1,3 +1,5 @@
1
+ # Top-level namespace for the gem.
1
2
  module Jujube
2
- VERSION = "0.11.0"
3
+ # The current gem version.
4
+ VERSION = "0.12.0"
3
5
  end
@@ -0,0 +1,15 @@
1
+ require_relative "../test_helper"
2
+
3
+ class AxesTest < Minitest::Test
4
+ include Jujube::Components
5
+
6
+ def test_label_expression
7
+ expected = {"axis" => {"type" => "label-expression", "name" => "arch", "values" => %w{i386 amd64}}}
8
+ assert_equal(expected, label_expression(:arch, %w{i386 amd64}))
9
+ end
10
+
11
+ def test_slave
12
+ expected = {"axis" => {"type" => "slave", "name" => "arch", "values" => %w{i386 amd64}}}
13
+ assert_equal(expected, slave(:arch, %w{i386 amd64}))
14
+ end
15
+ end
@@ -3,13 +3,13 @@ require_relative "../test_helper"
3
3
  class ParametersTest < Minitest::Test
4
4
  include Jujube::Components
5
5
 
6
- def test_label_expression_axis
7
- expected = {"axis" => {"type" => "label-expression", "name" => "arch", "values" => %w{i386 amd64}}}
8
- assert_equal(expected, label_expression(:arch, %w{i386 amd64}))
6
+ def test_string
7
+ expected = {"string" => {"name" => "NAME", "default" => "DEFAULT"}}
8
+ assert_equal(expected, string(name: "NAME", default: "DEFAULT"))
9
9
  end
10
10
 
11
- def test_slave_axis
12
- expected = {"axis" => {"type" => "slave", "name" => "arch", "values" => %w{i386 amd64}}}
13
- assert_equal(expected, slave(:arch, %w{i386 amd64}))
11
+ def test_validating_string
12
+ expected = {"validating-string" => {"name" => "NAME", "regex" => "REGEX", "msg" => "MESSAGE" }}
13
+ assert_equal(expected, validating_string(name: "NAME", regex: "REGEX", msg: "MESSAGE"))
14
14
  end
15
15
  end
@@ -3,13 +3,13 @@ require_relative "../test_helper"
3
3
  class PropertiesTest < Minitest::Test
4
4
  include Jujube::Components
5
5
 
6
- def test_throttle
7
- expected = {"throttle" => {"max-total" => 42, "option" => "category", "categories" => %w{cat1 cat2}}}
8
- assert_equal(expected, throttle(max_total: 42, option: "category", categories: %w{cat1 cat2}))
9
- end
10
-
11
6
  def test_priority_sorter
12
7
  expected = {"priority-sorter" => {"priority" => 42}}
13
8
  assert_equal(expected, priority_sorter(priority: 42))
14
9
  end
10
+
11
+ def test_throttle
12
+ expected = {"throttle" => {"max-total" => 42, "option" => "category", "categories" => %w{cat1 cat2}}}
13
+ assert_equal(expected, throttle(max_total: 42, option: "category", categories: %w{cat1 cat2}))
14
+ end
15
15
  end
@@ -3,6 +3,16 @@ require_relative "../test_helper"
3
3
  class PublishersTest < Minitest::Test
4
4
  include Jujube::Components
5
5
 
6
+ def test_archive
7
+ expected = {"archive" => {"artifacts" => "ARTIFACTS", "latest-only" => true, "allow-empty" => true}}
8
+ assert_equal(expected, archive(artifacts: "ARTIFACTS", latest_only: true, allow_empty: true))
9
+ end
10
+
11
+ def test_cppcheck
12
+ expected = {"cppcheck" => {"pattern" => "PATTERN"}}
13
+ assert_equal(expected, cppcheck(pattern: "PATTERN"))
14
+ end
15
+
6
16
  def test_email_ext
7
17
  assert_equal("email-ext", email_ext)
8
18
  end
@@ -12,6 +22,11 @@ class PublishersTest < Minitest::Test
12
22
  assert_equal(expected, email_ext(recipients: %w{fred barney}.join(", ")))
13
23
  end
14
24
 
25
+ def test_fitnesse
26
+ expected = {"fitnesse" => {"results" => "RESULTS"}}
27
+ assert_equal(expected, fitnesse(results: "RESULTS"))
28
+ end
29
+
15
30
  def test_ircbot
16
31
  expected = {"ircbot" => {"notify-start" => true}}
17
32
  assert_equal(expected, ircbot(notify_start: true))
@@ -22,14 +37,69 @@ class PublishersTest < Minitest::Test
22
37
  assert_equal(expected, junit(results: "RESULTS", keep_long_stdio: false))
23
38
  end
24
39
 
25
- def test_archive
26
- expected = {"archive" => {"artifacts" => "ARTIFACTS", "latest-only" => true, "allow-empty" => true}}
27
- assert_equal(expected, archive(artifacts: "ARTIFACTS", latest_only: true, allow_empty: true))
40
+ def test_trigger
41
+ expected = {"trigger" => {"project" => "PROJECT"}}
42
+ assert_equal(expected, trigger(project: "PROJECT"))
28
43
  end
29
44
 
30
- def test_cppcheck
31
- expected = {"cppcheck" => {"pattern" => "PATTERN"}}
32
- assert_equal(expected, cppcheck(pattern: "PATTERN"))
45
+ def test_trigger_parameterized_builds
46
+ expected = {"trigger-parameterized-builds" => [
47
+ {"project" => ["PROJECT1", "PROJECT2"], "condition" => "UNSTABLE"}
48
+ ]}
49
+ actual = trigger_parameterized_builds do |builds|
50
+ builds << build(project: %w[PROJECT1 PROJECT2], condition: "UNSTABLE")
51
+ end
52
+ assert_equal(expected, actual)
53
+ end
54
+
55
+ def test_trigger_parameterized_builds_formats_single_predefined_parameter
56
+ expected = {"trigger-parameterized-builds" => [
57
+ {"predefined-parameters" => "param=value"}
58
+ ]}
59
+ actual = trigger_parameterized_builds do |builds|
60
+ builds << build(predefined_parameters: {param: 'value'})
61
+ end
62
+ assert_equal(expected, actual)
63
+ end
64
+
65
+ def test_trigger_parameterized_builds_formats_multiiple_predefined_parameters
66
+ expected = {"trigger-parameterized-builds" => [
67
+ {"predefined-parameters" => "param1=value1\nparam2=value2\n"}
68
+ ]}
69
+ actual = trigger_parameterized_builds do |builds|
70
+ builds << build(predefined_parameters: {param1: 'value1', param2: 'value2'})
71
+ end
72
+ assert_equal(expected, actual)
73
+ end
74
+
75
+ def test_trigger_parameterized_builds_formats_boolean_parameters
76
+ expected = {"trigger-parameterized-builds" => [
77
+ {"boolean-parameters" => {"param_1" => true, "param_2" => false}}
78
+ ]}
79
+ actual = trigger_parameterized_builds do |builds|
80
+ builds << build(boolean_parameters: {param_1: true, param_2: false})
81
+ end
82
+ assert_equal(expected, actual)
83
+ end
84
+
85
+ def test_trigger_parameterized_builds_formats_git_revision_as_boolean
86
+ expected = {"trigger-parameterized-builds" => [
87
+ {"git-revision" => true}
88
+ ]}
89
+ actual = trigger_parameterized_builds do |builds|
90
+ builds << build(git_revision: true)
91
+ end
92
+ assert_equal(expected, actual)
93
+ end
94
+
95
+ def test_trigger_parameterized_builds_formats_git_revision_as_nested_hash
96
+ expected = {"trigger-parameterized-builds" => [
97
+ {"git-revision" => {"combine-queued-commits" => true}}
98
+ ]}
99
+ actual = trigger_parameterized_builds do |builds|
100
+ builds << build(git_revision: {combine_queued_commits: true})
101
+ end
102
+ assert_equal(expected, actual)
33
103
  end
34
104
 
35
105
  def test_xunit
@@ -43,14 +113,4 @@ class PublishersTest < Minitest::Test
43
113
  end
44
114
  assert_equal(expected, actual)
45
115
  end
46
-
47
- def test_trigger
48
- expected = {"trigger" => {"project" => "PROJECT"}}
49
- assert_equal(expected, trigger(project: "PROJECT"))
50
- end
51
-
52
- def test_fitnesse
53
- expected = {"fitnesse" => {"results" => "RESULTS"}}
54
- assert_equal(expected, fitnesse(results: "RESULTS"))
55
- end
56
116
  end
@@ -3,10 +3,6 @@ require_relative "../test_helper"
3
3
  class WrappersTest < Minitest::Test
4
4
  include Jujube::Components
5
5
 
6
- def test_timestamps
7
- assert_equal('timestamps', timestamps)
8
- end
9
-
10
6
  def test_timeout
11
7
  expected = {'timeout' => {'type' => 'elastic', 'fail' => true}}
12
8
  assert_equal(expected, timeout(type: 'elastic', fail: true))
@@ -16,4 +12,8 @@ class WrappersTest < Minitest::Test
16
12
  expected = {'timeout' => {'elastic-percentage' => 150, 'elastic-default-timeout' => 3}}
17
13
  assert_equal(expected, timeout(elastic_percentage: 150, elastic_default_timeout: 3))
18
14
  end
15
+
16
+ def test_timestamps
17
+ assert_equal('timestamps', timestamps)
18
+ end
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jujube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Randy Coulman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-08 00:00:00.000000000 Z
11
+ date: 2016-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.1'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '12'
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '10.1'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '12'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: minitest
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -113,6 +119,7 @@ files:
113
119
  - jujube.gemspec
114
120
  - lib/jujube.rb
115
121
  - lib/jujube/components.rb
122
+ - lib/jujube/components/axes.rb
116
123
  - lib/jujube/components/builders.rb
117
124
  - lib/jujube/components/helpers.rb
118
125
  - lib/jujube/components/macros.rb
@@ -131,6 +138,7 @@ files:
131
138
  - lib/jujube/macros.rb
132
139
  - lib/jujube/utils.rb
133
140
  - lib/jujube/version.rb
141
+ - test/components/axes_test.rb
134
142
  - test/components/builders_test.rb
135
143
  - test/components/parameters_test.rb
136
144
  - test/components/properties_test.rb
@@ -177,6 +185,7 @@ test_files:
177
185
  - acceptance/jujube/acceptance_test.rb
178
186
  - acceptance/jujube/end_to_end_test.rb
179
187
  - acceptance/jujube/usage_test.rb
188
+ - test/components/axes_test.rb
180
189
  - test/components/builders_test.rb
181
190
  - test/components/parameters_test.rb
182
191
  - test/components/properties_test.rb