roger 1.4.5 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c24e57e95788bdd88359a7e8d02a380a4a75f3e4
4
- data.tar.gz: a367cd14e6f5d835e006f4447fd981ab2b4d3bb7
3
+ metadata.gz: ff392fddffc0c128c0f1c2ed637a0fb34cfa056d
4
+ data.tar.gz: 8732e488d0ad390ebcf49aba40bf6a654446b6bf
5
5
  SHA512:
6
- metadata.gz: 15a711d5f391dcc2a6f080526323e831fc15cc5687a353a73d55f9fce227fa2632efb999b334fd16b7c376c34fa62190b37ce544008c49458ce220dfe5d57720
7
- data.tar.gz: 78ef19b99cdf2d2c84b96f119a86f05a2305979cff5f243ab8a2d9141b635c1ac67d425c6904d5ae2a9d7faf00b072460b8d82d561096dd600f95c0902d1f593
6
+ metadata.gz: d9c61357b6b2497f66e4f01ae627ed8ea20cc8cbe96f9a71db15ac15737019da9fecdd9e606723cdff76443b78f4328f1c3ac5dee3fafeca7ab4c3294b0b365d
7
+ data.tar.gz: 73320c598c51c6585c7cc82d5ab84f23446adea024371a67e42c7e26ca6f89fb8001d05b3ba97861c1450b8ed646ba7cf5c3b25ab78a29856f5dcc7554389eb6
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 1.4.6
4
+ * Allow setting target_path in dir finalizer
5
+ * Always create target_paths if they don't exist
6
+
3
7
  ## Version 1.4.5
4
8
  * Allow setting target_path in zip finalizer
5
9
 
@@ -7,12 +7,19 @@ module Roger::Release::Finalizers
7
7
  #
8
8
  class Dir < Base
9
9
  # @option options :prefix Prefix to put before the version (default = "html")
10
- def call(release, options = {})
11
- options = {}.update(@options)
12
- options.update(options) if options
10
+ def call(release, call_options = {})
11
+ options = {
12
+ prefix: "html",
13
+ target_path: release.target_path
14
+ }.update(@options)
15
+ options.update(call_options) if call_options
13
16
 
14
- name = [(options[:prefix] || "html"), release.scm.version].join("-")
15
- target_path = release.target_path + name
17
+ name = [options[:prefix], release.scm.version].join("-")
18
+
19
+ target_dir = Pathname.new(options[:target_path])
20
+ FileUtils.mkdir_p(target_dir) unless target_dir.exist?
21
+
22
+ target_path = target_dir + name
16
23
 
17
24
  release.log(self, "Finalizing release to #{target_path}")
18
25
 
@@ -16,8 +16,10 @@ module Roger::Release::Finalizers
16
16
 
17
17
  options.update(call_options) if call_options
18
18
 
19
+ target_path = ensure_target_path(options[:target_path])
20
+
19
21
  name = [options[:prefix], release.scm.version].join("-") + ".zip"
20
- zip_path = Pathname.new(options[:target_path]) + name
22
+ zip_path = target_path + name
21
23
 
22
24
  release.log(self, "Finalizing release to #{zip_path}")
23
25
 
@@ -32,6 +34,12 @@ module Roger::Release::Finalizers
32
34
 
33
35
  protected
34
36
 
37
+ def ensure_target_path(path)
38
+ target_path = Pathname.new(path)
39
+ FileUtils.mkdir_p(target_path) unless target_path.exist?
40
+ target_path
41
+ end
42
+
35
43
  def cleanup_existing_zip(release, path)
36
44
  return unless File.exist?(path)
37
45
 
@@ -1,4 +1,4 @@
1
1
  # Roger main namespace
2
2
  module Roger
3
- VERSION = "1.4.5"
3
+ VERSION = "1.4.6"
4
4
  end
@@ -39,5 +39,32 @@ module Roger
39
39
 
40
40
  assert_not_same original_ctime, File.ctime(dir)
41
41
  end
42
+
43
+ def test_target_path
44
+ finalizer = Roger::Release::Finalizers::Dir.new
45
+ dir = @release.project.construct.directory("rel")
46
+
47
+ finalizer.call(@release, target_path: dir)
48
+
49
+ assert File.exist?(dir + "html-1.0.0")
50
+ end
51
+
52
+ def test_target_path_with_string
53
+ finalizer = Roger::Release::Finalizers::Dir.new
54
+ dir = @release.project.construct.directory("rel")
55
+
56
+ finalizer.call(@release, target_path: dir.to_s)
57
+
58
+ assert File.exist?(dir + "html-1.0.0")
59
+ end
60
+
61
+ def test_target_path_will_be_created_if_nonexistent
62
+ finalizer = Roger::Release::Finalizers::Dir.new
63
+ dir = @release.target_path + "rel"
64
+
65
+ finalizer.call(@release, target_path: dir)
66
+
67
+ assert File.exist?(dir + "html-1.0.0")
68
+ end
42
69
  end
43
70
  end
@@ -57,5 +57,14 @@ module Roger
57
57
 
58
58
  assert File.exist?(dir + "html-1.0.0.zip")
59
59
  end
60
+
61
+ def test_target_path_will_be_created_if_nonexistent
62
+ finalizer = Roger::Release::Finalizers::Zip.new
63
+ dir = @release.build_path + "downloads"
64
+
65
+ finalizer.call(@release, target_path: dir)
66
+
67
+ assert File.exist?(dir + "html-1.0.0.zip")
68
+ end
60
69
  end
61
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flurin Egger