albacore 1.0.0.rc.1 → 1.0.0.rc.2
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/.travis.yml +16 -15
- data/README.md +1 -1
- data/albacore.gemspec +31 -31
- data/lib/albacore/unzip.rb +34 -34
- data/lib/albacore/version.rb +1 -1
- data/lib/albacore/zipdirectory.rb +107 -108
- data/spec/unzip_spec.rb +57 -57
- data/spec/zip_spec.rb +221 -215
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec14c60829d9a146ba63ab85739e4621794979f0
|
4
|
+
data.tar.gz: 8ee89bbe5ce64dd0c13119ec000fdd5e8d0fb443
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f859063fd41624d1519e5fb35db8aea6c99f47a4db03c822f20a659552d0f6722f54b7ecdd23064ad39ff831374be6fd4df16c5c0341a4c1cceef3b56574fa1d
|
7
|
+
data.tar.gz: b2f7193c93b87f62e3875937f68aa0ed50b91585d3204761ff3140176e61aebf98bac9e27cd80a8b1caf3e9f3b46f22b1c9afbdc02fba05e942426abedd60196
|
data/.travis.yml
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 1.9.3
|
4
|
+
- 2.0.0
|
5
|
+
- jruby
|
6
|
+
script: bundle exec rake specs:assemblyinfo specs:albacoremodel specs:attrmethods
|
7
|
+
bundler_args: --without=wiki
|
8
|
+
notifications:
|
9
|
+
email: false
|
10
|
+
gemfile: Gemfile
|
11
|
+
deploy:
|
12
|
+
provider: rubygems
|
13
|
+
api_key:
|
14
|
+
secure: c8WYx8M7i68fZzucth/eI7kj0OX55f6te5Toz88HhDRYdycJ7xu6GJBErOGQBK+26cLnu2sfi//TJXOBayCm7mluTcNSoQMrYalm9s5+oCNyNKbMCZtRZ/kYqHZY4cvOobqKeTTrTJH5puD3PUFbCqat3s4HKrQUjCthfd6ZUeY=
|
15
|
+
on:
|
16
|
+
tags: true
|
data/README.md
CHANGED
data/albacore.gemspec
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
|
5
|
-
require "albacore/version"
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = "albacore"
|
9
|
-
spec.version = Albacore::VERSION
|
10
|
-
spec.authors = ["Henrik Feldt", "Anthony Mastrean"]
|
11
|
-
spec.email = ["albacorebuild@gmail.com"]
|
12
|
-
spec.description = %q{Albacore is a professional quality suite of Rake tasks for building .NET or Mono based systems.}
|
13
|
-
spec.summary = %q{Dolphin-safe .NET and Mono rake tasks}
|
14
|
-
spec.homepage = "http://albacorebuild.net"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
spec.files = `git ls-files`.split($/)
|
18
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = ["lib"]
|
21
|
-
|
22
|
-
spec.add_dependency "nokogiri", "~> 1.5"
|
23
|
-
spec.add_dependency "rake"
|
24
|
-
spec.add_dependency "rubyzip", "
|
25
|
-
|
26
|
-
spec.add_development_dependency "guard"
|
27
|
-
spec.add_development_dependency "guard-rspec"
|
28
|
-
spec.add_development_dependency "rspec"
|
29
|
-
|
30
|
-
spec.rubyforge_project = "albacore"
|
31
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require "albacore/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "albacore"
|
9
|
+
spec.version = Albacore::VERSION
|
10
|
+
spec.authors = ["Henrik Feldt", "Anthony Mastrean"]
|
11
|
+
spec.email = ["albacorebuild@gmail.com"]
|
12
|
+
spec.description = %q{Albacore is a professional quality suite of Rake tasks for building .NET or Mono based systems.}
|
13
|
+
spec.summary = %q{Dolphin-safe .NET and Mono rake tasks}
|
14
|
+
spec.homepage = "http://albacorebuild.net"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($/)
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "nokogiri", "~> 1.5"
|
23
|
+
spec.add_dependency "rake"
|
24
|
+
spec.add_dependency "rubyzip", "~> 1.0"
|
25
|
+
|
26
|
+
spec.add_development_dependency "guard"
|
27
|
+
spec.add_development_dependency "guard-rspec"
|
28
|
+
spec.add_development_dependency "rspec"
|
29
|
+
|
30
|
+
spec.rubyforge_project = "albacore"
|
31
|
+
end
|
data/lib/albacore/unzip.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
require 'albacore/albacoretask'
|
2
|
-
require 'zip
|
3
|
-
require 'zip/
|
4
|
-
include Zip
|
5
|
-
|
6
|
-
class Unzip
|
7
|
-
include Albacore::Task
|
8
|
-
|
9
|
-
attr_accessor :destination, :file
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
super()
|
13
|
-
update_attributes Albacore.configuration.unzip.to_hash
|
14
|
-
end
|
15
|
-
|
16
|
-
def execute()
|
17
|
-
fail_with_message 'Zip File cannot be empty' if @file.nil?
|
18
|
-
return if @file.nil?
|
19
|
-
|
20
|
-
Zip::
|
21
|
-
zip_f.each do |f|
|
22
|
-
out_path = File.join(@destination, f.name)
|
23
|
-
FileUtils.mkdir_p(File.dirname(out_path))
|
24
|
-
|
25
|
-
File.delete(out_path) if @force and File.file?(out_path)
|
26
|
-
zip_f.extract(f, out_path) unless File.exist?(out_path)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def force
|
32
|
-
@force = true
|
33
|
-
end
|
34
|
-
end
|
1
|
+
require 'albacore/albacoretask'
|
2
|
+
require 'zip'
|
3
|
+
require 'zip/filesystem'
|
4
|
+
include Zip
|
5
|
+
|
6
|
+
class Unzip
|
7
|
+
include Albacore::Task
|
8
|
+
|
9
|
+
attr_accessor :destination, :file
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
super()
|
13
|
+
update_attributes Albacore.configuration.unzip.to_hash
|
14
|
+
end
|
15
|
+
|
16
|
+
def execute()
|
17
|
+
fail_with_message 'Zip File cannot be empty' if @file.nil?
|
18
|
+
return if @file.nil?
|
19
|
+
|
20
|
+
Zip::File.open(@file) do |zip_f|
|
21
|
+
zip_f.each do |f|
|
22
|
+
out_path = File.join(@destination, f.name)
|
23
|
+
FileUtils.mkdir_p(File.dirname(out_path))
|
24
|
+
|
25
|
+
File.delete(out_path) if @force and File.file?(out_path)
|
26
|
+
zip_f.extract(f, out_path) unless File.exist?(out_path)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def force
|
32
|
+
@force = true
|
33
|
+
end
|
34
|
+
end
|
data/lib/albacore/version.rb
CHANGED
@@ -1,108 +1,107 @@
|
|
1
|
-
require 'albacore/albacoretask'
|
2
|
-
require 'zip
|
3
|
-
require 'zip/
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
exclusions =
|
67
|
-
exclusions
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
@output_path
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
path =
|
84
|
-
path = @
|
85
|
-
path
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
@additional_files
|
103
|
-
|
104
|
-
file_name
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
1
|
+
require 'albacore/albacoretask'
|
2
|
+
require 'zip'
|
3
|
+
require 'zip/filesystem'
|
4
|
+
|
5
|
+
class ZipDirectory
|
6
|
+
TaskName = :zip
|
7
|
+
include Albacore::Task
|
8
|
+
|
9
|
+
attr_accessor :output_path, :output_file
|
10
|
+
attr_reader :flatten_zip
|
11
|
+
attr_array :directories_to_zip, :additional_files, :exclusions
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@exclusions = []
|
15
|
+
super()
|
16
|
+
update_attributes Albacore.configuration.zip.to_hash
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute()
|
20
|
+
fail_with_message 'Output File cannot be empty' if @output_file.nil?
|
21
|
+
return if @output_file.nil?
|
22
|
+
|
23
|
+
clean_directories_names
|
24
|
+
remove zip_name
|
25
|
+
|
26
|
+
Zip::File.open(zip_name, 'w') do |zipfile|
|
27
|
+
zip_directory(zipfile)
|
28
|
+
zip_additional(zipfile)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def flatten_zip
|
33
|
+
@flatten_zip = true
|
34
|
+
end
|
35
|
+
|
36
|
+
def clean_directories_names
|
37
|
+
return if @directories_to_zip.nil?
|
38
|
+
@directories_to_zip.each { |d| d.sub!(%r[/$],'')}
|
39
|
+
end
|
40
|
+
|
41
|
+
def remove(filename)
|
42
|
+
FileUtils.rm filename, :force=>true
|
43
|
+
end
|
44
|
+
|
45
|
+
def reject_file(f)
|
46
|
+
f == zip_name || is_excluded(f)
|
47
|
+
end
|
48
|
+
|
49
|
+
def is_excluded(f)
|
50
|
+
expanded_exclusions.any? do |e|
|
51
|
+
return true if e.respond_to? '~' and f =~ e
|
52
|
+
e == f
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def expanded_exclusions
|
57
|
+
return @expanded_exclusions unless @expanded_exclusions.nil?
|
58
|
+
|
59
|
+
regexp_exclusions, string_exclusions = @exclusions.partition {|x| x.respond_to? '~' }
|
60
|
+
@expanded_exclusions = [].concat(regexp_exclusions)
|
61
|
+
|
62
|
+
@directories_to_zip.each do |dir|
|
63
|
+
Dir.chdir(dir) do
|
64
|
+
string_exclusions.each do |ex|
|
65
|
+
exclusions = Dir.glob(ex)
|
66
|
+
exclusions = exclusions.map {|x| File.join(dir, x) } unless exclusions[0] == ex
|
67
|
+
exclusions << ex if exclusions.empty?
|
68
|
+
@expanded_exclusions += exclusions
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
@expanded_exclusions
|
74
|
+
end
|
75
|
+
|
76
|
+
def zip_name()
|
77
|
+
@output_path = set_output_path
|
78
|
+
File.join(@output_path, @output_file)
|
79
|
+
end
|
80
|
+
|
81
|
+
def set_output_path()
|
82
|
+
path = ''
|
83
|
+
path = @directories_to_zip.first unless @directories_to_zip.nil?
|
84
|
+
path = @output_path unless @output_path.nil?
|
85
|
+
return path
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
def zip_directory(zipfile)
|
90
|
+
return if @directories_to_zip.nil?
|
91
|
+
@directories_to_zip.each do |d|
|
92
|
+
Dir["#{d}/**/**"].reject{|f| reject_file(f)}.each do |file_path|
|
93
|
+
file_name = @flatten_zip ? file_path.sub(d + '/','') : file_path
|
94
|
+
zipfile.add(file_name, file_path)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def zip_additional(zipfile)
|
100
|
+
return if @additional_files.nil?
|
101
|
+
@additional_files = Array.[](@additional_files).flatten
|
102
|
+
@additional_files.reject{|f| reject_file(f)}.each do |file_path|
|
103
|
+
file_name = @flatten_zip ? file_path.split('/').last : file_path
|
104
|
+
zipfile.add(file_name, file_path)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
data/spec/unzip_spec.rb
CHANGED
@@ -1,57 +1,57 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'albacore/unzip'
|
3
|
-
|
4
|
-
describe Unzip, "when providing configuration" do
|
5
|
-
let :uz do
|
6
|
-
Albacore.configure do |config|
|
7
|
-
config.unzip.file = "configured"
|
8
|
-
end
|
9
|
-
uz = Unzip.new
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should use the configured values" do
|
13
|
-
uz.file.should == "configured"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should not 'force' by default" do
|
17
|
-
uz.instance_variable_get(:@force).should be_nil
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should enable 'force' by calling the force() method" do
|
21
|
-
uz.force
|
22
|
-
uz.instance_variable_get(:@force).should be_true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe Unzip, "when executing the task" do
|
27
|
-
let :uz do
|
28
|
-
zipped_file = mock('foo.txt')
|
29
|
-
zipped_file.stub(:name).and_return('foo.txt')
|
30
|
-
|
31
|
-
zip_file = mock('foo.zip')
|
32
|
-
zip_file.stub(:each).and_yield(zipped_file)
|
33
|
-
zip_file.stub(:extract)
|
34
|
-
|
35
|
-
Zip::
|
36
|
-
FileUtils.stub(:mkdir_p)
|
37
|
-
File.stub!(:file?).and_return(true)
|
38
|
-
|
39
|
-
uz = Unzip.new
|
40
|
-
uz.file = 'foo.zip'
|
41
|
-
uz.destination = '/tmp'
|
42
|
-
uz
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should delete the destinationfile if forced" do
|
46
|
-
File.should_receive(:delete).with('/tmp/foo.txt')
|
47
|
-
|
48
|
-
uz.force
|
49
|
-
uz.execute
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should keep the destination file if not forced" do
|
53
|
-
File.should_not_receive(:delete)
|
54
|
-
|
55
|
-
uz.execute
|
56
|
-
end
|
57
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'albacore/unzip'
|
3
|
+
|
4
|
+
describe Unzip, "when providing configuration" do
|
5
|
+
let :uz do
|
6
|
+
Albacore.configure do |config|
|
7
|
+
config.unzip.file = "configured"
|
8
|
+
end
|
9
|
+
uz = Unzip.new
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should use the configured values" do
|
13
|
+
uz.file.should == "configured"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should not 'force' by default" do
|
17
|
+
uz.instance_variable_get(:@force).should be_nil
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should enable 'force' by calling the force() method" do
|
21
|
+
uz.force
|
22
|
+
uz.instance_variable_get(:@force).should be_true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe Unzip, "when executing the task" do
|
27
|
+
let :uz do
|
28
|
+
zipped_file = mock('foo.txt')
|
29
|
+
zipped_file.stub(:name).and_return('foo.txt')
|
30
|
+
|
31
|
+
zip_file = mock('foo.zip')
|
32
|
+
zip_file.stub(:each).and_yield(zipped_file)
|
33
|
+
zip_file.stub(:extract)
|
34
|
+
|
35
|
+
Zip::File.stub!(:open).and_yield(zip_file)
|
36
|
+
FileUtils.stub(:mkdir_p)
|
37
|
+
File.stub!(:file?).and_return(true)
|
38
|
+
|
39
|
+
uz = Unzip.new
|
40
|
+
uz.file = 'foo.zip'
|
41
|
+
uz.destination = '/tmp'
|
42
|
+
uz
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should delete the destinationfile if forced" do
|
46
|
+
File.should_receive(:delete).with('/tmp/foo.txt')
|
47
|
+
|
48
|
+
uz.force
|
49
|
+
uz.execute
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should keep the destination file if not forced" do
|
53
|
+
File.should_not_receive(:delete)
|
54
|
+
|
55
|
+
uz.execute
|
56
|
+
end
|
57
|
+
end
|
data/spec/zip_spec.rb
CHANGED
@@ -1,215 +1,221 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'albacore/zipdirectory'
|
3
|
-
require 'albacore/unzip'
|
4
|
-
require 'ziptestdata'
|
5
|
-
|
6
|
-
describe ZipDirectory, 'when zipping a directory of files' do
|
7
|
-
before :each do
|
8
|
-
zip = ZipDirectory.new
|
9
|
-
zip.
|
10
|
-
zip.
|
11
|
-
zip.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
zip
|
23
|
-
zip.
|
24
|
-
zip.
|
25
|
-
zip.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
unzip
|
30
|
-
unzip.
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
zip
|
47
|
-
zip.
|
48
|
-
zip.
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
unzip.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
zip.
|
71
|
-
zip.
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'should zip
|
88
|
-
File.exist?(File.join(ZipTestData.output_folder, 'files', 'subfolder')).should
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
zip
|
103
|
-
end
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
zip
|
114
|
-
zip.
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
zip.
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
zip.
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
File.exist?
|
213
|
-
|
214
|
-
|
215
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'albacore/zipdirectory'
|
3
|
+
require 'albacore/unzip'
|
4
|
+
require 'ziptestdata'
|
5
|
+
|
6
|
+
describe ZipDirectory, 'when zipping a directory of files' do
|
7
|
+
before :each do
|
8
|
+
zip = ZipDirectory.new
|
9
|
+
zip.flatten_zip
|
10
|
+
zip.directories_to_zip ZipTestData.folder
|
11
|
+
zip.output_file = "test.zip"
|
12
|
+
zip.execute
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should produce a zip file" do
|
16
|
+
File.exist?(File.join(ZipTestData.folder, "test.zip")).should be_true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ZipDirectory, 'when zipping a directory with string exclusions' do
|
21
|
+
before :each do
|
22
|
+
zip = ZipDirectory.new
|
23
|
+
zip.flatten_zip
|
24
|
+
zip.directories_to_zip ZipTestData.folder
|
25
|
+
zip.output_file = 'test.zip'
|
26
|
+
zip.exclusions File.join(ZipTestData.folder, 'files', 'testfile.txt')
|
27
|
+
zip.execute
|
28
|
+
|
29
|
+
unzip = Unzip.new
|
30
|
+
unzip.file = File.join(ZipTestData.folder, 'test.zip')
|
31
|
+
unzip.destination = ZipTestData.output_folder
|
32
|
+
unzip.execute
|
33
|
+
end
|
34
|
+
|
35
|
+
after :each do
|
36
|
+
FileUtils.rm_rf ZipTestData.output_folder if File.exist? ZipTestData.output_folder
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should not zip files with the same name as any exclusions' do
|
40
|
+
File.exist?(File.join(ZipTestData.output_folder, 'files', 'testfile.txt')).should be_false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe ZipDirectory, 'when zipping a directory of files with regexp exclusions' do
|
45
|
+
before :each do
|
46
|
+
zip = ZipDirectory.new
|
47
|
+
zip.flatten_zip
|
48
|
+
zip.directories_to_zip ZipTestData.folder
|
49
|
+
zip.output_file = 'test.zip'
|
50
|
+
zip.exclusions /testfile/
|
51
|
+
zip.execute
|
52
|
+
|
53
|
+
unzip = Unzip.new
|
54
|
+
unzip.file = File.join(ZipTestData.folder, 'test.zip')
|
55
|
+
unzip.destination = ZipTestData.output_folder
|
56
|
+
unzip.execute
|
57
|
+
end
|
58
|
+
|
59
|
+
after :each do
|
60
|
+
FileUtils.rm_rf ZipTestData.output_folder if File.exist? ZipTestData.output_folder
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should not zip files that match any of the exclusions regexps' do
|
64
|
+
File.exist?(File.join(ZipTestData.output_folder, 'files', 'testfile.txt')).should be_false
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe ZipDirectory, 'when zipping a directory of files with glob string exclusions' do
|
69
|
+
before :each do
|
70
|
+
zip = ZipDirectory.new
|
71
|
+
zip.flatten_zip
|
72
|
+
zip.directories_to_zip ZipTestData.folder
|
73
|
+
zip.output_file = 'test.zip'
|
74
|
+
zip.exclusions "**/subfolder/*"
|
75
|
+
zip.execute
|
76
|
+
|
77
|
+
unzip = Unzip.new
|
78
|
+
unzip.file = File.join(ZipTestData.folder, 'test.zip')
|
79
|
+
unzip.destination = ZipTestData.output_folder
|
80
|
+
unzip.execute
|
81
|
+
end
|
82
|
+
|
83
|
+
after :each do
|
84
|
+
FileUtils.rm_rf ZipTestData.output_folder if File.exists? ZipTestData.output_folder
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'should not zip files that match the expanded globs' do
|
88
|
+
File.exist?(File.join(ZipTestData.output_folder, 'files', 'subfolder', 'sub file.txt')).should be_false
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'should zip the files that don\'t match the globs' do
|
92
|
+
File.exist?(File.join(ZipTestData.output_folder, 'files', 'subfolder')).should be_true
|
93
|
+
File.exist?(File.join(ZipTestData.output_folder, 'files', 'testfile.txt')).should be_true
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe ZipDirectory, "when providing configuration" do
|
98
|
+
let :zip do
|
99
|
+
Albacore.configure do |config|
|
100
|
+
config.zip.output_file = "configured"
|
101
|
+
end
|
102
|
+
zip = ZipDirectory.new
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should use the configured values" do
|
106
|
+
zip.output_file.should == "configured"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe ZipDirectory, 'when zipping a directory of files with additional files' do
|
111
|
+
describe 'and additional file is given as an array' do
|
112
|
+
before :each do
|
113
|
+
zip = ZipDirectory.new
|
114
|
+
zip.flatten_zip
|
115
|
+
zip.directories_to_zip ZipTestData.folder
|
116
|
+
zip.output_file = 'test.zip'
|
117
|
+
zip.exclusions "**/subfolder/*"
|
118
|
+
zip.additional_files = [File.join(File.dirname(__FILE__), 'support', 'test.yml')]
|
119
|
+
zip.execute
|
120
|
+
|
121
|
+
unzip = Unzip.new
|
122
|
+
unzip.file = File.join(ZipTestData.folder, 'test.zip')
|
123
|
+
unzip.destination = ZipTestData.output_folder
|
124
|
+
unzip.execute
|
125
|
+
end
|
126
|
+
|
127
|
+
after :each do
|
128
|
+
FileUtils.rm_rf ZipTestData.output_folder if File.exist? ZipTestData.output_folder
|
129
|
+
end
|
130
|
+
|
131
|
+
it "should add additional file" do
|
132
|
+
File.exist?(File.join(ZipTestData.folder, "test.zip")).should be_true
|
133
|
+
File.exist?(File.join(ZipTestData.output_folder, 'files', 'subfolder')).should be_true
|
134
|
+
File.exist?(File.join(ZipTestData.output_folder, 'files', 'testfile.txt')).should be_true
|
135
|
+
File.exist?(File.join(ZipTestData.output_folder, 'test.yml')).should be_true
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe 'and additional file is given as a string' do
|
140
|
+
before :each do
|
141
|
+
zip = ZipDirectory.new
|
142
|
+
zip.flatten_zip
|
143
|
+
zip.directories_to_zip ZipTestData.folder
|
144
|
+
zip.output_file = 'test.zip'
|
145
|
+
zip.exclusions "**/subfolder/*"
|
146
|
+
zip.additional_files = File.join(File.dirname(__FILE__), 'support', 'test.yml')
|
147
|
+
zip.execute
|
148
|
+
|
149
|
+
unzip = Unzip.new
|
150
|
+
unzip.file = File.join(ZipTestData.folder, 'test.zip')
|
151
|
+
unzip.destination = ZipTestData.output_folder
|
152
|
+
unzip.execute
|
153
|
+
end
|
154
|
+
|
155
|
+
after :each do
|
156
|
+
FileUtils.rm_rf ZipTestData.output_folder if File.exist? ZipTestData.output_folder
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should add additional file" do
|
160
|
+
File.exist?(File.join(ZipTestData.folder, "test.zip")).should be_true
|
161
|
+
File.exist?(File.join(ZipTestData.output_folder, 'files', 'subfolder')).should be_true
|
162
|
+
File.exist?(File.join(ZipTestData.output_folder, 'files', 'testfile.txt')).should be_true
|
163
|
+
File.exist?(File.join(ZipTestData.output_folder, 'test.yml')).should be_true
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
describe ZipDirectory, "without flatten_zip set" do
|
169
|
+
before :each do
|
170
|
+
zip = ZipDirectory.new
|
171
|
+
zip.directories_to_zip File.join('spec', 'support', 'yamlconfig')
|
172
|
+
zip.output_file = 'test.zip'
|
173
|
+
zip.output_path = ZipTestData.folder
|
174
|
+
zip.additional_files = [File.join('spec', 'support', 'test.yml'), File.join('spec', 'support', 'AssemblyInfo', 'assemblyinfo.yml')]
|
175
|
+
zip.execute
|
176
|
+
|
177
|
+
unzip = Unzip.new
|
178
|
+
unzip.file = File.join(ZipTestData.folder, 'test.zip')
|
179
|
+
unzip.destination = ZipTestData.output_folder
|
180
|
+
unzip.execute
|
181
|
+
end
|
182
|
+
|
183
|
+
after :each do
|
184
|
+
FileUtils.rm_rf ZipTestData.output_folder if File.exist? ZipTestData.output_folder
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should add additional file" do
|
188
|
+
File.exist?(File.join(ZipTestData.folder, "test.zip")).should be_true
|
189
|
+
Dir.exist?(File.join(ZipTestData.output_folder, 'spec', 'support', 'yamlconfig')).should be_true
|
190
|
+
File.exist?(File.join(ZipTestData.output_folder, 'spec', 'support', 'yamlconfig', 'msbuild.yml')).should be_true
|
191
|
+
File.exist?(File.join(ZipTestData.output_folder, 'spec', 'support', 'test.yml')).should be_true
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe ZipDirectory, "with flatten_zip set" do
|
196
|
+
before :each do
|
197
|
+
zip = ZipDirectory.new
|
198
|
+
zip.flatten_zip
|
199
|
+
zip.directories_to_zip File.join('spec', 'support', 'yamlconfig')
|
200
|
+
zip.output_file = 'test.zip'
|
201
|
+
zip.output_path = ZipTestData.folder
|
202
|
+
zip.additional_files = [File.join('spec', 'support', 'test.yml'), File.join('spec', 'support', 'AssemblyInfo', 'assemblyinfo.yml')]
|
203
|
+
zip.execute
|
204
|
+
|
205
|
+
unzip = Unzip.new
|
206
|
+
unzip.file = File.join(ZipTestData.folder, 'test.zip')
|
207
|
+
unzip.destination = ZipTestData.output_folder
|
208
|
+
unzip.execute
|
209
|
+
end
|
210
|
+
|
211
|
+
after :each do
|
212
|
+
FileUtils.rm_rf ZipTestData.output_folder if File.exist? ZipTestData.output_folder
|
213
|
+
end
|
214
|
+
|
215
|
+
it "should add additional file" do
|
216
|
+
File.exist?(File.join(ZipTestData.folder, "test.zip")).should be_true
|
217
|
+
Dir.exist?(File.join(ZipTestData.output_folder, 'spec', 'support', 'yamlconfig')).should be_false
|
218
|
+
File.exist?(File.join(ZipTestData.output_folder, 'msbuild.yml')).should be_true
|
219
|
+
File.exist?(File.join(ZipTestData.output_folder, 'test.yml')).should be_true
|
220
|
+
end
|
221
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: albacore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.rc.
|
4
|
+
version: 1.0.0.rc.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Feldt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -43,16 +43,16 @@ dependencies:
|
|
43
43
|
name: rubyzip
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ~>
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 1.0
|
48
|
+
version: '1.0'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.0
|
55
|
+
version: '1.0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: guard
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|