releasy 0.2.0rc1 → 0.2.0rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/CHANGELOG.md +1 -1
  2. data/README.md +79 -65
  3. data/Rakefile +1 -1
  4. data/lib/releasy/builders.rb +1 -1
  5. data/lib/releasy/builders/builder.rb +6 -4
  6. data/lib/releasy/builders/osx_app.rb +49 -27
  7. data/lib/releasy/builders/source.rb +1 -3
  8. data/lib/releasy/builders/windows_builder.rb +3 -10
  9. data/lib/releasy/builders/windows_folder.rb +4 -6
  10. data/lib/releasy/builders/windows_installer.rb +3 -5
  11. data/lib/releasy/builders/windows_standalone.rb +1 -3
  12. data/lib/releasy/builders/{windows_folder_from_ruby_dist.rb → windows_wrapped.rb} +24 -22
  13. data/lib/releasy/cli/install_sfx.rb +3 -3
  14. data/lib/releasy/deployers.rb +12 -0
  15. data/lib/releasy/deployers/deployer.rb +28 -0
  16. data/lib/releasy/deployers/github.rb +109 -0
  17. data/lib/releasy/mixins/can_exclude_encoding.rb +22 -0
  18. data/lib/releasy/mixins/exec.rb +2 -2
  19. data/lib/releasy/mixins/has_gemspecs.rb +6 -6
  20. data/lib/releasy/mixins/has_packagers.rb +37 -0
  21. data/lib/releasy/mixins/log.rb +39 -0
  22. data/lib/releasy/mixins/register.rb +0 -1
  23. data/lib/releasy/packagers.rb +12 -0
  24. data/lib/releasy/{archivers → packagers}/dmg.rb +4 -4
  25. data/lib/releasy/{archivers → packagers}/exe.rb +4 -4
  26. data/lib/releasy/{archivers/archiver.rb → packagers/packager.rb} +20 -11
  27. data/lib/releasy/packagers/seven_zip.rb +12 -0
  28. data/lib/releasy/{archivers → packagers}/tar_bzip2.rb +4 -4
  29. data/lib/releasy/{archivers → packagers}/tar_gzip.rb +4 -4
  30. data/lib/releasy/{archivers/tar_archiver.rb → packagers/tar_packager.rb} +4 -4
  31. data/lib/releasy/{archivers → packagers}/zip.rb +4 -4
  32. data/lib/releasy/project.rb +105 -46
  33. data/lib/releasy/version.rb +1 -1
  34. data/lib/releasy/windows_wrapper_maker.rb +0 -3
  35. data/releasy.gemspec +1 -0
  36. data/test/releasy/builders/helpers/helper.rb +0 -1
  37. data/test/releasy/builders/osx_app_test.rb +18 -8
  38. data/test/releasy/builders/{windows_folder_from_ruby_dist_test.rb → windows_wrapped_test.rb} +16 -14
  39. data/test/releasy/deployers/github_test.rb +133 -0
  40. data/test/releasy/deployers/helpers/helper.rb +19 -0
  41. data/test/releasy/integration/source_test.rb +25 -6
  42. data/test/releasy/mixins/log_test.rb +15 -0
  43. data/test/releasy/mixins/register_test.rb +0 -1
  44. data/test/releasy/{archivers_test.rb → packagers_test.rb} +16 -19
  45. data/test/releasy/project_test.rb +33 -29
  46. data/test/teststrap.rb +3 -1
  47. data/test/yard_test.rb +1 -1
  48. metadata +55 -34
  49. data/lib/releasy/archivers.rb +0 -12
  50. data/lib/releasy/archivers/seven_zip.rb +0 -12
  51. data/lib/releasy/mixins/has_archivers.rb +0 -37
@@ -20,43 +20,43 @@ context Releasy::Project do
20
20
  asserts(:name).nil
21
21
  asserts(:underscored_name).nil
22
22
  asserts(:version).nil
