cartage 2.0 → 2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2eb844544a84e06ad6bccddcc0a728f0fbc60c4b
4
- data.tar.gz: ec610a1c7412e3be6f0bad168ba11bf7892f6d78
3
+ metadata.gz: 917038345215ec704cfda8af3112c1e0bc2c98a0
4
+ data.tar.gz: af1617b95d9f8e1bdfdc184a3f58402bb1459281
5
5
  SHA512:
6
- metadata.gz: 4d8b293126b129ed714459adce60cb5c8d6f856f8e3b37c26f2ccb1fc011a0a161a2eef901407a100929a882fb211290d42c4e3667d20380a15c83f726af5716
7
- data.tar.gz: a6ae8c8df8b6cc3612f60d3b59c0f367b033241c70a4185499f855d8fa2835c83b9b8aa330f04913f60ee797991ba58a591529fd2677c1095cc6da99e0ac9c86
6
+ metadata.gz: 34061d77b8635fa5bd7cf55b082d7d6f464111d61b1887ec2c08b7a36df07e86a6a0a63ab6803e5b8d722e40d045355ea41dacfea8bd9dad6dd328ae4a0408b9
7
+ data.tar.gz: b93a1abb24bc2e038c036231bd0f578c139603a998b2b81147466511020d0e653723453551bdac2015208f43e07af23299779fb3e99c5b9e2b2f55d6ed7322df
@@ -51,15 +51,15 @@ Here's the most direct way to get your work merged into the project:
51
51
 
52
52
  * Fork the project.
53
53
  * Clone down your fork (`git clone
54
- git://github.com/KineticCafe/cartage.git`).
54
+ git://github.com/<username>/cartage.git`).
55
55
  * Create a topic branch to contain your change (`git checkout -b
56
56
  my_awesome_feature`).
57
57
  * Hack away, add tests. Not necessarily in that order.
58
58
  * Make sure everything still passes by running `rake`.
59
59
  * If necessary, rebase your commits into logical chunks, without errors.
60
60
  * Push the branch up (`git push origin my_awesome_feature`).
61
- * Create a pull request against KineticCafe/cartage and describe
62
- what your change does and the why you think it should be merged.
61
+ * Create a pull request against KineticCafe/cartage and describe your change
62
+ does and the why you think it should be merged.
63
63
 
64
64
  ### Contributors
65
65
 
data/History.md CHANGED
@@ -1,3 +1,23 @@
1
+ ### 2.1 / 2017-02-18
2
+
3
+ * Cartage 2.1 now knows how to load plug-ins relative to the project root
4
+ path. If you have a plug-in that you aren’t ready to release as a gem, just
5
+ put it in your project as `<ROOT_PATH>/lib/cartage/plugins/foo.rb`; Cartage
6
+ will find it automatically. This feature does not work with command
7
+ extensions.
8
+
9
+ * The hidden command, `cartage info plugins`, will now correctly report
10
+ plug-in versions.
11
+
12
+ * Cartage tries to restore files that were modified by a build system prior
13
+ to packaging. This would fail on files that were not part of the resulting
14
+ tarball (because they were in .cartignore). This has been fixed.
15
+
16
+ * A new utility function, Cartage#recursive_copy has been added to
17
+ recursively copy directories from disk into the work path. The interaction
18
+ of relative and absolute directories is subtle but documented on the method
19
+ itself.
20
+
1
21
  ### 2.0 / 2016-05-31
2
22
 
3
23
  * Rewrite! Over the last year, a number of deficiencies have been found,
data/Rakefile CHANGED
@@ -14,6 +14,7 @@ Hoe.plugin :travis
14
14
 
15
15
  spec = Hoe.spec 'cartage' do
16
16
  developer('Austin Ziegler', 'aziegler@kineticcafe.com')
17
+ developer('Kinetic Cafe', 'dev@kineticcafe.com')
17
18
 
18
19
  self.history_file = 'History.md'
19
20
  self.readme_file = 'README.rdoc'
@@ -24,7 +25,7 @@ spec = Hoe.spec 'cartage' do
24
25
 
25
26
  extra_deps << ['gli', '~> 2.13']
26
27
 
27
- extra_dev_deps << ['rake', '>= 10.0']
28
+ extra_dev_deps << ['rake', '>= 10.0', '< 12.0']
28
29
  extra_dev_deps << ['rdoc', '~> 4.2']
29
30
  extra_dev_deps << ['hoe-doofus', '~> 1.0']
30
31
  extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
@@ -10,7 +10,7 @@ require 'cartage/config'
10
10
  ##
