cartage 1.0
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.
- checksums.yaml +7 -0
- data/.autotest +8 -0
- data/.gemtest +1 -0
- data/.minitest.rb +2 -0
- data/.travis.yml +36 -0
- data/Cartage.yml.rdoc +271 -0
- data/Contributing.rdoc +66 -0
- data/Gemfile +9 -0
- data/History.rdoc +5 -0
- data/Licence.rdoc +27 -0
- data/Manifest.txt +24 -0
- data/README.rdoc +192 -0
- data/Rakefile +62 -0
- data/bin/cartage +8 -0
- data/cartage.yml.sample +172 -0
- data/lib/cartage.rb +496 -0
- data/lib/cartage/command.rb +59 -0
- data/lib/cartage/config.rb +193 -0
- data/lib/cartage/manifest.rb +218 -0
- data/lib/cartage/manifest/commands.rb +106 -0
- data/lib/cartage/pack_command.rb +14 -0
- data/lib/cartage/plugin.rb +80 -0
- data/test/minitest_config.rb +72 -0
- data/test/test_cartage.rb +261 -0
- data/test/test_cartage_config.rb +47 -0
- metadata +348 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d1f67642374f3f5997dd5d735d20b33e8e035c5c
|
4
|
+
data.tar.gz: 64cd9abc15c2bf0a2e8097545a1013d434b38e6b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5939952a64d810668aeec416727bdaadda5011d594115719bbfd5aaf3af3ee86d89614dd3689d7cfc30c41a76b459e7de1a40c811f13285c5eb56b8e101d1d42
|
7
|
+
data.tar.gz: dfd005d425fff150f5b465c1a88af03f6e2df935a3c2152f0607e84265524d44a6ef90d8dcb3c59b28e0463d2ded90ae9ece49a58dcf87803fe91e87b8e9b4d3
|
data/.autotest
ADDED
data/.gemtest
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
|
data/.minitest.rb
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,36 @@
|
|
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/Cartage.yml.rdoc
ADDED
@@ -0,0 +1,271 @@
|
|
1
|
+
= An Example cartage.yml
|
2
|
+
|
3
|
+
The best way to understand how to configure Cartage is to see an annotated
|
4
|
+
example of a +cartage.yml+ file.
|
5
|
+
|
6
|
+
== Secrets and cartage.yml
|
7
|
+
|
8
|
+
The items in the main part of the Cartage configuration are *not* generally
|
9
|
+
secret, but they are also not typically things that would be set in a static
|
10
|
+
configuration file. The main value that would probably be set under most
|
11
|
+
circumstances is the +name+ value.
|
12
|
+
|
13
|
+
Because Cartage reads its configuration through ERB, the following structure is
|
14
|
+
recommended for +config/cartage.yml+.
|
15
|
+
|
16
|
+
---
|
17
|
+
name: my-application
|
18
|
+
|
19
|
+
# This must not be indented for it to work.
|
20
|
+
<% if File.exist?('config/ansible/cartage.yml') %>
|
21
|
+
<%= File.read('config/ansible/cartage.yml') %>
|
22
|
+
<% end %>
|
23
|
+
<% if File.exist?('config/local/cartage.yml') %>
|
24
|
+
<%= File.read('config/local/cartage.yml') %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
== Main Cartage Configuration Options
|
28
|
+
|
29
|
+
=== +name+
|
30
|
+
|
31
|
+
The name of the application. Optional, defaults to the basename of the origin
|
32
|
+
Git URL. Overridden with <tt>cartage --name NAME</tt>.
|
33
|
+
|
34
|
+
name: my-application
|
35
|
+
|
36
|
+
=== +target+
|
37
|
+
|
38
|
+
The target path for the Cartage package. Optional and defaults to
|
39
|
+
<tt>./tmp</tt>. Overridden with <tt>cartage --target PATH</tt>.
|
40
|
+
|
41
|
+
target: tmp/cartage
|
42
|
+
|
43
|
+
=== +root_path+
|
44
|
+
|
45
|
+
The root path of the application. Optional, defaults to the top of the Git
|
46
|
+
repository (<tt>git rev-parse --show-cdup</tt>). Overridden with <tt>cartage
|
47
|
+
--root-path ROOT_PATH</tt>.
|
48
|
+
|
49
|
+
root_path: .
|
50
|
+
|
51
|
+
=== +timestamp+
|
52
|
+
|
53
|
+
The timestamp for the final package (which is
|
54
|
+
<tt><em>name</em>-<em>timestamp</em></tt>). Optional, defaults to the current
|
55
|
+
time in UTC. Overridden with <tt>cartage --timestamp TIMESTAMP</tt>. This
|
56
|
+
value is *not* validated to be a time value when supplied.
|
57
|
+
|
58
|
+
timestamp: not-a-timestamp
|
59
|
+
|
60
|
+
=== +bundle_cache+
|
61
|
+
|
62
|
+
The bundle cache path, where the package’s <tt>vendor-bundle.tar.bz2</tt>
|
63
|
+
will be stored between builds. Optional, defaults to <tt>./tmp</tt>.
|
64
|
+
Overridden with <tt>cartage --bundle-cache BUNDLE_CACHE</tt>.
|
65
|
+
|
66
|
+
bundle_cache: tmp/cache
|
67
|
+
|
68
|
+
=== +without+
|
69
|
+
|
70
|
+
The groups to exclude from <tt>bundle install</tt>. Optional, defaults to <tt>[
|
71
|
+
"development", "test"]</tt>. Overridden with <tt>cartage --without
|
72
|
+
group1,group2</tt>.
|
73
|
+
|
74
|
+
without:
|
75
|
+
- development
|
76
|
+
- test
|
77
|
+
- other
|
78
|
+
|
79
|
+
=== +plugins+
|
80
|
+
|
81
|
+
A dictionary that contains all plug-in configuration, keyed by plug-in name.
|
82
|
+
|
83
|
+
== Cartage Plug-In Configuration Options
|
84
|
+
|
85
|
+
=== cartage-s3
|
86
|
+
|
87
|
+
Cartage-s3 needs to know where to put the completed package and how to log into
|
88
|
+
the selected storage provider.
|
89
|
+
|
90
|
+
==== +path+
|
91
|
+
|
92
|
+
The path to the cartage S3 bucket or directory (for another service that
|
93
|
+
Fog::Storage supports). This has no default and is overridden with <tt>cartage
|
94
|
+
s3 --path PATH</tt>.
|
95
|
+
|
96
|
+
plugins:
|
97
|
+
s3:
|
98
|
+
path: cartage-bucket
|
99
|
+
|
100
|
+
==== +credentials+
|
101
|
+
|
102
|
+
The credentials dictionary passed to Fog::Storage for uploads. Each provider
|
103
|
+
has different keys. If present, this will dictionary be used in preference to
|
104
|
+
<tt>cartage s3</tt> flags <tt>--key-id</tt>, <tt>--secret-key</tt>, and
|
105
|
+
<tt>--region</tt> as those work *only* with Amazon AWS S3.
|
106
|
+
|
107
|
+
===== AWS
|
108
|
+
|
109
|
+
AWS S3 storage connections need +provider+, +aws_access_key_id+,
|
110
|
+
+aws_secret_access_key+, and +region+.
|
111
|
+
|
112
|
+
plugins:
|
113
|
+
s3:
|
114
|
+
credentials:
|
115
|
+
provider: AWS
|
116
|
+
aws_access_key_id: YOUR_AWS_ACCESS_KEY_ID
|
117
|
+
aws_secret_access_key: YOUR_AWS_SECRET_ACCESS_KEY
|
118
|
+
region: us-west-2
|
119
|
+
|
120
|
+
===== Rackspace
|
121
|
+
|
122
|
+
Rackspace storage connections need +provider+, +rackspace_username+,
|
123
|
+
+rackspace_api_key+, and optionally +rackspace_auth_url+.
|
124
|
+
|
125
|
+
plugins:
|
126
|
+
s3:
|
127
|
+
credentials:
|
128
|
+
provider: Rackspace
|
129
|
+
rackspace_username: RACKSPACE_USERNAME
|
130
|
+
rackspace_api_key: RACKSPACE_API_KEY
|
131
|
+
rackspace_auth_url: lon.auth.api.rackspacecloud.com
|
132
|
+
|
133
|
+
===== Google
|
134
|
+
|
135
|
+
Google storage connections need +provider+, +google_storage_access_key_id+, and
|
136
|
+
+google_storage_secret_access_key+.
|
137
|
+
|
138
|
+
plugins:
|
139
|
+
s3:
|
140
|
+
credentials:
|
141
|
+
provider: Google
|
142
|
+
google_storage_access_key_id: YOUR_SECRET_ACCESS_KEY_ID
|
143
|
+
google_storage_secret_access_key: YOUR_SECRET_ACCESS_KEY
|
144
|
+
|
145
|
+
=== cartage-remote
|
146
|
+
|
147
|
+
Cartage-remote needs to know where its remote build is going to run and how to
|
148
|
+
authenticate. It may also be told *what* to run. For cartage-remote 1.0, the
|
149
|
+
+remote+ configuration section is *required* (at least the +server+ key).
|
150
|
+
|
151
|
+
==== +server+
|
152
|
+
|
153
|
+
The name of the build server. This field is required and can show up in two
|
154
|
+
different formats. The first is as a string matching
|
155
|
+
<tt>[user@]host[:port]</tt>.
|
156
|
+
|
157
|
+
plugins:
|
158
|
+
remote:
|
159
|
+
server: build@my-build-machine:2222
|
160
|
+
|
161
|
+
The second is as a dictionary with +user+, +host+, and +port+ keys.
|
162
|
+
|
163
|
+
plugins:
|
164
|
+
remote:
|
165
|
+
server:
|
166
|
+
user: build
|
167
|
+
host: my-build-machine
|
168
|
+
port: 2222
|
169
|
+
|
170
|
+
==== +keys+
|
171
|
+
|
172
|
+
The SSH key(s) used to connect to the server. Optional, and cartage-remote will
|
173
|
+
use <tt>~/.ssh/*id_[rd]sa</tt> to find keys if this is not provided. The first
|
174
|
+
format is as a dictionary, embedding private keys directly in the configuration
|
175
|
+
file.
|
176
|
+
|
177
|
+
plugins:
|
178
|
+
remote:
|
179
|
+
keys:
|
180
|
+
custom: |
|
181
|
+
-----BEGIN RSA PRIVATE KEY-----
|
182
|
+
...
|
183
|
+
-----END RSA PRIVATE KEY-----
|
184
|
+
|
185
|
+
The second form is as an array of glob patterns to match key files.
|
186
|
+
|
187
|
+
plugins:
|
188
|
+
remote:
|
189
|
+
keys:
|
190
|
+
- "config/secrets/*id_[rd]sa"
|
191
|
+
- "~/.ssh/*id_[rd]sa"
|
192
|
+
|
193
|
+
The third form is as a single glob pattern to match key files or a specific key
|
194
|
+
file.
|
195
|
+
|
196
|
+
plugins:
|
197
|
+
remote:
|
198
|
+
keys: "config/secrets/*id_[rd]sa"
|
199
|
+
|
200
|
+
==== +build+
|
201
|
+
|
202
|
+
The build script that will be run on the remote server. This is optional with a
|
203
|
+
reasonable default, below.
|
204
|
+
|
205
|
+
#!/bin/bash
|
206
|
+
set -e
|
207
|
+
if [ -f Gemfile ]; then
|
208
|
+
bundle install --path %<remote_bundle>s
|
209
|
+
bundle exec cartage build \
|
210
|
+
--config-file %<config_file>s \
|
211
|
+
--target %<project_path>s
|
212
|
+
else
|
213
|
+
cartage build --config-file %<config_file>s \
|
214
|
+
--target %<project_path>s
|
215
|
+
fi
|
216
|
+
|
217
|
+
An example with an alternate build script that uses cartage-s3 to upload.
|
218
|
+
|
219
|
+
plugins:
|
220
|
+
remote:
|
221
|
+
build: |
|
222
|
+
#!/bin/bash
|
223
|
+
set -e
|
224
|
+
if [ -f Gemfile ]; then
|
225
|
+
bundle install --path %<remote_bundle>s
|
226
|
+
bundle exec cartage s3 \
|
227
|
+
--config-file %<config_file>s \
|
228
|
+
--target %<project_path>s \
|
229
|
+
--verbose
|
230
|
+
else
|
231
|
+
cartage build \
|
232
|
+
--config-file %<config_file>s \
|
233
|
+
--target %<project_path>s \
|
234
|
+
--verbose
|
235
|
+
fi
|
236
|
+
|
237
|
+
==== +prebuild+
|
238
|
+
|
239
|
+
The prebuild script that will be run on the local system. This is optional with
|
240
|
+
a reasonable default, below:
|
241
|
+
|
242
|
+
#!/bin/bash
|
243
|
+
ssh-keyscan -H %<remote_host>s >> ~/.ssh/known_hosts
|
244
|
+
|
245
|
+
An example with a slightly extended example is below. It is strongly
|
246
|
+
recommended that the <tt>ssh-keyscan</tt> step be run in all prebuild scripts
|
247
|
+
as cartage-remote runs SSH in a paranoid mode.
|
248
|
+
|
249
|
+
plugins:
|
250
|
+
remote:
|
251
|
+
prebuild: |
|
252
|
+
#!/bin/bash
|
253
|
+
ssh-keyscan -H %<remote_host>s >> ~/.ssh/known_hosts
|
254
|
+
echo 'Prebuild complete'
|
255
|
+
|
256
|
+
==== +postbuild+
|
257
|
+
|
258
|
+
The postbuild script that will be run on the local system. This is optional
|
259
|
+
with no default (no post-build actions).
|
260
|
+
|
261
|
+
An example that posts a message to Slack is below.
|
262
|
+
|
263
|
+
plugins:
|
264
|
+
remote:
|
265
|
+
postbuild: |
|
266
|
+
#!/bin/bash
|
267
|
+
t="token=SLACK_TOKEN"
|
268
|
+
c="channel=%23ci"
|
269
|
+
d=MYDOMAIN
|
270
|
+
u="https://${d}.slack.com/services/hooks/slackbot?${t}&${c}"
|
271
|
+
curl --data "Build %<name>s-%<timestamp>s complete." ${u}
|
data/Contributing.rdoc
ADDED
@@ -0,0 +1,66 @@
|
|
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.
|
data/Gemfile
ADDED
data/History.rdoc
ADDED
data/Licence.rdoc
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
== Licence
|
2
|
+
|
3
|
+
This software is available under an MIT-style licence.
|
4
|
+
|
5
|
+
* Copyright 2015 Kinetic Cafe
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
8
|
+
this software and associated documentation files (the "Software"), to deal in
|
9
|
+
the Software without restriction, including without limitation the rights to
|
10
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
11
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
12
|
+
so, subject to the following conditions:
|
13
|
+
|
14
|
+
* The names of its contributors may not be used to endorse or promote
|
15
|
+
products derived from this software without specific prior written
|
16
|
+
permission.
|
17
|
+
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
19
|
+
copies or substantial portions of the Software.
|
20
|
+
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
27
|
+
SOFTWARE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
.autotest
|
2
|
+
.gemtest
|
3
|
+
.minitest.rb
|
4
|
+
.travis.yml
|
5
|
+
Cartage.yml.rdoc
|
6
|
+
Contributing.rdoc
|
7
|
+
Gemfile
|
8
|
+
History.rdoc
|
9
|
+
Licence.rdoc
|
10
|
+
Manifest.txt
|
11
|
+
README.rdoc
|
12
|
+
Rakefile
|
13
|
+
bin/cartage
|
14
|
+
cartage.yml.sample
|
15
|
+
lib/cartage.rb
|
16
|
+
lib/cartage/command.rb
|
17
|
+
lib/cartage/config.rb
|
18
|
+
lib/cartage/manifest.rb
|
19
|
+
lib/cartage/manifest/commands.rb
|
20
|
+
lib/cartage/pack_command.rb
|
21
|
+
lib/cartage/plugin.rb
|
22
|
+
test/minitest_config.rb
|
23
|
+
test/test_cartage.rb
|
24
|
+
test/test_cartage_config.rb
|