thor-tropo 0.0.3

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.
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ VERSION
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in thor-tropo.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 John Dyer
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Thor::Tropo
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'thor-tropo'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install thor-tropo
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env rake
2
+ require 'rspec/core/rake_task'
3
+ require 'cucumber'
4
+ require 'cucumber/rake/task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ Cucumber::Rake::Task.new(:features) do |t|
9
+ t.cucumber_opts = "--format pretty --tags ~wip"
10
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+ $:.unshift File.expand_path('../lib', __FILE__)
3
+
4
+ require 'bundler'
5
+ require 'thor/rake_compat'
6
+ require 'thor/scmversion'
7
+ require 'thor-tropo'
8
+ class Gem < Thor
9
+ include Thor::RakeCompat
10
+ Bundler::GemHelper.install_tasks
11
+
12
+ desc 'build', "Build thor-tropo-#{ThorTropo::VERSION}.gem into the pkg directory"
13
+ def build
14
+ Rake::Task['build'].execute
15
+ end
16
+
17
+ desc 'install', "Build and install thor-tropo-#{ThorTropo::VERSION}.gem into system gems"
18
+ def install
19
+ Rake::Task['install'].execute
20
+ end
21
+
22
+ desc 'release', "Create tag v#{ThorTropo::VERSION} and build and push thor-tropo-#{ThorTropo::VERSION}.gem to Rubygems"
23
+ def release
24
+ Rake::Task['release'].execute
25
+ end
26
+ end
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.push File.expand_path("../../lib", __FILE__)
4
+ require 'thor-scmversion'
5
+
6
+ ThorSCMVersion::Tasks.start
@@ -0,0 +1,131 @@
1
+ require 'thor'
2
+ require 'thor/actions'
3
+ require 'thor/scmversion'
4
+ require 'tmpdir'
5
+ require 'archive/tar/minitar'
6
+ require 'zlib'
7
+ #require 'thor/foodcritic'
8
+ require 'berkshelf/thor'
9
+ require 'berkshelf/chef'
10
+
11
+
12
+ module ThorTropo
13
+ class Tasks < Thor
14
+ include Thor::Actions
15
+
16
+
17
+ class_option :called_path,
18
+ :type => :string,
19
+ :default => Dir.pwd
20
+
21
+ class_option :verbose,
22
+ :type => :boolean,
23
+ :aliases => "-v",
24
+ :default => false
25
+
26
+
27
+ namespace "tropo"
28
+
29
+ desc "bump", "Bump version"
30
+ def bump
31
+ puts "This should bump the version in the metatdata.rb file... eventually"
32
+ end
33
+
34
+
35
+ desc "package", "Package cookbook"
36
+ def package
37
+ unless clean?
38
+ say "There are files that need to be committed first.", :red
39
+ exit 1
40
+ end
41
+
42
+ bundle_cookbook
43
+ # tag_version {
44
+ # publish_cookbook(options)
45
+ # }
46
+ end
47
+
48
+
49
+ # desc "build", "Package cookbook"
50
+
51
+ # def build
52
+ # cleanup
53
+ # run "git archive --format=tar -o #{pkg_path}/tarfile HEAD"
54
+ # run "tar rf #{pkg_path}/tarfile VERSION" # Stick VERSION in the tar
55
+ # run "gzip -9 #{pkg_path}/tarfile"
56
+ # FileUtils.mv "#{pkg_path}/tarfile.gz", artifact_path
57
+ # say "Built #{artifact_path}"
58
+ # end
59
+
60
+ no_tasks do
61
+
62
+ def clean?
63
+ sh_with_excode("git diff --exit-codeBerkshelf")[1] == 0
64
+ end
65
+
66
+ def bundle_cookbook
67
+ tmp = Dir.mktmpdir
68
+ opts = {
69
+ berksfile: File.join(options[:called_path],"/Berksfile"),
70
+ path: "#{tmp}/cookbooks"
71
+ }
72
+
73
+ invoke("berkshelf:install", [], opts)
74
+ output = File.expand_path(File.join(Dir.home, "#{options[:called_path].split("/")[-1]}-#{current_version}.tar.gz"))
75
+
76
+
77
+ Dir.chdir(tmp) do |dir|
78
+ tgz = Zlib::GzipWriter.new(File.open(output, 'wb'))
79
+ Archive::Tar::Minitar.pack('./cookbooks', tgz)
80
+ end
81
+ end
82
+
83
+ def current_version
84
+ metadata = Ridley::Chef::Cookbook::Metadata.from_file(File.join(options[:called_path],"metadata.rb"))
85
+ metadata.version
86
+ end
87
+
88
+ def tag_version
89
+ sh "git tag -a -m \"Version #{current_version}\" #{current_version}"
90
+ say "Tagged: #{current_version}", :green
91
+ yield if block_given?
92
+ sh "git push --tags"
93
+ rescue => e
94
+ say "Untagging: #{current_version} due to error", :red
95
+ sh_with_excode "git tag -d #{current_version}"
96
+ say e, :red
97
+ exit 1
98
+ end
99
+
100
+ def source_root
101
+ options[:called_path]
102
+ end
103
+
104
+ def sh(cmd, dir = source_root, &block)
105
+ out, code = sh_with_excode(cmd, dir, &block)
106
+ code == 0 ? out : raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
107
+ end
108
+
109
+ def sh_with_excode(cmd, dir = source_root, &block)
110
+ cmd << " 2>&1"
111
+ outbuf = ''
112
+
113
+ Dir.chdir(dir) {
114
+ outbuf = `#{cmd}`
115
+ if $? == 0
116
+ block.call(outbuf) if block
117
+ end
118
+ }
119
+
120
+ [ outbuf, $? ]
121
+ end
122
+
123
+ def cleanup
124
+ FileUtils.rm_r(pkg_path, :force => true)
125
+ FileUtils.mkdir_p pkg_path
126
+ end
127
+
128
+ end
129
+
130
+ end
131
+ end
@@ -0,0 +1,3 @@
1
+ module ThorTropo
2
+ VERSION = IO.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')) rescue "0.0.1"
3
+ end
@@ -0,0 +1 @@
1
+ require 'thor-tropo'
@@ -0,0 +1,34 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/thor-tropo/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["John Dyer"]
6
+ gem.email = ["johntdyer@gmail.com"]
7
+ gem.description = %q{Thor tasks to package a project}
8
+ gem.summary = %q{Set of tasks to assist in making packages from a git controlled project.}
9
+ gem.homepage = "https://github.com/johntdyer/thor-tropo"
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "thor-tropo"
15
+ gem.require_paths = ["lib","bin"]
16
+ gem.version = ThorTropo::VERSION
17
+
18
+ gem.add_dependency 'json', ">= 1.7.0"
19
+ gem.add_dependency 'thor'
20
+ gem.add_dependency 'chef', "~> 11.0"
21
+ gem.add_dependency 'berkshelf'
22
+ gem.add_dependency 'thor-scmversion'
23
+ gem.add_dependency 'minitar', '~> 0.5.4'
24
+
25
+ gem.add_development_dependency 'foodcritic'
26
+ gem.add_development_dependency 'webmock'
27
+ gem.add_development_dependency 'spork'
28
+ gem.add_development_dependency 'simplecov'
29
+ gem.add_development_dependency 'vcr'
30
+ gem.add_development_dependency 'aruba'
31
+ gem.add_development_dependency 'rspec'
32
+ gem.add_development_dependency "bundler", "~> 1.3"
33
+ gem.add_development_dependency "rake"
34
+ end
metadata ADDED
@@ -0,0 +1,300 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: thor-tropo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - John Dyer
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: json
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.7.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.7.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: thor
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: chef
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '11.0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '11.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: berkshelf
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: thor-scmversion
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: minitar
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 0.5.4
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 0.5.4
110
+ - !ruby/object:Gem::Dependency
111
+ name: foodcritic
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: webmock
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: spork
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: simplecov
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: vcr
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ - !ruby/object:Gem::Dependency
191
+ name: aruba
192
+ requirement: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ - !ruby/object:Gem::Dependency
207
+ name: rspec
208
+ requirement: !ruby/object:Gem::Requirement
209
+ none: false
210
+ requirements:
211
+ - - ! '>='
212
+ - !ruby/object:Gem::Version
213
+ version: '0'
214
+ type: :development
215
+ prerelease: false
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ! '>='
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ - !ruby/object:Gem::Dependency
223
+ name: bundler
224
+ requirement: !ruby/object:Gem::Requirement
225
+ none: false
226
+ requirements:
227
+ - - ~>
228
+ - !ruby/object:Gem::Version
229
+ version: '1.3'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
234
+ requirements:
235
+ - - ~>
236
+ - !ruby/object:Gem::Version
237
+ version: '1.3'
238
+ - !ruby/object:Gem::Dependency
239
+ name: rake
240
+ requirement: !ruby/object:Gem::Requirement
241
+ none: false
242
+ requirements:
243
+ - - ! '>='
244
+ - !ruby/object:Gem::Version
245
+ version: '0'
246
+ type: :development
247
+ prerelease: false
248
+ version_requirements: !ruby/object:Gem::Requirement
249
+ none: false
250
+ requirements:
251
+ - - ! '>='
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
254
+ description: Thor tasks to package a project
255
+ email:
256
+ - johntdyer@gmail.com
257
+ executables:
258
+ - scmversion
259
+ extensions: []
260
+ extra_rdoc_files: []
261
+ files:
262
+ - .gitignore
263
+ - Gemfile
264
+ - LICENSE.txt
265
+ - README.md
266
+ - Rakefile
267
+ - Thorfile
268
+ - VERSION
269
+ - bin/scmversion
270
+ - lib/thor-tropo.rb
271
+ - lib/thor-tropo/version.rb
272
+ - lib/thor/tropo.rb
273
+ - thor-tropo.gemspec
274
+ homepage: https://github.com/johntdyer/thor-tropo
275
+ licenses: []
276
+ post_install_message:
277
+ rdoc_options: []
278
+ require_paths:
279
+ - lib
280
+ - bin
281
+ required_ruby_version: !ruby/object:Gem::Requirement
282
+ none: false
283
+ requirements:
284
+ - - ! '>='
285
+ - !ruby/object:Gem::Version
286
+ version: '0'
287
+ required_rubygems_version: !ruby/object:Gem::Requirement
288
+ none: false
289
+ requirements:
290
+ - - ! '>='
291
+ - !ruby/object:Gem::Version
292
+ version: '0'
293
+ requirements: []
294
+ rubyforge_project:
295
+ rubygems_version: 1.8.23
296
+ signing_key:
297
+ specification_version: 3
298
+ summary: Set of tasks to assist in making packages from a git controlled project.
299
+ test_files: []
300
+ has_rdoc: