rake-funnel 0.13.0.pre → 0.14.0.pre
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 +4 -4
- data/lib/rake/funnel/tasks/zip.rb +7 -1
- data/lib/rake/funnel/version.rb +1 -1
- data/spec/rake/funnel/tasks/zip_spec.rb +42 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2df90b7f521cea1310f24ab8c866e96ec3e81748
|
4
|
+
data.tar.gz: bf9598bfb25bcc2e4a87f20ff62041e085b48b5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e655ab8137fe6a2f23d3a118981a47faeb5791831b59adf00298d3cac5948e1c3e7a16b76a30a82720a29757c50ba599e9ca61f8bac8a8388ab3b7feef59953
|
7
|
+
data.tar.gz: 43b3c6c3570549b05dd48f2f882bbbb017601041d1346487afdddf7164960ea5eae6c0c3598b18aa872c7b3c18155db48b447b1623e4297778c305ed74cba822
|
@@ -6,7 +6,7 @@ module Rake
|
|
6
6
|
class Zip < Rake::TaskLib
|
7
7
|
include Rake::Funnel::Support
|
8
8
|
|
9
|
-
attr_accessor :name, :source, :target, :zip_root
|
9
|
+
attr_accessor :name, :source, :target, :zip_root, :allow_empty
|
10
10
|
|
11
11
|
def initialize(*args, &task_block)
|
12
12
|
setup_ivars(args)
|
@@ -21,6 +21,7 @@ module Rake
|
|
21
21
|
@source = []
|
22
22
|
@target = nil
|
23
23
|
@zip_root = nil
|
24
|
+
@allow_empty = true
|
24
25
|
end
|
25
26
|
|
26
27
|
def define(args, &task_block)
|
@@ -29,6 +30,11 @@ module Rake
|
|
29
30
|
task(name, *args) do |_, task_args|
|
30
31
|
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
|
31
32
|
|
33
|
+
if files.empty? && !allow_empty
|
34
|
+
Rake.rake_output_message('No files to zip')
|
35
|
+
next
|
36
|
+
end
|
37
|
+
|
32
38
|
Zipper.zip(files, target, zip_root)
|
33
39
|
|
34
40
|
Rake.rake_output_message("Created #{target}")
|
data/lib/rake/funnel/version.rb
CHANGED
@@ -11,6 +11,7 @@ describe Rake::Funnel::Tasks::Zip do
|
|
11
11
|
its(:source) { should eq([]) }
|
12
12
|
its(:target) { should be_nil }
|
13
13
|
its(:zip_root) { should be_nil }
|
14
|
+
its(:allow_empty) { should eq(true) }
|
14
15
|
end
|
15
16
|
|
16
17
|
describe 'execution' do
|
@@ -46,5 +47,46 @@ describe Rake::Funnel::Tasks::Zip do
|
|
46
47
|
it 'should report the created zip file' do
|
47
48
|
expect(Rake).to have_received(:rake_output_message).with("Created #{subject.target}")
|
48
49
|
end
|
50
|
+
|
51
|
+
describe '#allow_empty' do
|
52
|
+
subject {
|
53
|
+
described_class.new do |t|
|
54
|
+
t.source = source
|
55
|
+
t.target = 'some path/file.zip'
|
56
|
+
t.zip_root = 'zip root'
|
57
|
+
t.allow_empty = allow_empty
|
58
|
+
end
|
59
|
+
}
|
60
|
+
|
61
|
+
context 'empty allowed with empty file list' do
|
62
|
+
let(:source) { [] }
|
63
|
+
let(:allow_empty) { true }
|
64
|
+
|
65
|
+
before {
|
66
|
+
Task[subject.name].invoke
|
67
|
+
}
|
68
|
+
|
69
|
+
it 'should invoker Zipper' do
|
70
|
+
expect(Zipper).to have_received(:zip)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'empty not allowed with empty file list' do
|
75
|
+
let(:source) { [] }
|
76
|
+
let(:allow_empty) { false }
|
77
|
+
|
78
|
+
before {
|
79
|
+
Task[subject.name].invoke
|
80
|
+
}
|
81
|
+
|
82
|
+
it 'should not invoker Zipper' do
|
83
|
+
expect(Zipper).not_to have_received(:zip)
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should warn' do
|
87
|
+
expect(Rake).to have_received(:rake_output_message).with('No files to zip')
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
49
91
|
end
|
50
92
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-funnel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Groß
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|