11
11
  # Cartage, a reliable package builder.
12
12
  class Cartage
13
- VERSION = '2.0' #:nodoc:
13
+ VERSION = '2.1' #:nodoc:
14
14
 
15
15
  # Creates a new Cartage instance. If provided a Cartage::Config object in
16
16
  # +config+, sets the configuration and resolves it. If +config+ is not
@@ -298,6 +298,65 @@ class Cartage
298
298
  end
299
299
  end
300
300
 
301
+ # Recursively copy a provided +path+ to the #work_path, using a tar pipeline.
302
+ # The target location can be amended by the use of the +to+ parameter as a
303
+ # relative path to #work_path.
304
+ #
305
+ # If a relative +path+ is provided, it will be treated as relative to
306
+ # #root_path, and it will be used unmodified for writing to the target
307
+ # location. If an absolute path is provided, only the last part of the path
308
+ # will be used as the target name.
309
+ #
310
+ # An error will be raised if either +path+ or +to+ contains a parent-relative
311
+ # reference (<tt>../</tt>), or if the tar pipeline fails.
312
+ #
313
+ # === Examples
314
+ #
315
+ # cartage.recursive_copy('public/assets')
316
+ #
317
+ # This will cause <tt><em>root_path</em>/public/assets</tt> to be copied into
318
+ # <tt><em>work_path</em>/public/assets</tt>.
319
+ #
320
+ # cartage.recursive_copy('/tmp/public/assets')
321
+ #
322
+ # This will cause <tt>/tmp/public/assets</tt> to be copied into
323
+ # <tt><em>work_path</em>/assets</tt>.
324
+ #
325
+ # cartage.recursive_copy('/tmp/public/assets', to: 'public')
326
+ #
327
+ # This will cause <tt>/tmp/public/assets</tt> to be copied into
328
+ # <tt><em>work_path</em>/public/assets</tt>.
329
+ def recursive_copy(path, to: nil)
330
+ path = Pathname(path)
331
+ to = Pathname(to) if to
332
+
333
+ if path.to_s =~ %r{\.\./} || (to && to.to_s =~ %r{\.\./})
334
+ fail StandardError, "Recursive copy parameters cannot contain '/../'"
335
+ end
336
+
337
+ if path.relative?
338
+ parent = root_path
339
+ else
340
+ parent, path = path.split
341
+ end
342
+
343
+ target = work_path
344
+ target /= to if to
345
+
346
+ tar_cf_cmd = [ 'tar', 'cf', '-', '-h', '-C', parent, path ].map(&:to_s)
347
+ tar_xf_cmd = [ 'tar', 'xf', '-', '-C', target ].map(&:to_s)
348
+
349
+ IO.popen(tar_cf_cmd) do |cf|
350
+ IO.popen(tar_xf_cmd, 'w') do |xf|
351
+ xf.write cf.read
352
+ end
353
+
354
+ fail StandardError, "Error running #{tar_xf_cmd.join(' ')}" unless $?.success?
355
+ end
356
+
357
+ fail StandardError, "Error running #{tar_cf_cmd.join(' ')}" unless $?.success?
358
+ end
359
+
301
360
  private
302
361
 
303
362
  attr_writer :release_hashref
@@ -305,8 +364,6 @@ class Cartage
305
364
  def resolve_config!
306
365
  fail 'No configuration' unless config
307
366
 
308
- Cartage::Plugin.load_for(singleton_class)
309
-
310
367
  self.disable_dependency_cache = config.disable_dependency_cache
311
368
  self.quiet = config.quiet
312
369
  self.verbose = config.verbose
@@ -318,6 +375,12 @@ class Cartage
318
375
  maybe_assign :dependency_cache_path, config.dependency_cache_path
319
376
  maybe_assign :release_hashref, config.release_hashref
320
377
 
378
+ lib = root_path.join('lib').to_s
379
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.any? { |l| l == lib }
380
+ Cartage::Plugin.load(rescan: true)
381
+
382
+ Cartage::Plugin.load_for(singleton_class)
383
+
321
384
  Cartage::Plugin.each do |name|
322
385
  next unless respond_to?(name)
323
386
  plugin = send(name) or next
@@ -400,6 +463,8 @@ class Cartage
400
463
  end
401
464
 
402
465
  def restore_modified_file(filename)
466
+ return unless work_path.join(filename).exist?
467
+
403
468
  command = [
404
469
  'git', 'show', "#{release_hashref}:#{filename}"
405
470
  ]
@@ -48,7 +48,7 @@ that just provide commands are not reported as plugins.
48
48
  puts <<-plugins
