packer-config 1.1.0 → 1.2.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: 148517d2535b585d2b88e40901b6f5c5e393b715
4
- data.tar.gz: 04f60d496b44cfb03181914a6657a789be35a8f9
3
+ metadata.gz: 0f326683585a01902ddd9d38a88269cb0d95655b
4
+ data.tar.gz: 5488b3e8d5c0c397d28c74d36db2220e7c80357b
5
5
  SHA512:
6
- metadata.gz: c45a724bbd36bcb1746e91e15e5499452970c1474e347c71307035cd571d0446cfaa4ca04df27915f4ecaa0985254f479fd34fb177719f28dfe73f5a11502589
7
- data.tar.gz: ffacf9de4ecd57ff523123cf29ba7a03dc07106aba1b21f259c55942a986972300e44a6930a97f5b31bce9abb246e2b990718690b75b560123b35ac688857260
6
+ metadata.gz: a4cd9a12a2e6451b72e0cbd8920500d18956c7faa74a097e31929d7202db35a4dc2549cbedbd52f2c93786c36394c0bd4361e27513cf8d38d9e5a8a3897213fa
7
+ data.tar.gz: af76bc9e7d325e3eae01a5c7eefd597ff06d28a1ede9298dcdd659ab1c748e46fad023f4787cd72d98ef6fc016adb0c692f54fda0376872e55e7b2a0afcc2074
data/README.md CHANGED
@@ -50,6 +50,8 @@ The following [Packer post-processors](http://www.packer.io/docs/templates/post-
50
50
 
51
51
  * [docker-import](http://www.packer.io/docs/post-processors/docker-import.html)
52
52
  * [docker-push](http://www.packer.io/docs/post-processors/docker-push.html)
53
+ * [docker-save](http://www.packer.io/docs/post-processors/docker-save.html)
54
+ * [docker-tag](http://www.packer.io/docs/post-processors/docker-tag.html)
53
55
  * [vagrant](http://www.packer.io/docs/post-processors/vagrant.html)
54
56
 
55
57
  ## Examples
@@ -1,11 +1,16 @@
1
1
  # packer-config Release Notes
2
2
 
3
+ ## 1.2.0
4
+
5
+ * Add support for docker-save post-processor (via [frasercobb][])
6
+ * Add support for docker-tab post-processor (via [frasercobb][])
7
+
3
8
  ## 1.1.0
4
- * Thanks to [grepory](https://github.com/grepory) we have a `vmware-vmx` builder
9
+ * Thanks to [grepory][] we have a `vmware-vmx` builder
5
10
 
6
11
  ## 1.0.0
7
12
  * A 1.0.0 release because...why not? You're either working or you're not and this is working so let's drop the `0.x.x` pretense and tango.
8
- * Thanks to [frasercobb](https://github.com/frasercobb) we have `puppet-server` and `puppet-masterless` provisioner interfaces
13
+ * Thanks to [frasercobb][] we have `puppet-server` and `puppet-masterless` provisioner interfaces
9
14
  * There's also `ansible`, `chef-client`, `chef-solo` and `salt` provisioners for you to use now
10
15
  * Added the `null` builder because it seemed handy to have
11
16
  * Updated the example in the README (and the integration test) to CentOS 6.6
@@ -15,3 +20,8 @@
15
20
 
16
21
  * Added the ability to call `#build` with a quiet option. This option turns streaming to stdout off/on. With `quiet: false`, you will see the output of the Packer call on your screen while `#build` is executing it. This can be handy for view Packer status for long running Packer jobs.
17
22
  * Started writing release notes!
23
+
24
+
25
+ [frasercobb]: https://github.com/frasercobb
26
+ [grepory]: https://github.com/grepory
27
+ [ianchesal]: https://github.com/ianchesal
data/TODO.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # TODO
2
2
 
3
+ * Use [lowered-expectations](https://rubygems.org/gems/lowered-expectations) to enforce a minimum version of `packer` exists in order to use this gem
3
4
  * Add an option to Packer::Config#validate to run the configuration through packer's `validate` command
4
5
  * Add spec tests for every method on every sub-class. Found during integration testing that some methods on the sub-classes had typos in the `__*` method calls. Spec tests would have caught this.
5
6
  * Look in to something like VCR to drive the tests of the child classes -- there's a lot of repetitive testing that could be done on them.
6
- * Add missing builders, provisioners and post-processors. I only implemented the builders, provisioners and post-processors that I'm currently using.
7
7
  * Refactor the child classes. I get the feeling that these could be implemented in some better, templated, type of way
@@ -6,11 +6,15 @@ module Packer
6
6
  class PostProcessor < Packer::DataObject
7
7
  DOCKER_IMPORT = 'docker-import'
8
8
  DOCKER_PUSH = 'docker-push'
9
+ DOCKER_SAVE = 'docker-save'
10
+ DOCKER_TAG = 'docker-tag'
9
11
  VAGRANT = 'vagrant'
10
12
 
11
13
  VALID_POST_PROCESSOR_TYPES = [
12
14
  DOCKER_IMPORT,
13
15
  DOCKER_PUSH,
16
+ DOCKER_SAVE,
17
+ DOCKER_TAG,
14
18
  VAGRANT
15
19
  ]
16
20
 
@@ -24,6 +28,8 @@ module Packer
24
28
  {
25
29
  DOCKER_IMPORT => Packer::PostProcessor::DockerImport,
26
30
  DOCKER_PUSH => Packer::PostProcessor::DockerPush,
31
+ DOCKER_SAVE => Packer::PostProcessor::DockerSave,
32
+ DOCKER_TAG => Packer::PostProcessor::DockerTag,
27
33
  VAGRANT => Packer::PostProcessor::Vagrant
28
34
  }.fetch(type).new
29
35
  end
@@ -10,6 +10,14 @@ module Packer
10
10
  self.data['type'] = DOCKER_IMPORT
11
11
  self.add_required('repository')
12
12
  end
13
+
14
+ def repository(repo)
15
+ self.__add_string('repository', repo)
16
+ end
17
+
18
+ def tag(tag)
19
+ self.__add_string('tag', tag)
20
+ end
13
21
  end
14
22
 
15
23
  class DockerPush < PostProcessor
@@ -17,6 +25,54 @@ module Packer
17
25
  super
18
26
  self.data['type'] = DOCKER_PUSH
19
27
  end
28
+
29
+ def login(bool)
30
+ self.__add_boolean('login', bool)
31
+ end
32
+
33
+ def login_email(email)
34
+ self.__add_string('login_email', email)
35
+ end
36
+
37
+ def login_username(username)
38
+ self.__add_string('login_username', username)
39
+ end
40
+
41
+ def login_password(password)
42
+ self.__add_string('login_password', password)
43
+ end
44
+
45
+ def login_server(server)
46
+ self.__add_string('login_server', server)
47
+ end
48
+ end
49
+
50
+ class DockerSave < PostProcessor
51
+ def initialize
52
+ super
53
+ self.data['type'] = DOCKER_SAVE
54
+ self.add_required('path')
55
+ end
56
+
57
+ def path(path)
58
+ self.__add_string('path', path)
59
+ end
60
+ end
61
+
62
+ class DockerTag < PostProcessor
63
+ def initialize
64
+ super
65
+ self.data['type'] = DOCKER_TAG
66
+ self.add_required('repository')
67
+ end
68
+
69
+ def repository(repo)
70
+ self.__add_string('repository', repo)
71
+ end
72
+
73
+ def tag(tag)
74
+ self.__add_string('tag', tag)
75
+ end
20
76
  end
21
77
  end
22
78
  end
@@ -1,3 +1,3 @@
1
1
  module Packer
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -6,7 +6,7 @@ require 'packer/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "packer-config"
8
8
  spec.version = Packer::VERSION
9
- spec.authors = ["Ian Chesal", "Fraser Cobb"]
9
+ spec.authors = ["Ian Chesal", "Fraser Cobb", "Greg Poirier"]
10
10
  spec.email = ["ian.chesal@gmail.com"]
11
11
  spec.summary = 'An object model to build packer.io configurations in Ruby.'
12
12
  spec.description = <<-END
@@ -6,9 +6,45 @@ RSpec.describe Packer::PostProcessor::DockerImport do
6
6
  Packer::PostProcessor.get_postprocessor(Packer::PostProcessor::DOCKER_IMPORT)
7
7
  end
8
8
 
9
+ let(:some_string) do
10
+ 'some string'
11
+ end
12
+
13
+ let(:some_array_of_ints) do
14
+ [1, 2, 3]
15
+ end
16
+
9
17
  describe '#initialize' do
10
18
  it 'has a type of shell' do
11
19
  expect(postprocessor.data['type']).to eq(Packer::PostProcessor::DOCKER_IMPORT)
12
20
  end
13
21
  end
22
+
23
+ describe '#repository' do
24
+ it 'accepts a string' do
25
+ postprocessor.repository(some_string)
26
+ expect(postprocessor.data['repository']).to eq(some_string)
27
+ postprocessor.data.delete('repository')
28
+ end
29
+
30
+ it 'converts any argument passed to a string' do
31
+ postprocessor.repository(some_array_of_ints)
32
+ expect(postprocessor.data['repository']).to eq(some_array_of_ints.to_s)
33
+ postprocessor.data.delete('repository')
34
+ end
35
+ end
36
+
37
+ describe 'tag' do
38
+ it 'accepts a string' do
39
+ postprocessor.tag(some_string)
40
+ expect(postprocessor.data['tag']).to eq(some_string)
41
+ postprocessor.data.delete('tag')
42
+ end
43
+
44
+ it 'converts any argument passed to a string' do
45
+ postprocessor.tag(some_array_of_ints)
46
+ expect(postprocessor.data['tag']).to eq(some_array_of_ints.to_s)
47
+ postprocessor.data.delete('tag')
48
+ end
49
+ end
14
50
  end
@@ -6,9 +6,85 @@ RSpec.describe Packer::PostProcessor::DockerPush do
6
6
  Packer::PostProcessor.get_postprocessor(Packer::PostProcessor::DOCKER_PUSH)
7
7
  end
8
8
 
9
+ let(:some_string) do
10
+ 'some string'
11
+ end
12
+
13
+ let(:some_boolean) do
14
+ true
15
+ end
16
+
17
+ let(:some_array_of_ints) do
18
+ [1, 2, 3]
19
+ end
20
+
9
21
  describe '#initialize' do
10
22
  it 'has a type of shell' do
11
23
  expect(postprocessor.data['type']).to eq(Packer::PostProcessor::DOCKER_PUSH)
12
24
  end
13
25
  end
26
+
27
+ describe '#login' do
28
+ it 'accepts a boolean' do
29
+ postprocessor.login(some_boolean)
30
+ expect(postprocessor.data['login']).to be_truthy
31
+ postprocessor.data.delete('login')
32
+ end
33
+ end
34
+
35
+ describe '#login_email' do
36
+ it 'accepts a string' do
37
+ postprocessor.login_email(some_string)
38
+ expect(postprocessor.data['login_email']).to eq(some_string)
39
+ postprocessor.data.delete('login_email')
40
+ end
41
+
42
+ it 'converts any argument passed to a string' do
43
+ postprocessor.login_email(some_array_of_ints)
44
+ expect(postprocessor.data['login_email']).to eq(some_array_of_ints.to_s)
45
+ postprocessor.data.delete('login_email')
46
+ end
47
+ end
48
+
49
+ describe '#login_username' do
50
+ it 'accepts a string' do
51
+ postprocessor.login_username(some_string)
52
+ expect(postprocessor.data['login_username']).to eq(some_string)
53
+ postprocessor.data.delete('login_username')
54
+ end
55
+
56
+ it 'converts any argument passed to a string' do
57
+ postprocessor.login_username(some_array_of_ints)
58
+ expect(postprocessor.data['login_username']).to eq(some_array_of_ints.to_s)
59
+ postprocessor.data.delete('login_username')
60
+ end
61
+ end
62
+
63
+ describe '#login_password' do
64
+ it 'accepts a string' do
65
+ postprocessor.login_password(some_string)
66
+ expect(postprocessor.data['login_password']).to eq(some_string)
67
+ postprocessor.data.delete('login_password')
68
+ end
69
+
70
+ it 'converts any argument passed to a string' do
71
+ postprocessor.login_password(some_array_of_ints)
72
+ expect(postprocessor.data['login_password']).to eq(some_array_of_ints.to_s)
73
+ postprocessor.data.delete('login_password')
74
+ end
75
+ end
76
+
77
+ describe '#login_server' do
78
+ it 'accepts a string' do
79
+ postprocessor.login_server(some_string)
80
+ expect(postprocessor.data['login_server']).to eq(some_string)
81
+ postprocessor.data.delete('login_server')
82
+ end
83
+
84
+ it 'converts any argument passed to a string' do
85
+ postprocessor.login_server(some_array_of_ints)
86
+ expect(postprocessor.data['login_server']).to eq(some_array_of_ints.to_s)
87
+ postprocessor.data.delete('login_server')
88
+ end
89
+ end
14
90
  end
@@ -0,0 +1,36 @@
1
+ # Encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe Packer::PostProcessor::DockerSave do
5
+ let(:postprocessor) do
6
+ Packer::PostProcessor.get_postprocessor(Packer::PostProcessor::DOCKER_SAVE)
7
+ end
8
+
9
+ let(:some_string) do
10
+ 'some string'
11
+ end
12
+
13
+ let(:some_array_of_ints) do
14
+ [1, 2, 3]
15
+ end
16
+
17
+ describe '#initialize' do
18
+ it 'has a type of shell' do
19
+ expect(postprocessor.data['type']).to eq(Packer::PostProcessor::DOCKER_SAVE)
20
+ end
21
+ end
22
+
23
+ describe '#path' do
24
+ it 'accepts a string' do
25
+ postprocessor.path(some_string)
26
+ expect(postprocessor.data['path']).to eq(some_string)
27
+ postprocessor.data.delete('path')
28
+ end
29
+
30
+ it 'converts any argument passed to a string' do
31
+ postprocessor.path(some_array_of_ints)
32
+ expect(postprocessor.data['path']).to eq(some_array_of_ints.to_s)
33
+ postprocessor.data.delete('path')
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,50 @@
1
+ # Encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe Packer::PostProcessor::DockerTag do
5
+ let(:postprocessor) do
6
+ Packer::PostProcessor.get_postprocessor(Packer::PostProcessor::DOCKER_TAG)
7
+ end
8
+
9
+ let(:some_string) do
10
+ 'some string'
11
+ end
12
+
13
+ let(:some_array_of_ints) do
14
+ [1, 2, 3]
15
+ end
16
+
17
+ describe '#initialize' do
18
+ it 'has a type of shell' do
19
+ expect(postprocessor.data['type']).to eq(Packer::PostProcessor::DOCKER_TAG)
20
+ end
21
+ end
22
+
23
+ describe '#repository' do
24
+ it 'accepts a string' do
25
+ postprocessor.repository(some_string)
26
+ expect(postprocessor.data['repository']).to eq(some_string)
27
+ postprocessor.data.delete('repository')
28
+ end
29
+
30
+ it 'converts any argument passed to a string' do
31
+ postprocessor.repository(some_array_of_ints)
32
+ expect(postprocessor.data['repository']).to eq(some_array_of_ints.to_s)
33
+ postprocessor.data.delete('repository')
34
+ end
35
+ end
36
+
37
+ describe '#tag' do
38
+ it 'accepts a string' do
39
+ postprocessor.tag(some_string)
40
+ expect(postprocessor.data['tag']).to eq(some_string)
41
+ postprocessor.data.delete('tag')
42
+ end
43
+
44
+ it 'converts any argument passed to a string' do
45
+ postprocessor.tag(some_array_of_ints)
46
+ expect(postprocessor.data['tag']).to eq(some_array_of_ints.to_s)
47
+ postprocessor.data.delete('tag')
48
+ end
49
+ end
50
+ end
@@ -121,7 +121,7 @@ RSpec.describe Packer::Provisioner do
121
121
  it 'accepts a boolean' do
122
122
  provisioner.prevent_sudo(some_boolean)
123
123
  expect(provisioner.data['prevent_sudo']).to be_truthy
124
- provisioner.data.delete('some_boolean')
124
+ provisioner.data.delete('prevent_sudo')
125
125
  end
126
126
  end
127
127
 
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packer-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Chesal
8
8
  - Fraser Cobb
9
+ - Greg Poirier
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2015-04-01 00:00:00.000000000 Z
13
+ date: 2015-05-15 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: bundler
@@ -185,6 +186,8 @@ files:
185
186
  - spec/packer/postprocessor_spec.rb
186
187
  - spec/packer/postprocessors/docker_import_spec.rb
187
188
  - spec/packer/postprocessors/docker_push_spec.rb
189
+ - spec/packer/postprocessors/docker_save_spec.rb
190
+ - spec/packer/postprocessors/docker_tag_spec.rb
188
191
  - spec/packer/postprocessors/vagrant_spec.rb
189
192
  - spec/packer/provisioner_spec.rb
190
193
  - spec/packer/provisioners/ansible_spec.rb
@@ -223,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
226
  version: '0'
224
227
  requirements: []
225
228
  rubyforge_project:
226
- rubygems_version: 2.2.2
229
+ rubygems_version: 2.4.5
227
230
  signing_key:
228
231
  specification_version: 4
229
232
  summary: An object model to build packer.io configurations in Ruby.
@@ -253,6 +256,8 @@ test_files:
253
256
  - spec/packer/postprocessor_spec.rb
254
257
  - spec/packer/postprocessors/docker_import_spec.rb
255
258
  - spec/packer/postprocessors/docker_push_spec.rb
259
+ - spec/packer/postprocessors/docker_save_spec.rb
260
+ - spec/packer/postprocessors/docker_tag_spec.rb
256
261
  - spec/packer/postprocessors/vagrant_spec.rb
257
262
  - spec/packer/provisioner_spec.rb
258
263
  - spec/packer/provisioners/ansible_spec.rb