23
+ asserts(:description).nil
24
+ asserts(:underscored_description).nil
23
25
  asserts(:executable).nil
24
26
  asserts(:files).empty
25
27
  asserts(:files).kind_of Rake::FileList
26
28
  asserts(:exposed_files).empty
27
29
  asserts(:exposed_files).kind_of Rake::FileList
28
- asserts(:verbose?).equals true
29
30
  asserts(:links).equals Hash.new
30
31
  asserts(:create_md5s?).equals false
32
+ asserts(:encoding_excluded?).equals false
31
33
 
32
34
  asserts(:to_s).equals "<Releasy::Project>"
33
35
  asserts(:output_path).equals "pkg"
34
36
  asserts(:folder_base).equals "pkg/" # Would be more, but dependent on name.
35
37
 
36
- asserts("attempting to generate tasks without any outputs") { topic.send :generate_tasks }.raises Releasy::ConfigError, /must specify at least one valid output/i
38
+ asserts("attempting to generate tasks without any outputs") { topic.send :generate_tasks }.raises Releasy::ConfigError, /Must use #add_build at least once before tasks can be generated/i
37
39
 
38
40
  asserts(:active_builders).empty
39
41
  asserts(:add_build, :source).kind_of Releasy::Builders::Source
40
42
  asserts(:active_builders).size 1
41
- asserts(:add_build, :source).raises(Releasy::ConfigError, /already have output :source/i)
43
+ asserts(:add_build, :source).raises(ArgumentError, /already have output :source/i)
42
44
  asserts(:add_build, :unknown).raises(ArgumentError, /unsupported output/i)
43
45
 
44
- asserts("active_archivers") { topic.send(:active_archivers, topic.send(:active_builders).first) }.empty
45
- asserts(:add_archive, :zip).kind_of Releasy::Archivers::Zip
46
- asserts("active_archivers") { topic.send(:active_archivers, topic.send(:active_builders).first) }.size 1
47
- asserts(:add_archive, :zip).raises(Releasy::ConfigError, /already have archive format :zip/i)
48
- asserts(:add_archive, :unknown).raises(ArgumentError, /unsupported archive/i)
46
+ asserts("active_packagers") { topic.send(:active_packagers, topic.send(:active_builders).first) }.empty
47
+ asserts(:add_package, :zip).kind_of Releasy::Packagers::Zip
48
+ asserts("active_packagers") { topic.send(:active_packagers, topic.send(:active_builders).first) }.size 1
49
+ asserts(:add_package, :zip).raises(ArgumentError, /already have archive format :zip/i)
50
+ asserts(:add_package, :unknown).raises(ArgumentError, /unsupported archive/i)
49
51
 
50
52
  context "#verbose" do
51
- hookup { topic.quiet }
52
53
  hookup { topic.verbose }
53
- asserts(:verbose?).equals true
54
+ asserts(:log_level).equals :verbose
54
55
  end
55
56
 
56
- context "#quiet" do
57
- hookup { topic.verbose }
58
- hookup { topic.quiet }
59
- asserts(:verbose?).equals false
57
+ context "#silent" do
58
+ hookup { topic.silent }
59
+ asserts(:log_level).equals :silent
60
60
  end
61
61
 
62
62
  context "#create_md5s" do
@@ -83,13 +83,14 @@ context Releasy::Project do
83
83
  name "Test Project - (2a)"
84
84
  version "v0.1.5"
85
85
 
86
- add_archive :"7z"
87
- add_archive :zip
86
+ add_package :"7z"
87
+ add_package :zip
88
+ exclude_encoding
88
89
 
89
90
  add_build :source
90
91
  add_build :osx_app do
91
- add_archive :tar_gz do
92
- extension "tgz"
92
+ add_package :tar_gz do
93
+ extension ".tgz"
93
94
  end
94
95
  wrapper Dir["../wrappers/gosu-mac-wrapper-*.tar.gz"].first
95
96
  url "org.url.app"
@@ -105,21 +106,24 @@ context Releasy::Project do
105
106
  end
106
107
  end
107
108
 
109
+ asserts(:encoding_excluded?).equals true
108
110
  asserts(:to_s).equals %[<Releasy::Project Test Project - (2a) v0.1.5>]
109
111
  asserts(:name).equals "Test Project - (2a)"
110
112
  asserts(:underscored_name).equals "test_project_2a"
111
113
  asserts(:version).equals "v0.1.5"
112
114
  asserts("file") { topic.files.to_a }.same_elements source_files
113
115
  asserts(:underscored_version).equals "v0_1_5"
116
+ asserts(:description).equals "Test Project - (2a) v0.1.5"
117
+ asserts(:underscored_description).equals "test_project_2a_v0_1_5"
114
118
  asserts(:executable).equals "bin/test_project_2a"
115
119
  asserts(:folder_base).equals "pkg/test_project_2a_v0_1_5"
116
120
  asserts(:links).equals "www.frog.com" => "Frog", "www2.fish.com" => "Fish"
117
121
 
118
122
  asserts(:active_builders).size(Gem.win_platform? ? 3 : 2)
119
- asserts("source active_archivers") { topic.send(:active_archivers, topic.send(:active_builders).find {|b| b.type == :source }) }.size 2
120
- asserts("osx app active_archivers") { topic.send(:active_archivers, topic.send(:active_builders).find {|b| b.type == :osx_app }) }.size 3
123
+ asserts("source active_packagers") { topic.send(:active_packagers, topic.send(:active_builders).find {|b| b.type == :source }) }.size 2
124
+ asserts("osx app active_packagers") { topic.send(:active_packagers, topic.send(:active_builders).find {|b| b.type == :osx_app }) }.size 3
121
125
  if Gem.win_platform?
122
- asserts("Windows standalone active_archivers") { topic.send(:active_archivers, topic.send(:active_builders).find {|b| b.type == :windows_standalone }) }.size 2
126
+ asserts("Windows standalone active_packagers") { topic.send(:active_packagers, topic.send(:active_builders).find {|b| b.type == :windows_standalone }) }.size 2
123
127
  end
124
128
 
125
129
  asserts "add_build yields an instance_eval-ed Releasy::DSLWrapper" do
@@ -130,10 +134,10 @@ context Releasy::Project do
130
134
  correct
131
135
  end
132
136
 
133
- asserts "add_archive yields an instance_eval-ed Releasy::DSLWrapper" do
137
+ asserts "add_package yields an instance_eval-ed Releasy::DSLWrapper" do
134
138
  correct = false
135
- topic.add_archive :tar_gz do
136
- correct = (is_a?(Releasy::DSLWrapper) and owner.is_a?(Releasy::Archivers::TarGzip))
139
+ topic.add_package :tar_gz do
140
+ correct = (is_a?(Releasy::DSLWrapper) and owner.is_a?(Releasy::Packagers::TarGzip))
137
141
  end
138
142
  correct
139
143
  end
@@ -141,9 +145,9 @@ context Releasy::Project do
141
145
  context "#generate_archive_tasks" do
142
146
  asserts(:generate_archive_tasks).equals { topic }
143
147
 
144
- should "call generate_tasks on all archivers" do
148
+ should "call generate_tasks on all packagers" do
145
149
  topic.send(:active_builders).each do |builder|
146
- topic.send(:active_archivers, builder).each {|a| mock(a).generate_tasks(builder.type.to_s.sub('_', ':'), builder.send(:folder)) }
150
+ topic.send(:active_packagers, builder).each {|a| mock(a).generate_tasks(builder.type.to_s.sub('_', ':'), builder.send(:folder), []) }
147
151
  end
148
152
  topic.send :generate_archive_tasks
149
153
  end
@@ -169,12 +173,12 @@ context Releasy::Project do
169
173
  p.name = "Test Project - (2a)"
