Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ rvm:
- 1.9.3
- 2.0.0
- 2.1.3
- 2.4.1
- jruby
- rbx

script:
- rake spec
- bundle exec rake spec

before_install:
- gem update bundler
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

* Added support for `min_packer_version` and `description` keys.

## 0.2.0 (2016-03-01)

* Added support for output to STDOUT. The filename of '-' is used to signify outout should go to STDOUT. (PR#7) This feature will become the default functionality in the 0.3.0 release.
Expand Down Expand Up @@ -52,4 +56,4 @@ Bug Fixes:
## 0.0.1 (Internal)

* Initial private release
* Supports Amazon, Virtualbox and VMWare builders
* Supports Amazon, Virtualbox and VMWare builders
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ Racker::Processor.register_template do |t|
end
```

#### Other keys

You can add `description` or `min_packer_version` to template.

```ruby
Racker::Processor.register_template do |t|
t.description = 'some description'
t.min_packer_version = '1.0.0'
end
```
### Putting it all together

Racker offers 2 very basic example templates `example/template1.rb` and `example/template2.rb` as well as the resulting packer template from the two templates run through Racker.
Expand Down
6 changes: 6 additions & 0 deletions lib/racker/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ def to_packer
# Create the new smash
packer = Smash.new

# Packer Version
packer['min_packer_version'] = self['min_packer_version'].dup unless self['min_packer_version'].nil? || self['min_packer_version'].empty?

# Description
packer['description'] = self['description'].dup unless self['description'].nil? || self['description'].empty?

# Variables
packer['variables'] = self['variables'].dup unless self['variables'].nil? || self['variables'].empty?

Expand Down
4 changes: 2 additions & 2 deletions racker.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
gem.add_dependency 'multi_json', '~> 1.8'
gem.add_dependency 'log4r', '~> 1.1.10'

gem.add_development_dependency 'bundler', '~> 1.3'
gem.add_development_dependency 'bundler', '~> 1.15'
gem.add_development_dependency 'coveralls', '~> 0.6.7'
gem.add_development_dependency 'guard', '~> 2.2.3'
gem.add_development_dependency 'guard-bundler', '~> 2.0.0'
Expand All @@ -31,7 +31,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rake'
gem.add_development_dependency 'rspec'
gem.add_development_dependency 'rspec-mocks'
gem.add_development_dependency 'rubocop', '~> 0.26.1'
gem.add_development_dependency 'rubocop', '>= 0.38.0'
gem.add_development_dependency 'ruby_gntp', '~> 0.3.4'
gem.add_development_dependency 'simplecov', '~> 0.7.1'
gem.add_development_dependency 'yard', '~> 0.8'
Expand Down
2 changes: 2 additions & 0 deletions spec/fixtures/high_priority_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
:iso_url => 'priority.img',
:password => '~~',
}
t.description = 'some description'
t.min_packer_version = '1.1.1'
end
20 changes: 20 additions & 0 deletions spec/unit/processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,26 @@
expect(JSON.parse(template)).to eq(parsed_low_priority_template)
end

it 'supports `min_packer_version` option' do
@options[:templates] = [
fixture_path('high_priority_template.rb'),
]
template = @instance.execute!

result = JSON.parse(template)
expect(result['min_packer_version']).to eq('1.1.1')
end

it 'supports `description` option' do
@options[:templates] = [
fixture_path('high_priority_template.rb'),
]
template = @instance.execute!

result = JSON.parse(template)
expect(result['description']).to eq('some description')
end

end

context '#initialize' do
Expand Down