builderator 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,39 @@
1
+ require 'json'
2
+ require_relative '../util'
3
+
4
+ module Builderator
5
+ module Util
6
+ ##
7
+ # Helpers for packer
8
+ ##
9
+ module Packer
10
+ class << self
11
+ def version(arg = nil)
12
+ return @version = arg unless arg.nil?
13
+ @version || '0.8.6'
14
+ end
15
+ alias_method :use, :version
16
+
17
+ def installed?
18
+ File.exist?(path)
19
+ end
20
+
21
+ def platform
22
+ `uname -s`.chomp.downcase
23
+ end
24
+
25
+ def path
26
+ File.join(ENV['HOME'], "packer_#{ version }")
27
+ end
28
+
29
+ def bin
30
+ File.join(ENV['HOME'], "packer/packer")
31
+ end
32
+
33
+ def url
34
+ "https://dl.bintray.com/mitchellh/packer/packer_#{ version }_#{ platform }_amd64.zip"
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,44 @@
1
+ require 'stringio'
2
+
3
+ module Builderator
4
+ module Util
5
+ ##
6
+ # Extend the functionality of Thor::Actions::run
7
+ ##
8
+ module Shell
9
+ def execute(command, config = {})
10
+ return unless behavior == :invoke
11
+
12
+ destination = relative_to_original_destination_root(destination_root, false)
13
+ desc = "#{command} from #{destination.inspect}"
14
+
15
+ if config[:with]
16
+ desc = "#{File.basename(config[:with].to_s)} #{desc}"
17
+ command = "#{config[:with]} #{command}"
18
+ end
19
+
20
+ say_status :run, desc, config.fetch(:verbose, true)
21
+ BufferTee.new($stdout).tap do |t|
22
+ IO.popen(command, :err => [:child, :out]).each { |l| t.write(l) }
23
+ end unless options[:pretend]
24
+ end
25
+
26
+ ##
27
+ # Buffer an IO stream and forward to another IO instance
28
+ ##
29
+ class BufferTee < StringIO
30
+ attr_reader :output
31
+
32
+ def initialize(out, *args)
33
+ super(*args)
34
+ @output = out
35
+ end
36
+
37
+ def write(data)
38
+ super(data)
39
+ output.write(data)
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,22 @@
1
+ module Builderator
2
+ module Util
3
+ ##
4
+ # Generic wrapper for exceptions in Thor Tasks
5
+ ##
6
+ class TaskException < StandardError
7
+ attr_reader :status
8
+ attr_reader :task
9
+
10
+ def initialize(status, task, color = :red)
11
+
12
+ @status = status
13
+ @task = task
14
+ @color = color
15
+ end
16
+
17
+ def status
18
+ [@status, message, @color]
19
+ end
20
+ end
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,210 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: builderator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.10
5
+ platform: ruby
6
+ authors:
7
+ - John Manero
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '10.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.7.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.7.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: berkshelf
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.2'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: chef
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '12.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '12.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: thor
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.19.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.19.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: thor-scmversion
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 1.7.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 1.7.0
111
+ description: |
112
+ # Builderator
113
+ __Tools to make CI Packer builds awesome__
114
+
115
+ ## Installation
116
+
117
+ Add this line to your application's Gemfile:
118
+
119
+ ```ruby
120
+ gem 'builderator'
121
+ ```
122
+
123
+ And then execute:
124
+
125
+ $ bundle
126
+
127
+ Or install it yourself as:
128
+
129
+ $ gem install builderator
130
+
131
+ ## Usage
132
+
133
+ Run `bundle exec thor build help`
134
+
135
+ ## Contributing
136
+
137
+ 1. Fork it ( https://github.com/[my-github-username]/builderator/fork )
138
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
139
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
140
+ 4. Push to the branch (`git push origin my-new-feature`)
141
+ 5. Create a new Pull Request
142
+ email:
143
+ - jmanero@rapid7.com
144
+ executables:
145
+ - build
146
+ extensions: []
147
+ extra_rdoc_files: []
148
+ files:
149
+ - ".gitignore"
150
+ - ".rubocop.yml"
151
+ - Gemfile
152
+ - LICENSE.txt
153
+ - README.md
154
+ - Rakefile
155
+ - Thorfile
156
+ - VERSION
157
+ - bin/build
158
+ - builderator.gemspec
159
+ - docs/clean.md
160
+ - lib/builderator.rb
161
+ - lib/builderator/control/ami.rb
162
+ - lib/builderator/control/clean.rb
163
+ - lib/builderator/metadata.rb
164
+ - lib/builderator/model.rb
165
+ - lib/builderator/model/images.rb
166
+ - lib/builderator/model/instances.rb
167
+ - lib/builderator/model/launch_configs.rb
168
+ - lib/builderator/model/scaling_groups.rb
169
+ - lib/builderator/model/snapshots.rb
170
+ - lib/builderator/model/volumes.rb
171
+ - lib/builderator/tasks.rb
172
+ - lib/builderator/tasks/ami.rb
173
+ - lib/builderator/tasks/berks.rb
174
+ - lib/builderator/tasks/clean.rb
175
+ - lib/builderator/tasks/cookbook.rb
176
+ - lib/builderator/tasks/packer.rb
177
+ - lib/builderator/tasks/vagrant.rb
178
+ - lib/builderator/util.rb
179
+ - lib/builderator/util/aws_exception.rb
180
+ - lib/builderator/util/berkshim.rb
181
+ - lib/builderator/util/cookbook.rb
182
+ - lib/builderator/util/limit_exception.rb
183
+ - lib/builderator/util/packer.rb
184
+ - lib/builderator/util/shell.rb
185
+ - lib/builderator/util/task_exception.rb
186
+ homepage: https://github.com/rapid7/builderator
187
+ licenses:
188
+ - MIT
189
+ metadata: {}
190
+ post_install_message:
191
+ rdoc_options: []
192
+ require_paths:
193
+ - lib
194
+ required_ruby_version: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
199
+ required_rubygems_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: '0'
204
+ requirements: []
205
+ rubyforge_project:
206
+ rubygems_version: 2.4.3
207
+ signing_key:
208
+ specification_version: 4
209
+ summary: Tools to make CI Packer builds awesome
210
+ test_files: []