170
174
  p.version = "v0.1.5"
171
175
 
172
- p.add_archive :"7z"
173
- p.add_archive :zip
176
+ p.add_package :"7z"
177
+ p.add_package :zip
174
178
 
175
179
  p.add_build :source
176
180
  p.add_build :osx_app do |b|
177
- b.add_archive :tar_gz do |a|
181
+ b.add_package :tar_gz do |a|
178
182
  a.extension = ".tgz"
179
183
  end
180
184
  b.wrapper = Dir["../wrappers/gosu-mac-wrapper-*.tar.gz"].first
@@ -39,13 +39,15 @@ $original_path = Dir.pwd
39
39
 
40
40
  def output_path; "../test_output"; end
41
41
 
42
+ Releasy::Mixins::Log.log_level = :silent
43
+
42
44
  # Ensure that the output directory is clean before starting tests, but don't do it for every test.
43
45
  output_dir = "test_output"
44
46
  if File.directory? output_dir
45
47
  puts "Deleting existing test outputs"
46
48
  rm_r FileList["#{output_dir}/*"], :verbose => false
47
49
  else
48
- mkdir output_dir
50
+ mkdir output_dir, :verbose => false
49
51
  end
50
52
 
51
53
 
@@ -50,7 +50,7 @@ context "YARD @examples" do
50
50
  end
51
51
  end
52
52
 
53
- module AlphaChannel
53
+ module MyApplication
54
54
  VERSION = "1.2.2"
55
55
  end
56
56
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: releasy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0rc1
4
+ version: 0.2.0rc2
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-25 00:00:00.000000000 Z
12
+ date: 2012-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ocra
16
- requirement: &3178992 !ruby/object:Gem::Requirement
16
+ requirement: &22452180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *3178992
24
+ version_requirements: *22452180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &3191196 !ruby/object:Gem::Requirement
27
+ requirement: &22451748 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.2.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *3191196
35
+ version_requirements: *22451748
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cri
38
- requirement: &3188400 !ruby/object:Gem::Requirement
38
+ requirement: &22451352 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.1.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *3188400
46
+ version_requirements: *22451352
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: thor
49
- requirement: &3201468 !ruby/object:Gem::Requirement
49
+ requirement: &22450980 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,21 @@ dependencies:
54
54
  version: 0.14.6
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *3201468
57
+ version_requirements: *22450980
58
+ - !ruby/object:Gem::Dependency
59
+ name: net-github-upload
60
+ requirement: &22450644 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 0.0.7
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *22450644
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: riot
60
- requirement: &3209964 !ruby/object:Gem::Requirement
71
+ requirement: &22450260 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ~>
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: 0.12.5
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *3209964
79
+ version_requirements: *22450260
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: rr
71
- requirement: &3208116 !ruby/object:Gem::Requirement
82
+ requirement: &22449912 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ~>
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: 1.0.4
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *3208116
90
+ version_requirements: *22449912
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: yard
82
- requirement: &3207192 !ruby/object:Gem::Requirement
93
+ requirement: &22449552 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ~>
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: 0.7.4
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *3207192
101
+ version_requirements: *22449552
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: redcarpet
93
- requirement: &3206124 !ruby/object:Gem::Requirement
104
+ requirement: &22449180 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ~>
@@ -98,7 +109,7 @@ dependencies:
98
109
  version: 2.0.1
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *3206124
112
+ version_requirements: *22449180
102
113
  description: ! 'Releasy helps to make Ruby application releases simpler, by creating
103
114
  and archiving source folders, Windows folders,
104
115
 
@@ -122,15 +133,6 @@ files:
122
133
  - bin/7z.sfx
123
134
  - bin/releasy
124
135
  - lib/releasy.rb
