albacore 1.0.0.rc.1 → 1.0.0.rc.2

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: c1e2e74b02e67eb95188c0877c91bdd4fccbe430
4
- data.tar.gz: 3c0c9660d7c0dfde9a5295a55d91221a4510ba97
3
+ metadata.gz: ec14c60829d9a146ba63ab85739e4621794979f0
4
+ data.tar.gz: 8ee89bbe5ce64dd0c13119ec000fdd5e8d0fb443
5
5
  SHA512:
6
- metadata.gz: 661046323ec3746f3dee00c77bde928889e9cbfee1b7b20b958bb35881ef08de37fd75f8653eb5ca840c051f6b808c16a9d62e6685d10cb6f4303a97801ceb9e
7
- data.tar.gz: 67e05ef730f5b3fa0558ac0cdf514f71fe597807dfbc03d628c227a23491094f2b53a98ba1b963a50f36f5f34033de0e75b0fa57aff5c48e6d8e41b80451eb7e
6
+ metadata.gz: f859063fd41624d1519e5fb35db8aea6c99f47a4db03c822f20a659552d0f6722f54b7ecdd23064ad39ff831374be6fd4df16c5c0341a4c1cceef3b56574fa1d
7
+ data.tar.gz: b2f7193c93b87f62e3875937f68aa0ed50b91585d3204761ff3140176e61aebf98bac9e27cd80a8b1caf3e9f3b46f22b1c9afbdc02fba05e942426abedd60196
@@ -1,15 +1,16 @@
1
- language: ruby
2
- rvm:
3
- - 1.9.2
4
- - 1.9.3
5
- - 2.0.0
6
- - jruby
7
- script: "bundle exec rake specs:assemblyinfo specs:albacoremodel specs:attrmethods"
8
- branches:
9
- only:
10
- - dev
11
- #env:
12
- bundler_args: --without=wiki
13
- notifications:
14
- email: false
15
- gemfile: Gemfile
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
@@ -37,7 +37,7 @@ require "albacore"
37
37
 
38
38
  Albacore has been tested against the following versions of Ruby for Windows and Linux. Use unsupported versions at your own risk!
39
39
 
40
- * MRI: `1.9.2`, `1.9.3`, `2.0.0`
40
+ * MRI: `1.9.3`, `2.0.0`
41
41
  * JRuby: `HEAD`
42
42
 
43
43
 
@@ -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", "< 1.0.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
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
@@ -1,34 +1,34 @@
1
- require 'albacore/albacoretask'
2
- require 'zip/zip'
3
- require 'zip/zipfilesystem'
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::ZipFile.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
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
@@ -1,3 +1,3 @@
1
1
  module Albacore
2
- VERSION = "1.0.0.rc.1"
2
+ VERSION = "1.0.0.rc.2"
3
3
  end
