releasy 0.2.0rc1 → 0.2.0rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +1 -1
- data/README.md +79 -65
- data/Rakefile +1 -1
- data/lib/releasy/builders.rb +1 -1
- data/lib/releasy/builders/builder.rb +6 -4
- data/lib/releasy/builders/osx_app.rb +49 -27
- data/lib/releasy/builders/source.rb +1 -3
- data/lib/releasy/builders/windows_builder.rb +3 -10
- data/lib/releasy/builders/windows_folder.rb +4 -6
- data/lib/releasy/builders/windows_installer.rb +3 -5
- data/lib/releasy/builders/windows_standalone.rb +1 -3
- data/lib/releasy/builders/{windows_folder_from_ruby_dist.rb → windows_wrapped.rb} +24 -22
- data/lib/releasy/cli/install_sfx.rb +3 -3
- data/lib/releasy/deployers.rb +12 -0
- data/lib/releasy/deployers/deployer.rb +28 -0
- data/lib/releasy/deployers/github.rb +109 -0
- data/lib/releasy/mixins/can_exclude_encoding.rb +22 -0
- data/lib/releasy/mixins/exec.rb +2 -2
- data/lib/releasy/mixins/has_gemspecs.rb +6 -6
- data/lib/releasy/mixins/has_packagers.rb +37 -0
- data/lib/releasy/mixins/log.rb +39 -0
- data/lib/releasy/mixins/register.rb +0 -1
- data/lib/releasy/packagers.rb +12 -0
- data/lib/releasy/{archivers → packagers}/dmg.rb +4 -4
- data/lib/releasy/{archivers → packagers}/exe.rb +4 -4
- data/lib/releasy/{archivers/archiver.rb → packagers/packager.rb} +20 -11
- data/lib/releasy/packagers/seven_zip.rb +12 -0
- data/lib/releasy/{archivers → packagers}/tar_bzip2.rb +4 -4
- data/lib/releasy/{archivers → packagers}/tar_gzip.rb +4 -4
- data/lib/releasy/{archivers/tar_archiver.rb → packagers/tar_packager.rb} +4 -4
- data/lib/releasy/{archivers → packagers}/zip.rb +4 -4
- data/lib/releasy/project.rb +105 -46
- data/lib/releasy/version.rb +1 -1
- data/lib/releasy/windows_wrapper_maker.rb +0 -3
- data/releasy.gemspec +1 -0
- data/test/releasy/builders/helpers/helper.rb +0 -1
- data/test/releasy/builders/osx_app_test.rb +18 -8
- data/test/releasy/builders/{windows_folder_from_ruby_dist_test.rb → windows_wrapped_test.rb} +16 -14
- data/test/releasy/deployers/github_test.rb +133 -0
- data/test/releasy/deployers/helpers/helper.rb +19 -0
- data/test/releasy/integration/source_test.rb +25 -6
- data/test/releasy/mixins/log_test.rb +15 -0
- data/test/releasy/mixins/register_test.rb +0 -1
- data/test/releasy/{archivers_test.rb → packagers_test.rb} +16 -19
- data/test/releasy/project_test.rb +33 -29
- data/test/teststrap.rb +3 -1
- data/test/yard_test.rb +1 -1
- metadata +55 -34
- data/lib/releasy/archivers.rb +0 -12
- data/lib/releasy/archivers/seven_zip.rb +0 -12
- data/lib/releasy/mixins/has_archivers.rb +0 -37
data/lib/releasy/version.rb
CHANGED
@@ -4,9 +4,6 @@ require 'ocra'
|
|
4
4
|
module Releasy
|
5
5
|
# Creates wrappers and executables by wrapping Ocra's functionality.
|
6
6
|
class WindowsWrapperMaker
|
7
|
-
include FileUtils
|
8
|
-
include FileUtils::Verbose
|
9
|
-
|
10
7
|
# Creates an win32 executable file (xxx.exe) that runs via a Ruby executable at bin/ruby(w).exe
|
11
8
|
# Paths given to the executable are relative to the directory that the executable is in.
|
12
9
|
# Assumes that user's source will be put into _./src/_ and that ruby executables will be in _./bin/_
|
data/releasy.gemspec
CHANGED
@@ -29,6 +29,7 @@ END
|
|
29
29
|
s.add_runtime_dependency('rake', '~> 0.9.2.2')
|
30
30
|
s.add_runtime_dependency('cri', '~> 2.1.0')
|
31
31
|
s.add_runtime_dependency('thor', '~> 0.14.6') # Only needed in Ruby 1.8, since it provides HashWithIndifferentAccess.
|
32
|
+
s.add_runtime_dependency('net-github-upload', '~> 0.0.7')
|
32
33
|
|
33
34
|
s.add_development_dependency('riot', '~> 0.12.5')
|
34
35
|
s.add_development_dependency('rr', '~> 1.0.4')
|
@@ -18,17 +18,16 @@ if osx_app_wrapper
|
|
18
18
|
end
|
19
19
|
|
20
20
|
asserts(:folder_suffix).equals "OSX"
|
21
|
-
asserts(:
|
21
|
+
asserts(:encoding_excluded?).equals false
|
22
|
+
asserts(:icon=, "test_app.ico").raises ArgumentError, /icon must be a .icns file/
|
22
23
|
denies(:gemspecs).empty
|
23
24
|
|
24
|
-
context "
|
25
|
-
hookup
|
26
|
-
topic.url = "org.frog.fish"
|
27
|
-
end
|
25
|
+
context "#wrapper not set" do
|
26
|
+
hookup { topic.url = "org.frog.fish" }
|
28
27
|
asserts(:generate_tasks).raises Releasy::ConfigError, /wrapper not set/
|
29
28
|
end
|
30
29
|
|
31
|
-
context "invalid
|
30
|
+
context "#wrapper invalid" do
|
32
31
|
hookup do
|
33
32
|
topic.url = "org.frog.fish"
|
34
33
|
topic.wrapper = "whatever"
|
@@ -37,10 +36,17 @@ if osx_app_wrapper
|
|
37
36
|
asserts(:generate_tasks).raises Releasy::ConfigError, /wrapper not valid/
|
38
37
|
end
|
39
38
|
|
40
|
-
context "
|
39
|
+
context "#wrapper does not exist" do
|
41
40
|
hookup do
|
42
|
-
topic.
|
41
|
+
topic.url = "org.frog.fish"
|
42
|
+
topic.wrapper = "gosu-mac-wrapper-0.0.00.tar.gz"
|
43
43
|
end
|
44
|
+
|
45
|
+
asserts(:build).raises Releasy::ConfigError, /wrapper file does not exist:/
|
46
|
+
end
|
47
|
+
|
48
|
+
context "no url" do
|
49
|
+
hookup { topic.wrapper = osx_app_wrapper }
|
44
50
|
asserts(:generate_tasks).raises Releasy::ConfigError, /url not set/
|
45
51
|
end
|
46
52
|
|
@@ -50,6 +56,7 @@ if osx_app_wrapper
|
|
50
56
|
topic.wrapper = osx_app_wrapper
|
51
57
|
topic.icon = "test_app.icns"
|
52
58
|
topic.gemspecs = gemspecs_to_use
|
59
|
+
topic.exclude_encoding
|
53
60
|
topic.send :generate_tasks
|
54
61
|
end
|
55
62
|
|
@@ -98,6 +105,9 @@ if osx_app_wrapper
|
|
98
105
|
|
99
106
|
denies("default chingu gem left in app") { File.exists?("#{app_folder}/Contents/Resources/lib/chingu") }
|
100
107
|
|
108
|
+
helper(:enc_folder) { "#{app_folder}/Contents/Resources/lib/enc" }
|
109
|
+
asserts("remaining encoding files") { Dir["#{enc_folder}/**/*.bundle"].map {|f| f[(enc_folder.size + 1)..-1] } }.same_elements %w[encdb.bundle iso_8859_1.bundle utf_16le.bundle trans/single_byte.bundle trans/transdb.bundle trans/utf_16_32.bundle]
|
110
|
+
|
101
111
|
if RUBY_PLATFORM =~ /darwin/
|
102
112
|
asserts("program output") { clear_all_env { %x["./#{app_folder}/Contents/MacOS/Test App"] } }.equals "test run!\n"
|
103
113
|
end
|
data/test/releasy/builders/{windows_folder_from_ruby_dist_test.rb → windows_wrapped_test.rb}
RENAMED
@@ -2,11 +2,11 @@ require File.expand_path("helpers/helper", File.dirname(__FILE__))
|
|
2
2
|
|
3
3
|
Dir[File.expand_path("wrappers/ruby-*.7z", $original_path)].each do |path_to_ruby_dist|
|
4
4
|
ruby_version = path_to_ruby_dist[/\d\.\d\.\d-p\d+/]
|
5
|
-
suffix = "
|
5
|
+
suffix = "WIN32_WRAPPED_#{ruby_version.tr(".", "_")}"
|
6
6
|
folder = File.join(output_path, "test_app_0_1_#{suffix}")
|
7
7
|
|
8
|
-
context "#{Releasy::Builders::
|
9
|
-
setup { Releasy::Builders::
|
8
|
+
context "#{Releasy::Builders::WindowsWrapped} for #{ruby_version}" do
|
9
|
+
setup { Releasy::Builders::WindowsWrapped.new new_project }
|
10
10
|
|
11
11
|
teardown do
|
12
12
|
Dir.chdir $original_path
|
@@ -17,9 +17,9 @@ Dir[File.expand_path("wrappers/ruby-*.7z", $original_path)].each do |path_to_rub
|
|
17
17
|
Dir.chdir project_path
|
18
18
|
end
|
19
19
|
|
20
|
-
asserts(:
|
20
|
+
asserts(:wrapper).nil
|
21
21
|
asserts(:folder_suffix).equals "WIN32"
|
22
|
-
asserts(:generate_tasks).raises Releasy::ConfigError, /
|
22
|
+
asserts(:generate_tasks).raises Releasy::ConfigError, /wrapper not set/
|
23
23
|
denies(:gemspecs).empty
|
24
24
|
|
25
25
|
if Gem.win_platform?
|
@@ -28,18 +28,20 @@ Dir[File.expand_path("wrappers/ruby-*.7z", $original_path)].each do |path_to_rub
|
|
28
28
|
asserts(:valid_for_platform?)
|
29
29
|
end
|
30
30
|
|
31
|
-
context "invalid
|
32
|
-
hookup
|
33
|
-
|
34
|
-
|
31
|
+
context "#wrapper invalid" do
|
32
|
+
hookup { topic.wrapper = "wrapper" }
|
33
|
+
asserts(:generate_tasks).raises Releasy::ConfigError, /wrapper not valid/
|
34
|
+
end
|
35
35
|
|
36
|
-
|
36
|
+
context "#wrapper doesn't exist" do
|
37
|
+
hookup { topic.wrapper = "ruby-1.9.0-p999-i386-mingw32.7z" }
|
38
|
+
asserts(:build).raises Releasy::ConfigError, /wrapper does not exist/
|
37
39
|
end
|
38
40
|
|
39
41
|
context "valid" do
|
40
42
|
hookup do
|
41
43
|
stub(topic).valid_for_platform?.returns(true) # Need to do this so we can test on all platforms.
|
42
|
-
topic.
|
44
|
+
topic.wrapper = path_to_ruby_dist
|
43
45
|
topic.folder_suffix = suffix
|
44
46
|
topic.executable_type = :console
|
45
47
|
topic.gemspecs = gemspecs_to_use
|
@@ -50,12 +52,12 @@ Dir[File.expand_path("wrappers/ruby-*.7z", $original_path)].each do |path_to_rub
|
|
50
52
|
|
51
53
|
asserts(:output_path).equals output_path
|
52
54
|
asserts(:folder_suffix).equals suffix
|
53
|
-
asserts(:
|
55
|
+
asserts(:wrapper).equals path_to_ruby_dist
|
54
56
|
asserts("gemspecs correct") { topic.gemspecs == gemspecs_to_use }
|
55
57
|
|
56
58
|
context "tasks" do
|
57
59
|
tasks = [
|
58
|
-
[ :Task, "build:windows:
|
60
|
+
[ :Task, "build:windows:wrapped", [folder] ],
|
59
61
|
[ :FileTask, '..', [] ], # byproduct of using #directory
|
60
62
|
[ :FileTask, output_path, [] ], # byproduct of using #directory
|
61
63
|
[ :FileTask, folder, source_files + [path_to_ruby_dist]],
|
@@ -65,7 +67,7 @@ Dir[File.expand_path("wrappers/ruby-*.7z", $original_path)].each do |path_to_rub
|
|
65
67
|
end
|
66
68
|
|
67
69
|
context "generate" do
|
68
|
-
hookup { Rake::Task["build:windows:
|
70
|
+
hookup { Rake::Task["build:windows:wrapped"].invoke }
|
69
71
|
|
70
72
|
asserts("files copied to folder") { source_files.all? {|f| same_contents? "#{folder}/src/#{f}", f } }
|
71
73
|
asserts("readme copied to folder") { same_contents? "#{folder}/README.txt", "README.txt" }
|
@@ -0,0 +1,133 @@
|
|
1
|
+
require File.expand_path("helpers/helper", File.dirname(__FILE__))
|
2
|
+
require 'net/github-upload' # Because this isn't otherwise loaded until it is needed.
|
3
|
+
|
4
|
+
context Releasy::Deployers::Github do
|
5
|
+
setup do
|
6
|
+
any_instance_of Releasy::Deployers::Github do |github|
|
7
|
+
stub(github, :`).with("git config github.user").returns "test_user"
|
8
|
+
stub(github, :`).with("git config github.token").returns "0" * 32
|
9
|
+
end
|
10
|
+
|
11
|
+
Releasy::Deployers::Github.new new_project
|
12
|
+
end
|
13
|
+
|
14
|
+
teardown do
|
15
|
+
Dir.chdir $original_path
|
16
|
+
Rake::Task.clear
|
17
|
+
end
|
18
|
+
|
19
|
+
hookup do
|
20
|
+
Dir.chdir project_path
|
21
|
+
end
|
22
|
+
|
23
|
+
asserts(:user).equals "test_user"
|
24
|
+
asserts(:token).equals "0" * 32
|
25
|
+
asserts(:description).equals "Test App 0.1"
|
26
|
+
|
27
|
+
context "repository not configured" do
|
28
|
+
setup do
|
29
|
+
any_instance_of Releasy::Deployers::Github do |github|
|
30
|
+
mock(github, :`).with("git config remote.origin.url").returns { raise Errno::ENOENT }
|
31
|
+
end
|
32
|
+
|
33
|
+
Releasy::Deployers::Github.new new_project
|
34
|
+
end
|
35
|
+
|
36
|
+
asserts(:repository).equals "test_app"
|
37
|
+
end
|
38
|
+
|
39
|
+
context "repository configured" do
|
40
|
+
setup do
|
41
|
+
any_instance_of Releasy::Deployers::Github do |github|
|
42
|
+
mock(github, :`).with("git config remote.origin.url").returns "git@github.com:test_user/test-app.git"
|
43
|
+
end
|
44
|
+
|
45
|
+
Releasy::Deployers::Github.new new_project
|
46
|
+
end
|
47
|
+
|
48
|
+
asserts(:repository).equals "test-app"
|
49
|
+
end
|
50
|
+
|
51
|
+
context "user not configured" do
|
52
|
+
setup do
|
53
|
+
any_instance_of Releasy::Deployers::Github do |github|
|
54
|
+
mock(github, :`).with("git config github.user").returns { raise Errno::ENOENT }
|
55
|
+
mock(github, :`).with("git config github.token").returns "0" * 32
|
56
|
+
end
|
57
|
+
|
58
|
+
Releasy::Deployers::Github.new new_project
|
59
|
+
end
|
60
|
+
|
61
|
+
asserts(:user).nil
|
62
|
+
|
63
|
+
asserts(:deploy, "file").raises Releasy::ConfigError, /#user must be set manually if it is not configured on the system/
|
64
|
+
end
|
65
|
+
|
66
|
+
context "token not configured" do
|
67
|
+
setup do
|
68
|
+
any_instance_of Releasy::Deployers::Github do |github|
|
69
|
+
mock(github, :`).with("git config github.user").returns "test_user"
|
70
|
+
mock(github, :`).with("git config github.token").returns { raise Errno::ENOENT }
|
71
|
+
end
|
72
|
+
Releasy::Deployers::Github.new new_project
|
73
|
+
end
|
74
|
+
|
75
|
+
asserts(:token).nil
|
76
|
+
|
77
|
+
asserts(:deploy, "file").raises Releasy::ConfigError, /#token must be set manually if it is not configured on the system/
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
context "valid" do
|
82
|
+
context "#generate_tasks" do
|
83
|
+
hookup { topic.send :generate_tasks, "source:7z", "SOURCE.7z", ".7z" }
|
84
|
+
tasks = [
|
85
|
+
[ :Task, "deploy:source:7z:github", %w[package:source:7z] ],
|
86
|
+
]
|
87
|
+
|
88
|
+
test_tasks tasks
|
89
|
+
end
|
90
|
+
|
91
|
+
context "#deploy" do
|
92
|
+
helper(:stub_file_size) { stub(File).size("file.zip").returns 1000 }
|
93
|
+
|
94
|
+
should "expect an Net::GitHub::Upload to be created and used to upload" do
|
95
|
+
stub_file_size
|
96
|
+
mock(Net::GitHub::Upload).new :login => "test_user", :token => "0" * 32 do
|
97
|
+
mock!.upload :repos => "test_app", :file => "file.zip", :description => "Test App 0.1", :replace => false
|
98
|
+
end
|
99
|
+
|
100
|
+
topic.send :deploy, "file.zip"
|
101
|
+
|
102
|
+
true
|
103
|
+
end
|
104
|
+
|
105
|
+
should "expect an Net::GitHub::Upload to be created and exit (not forcing replacement and file already exists)" do
|
106
|
+
stub_file_size
|
107
|
+
mock(Net::GitHub::Upload).new :login => "test_user", :token => "0" * 32 do
|
108
|
+
mock!.upload :repos => "test_app", :file => "file.zip", :description => "Test App 0.1", :replace => false do
|
109
|
+
raise "file already exists"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
mock(topic).exit(1)
|
114
|
+
|
115
|
+
topic.send :deploy, "file.zip"
|
116
|
+
|
117
|
+
true
|
118
|
+
end
|
119
|
+
|
120
|
+
should "expect an Net::GitHub::Upload to be created and used to upload (forcing replacement)" do
|
121
|
+
stub_file_size
|
122
|
+
mock(Net::GitHub::Upload).new :login => "test_user", :token => "0" * 32 do
|
123
|
+
mock!.upload :repos => "test_app", :file => "file.zip", :description => "Test App 0.1", :replace => true
|
124
|
+
end
|
125
|
+
|
126
|
+
topic.replace!
|
127
|
+
topic.send :deploy, "file.zip"
|
128
|
+
|
129
|
+
true
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path("../../../teststrap", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
def new_project
|
4
|
+
project = Releasy::Project.new
|
5
|
+
project.name = "Test App"
|
6
|
+
project.version = "0.1"
|
7
|
+
project.files = source_files
|
8
|
+
project.exposed_files = %w[README.txt LICENSE.txt]
|
9
|
+
project.add_link "http://spooner.github.com/libraries/releasy/", "Releasy website"
|
10
|
+
project.output_path = output_path
|
11
|
+
|
12
|
+
project.add_build :source
|
13
|
+
|
14
|
+
project.add_package :"7z"
|
15
|
+
|
16
|
+
project
|
17
|
+
end
|
18
|
+
|
19
|
+
def archive_file; "test_app_0_1_SOURCE.7z"; end
|
@@ -20,14 +20,16 @@ context "Source in all formats" do
|
|
20
20
|
create_md5s
|
21
21
|
|
22
22
|
add_build :source do
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
add_package :dmg
|
24
|
+
add_package :exe
|
25
|
+
add_package :zip
|
26
|
+
add_package :"7z"
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
add_package :tar_gz
|
30
|
+
add_package :tar_bz2
|
31
|
+
|
32
|
+
add_deploy :github
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
@@ -46,6 +48,23 @@ context "Source in all formats" do
|
|
46
48
|
|
47
49
|
context "tasks" do
|
48
50
|
tasks = [
|
51
|
+
[ :Task, "deploy", %w[deploy:source] ],
|
52
|
+
[ :Task, "deploy:github", %w[deploy:source:github] ],
|
53
|
+
[ :Task, "deploy:source", %w[deploy:source:github] ],
|
54
|
+
[ :Task, "deploy:source:github", %w[deploy:source:dmg:github deploy:source:7z:github deploy:source:exe:github deploy:source:tar_gz:github deploy:source:tar_bz2:github deploy:source:zip:github] ],
|
55
|
+
[ :Task, "deploy:source:dmg", %w[deploy:source:dmg:github] ],
|
56
|
+
[ :Task, "deploy:source:dmg:github", %w[package:source:dmg] ],
|
57
|
+
[ :Task, "deploy:source:7z", %w[deploy:source:7z:github] ],
|
58
|
+
[ :Task, "deploy:source:7z:github", %w[package:source:7z] ],
|
59
|
+
[ :Task, "deploy:source:exe", %w[deploy:source:exe:github] ],
|
60
|
+
[ :Task, "deploy:source:exe:github", %w[package:source:exe] ],
|
61
|
+
[ :Task, "deploy:source:tar_gz", %w[deploy:source:tar_gz:github] ],
|
62
|
+
[ :Task, "deploy:source:tar_gz:github", %w[package:source:tar_gz] ],
|
63
|
+
[ :Task, "deploy:source:tar_bz2", %w[deploy:source:tar_bz2:github] ],
|
64
|
+
[ :Task, "deploy:source:tar_bz2:github", %w[package:source:tar_bz2] ],
|
65
|
+
[ :Task, "deploy:source:zip", %w[deploy:source:zip:github] ],
|
66
|
+
[ :Task, "deploy:source:zip:github", %w[package:source:zip] ],
|
67
|
+
|
49
68
|
[ :Task, "package", %w[package:source] ],
|
50
69
|
[ :Task, "package:source", %w[package:source:dmg package:source:7z package:source:exe package:source:tar_gz package:source:tar_bz2 package:source:zip] ],
|
51
70
|
[ :Task, "package:source:dmg", ["#{folder}.dmg"] ],
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path("../../teststrap", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
context Releasy::Mixins::Log do
|
4
|
+
setup { Releasy::Mixins::Log }
|
5
|
+
|
6
|
+
asserts(:log_level=, :fish).raises ArgumentError, "Bad log_level: :fish"
|
7
|
+
|
8
|
+
context "included" do
|
9
|
+
setup { Object.new.extend topic }
|
10
|
+
|
11
|
+
asserts_topic.respond_to :heading
|
12
|
+
asserts_topic.respond_to :info
|
13
|
+
asserts_topic.respond_to :warn
|
14
|
+
end
|
15
|
+
end
|
@@ -20,7 +20,6 @@ context Releasy::Mixins::Register do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
asserts("trying to register a non-class") { topic.register 12 }.raises TypeError, /Can only register classes/
|
23
|
-
asserts("trying to register a class not within the module") { topic.register NotInModule }.raises ArgumentError, /Can't register a class not within this module/
|
24
23
|
asserts("trying to register a class without TYPE, even if in the module") { topic.register topic::Untyped }.raises ArgumentError, /To register, a class must have TYPE defined/
|
25
24
|
|
26
25
|
context "with registered classes (blue and red frogs)" do
|
@@ -1,22 +1,22 @@
|
|
1
1
|
require File.expand_path("../teststrap", File.dirname(__FILE__))
|
2
2
|
|
3
|
-
# Test all
|
3
|
+
# Test all packagers at once, since they are pretty much identical.
|
4
4
|
[
|
5
|
-
[:dmg, Releasy::
|
6
|
-
[:exe, Releasy::
|
7
|
-
[:"7z", Releasy::
|
8
|
-
[:tar_bz2, Releasy::
|
9
|
-
[:tar_gz, Releasy::
|
10
|
-
[:zip, Releasy::
|
11
|
-
].each do |type,
|
5
|
+
[:dmg, Releasy::Packagers::Dmg, %[GZIP=-9 hdiutil create -fs HFS+ -srcfolder "f" -volname "Test App 0.1" "f.dmg"]],
|
6
|
+
[:exe, Releasy::Packagers::Exe, %[7z a -mmt -bd -t7z -mx9 -sfx7z.sfx "f.exe" "f"]],
|
7
|
+
[:"7z", Releasy::Packagers::SevenZip, %[7z a -mmt -bd -t7z -mx9 "f.7z" "f"]],
|
8
|
+
[:tar_bz2, Releasy::Packagers::TarBzip2, %[7z a -so -mmt -bd -ttar "f.tar" "f" | 7z a -si -bd -tbzip2 -mx9 "f.tar.bz2"]],
|
9
|
+
[:tar_gz, Releasy::Packagers::TarGzip, %[7z a -so -mmt -bd -ttar "f.tar" "f" | 7z a -si -bd -tgzip -mx9 "f.tar.gz"]],
|
10
|
+
[:zip, Releasy::Packagers::Zip, %[7z a -mmt -bd -tzip -mx9 "f.zip" "f"]],
|
11
|
+
].each do |type, packager, command|
|
12
12
|
extension = "." + type.to_s.tr("_", ".")
|
13
13
|
|
14
|
-
context
|
14
|
+
context packager do
|
15
15
|
setup do
|
16
16
|
project = Releasy::Project.new
|
17
17
|
project.name = "Test App"
|
18
18
|
project.version = "0.1"
|
19
|
-
|
19
|
+
packager.new project
|
20
20
|
end
|
21
21
|
teardown { Rake::Task.clear }
|
22
22
|
|
@@ -32,15 +32,12 @@ require File.expand_path("../teststrap", File.dirname(__FILE__))
|
|
32
32
|
asserts(:package, "f").equals "f.wobble"
|
33
33
|
end
|
34
34
|
|
35
|
-
context "setting extension without a .
|
36
|
-
|
37
|
-
|
38
|
-
asserts(:extension).equals "wobble"
|
39
|
-
asserts(:package, "f").equals "f.wobble"
|
35
|
+
context "setting extension without a . raises an error" do
|
36
|
+
asserts(:extension=, "wobble").raises ArgumentError, /extension must be valid/
|
40
37
|
end
|
41
38
|
|
42
39
|
context "generated tasks" do
|
43
|
-
hookup { topic.send :generate_tasks, "source", "frog" }
|
40
|
+
hookup { topic.send :generate_tasks, "source", "frog", [] }
|
44
41
|
|
45
42
|
tasks = [
|
46
43
|
[:FileTask, "frog#{extension}", %w[frog]],
|
@@ -53,11 +50,11 @@ require File.expand_path("../teststrap", File.dirname(__FILE__))
|
|
53
50
|
context "class" do
|
54
51
|
setup { topic.class }
|
55
52
|
|
56
|
-
asserts("#{
|
53
|
+
asserts("#{packager}::TYPE") { topic::TYPE }.equals type
|
57
54
|
|
58
55
|
if type == :exe
|
59
|
-
asserts("#{
|
60
|
-
asserts("#{
|
56
|
+
asserts("#{packager}::SFX_NAME") { topic::SFX_NAME }.equals "7z.sfx"
|
57
|
+
asserts("#{packager}::SFX_FILE") { topic::SFX_FILE }.equals File.expand_path("bin/7z.sfx", $original_path)
|
61
58
|
asserts("sfx file included") { File.exists? topic::SFX_FILE }
|
62
59
|
end
|
63
60
|
end
|