125
- - lib/releasy/archivers.rb
126
- - lib/releasy/archivers/archiver.rb
127
- - lib/releasy/archivers/dmg.rb
128
- - lib/releasy/archivers/exe.rb
129
- - lib/releasy/archivers/seven_zip.rb
130
- - lib/releasy/archivers/tar_archiver.rb
131
- - lib/releasy/archivers/tar_bzip2.rb
132
- - lib/releasy/archivers/tar_gzip.rb
133
- - lib/releasy/archivers/zip.rb
134
136
  - lib/releasy/builders.rb
135
137
  - lib/releasy/builders/builder.rb
136
138
  - lib/releasy/builders/ocra_builder.rb
@@ -138,23 +140,36 @@ files:
138
140
  - lib/releasy/builders/source.rb
139
141
  - lib/releasy/builders/windows_builder.rb
140
142
  - lib/releasy/builders/windows_folder.rb
141
- - lib/releasy/builders/windows_folder_from_ruby_dist.rb
142
143
  - lib/releasy/builders/windows_installer.rb
143
144
  - lib/releasy/builders/windows_standalone.rb
145
+ - lib/releasy/builders/windows_wrapped.rb
144
146
  - lib/releasy/cli.rb
145
147
  - lib/releasy/cli/install_sfx.rb
148
+ - lib/releasy/deployers.rb
149
+ - lib/releasy/deployers/deployer.rb
150
+ - lib/releasy/deployers/github.rb
146
151
  - lib/releasy/dsl_wrapper.rb
152
+ - lib/releasy/mixins/can_exclude_encoding.rb
147
153
  - lib/releasy/mixins/exec.rb
148
- - lib/releasy/mixins/has_archivers.rb
149
154
  - lib/releasy/mixins/has_gemspecs.rb
155
+ - lib/releasy/mixins/has_packagers.rb
156
+ - lib/releasy/mixins/log.rb
150
157
  - lib/releasy/mixins/register.rb
158
+ - lib/releasy/packagers.rb
159
+ - lib/releasy/packagers/dmg.rb
160
+ - lib/releasy/packagers/exe.rb
161
+ - lib/releasy/packagers/packager.rb
162
+ - lib/releasy/packagers/seven_zip.rb
163
+ - lib/releasy/packagers/tar_bzip2.rb
164
+ - lib/releasy/packagers/tar_gzip.rb
165
+ - lib/releasy/packagers/tar_packager.rb
166
+ - lib/releasy/packagers/zip.rb
151
167
  - lib/releasy/project.rb
152
168
  - lib/releasy/version.rb
153
169
  - lib/releasy/windows_wrapper_maker.rb
154
170
  - lib/releasy/windows_wrapper_maker/Gemfile
155
171
  - media/releasy.png
156
172
  - releasy.gemspec
157
- - test/releasy/archivers_test.rb
158
173
  - test/releasy/builders/data/Info.plist
159
174
  - test/releasy/builders/data/Main.rb
160
175
  - test/releasy/builders/data/relapse_runner.rb
@@ -164,14 +179,18 @@ files:
164
179
  - test/releasy/builders/osx_app_test.rb
165
180
  - test/releasy/builders/source_test.rb
166
181
  - test/releasy/builders/windows_builder_test.rb
167
- - test/releasy/builders/windows_folder_from_ruby_dist_test.rb
168
182
  - test/releasy/builders/windows_folder_test.rb
169
183
  - test/releasy/builders/windows_installer_test.rb
170
184
  - test/releasy/builders/windows_standalone_test.rb
185
+ - test/releasy/builders/windows_wrapped_test.rb
171
186
  - test/releasy/cli/install_sfx_test.rb
187
+ - test/releasy/deployers/github_test.rb
188
+ - test/releasy/deployers/helpers/helper.rb
172
189
  - test/releasy/dsl_wrapper_test.rb
173
190
  - test/releasy/integration/source_test.rb
191
+ - test/releasy/mixins/log_test.rb
174
192
  - test/releasy/mixins/register_test.rb