@@ -1,108 +1,107 @@
1
- require 'albacore/albacoretask'
2
- require 'zip/zip'
3
- require 'zip/zipfilesystem'
4
- include Zip
5
-
6
- class ZipDirectory
7
- TaskName = :zip
8
- include Albacore::Task
9
-
10
- attr_accessor :output_path, :output_file
11
- attr_reader :flatten_zip
12
- attr_array :directories_to_zip, :additional_files, :exclusions
13
-
14
- def initialize
15
- @exclusions = []
16
- super()
17
- update_attributes Albacore.configuration.zip.to_hash
18
- end
19
-
20
- def execute()
21
- fail_with_message 'Output File cannot be empty' if @output_file.nil?
22
- return if @output_file.nil?
23
-
24
- clean_directories_names
25
- remove zip_name
26
-
27
- ZipFile.open(zip_name, 'w') do |zipfile|
28
- zip_directory(zipfile)
29
- zip_additional(zipfile)
30
- end
31
- end
32
-
33
- def flatten_zip
34
- @flatten_zip = true
35
- end
36
-
37
- def clean_directories_names
38
- return if @directories_to_zip.nil?
39
- @directories_to_zip.each { |d| d.sub!(%r[/$],'')}
40
- end
41
-
42
- def remove(filename)
43
- FileUtils.rm filename, :force=>true
44
- end
45
-
46
- def reject_file(f)
47
- f == zip_name || is_excluded(f)
48
- end
49
-
50
- def is_excluded(f)
51
- expanded_exclusions.any? do |e|
52
- return true if e.respond_to? '~' and f =~ e
53
- e == f
54
- end
55
- end
56
-
57
- def expanded_exclusions
58
- return @expanded_exclusions unless @expanded_exclusions.nil?
59
-
60
- regexp_exclusions, string_exclusions = @exclusions.partition {|x| x.respond_to? '~' }
61
- @expanded_exclusions = [].concat(regexp_exclusions)
62
-
63
- @directories_to_zip.each do |dir|
64
- Dir.chdir(dir) do
65
- string_exclusions.each do |ex|
66
- exclusions = Dir.glob(ex)
67
- exclusions = exclusions.map {|x| File.join(dir, x) } unless exclusions[0] == ex
68
- exclusions << ex if exclusions.empty?
69
- @expanded_exclusions += exclusions
70
- end
71
- end
72
- end
73
-
74
- @expanded_exclusions
75
- end
76
-
77
- def zip_name()
78
- @output_path = set_output_path
79
- File.join(@output_path, @output_file)
80
- end
81
-
82
- def set_output_path()
83
- path = ''
84
- path = @directories_to_zip.first unless @directories_to_zip.nil?
85
- path = @output_path unless @output_path.nil?
86
- return path
87
- end
88
-
89
-
90
- def zip_directory(zipfile)
91
- return if @directories_to_zip.nil?
92
- @directories_to_zip.each do |d|
93
- Dir["#{d}/**/**"].reject{|f| reject_file(f)}.each do |file_path|
94
- file_name = @flatten_zip ? file_path.sub(d + '/','') : file_path
95
- zipfile.add(file_name, file_path)
96
- end
97
- end
98
- end
99
-
100
- def zip_additional(zipfile)
101
- return if @additional_files.nil?
102
- @additional_files = Array.[](@additional_files).flatten
103
- @additional_files.reject{|f| reject_file(f)}.each do |file_path|
104
- file_name = @flatten_zip ? file_path.split('/').last : file_path
105
- zipfile.add(file_name, file_path)
106
- end
107
- end
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
@@ -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::ZipFile.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
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
@@ -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.directories_to_zip ZipTestData.folder
10
- zip.output_file = "test.zip"
11
- zip.execute
12
- end
13
-
14
- it "should produce a zip file" do
15
- File.exist?(File.join(ZipTestData.folder, "test.zip")).should be_true
16
- end
17
- end
18
-
19
- describe ZipDirectory, 'when zipping a directory with string exclusions' do
20
- before :each do
21
- zip = ZipDirectory.new
22
- zip.directories_to_zip ZipTestData.folder
23
- zip.output_file = 'test.zip'
24
- zip.exclusions File.join(ZipTestData.folder, 'files', 'testfile.txt')
25
- zip.execute
26
-
27
- unzip = Unzip.new
28
- unzip.file = File.join(ZipTestData.folder, 'test.zip')
29
- unzip.destination = ZipTestData.output_folder
30
- unzip.execute
31
- end
32
-
33
- after :each do
34
- FileUtils.rm_rf ZipTestData.output_folder if File.exist? ZipTestData.output_folder
35
- end
36
-
37
- it 'should not zip files with the same name as any exclusions' do
38
- File.exist?(File.join(ZipTestData.output_folder, 'files', 'testfile.txt')).should be_false
39
- end
40
- end
41
-
42
- describe ZipDirectory, 'when zipping a directory of files with regexp exclusions' do
43
- before :each do
44
- zip = ZipDirectory.new
45
- zip.directories_to_zip ZipTestData.folder
46
- zip.output_file = 'test.zip'
47
- zip.exclusions /testfile/
48
- zip.execute
49
-
50
- unzip = Unzip.new
51
- unzip.file = File.join(ZipTestData.folder, 'test.zip')
52
- unzip.destination = ZipTestData.output_folder
53
- unzip.execute
54
- end
55
-
56
- after :each do
57
- FileUtils.rm_rf ZipTestData.output_folder if File.exist? ZipTestData.output_folder
58
- end
59
-
60
- it 'should not zip files that match any of the exclusions regexps' do
61
- File.exist?(File.join(ZipTestData.output_folder, 'files', 'testfile.txt')).should be_false
62
- end
63
- end
64
-
65
- describe ZipDirectory, 'when zipping a directory of files with glob string exclusions' do
66
- before :each do
67
- zip = ZipDirectory.new
68
- zip.directories_to_zip ZipTestData.folder
69
- zip.output_file = 'test.zip'
70
- zip.exclusions "**/subfolder/*"
71
- zip.execute
72
-
73
- unzip = Unzip.new
74
- unzip.file = File.join(ZipTestData.folder, 'test.zip')
75
- unzip.destination = ZipTestData.output_folder
76
- unzip.execute
77
- end
78
-
79
- after :each do
80
- FileUtils.rm_rf ZipTestData.output_folder if File.exists? ZipTestData.output_folder
81
- end
82
-
83
- it 'should not zip files that match the expanded globs' do
84
- File.exist?(File.join(ZipTestData.output_folder, 'files', 'subfolder', 'sub file.txt')).should be_false
85
- end
86
-
87
- it 'should zip the files that don\'t match the globs' do
88
- File.exist?(File.join(ZipTestData.output_folder, 'files', 'subfolder')).should be_true
89
- File.exist?(File.join(ZipTestData.output_folder, 'files', 'testfile.txt')).should be_true
90
- end
91
- end
92
-
93
- describe ZipDirectory, "when providing configuration" do
94
- let :zip do
95
- Albacore.configure do |config|
96
- config.zip.output_file = "configured"
97
- end
98
- zip = ZipDirectory.new
99
- end
100
-
101
- it "should use the configured values" do
102
- zip.output_file.should == "configured"
103
- end
104
- end
105
-
106
- describe ZipDirectory, 'when zipping a directory of files with additional files' do
107
- describe 'and additional file is given as an array' do
108
- before :each do
109
- zip = ZipDirectory.new
110
- zip.directories_to_zip ZipTestData.folder
111
- zip.output_file = 'test.zip'
112
- zip.exclusions "**/subfolder/*"
113
- zip.additional_files = [File.join(File.dirname(__FILE__), 'support', 'test.yml')]
114
- zip.execute
115
-
116
- unzip = Unzip.new
117
- unzip.file = File.join(ZipTestData.folder, 'test.zip')
118
- unzip.destination = ZipTestData.output_folder
119
- unzip.execute
120
- end
121
-
122
- after :each do
123
- FileUtils.rm_rf ZipTestData.output_folder if File.exist? ZipTestData.output_folder
124
- end
125
-
126
- it "should add additional file" do
127
- File.exist?(File.join(ZipTestData.folder, "test.zip")).should be_true
128
- File.exist?(File.join(ZipTestData.output_folder, 'files', 'subfolder')).should be_true
129
- File.exist?(File.join(ZipTestData.output_folder, 'files', 'testfile.txt')).should be_true
130
- File.exist?(File.join(ZipTestData.output_folder, 'test.yml')).should be_true
131
- end
132
- end
133
-
134
- describe 'and additional file is given as a string' do
135
- before :each do
136
- zip = ZipDirectory.new
137
- zip.directories_to_zip ZipTestData.folder
138
- zip.output_file = 'test.zip'
139
- zip.exclusions "**/subfolder/*"
140
- zip.additional_files = File.join(File.dirname(__FILE__), 'support', 'test.yml')
141
- zip.execute
142
-
143
- unzip = Unzip.new
144
- unzip.file = File.join(ZipTestData.folder, 'test.zip')
145
- unzip.destination = ZipTestData.output_folder
146
- unzip.execute
147
- end
148
-
149
- after :each do
150
- FileUtils.rm_rf ZipTestData.output_folder if File.exist? ZipTestData.output_folder
151
- end
152
-
153
- it "should add additional file" do
154
- File.exist?(File.join(ZipTestData.folder, "test.zip")).should be_true
155
- File.exist?(File.join(ZipTestData.output_folder, 'files', 'subfolder')).should be_true
156
- File.exist?(File.join(ZipTestData.output_folder, 'files', 'testfile.txt')).should be_true
157
- File.exist?(File.join(ZipTestData.output_folder, 'test.yml')).should be_true
158
- end
159
- end
160
- end
161
-
162
- describe ZipDirectory, "without flatten_zip set" do
163
- before :each do
164
- zip = ZipDirectory.new
165
- zip.directories_to_zip File.join('spec', 'support', 'yamlconfig')
166
- zip.output_file = 'test.zip'
167
- zip.output_path = ZipTestData.folder
168
- zip.additional_files = [File.join('spec', 'support', 'test.yml'), File.join('spec', 'support', 'AssemblyInfo', 'assemblyinfo.yml')]
169
- zip.execute
170
-
171
- unzip = Unzip.new
172
- unzip.file = File.join(ZipTestData.folder, 'test.zip')
173
- unzip.destination = ZipTestData.output_folder
174
- unzip.execute
175
- end
176
-
177
- after :each do
178
- FileUtils.rm_rf ZipTestData.output_folder if File.exist? ZipTestData.output_folder
179
- end
180
-
181
- it "should add additional file" do
182
- File.exist?(File.join(ZipTestData.folder, "test.zip")).should be_true
183
- Dir.exist?(File.join(ZipTestData.output_folder, 'spec', 'support', 'yamlconfig')).should be_true
184
- File.exist?(File.join(ZipTestData.output_folder, 'spec', 'support', 'yamlconfig', 'msbuild.yml')).should be_true
185
- File.exist?(File.join(ZipTestData.output_folder, 'spec', 'support', 'test.yml')).should be_true
186
- end
187
- end
188
-
189
- describe ZipDirectory, "with flatten_zip set" do
190
- before :each do
191
- zip = ZipDirectory.new
192
- zip.flatten_zip
193
- zip.directories_to_zip File.join('spec', 'support', 'yamlconfig')
194
- zip.output_file = 'test.zip'
195
- zip.output_path = ZipTestData.folder
196
- zip.additional_files = [File.join('spec', 'support', 'test.yml'), File.join('spec', 'support', 'AssemblyInfo', 'assemblyinfo.yml')]
197
- zip.execute
198
-
199
- unzip = Unzip.new
200
- unzip.file = File.join(ZipTestData.folder, 'test.zip')
201
- unzip.destination = ZipTestData.output_folder
202
- unzip.execute
203
- end
204
-
205
- after :each do
206
- FileUtils.rm_rf ZipTestData.output_folder if File.exist? ZipTestData.output_folder
207
- end
208
-
209
- it "should add additional file" do
210
- File.exist?(File.join(ZipTestData.folder, "test.zip")).should be_true
211
- Dir.exist?(File.join(ZipTestData.output_folder, 'spec', 'support', 'yamlconfig')).should be_false
212
- File.exist?(File.join(ZipTestData.output_folder, 'msbuild.yml')).should be_true
213
- File.exist?(File.join(ZipTestData.output_folder, 'test.yml')).should be_true
214
- end
215
- end
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.1
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-09-09 00:00:00.000000000 Z
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.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.0
55
+ version: '1.0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: guard
58
58
  requirement: !ruby/object:Gem::Requirement