49
49
  Active Plug-ins:
50
50
 
51
- #{plugs.join("\n")}
51
+ #{plugs.sort.join("\n")}
52
52
  plugins
53
53
  end
54
54
  end
@@ -31,7 +31,7 @@ class Cartage
31
31
  # The version of the plug-in.
32
32
  def version
33
33
  if const_defined?(:VERSION, false)
34
- VERSION
34
+ self::VERSION
35
35
  else
36
36
  Cartage::VERSION
37
37
  end
@@ -46,10 +46,13 @@ class Cartage
46
46
  # A utility method that will find all Cartage plug-ins and load them. A
47
47
  # Cartage plug-in is found in the Gems as <tt>cartage/plugins/*.rb</tt>
48
48
  # and descends from Cartage::Plugin.
49
- def load #:nodoc:
49
+ def load(rescan: false) #:nodoc:
50
50
  @found ||= {}
51
51
  @loaded ||= {}
52
- @files ||= Gem.find_files('cartage/plugins/*.rb')
52
+
53
+ if @files.nil? || rescan
54
+ @files = Gem.find_files('cartage/plugins/*.rb')
55
+ end
53
56
 
54
57
  @files.reverse_each do |path|
55
58
  name = File.basename(path, '.rb').to_sym
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cartage
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: '2.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Ziegler
8
+ - Kinetic Cafe
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-05-31 00:00:00.000000000 Z
12
+ date: 2017-03-16 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: gli
@@ -30,42 +31,48 @@ dependencies:
30
31
  requirements:
31
32
  - - "~>"
32
33
  - !ruby/object:Gem::Version
33
- version: '5.9'
34
+ version: '5.10'
34
35
  type: :development
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
39
  - - "~>"
39
40
  - !ruby/object:Gem::Version
40
- version: '5.9'
41
+ version: '5.10'
41
42
  - !ruby/object:Gem::Dependency
42
- name: rdoc
43
+ name: rake
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
- - - "~>"
46
+ - - ">="
46
47
  - !ruby/object:Gem::Version
47
- version: '4.0'
48
+ version: '10.0'
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: '12.0'
48
52
  type: :development
49
53
  prerelease: false
50
54
  version_requirements: !ruby/object:Gem::Requirement
51
55
  requirements:
52
- - - "~>"
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '10.0'
59
+ - - "<"
53
60
  - !ruby/object:Gem::Version
54
- version: '4.0'
61
+ version: '12.0'
55
62
  - !ruby/object:Gem::Dependency
56
- name: rake
63
+ name: rdoc
57
64
  requirement: !ruby/object:Gem::Requirement
58
65
  requirements:
59
- - - ">="
66
+ - - "~>"
60
67
  - !ruby/object:Gem::Version
61
- version: '10.0'
68
+ version: '4.2'
62
69
  type: :development
63
70
  prerelease: false
64
71
  version_requirements: !ruby/object:Gem::Requirement
65
72
  requirements:
66
- - - ">="
73
+ - - "~>"
67
74
  - !ruby/object:Gem::Version
68
- version: '10.0'
75
+ version: '4.2'
69
76
  - !ruby/object:Gem::Dependency
70
77
  name: hoe-doofus
71
78
  requirement: !ruby/object:Gem::Requirement
@@ -226,14 +233,14 @@ dependencies:
226
233
  requirements:
227
234
  - - "~>"
228
235
  - !ruby/object:Gem::Version
229
- version: '3.15'
236
+ version: '3.16'
230
237
  type: :development
231
238
  prerelease: false
232
239
  version_requirements: !ruby/object:Gem::Requirement
233
240
  requirements:
234
241
  - - "~>"
235
242
  - !ruby/object:Gem::Version
236
- version: '3.15'
243
+ version: '3.16'
237
244
  description: |-
238
245
  Cartage provides a repeatable means to create a package for a server-side
239
246
  application that can be used in deployment with a configuration tool like
@@ -243,6 +250,7 @@ description: |-
243
250
  server(s).
244
251
  email:
245
252
  - aziegler@kineticcafe.com
253
+ - dev@kineticcafe.com
246
254
  executables:
247
255
  - cartage
248
256
  extensions: []
@@ -310,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
310
318
  version: '0'
311
319
  requirements: []
312
320
  rubyforge_project:
313
- rubygems_version: 2.6.4
321
+ rubygems_version: 2.5.1
314
322
  signing_key:
315
323
  specification_version: 4
316
324
  summary: Cartage provides a repeatable means to create a package for a server-side