193
+ - test/releasy/packagers_test.rb
175
194
  - test/releasy/project_test.rb
176
195
  - test/releasy/windows_wrapper_maker_test.rb
177
196
  - test/teststrap.rb
@@ -201,7 +220,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
220
  version: '0'
202
221
  segments:
203
222
  - 0
204
- hash: 921787251
223
+ hash: 710558637
205
224
  required_rubygems_version: !ruby/object:Gem::Requirement
206
225
  none: false
207
226
  requirements:
@@ -217,19 +236,21 @@ signing_key:
217
236
  specification_version: 3
218
237
  summary: Releasy helps to make Ruby application releases simpler
219
238
  test_files:
220
- - test/releasy/archivers_test.rb
221
239
  - test/releasy/builders/ocra_builder_test.rb
222
240
  - test/releasy/builders/osx_app_test.rb
223
241
  - test/releasy/builders/source_test.rb
224
242
  - test/releasy/builders/windows_builder_test.rb
225
- - test/releasy/builders/windows_folder_from_ruby_dist_test.rb
226
243
  - test/releasy/builders/windows_folder_test.rb
227
244
  - test/releasy/builders/windows_installer_test.rb
228
245
  - test/releasy/builders/windows_standalone_test.rb
246
+ - test/releasy/builders/windows_wrapped_test.rb
229
247
  - test/releasy/cli/install_sfx_test.rb
248
+ - test/releasy/deployers/github_test.rb
230
249
  - test/releasy/dsl_wrapper_test.rb
231
250
  - test/releasy/integration/source_test.rb
251
+ - test/releasy/mixins/log_test.rb
232
252
  - test/releasy/mixins/register_test.rb
253
+ - test/releasy/packagers_test.rb
233
254
  - test/releasy/project_test.rb
234
255
  - test/releasy/windows_wrapper_maker_test.rb
235
256
  - test/yard_test.rb
@@ -1,12 +0,0 @@
1
- require 'releasy/mixins/register'
2
-
3
- module Releasy
4
- # Contains all {Archiver} types.
5
- module Archivers
6
- extend Mixins::Register
7
- end
8
- end
9
-
10
- %w[dmg exe seven_zip tar_bzip2 tar_gzip zip].each do |archiver|
11
- require "releasy/archivers/#{archiver}"
12
- end
@@ -1,12 +0,0 @@
1
- require "releasy/archivers/archiver"
2
-
3
- module Releasy
4
- module Archivers
5
- # 7z archive format (LZMA)
6
- class SevenZip < Archiver
7
- TYPE = :"7z"
8
- DEFAULT_EXTENSION = ".7z"
9
- Archivers.register self
10
- end
11
- end
12
- end
@@ -1,37 +0,0 @@
1
- module Releasy
2
- module Mixins
3
- # An object that owns one or more instances of {Archivers::Archiver}
4
- module HasArchivers
5
- # Add an archive type to be generated for each of your outputs.
6
- # @see Project#initialize
7
- # @param type [:exe, :"7z", :tar_bz2, :tar_gz, :zip]
8
- # @return [Project] self
9
- def add_archive(type, &block)
10
- raise ArgumentError, "Unsupported archive format #{type.inspect}" unless Archivers.has_type? type
11
- raise ConfigError, "Already have archive format #{type.inspect}" if archivers.any? {|a| a.type == type }
12
-
13
- archiver = Archivers[type].new(respond_to?(:project) ? project : self)
14
- archivers << archiver
15
-
16
- if block_given?
17
- if block.arity == 0
18
- DSLWrapper.new(archiver, &block)
19
- else
20
- yield archiver
21
- end
22
- end
23
-
24
- archiver
25
- end
26
-
27
- protected
28
- def archivers; @archivers ||= []; end
29
-
30
- protected
31
- # @return [Array<Archiver>]
32
- def active_archivers
33
- archivers
34
- end
35
- end
36
- end
37
- end