cartage 1.2 → 2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Cartage.yml.rdoc +51 -215
- data/Contributing.md +71 -0
- data/Extending.md +520 -0
- data/History.md +106 -0
- data/{Licence.rdoc → Licence.md} +5 -5
- data/Manifest.txt +19 -12
- data/README.rdoc +64 -109
- data/Rakefile +37 -32
- data/bin/cartage +2 -2
- data/cartage-cli.md +137 -0
- data/cartage.yml.sample +43 -153
- data/lib/cartage.rb +296 -366
- data/lib/cartage/backport.rb +66 -0
- data/lib/cartage/cli.rb +234 -0
- data/lib/cartage/commands/echo.rb +23 -0
- data/lib/cartage/commands/info.rb +57 -0
- data/lib/cartage/commands/manifest.rb +88 -0
- data/lib/cartage/commands/pack.rb +18 -0
- data/lib/cartage/config.rb +118 -125
- data/lib/cartage/core.rb +112 -0
- data/lib/cartage/gli_ext.rb +58 -0
- data/lib/cartage/minitest.rb +140 -0
- data/lib/cartage/plugin.rb +137 -25
- data/lib/cartage/plugins/build_tarball.rb +40 -0
- data/lib/cartage/{manifest.rb → plugins/manifest.rb} +47 -35
- data/test/minitest_config.rb +3 -65
- data/test/test_cartage.rb +253 -109
- data/test/test_cartage_build_tarball.rb +57 -0
- data/test/test_cartage_config.rb +100 -28
- data/test/test_cartage_core.rb +172 -0
- data/test/test_cartage_manifest.rb +234 -13
- data/test/test_cartage_plugin.rb +85 -0
- metadata +63 -79
- data/.autotest +0 -8
- data/.gemtest +0 -1
- data/.minitest.rb +0 -2
- data/.travis.yml +0 -36
- data/Contributing.rdoc +0 -66
- data/Gemfile +0 -9
- data/History.rdoc +0 -43
- data/lib/cartage/command.rb +0 -59
- data/lib/cartage/manifest/commands.rb +0 -106
- data/lib/cartage/pack_command.rb +0 -14
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minitest_config'
|
4
|
+
|
5
|
+
describe Cartage::Plugin do
|
6
|
+
let(:config) { Cartage::Config.load(:default) }
|
7
|
+
let(:cartage) { Cartage.new(config) }
|
8
|
+
let(:plugin) { Cartage::Plugin::Test }
|
9
|
+
let(:instance) { plugin.new(cartage) }
|
10
|
+
|
11
|
+
it 'cannot be instantiated without being subclassed' do
|
12
|
+
assert_raises_with_message NotImplementedError, 'not a subclass' do
|
13
|
+
Cartage::Plugin.new(cartage)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Cartage::Plugin::Test < ::Cartage::Plugin
|
18
|
+
def test
|
19
|
+
'test'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe Cartage::Plugin::Test do
|
24
|
+
it 'is enabled by default' do
|
25
|
+
assert_true instance.enabled?
|
26
|
+
assert_false instance.disabled?
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'can be disabled by configuration' do
|
30
|
+
contents = {
|
31
|
+
plugins: {
|
32
|
+
test: {
|
33
|
+
disabled: true
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}.to_yaml
|
37
|
+
|
38
|
+
config = instance_stub Pathname, :read, -> { contents } do
|
39
|
+
instance_stub Pathname, :exist?, -> { true } do
|
40
|
+
Cartage::Config.load('foo')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
cartage = Cartage.new(config)
|
45
|
+
assert_false cartage.test.enabled?
|
46
|
+
assert_true cartage.test.disabled?
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'has its configured feature offers' do
|
50
|
+
assert_true instance.offer?(:test)
|
51
|
+
assert_false instance.offer?(:other)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'is named based on the class' do
|
55
|
+
assert_equal 'test', instance.plugin_name
|
56
|
+
assert_equal 'test', plugin.plugin_name
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe Cartage::Plugins do
|
61
|
+
let(:manifest) { Cartage::Manifest.new(cartage) }
|
62
|
+
let(:subject) { Cartage::Plugins.new.tap { |c| c.add(instance, manifest) } }
|
63
|
+
|
64
|
+
it '#enabled returns all enabled plugins' do
|
65
|
+
instance.define_singleton_method(:disabled?, -> { true })
|
66
|
+
assert_equal 1, subject.enabled.count
|
67
|
+
end
|
68
|
+
|
69
|
+
it '#request executes the named feature on found plug-ins' do
|
70
|
+
instance_stub Cartage::Plugin::Test, :test, -> {} do
|
71
|
+
subject.request(:test)
|
72
|
+
end
|
73
|
+
|
74
|
+
assert_instance_called Cartage::Plugin::Test, :test, 1
|
75
|
+
end
|
76
|
+
|
77
|
+
it '#request_map maps the named feature on found plug-ins' do
|
78
|
+
instance_stub Cartage::Plugin::Test, :test, -> { 'TEST' } do
|
79
|
+
assert_equal %w(TEST), subject.request_map(:test)
|
80
|
+
end
|
81
|
+
|
82
|
+
assert_instance_called Cartage::Plugin::Test, :test, 1
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cartage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: gli
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.13'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.13'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.9'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '5.
|
40
|
+
version: '5.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rdoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '10.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '1.2'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: minitest-bonus-assertions
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '2.0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '2.0'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: minitest-focus
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,60 +226,21 @@ dependencies:
|
|
212
226
|
requirements:
|
213
227
|
- - "~>"
|
214
228
|
- !ruby/object:Gem::Version
|
215
|
-
version: '3.
|
229
|
+
version: '3.15'
|
216
230
|
type: :development
|
217
231
|
prerelease: false
|
218
232
|
version_requirements: !ruby/object:Gem::Requirement
|
219
233
|
requirements:
|
220
234
|
- - "~>"
|
221
235
|
- !ruby/object:Gem::Version
|
222
|
-
version: '3.
|
236
|
+
version: '3.15'
|
223
237
|
description: |-
|
224
|
-
Cartage provides a
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
Cartage has learned its tricks from Heroku, Capistrano, and Hoe. From Hoe, it
|
232
|
-
learned to keep a manifest to control what is packaged (as well as its plug-in
|
233
|
-
system). From Heroku, it learned to keep a simple ignore file. From Capistrano,
|
234
|
-
it learned to mark the Git hashref as a file in its built package, and to
|
235
|
-
timestamp the packages.
|
236
|
-
|
237
|
-
Cartage follows a relatively simple set of steps when creating a package:
|
238
|
-
|
239
|
-
1. Copy the application files to the work area. The application’s files are
|
240
|
-
specified in +Manifest.txt+ and filtered against the exclusion list
|
241
|
-
(+.cartignore+). If there is no +.cartignore+, try to use +.slugignore+. If
|
242
|
-
there is no +.slugignore+, Cartage will use a sensible default exclusion
|
243
|
-
list. To override the use of this exclusion list, an empty +.cartignore+
|
244
|
-
file must be present.
|
245
|
-
|
246
|
-
2. The Git hashref is written to the work area (as +release_hashref+) and to
|
247
|
-
the package staging area.
|
248
|
-
|
249
|
-
3. Files that have been modified are restored to pristine condition in the
|
250
|
-
work area. The source files are not touched. (This ensures that
|
251
|
-
+config/database.yml+, for example, will not be the version used by a
|
252
|
-
continuous integration system.)
|
253
|
-
|
254
|
-
4. Bundler is fetched into the work area, and the bundle is installed into the
|
255
|
-
work area’s +vendor/bundle+ without the +development+ and +test+
|
256
|
-
environments. If a bundle cache is kept (by default, one is), the resulting
|
257
|
-
+vendor/bundle+ will be put into a bundle cache so that future bundle
|
258
|
-
installs are faster.
|
259
|
-
|
260
|
-
5. A timestamped tarball is created from the contents of the work area. It can
|
261
|
-
then be copied to a more permanent or accessible location.
|
262
|
-
|
263
|
-
Cartage is extremely opinionated about its tools and environment:
|
264
|
-
|
265
|
-
* The packages are created with +tar+ and +bzip2+ using <tt>tar cfj</tt>.
|
266
|
-
* Cartage only understands +git+, which is used for creating
|
267
|
-
<tt>release_hashref</tt>s, +Manifest.txt+ creation and comparison, and even
|
268
|
-
default application name detection (from the name of the origin remote).
|
238
|
+
Cartage provides a repeatable means to create a package for a server-side
|
239
|
+
application that can be used in deployment with a configuration tool like
|
240
|
+
Ansible, Chef, Puppet, or Salt. The package is created with vendored
|
241
|
+
dependencies so that it can be deployed in environments with strict access
|
242
|
+
control rules and without requiring development tool presence on the target
|
243
|
+
server(s).
|
269
244
|
email:
|
270
245
|
- aziegler@kineticcafe.com
|
271
246
|
executables:
|
@@ -273,37 +248,46 @@ executables:
|
|
273
248
|
extensions: []
|
274
249
|
extra_rdoc_files:
|
275
250
|
- Cartage.yml.rdoc
|
276
|
-
- Contributing.
|
277
|
-
-
|
278
|
-
-
|
251
|
+
- Contributing.md
|
252
|
+
- Extending.md
|
253
|
+
- History.md
|
254
|
+
- Licence.md
|
279
255
|
- Manifest.txt
|
280
256
|
- README.rdoc
|
257
|
+
- cartage-cli.md
|
281
258
|
files:
|
282
|
-
- ".autotest"
|
283
|
-
- ".gemtest"
|
284
|
-
- ".minitest.rb"
|
285
|
-
- ".travis.yml"
|
286
259
|
- Cartage.yml.rdoc
|
287
|
-
- Contributing.
|
288
|
-
-
|
289
|
-
- History.
|
290
|
-
- Licence.
|
260
|
+
- Contributing.md
|
261
|
+
- Extending.md
|
262
|
+
- History.md
|
263
|
+
- Licence.md
|
291
264
|
- Manifest.txt
|
292
265
|
- README.rdoc
|
293
266
|
- Rakefile
|
294
267
|
- bin/cartage
|
268
|
+
- cartage-cli.md
|
295
269
|
- cartage.yml.sample
|
296
270
|
- lib/cartage.rb
|
297
|
-
- lib/cartage/
|
271
|
+
- lib/cartage/backport.rb
|
272
|
+
- lib/cartage/cli.rb
|
273
|
+
- lib/cartage/commands/echo.rb
|
274
|
+
- lib/cartage/commands/info.rb
|
275
|
+
- lib/cartage/commands/manifest.rb
|
276
|
+
- lib/cartage/commands/pack.rb
|
298
277
|
- lib/cartage/config.rb
|
299
|
-
- lib/cartage/
|
300
|
-
- lib/cartage/
|
301
|
-
- lib/cartage/
|
278
|
+
- lib/cartage/core.rb
|
279
|
+
- lib/cartage/gli_ext.rb
|
280
|
+
- lib/cartage/minitest.rb
|
302
281
|
- lib/cartage/plugin.rb
|
282
|
+
- lib/cartage/plugins/build_tarball.rb
|
283
|
+
- lib/cartage/plugins/manifest.rb
|
303
284
|
- test/minitest_config.rb
|
304
285
|
- test/test_cartage.rb
|
286
|
+
- test/test_cartage_build_tarball.rb
|
305
287
|
- test/test_cartage_config.rb
|
288
|
+
- test/test_cartage_core.rb
|
306
289
|
- test/test_cartage_manifest.rb
|
290
|
+
- test/test_cartage_plugin.rb
|
307
291
|
homepage: https://github.com/KineticCafe/cartage/
|
308
292
|
licenses:
|
309
293
|
- MIT
|
@@ -316,20 +300,20 @@ require_paths:
|
|
316
300
|
- lib
|
317
301
|
required_ruby_version: !ruby/object:Gem::Requirement
|
318
302
|
requirements:
|
319
|
-
- - "
|
303
|
+
- - "~>"
|
320
304
|
- !ruby/object:Gem::Version
|
321
|
-
version: '0'
|
305
|
+
version: '2.0'
|
322
306
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
323
307
|
requirements:
|
324
|
-
- - "
|
308
|
+
- - ">"
|
325
309
|
- !ruby/object:Gem::Version
|
326
|
-
version:
|
310
|
+
version: 1.3.1
|
327
311
|
requirements: []
|
328
312
|
rubyforge_project:
|
329
|
-
rubygems_version: 2.4
|
313
|
+
rubygems_version: 2.6.4
|
330
314
|
signing_key:
|
331
315
|
specification_version: 4
|
332
|
-
summary: Cartage provides a
|
333
|
-
|
334
|
-
|
316
|
+
summary: Cartage provides a repeatable means to create a package for a server-side
|
317
|
+
application that can be used in deployment with a configuration tool like Ansible,
|
318
|
+
Chef, Puppet, or Salt
|
335
319
|
test_files: []
|
data/.autotest
DELETED
data/.gemtest
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
|
data/.minitest.rb
DELETED
data/.travis.yml
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
---
|
2
|
-
sudo: false
|
3
|
-
language: ruby
|
4
|
-
rvm:
|
5
|
-
- "2.2"
|
6
|
-
- "2.1"
|
7
|
-
- 2.0.0
|
8
|
-
- ruby-head
|
9
|
-
- jruby-head
|
10
|
-
- jruby-9.0.0.0.pre1
|
11
|
-
- rbx-2
|
12
|
-
matrix:
|
13
|
-
allow_failures:
|
14
|
-
- rvm: rbx-2
|
15
|
-
- rvm: jruby-head
|
16
|
-
- rvm: jruby-9.0.0.0.pre1
|
17
|
-
- rvm: ruby-head
|
18
|
-
gemfile:
|
19
|
-
- Gemfile
|
20
|
-
before_script:
|
21
|
-
- |
|
22
|
-
case "${TRAVIS_RUBY_VERSION}" in
|
23
|
-
rbx*)
|
24
|
-
gem install psych
|
25
|
-
;;
|
26
|
-
esac
|
27
|
-
- rake travis:before -t
|
28
|
-
script: rake travis
|
29
|
-
after_script:
|
30
|
-
- rake travis:after -t
|
31
|
-
notifications:
|
32
|
-
email:
|
33
|
-
recipients:
|
34
|
-
- aziegler@kineticcafe.com
|
35
|
-
on_success: change
|
36
|
-
on_failure: always
|
data/Contributing.rdoc
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
== Contributing
|
2
|
-
|
3
|
-
We value any contribution to cartage you can provide: a bug report, a feature
|
4
|
-
request, or code contributions.
|
5
|
-
|
6
|
-
Cartage is reasonably complex code, so there are a few guidelines:
|
7
|
-
|
8
|
-
* Changes *will* *not* be accepted without tests. The test suite is written
|
9
|
-
with {Minitest}[https://github.com/seattlerb/minitest].
|
10
|
-
* Match our coding style.
|
11
|
-
* Use a thoughtfully-named topic branch that contains your change. Rebase your
|
12
|
-
commits into logical chunks as necessary.
|
13
|
-
* Use {quality commit messages}[http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html].
|
14
|
-
* Do not change the version number; when your patch is accepted and a release
|
15
|
-
is made, the version will be updated at that point.
|
16
|
-
* Submit a GitHub pull request with your changes.
|
17
|
-
* New behaviours and features are probably better created as cartage plugins.
|
18
|
-
If they are best suited for the core Cartage features, they require new or
|
19
|
-
updated documentation.
|
20
|
-
|
21
|
-
=== Test Dependencies
|
22
|
-
|
23
|
-
Cartage uses Ryan Davis’s {Hoe}[https://github.com/seattlerb/hoe] to manage the
|
24
|
-
release process, and it adds a number of rake tasks. You will mostly be
|
25
|
-
interested in:
|
26
|
-
|
27
|
-
$ rake
|
28
|
-
|
29
|
-
which runs the tests the same way that:
|
30
|
-
|
31
|
-
$ rake test
|
32
|
-
$ rake travis
|
33
|
-
|
34
|
-
will do.
|
35
|
-
|
36
|
-
To assist with the installation of the development dependencies for
|
37
|
-
cartage, I have provided the simplest possible Gemfile pointing to
|
38
|
-
the (generated) +cartage.gemspec+ file. This will permit you to do:
|
39
|
-
|
40
|
-
$ bundle install
|
41
|
-
|
42
|
-
to get the development dependencies. If you aleady have +hoe+ installed, you
|
43
|
-
can accomplish the same thing with:
|
44
|
-
|
45
|
-
$ rake newb
|
46
|
-
|
47
|
-
This task will install any missing dependencies, run the tests/specs, and
|
48
|
-
generate the RDoc.
|
49
|
-
|
50
|
-
=== Workflow
|
51
|
-
|
52
|
-
Here's the most direct way to get your work merged into the project:
|
53
|
-
|
54
|
-
* Fork the project.
|
55
|
-
* Clone down your fork (<tt>git clone git://github.com/KineticCafe/cartage.git</tt>).
|
56
|
-
* Create a topic branch to contain your change (<tt>git checkout -b my\_awesome\_feature</tt>).
|
57
|
-
* Hack away, add tests. Not necessarily in that order.
|
58
|
-
* Make sure everything still passes by running +rake+.
|
59
|
-
* If necessary, rebase your commits into logical chunks, without errors.
|
60
|
-
* Push the branch up (<tt>git push origin my\_awesome\_feature</tt>).
|
61
|
-
* Create a pull request against KineticCafe/cartage and describe
|
62
|
-
what your change does and the why you think it should be merged.
|
63
|
-
|
64
|
-
=== Contributors
|
65
|
-
|
66
|
-
* Austin Ziegler created Cartage.
|