releasy 0.2.0rc1

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.
Files changed (74) hide show
  1. data/.gitignore +17 -0
  2. data/.yardopts +4 -0
  3. data/CHANGELOG.md +24 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.md +165 -0
  7. data/Rakefile +31 -0
  8. data/bin/7z.sfx +0 -0
  9. data/bin/releasy +7 -0
  10. data/lib/releasy.rb +18 -0
  11. data/lib/releasy/archivers.rb +12 -0
  12. data/lib/releasy/archivers/archiver.rb +74 -0
  13. data/lib/releasy/archivers/dmg.rb +18 -0
  14. data/lib/releasy/archivers/exe.rb +23 -0
  15. data/lib/releasy/archivers/seven_zip.rb +12 -0
  16. data/lib/releasy/archivers/tar_archiver.rb +14 -0
  17. data/lib/releasy/archivers/tar_bzip2.rb +13 -0
  18. data/lib/releasy/archivers/tar_gzip.rb +13 -0
  19. data/lib/releasy/archivers/zip.rb +12 -0
  20. data/lib/releasy/builders.rb +12 -0
  21. data/lib/releasy/builders/builder.rb +52 -0
  22. data/lib/releasy/builders/ocra_builder.rb +43 -0
  23. data/lib/releasy/builders/osx_app.rb +158 -0
  24. data/lib/releasy/builders/source.rb +27 -0
  25. data/lib/releasy/builders/windows_builder.rb +65 -0
  26. data/lib/releasy/builders/windows_folder.rb +47 -0
  27. data/lib/releasy/builders/windows_folder_from_ruby_dist.rb +150 -0
  28. data/lib/releasy/builders/windows_installer.rb +117 -0
  29. data/lib/releasy/builders/windows_standalone.rb +37 -0
  30. data/lib/releasy/cli.rb +12 -0
  31. data/lib/releasy/cli/install_sfx.rb +66 -0
  32. data/lib/releasy/dsl_wrapper.rb +71 -0
  33. data/lib/releasy/mixins/exec.rb +14 -0
  34. data/lib/releasy/mixins/has_archivers.rb +37 -0
  35. data/lib/releasy/mixins/has_gemspecs.rb +42 -0
  36. data/lib/releasy/mixins/register.rb +47 -0
  37. data/lib/releasy/project.rb +300 -0
  38. data/lib/releasy/version.rb +3 -0
  39. data/lib/releasy/windows_wrapper_maker.rb +90 -0
  40. data/lib/releasy/windows_wrapper_maker/Gemfile +8 -0
  41. data/media/releasy.png +0 -0
  42. data/releasy.gemspec +37 -0
  43. data/test/releasy/archivers_test.rb +65 -0
  44. data/test/releasy/builders/data/Info.plist +51 -0
  45. data/test/releasy/builders/data/Main.rb +12 -0
  46. data/test/releasy/builders/data/relapse_runner.rb +1 -0
  47. data/test/releasy/builders/data/set_app_executable.sh +3 -0
  48. data/test/releasy/builders/helpers/helper.rb +47 -0
  49. data/test/releasy/builders/ocra_builder_test.rb +37 -0
  50. data/test/releasy/builders/osx_app_test.rb +107 -0
  51. data/test/releasy/builders/source_test.rb +43 -0
  52. data/test/releasy/builders/windows_builder_test.rb +26 -0
  53. data/test/releasy/builders/windows_folder_from_ruby_dist_test.rb +105 -0
  54. data/test/releasy/builders/windows_folder_test.rb +56 -0
  55. data/test/releasy/builders/windows_installer_test.rb +62 -0
  56. data/test/releasy/builders/windows_standalone_test.rb +58 -0
  57. data/test/releasy/cli/install_sfx_test.rb +90 -0
  58. data/test/releasy/dsl_wrapper_test.rb +79 -0
  59. data/test/releasy/integration/source_test.rb +122 -0
  60. data/test/releasy/mixins/register_test.rb +52 -0
  61. data/test/releasy/project_test.rb +198 -0
  62. data/test/releasy/windows_wrapper_maker_test.rb +61 -0
  63. data/test/teststrap.rb +52 -0
  64. data/test/yard_test.rb +61 -0
  65. data/test_project/Gemfile +9 -0
  66. data/test_project/LICENSE.txt +1 -0
  67. data/test_project/README.txt +2 -0
  68. data/test_project/bin/test_app +3 -0
  69. data/test_project/lib/test_app.rb +6 -0
  70. data/test_project/lib/test_app/stuff.rb +1 -0
  71. data/test_project/test_app.icns +0 -0
  72. data/test_project/test_app.ico +0 -0
  73. data/wrappers/put_wrappers_here_for_testing.txt +17 -0
  74. metadata +236 -0
@@ -0,0 +1,90 @@
1
+ require 'fileutils'
2
+ require 'ocra'
3
+
4
+ module Releasy
5
+ # Creates wrappers and executables by wrapping Ocra's functionality.
6
+ class WindowsWrapperMaker
7
+ include FileUtils
8
+ include FileUtils::Verbose
9
+
10
+ # Creates an win32 executable file (xxx.exe) that runs via a Ruby executable at bin/ruby(w).exe
11
+ # Paths given to the executable are relative to the directory that the executable is in.
12
+ # Assumes that user's source will be put into _./src/_ and that ruby executables will be in _./bin/_
13
+ #
14
+ # @param executable_file [String] File to create, which should be a .exe file.
15
+ # @param ruby_file [String] Path of script to run with the executable.
16
+ # @option options :rubyopt [String] RUBYOPT environment variable - Options to pass to Ruby ('')
17
+ # @option options :rubylib [String] RUBYLIB environment variable - Paths, relative to _./src/_, to add to $LOAD_PATH ('').
18
+ # @option options :gem_path [String] GEM_PATH environment variable - Path, relative to _./_, to load gems from ('vendor').
19
+ # @option options :windows [Boolean] True for an application that uses windows, false for a console application (false)
20
+ # @option options :icon [String] Path to Windows icon file (.ico) that the executable should use (nil).
21
+ def build_executable(executable_file, ruby_file, options = {})
22
+ options = {
23
+ :rubyopt => '',
24
+ :rubylib => '',
25
+ :gem_path => 'vendor',
26
+ :windows => false,
27
+ :icon => nil,
28
+ }.merge! options
29
+
30
+ load_ocra unless defined? Ocra::OcraBuilder
31
+ set_ocra_options options[:icon]
32
+
33
+ Ocra::OcraBuilder.new(executable_file, options[:windows]) do |sb|
34
+ root = Ocra.Pathname Ocra::TEMPDIR_ROOT
35
+
36
+ sb.setenv('RUBYOPT', options[:rubyopt])
37
+ sb.setenv('RUBYLIB', options[:rubylib])
38
+ sb.setenv('GEM_PATH', (root / options[:gem_path]).to_native)
39
+ sb.setenv('BUNDLE_GEMFILE', '')
40
+ sb.setenv('BUNDLE_BIN_PATH', '')
41
+
42
+ ruby_executable = options[:windows] ? "rubyw.exe" : "ruby.exe"
43
+ exe = root / 'bin' / ruby_executable
44
+ script = (root / ruby_file).to_native
45
+
46
+ sb.postcreateprocess(exe, "#{ruby_executable} \"#{script}\"")
47
+ end
48
+
49
+ nil
50
+ end
51
+
52
+ protected
53
+ def set_ocra_options(icon)
54
+ options = Ocra.instance_variable_get(:@options)
55
+ options[:lzma_mode] = false
56
+ options[:chdir_first] = true
57
+ options[:icon_filename] = icon
58
+
59
+ nil
60
+ end
61
+
62
+ protected
63
+ def load_ocra
64
+ Object.send(:remove_const, :Ocra) # remove the "class Ocra", so we can load the "module Ocra"
65
+ spec = Gem.loaded_specs['ocra']
66
+
67
+ # If we aren't on Windows, then File::ALT_SEPARATOR won't be defined or will be defined to the local system.
68
+ # To save breaking the world, change it as we load, not in File itself.
69
+ ocra_file = spec.bin_file(spec.executable)
70
+ if Gem.win_platform?
71
+ load ocra_file
72
+ else
73
+ script = File.read(ocra_file)
74
+ # On non-windows, UTF8 is the standard way to load files, which is not what we want at all since it will complain about "\xFF".
75
+ script.force_encoding Encoding::ASCII_8BIT if script.respond_to? :force_encoding
76
+ script.gsub!("File::ALT_SEPARATOR", "'\\\\\\\\'")
77
+ Object.class_eval script, ocra_file
78
+ end
79
+
80
+ # Need to disable this method so we get the right output.
81
+ Ocra::OcraBuilder.class_eval do
82
+ def createinstdir(*args); end
83
+ end
84
+
85
+ Ocra.find_stubs
86
+
87
+ nil
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,8 @@
1
+ # Gemfile used to create windows_wrapper
2
+ source :rubygems
3
+
4
+ # Ocra used to make the wrapper.
5
+ gem 'ocra', '~> 1.3.0'
6
+
7
+ # Ray used to generate it.
8
+ gem 'ray', '~> 0.2.0'
Binary file
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
+ require "releasy/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "releasy"
7
+ s.version = Releasy::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Bil Bas (Spooner)"]
10
+ s.email = ["bil.bagpuss@gmail.com"]
11
+ s.homepage = "http://spooner.github.com/libraries/releasy/"
12
+ s.summary = %q{Releasy helps to make Ruby application releases simpler}
13
+ s.description = <<END
14
+ #{s.summary}, by creating and archiving source folders, Windows folders,
15
+ standalone executables, installers and OS X app bundles.
16
+ END
17
+
18
+ s.licenses = ["MIT", "GNU LGPL"] # Since I include a file from 7z.
19
+ s.rubyforge_project = "releasy"
20
+
21
+ s.requirements << '7z (optional; used to generate archives)'
22
+ s.requirements << 'InnoSetup (optional on Windows; used to make Win32 installer)'
23
+
24
+ s.files = `git ls-files`.split("\n")
25
+ s.test_files = Dir["test/**/*_test.rb"]
26
+ s.executable = "releasy"
27
+
28
+ s.add_runtime_dependency('ocra', '~> 1.3.0')
29
+ s.add_runtime_dependency('rake', '~> 0.9.2.2')
30
+ s.add_runtime_dependency('cri', '~> 2.1.0')
31
+ s.add_runtime_dependency('thor', '~> 0.14.6') # Only needed in Ruby 1.8, since it provides HashWithIndifferentAccess.
32
+
33
+ s.add_development_dependency('riot', '~> 0.12.5')
34
+ s.add_development_dependency('rr', '~> 1.0.4')
35
+ s.add_development_dependency('yard', '~> 0.7.4')
36
+ s.add_development_dependency('redcarpet', '~> 2.0.1')
37
+ end
@@ -0,0 +1,65 @@
1
+ require File.expand_path("../teststrap", File.dirname(__FILE__))
2
+
3
+ # Test all archivers at once, since they are pretty much identical.
4
+ [
5
+ [:dmg, Releasy::Archivers::Dmg, %[GZIP=-9 hdiutil create -fs HFS+ -srcfolder "f" -volname "Test App 0.1" "f.dmg"]],
6
+ [:exe, Releasy::Archivers::Exe, %[7z a -mmt -bd -t7z -mx9 -sfx7z.sfx "f.exe" "f"]],
7
+ [:"7z", Releasy::Archivers::SevenZip, %[7z a -mmt -bd -t7z -mx9 "f.7z" "f"]],
8
+ [:tar_bz2, Releasy::Archivers::TarBzip2, %[7z a -so -mmt -bd -ttar "f.tar" "f" | 7z a -si -bd -tbzip2 -mx9 "f.tar.bz2"]],
9
+ [:tar_gz, Releasy::Archivers::TarGzip, %[7z a -so -mmt -bd -ttar "f.tar" "f" | 7z a -si -bd -tgzip -mx9 "f.tar.gz"]],
10
+ [:zip, Releasy::Archivers::Zip, %[7z a -mmt -bd -tzip -mx9 "f.zip" "f"]],
11
+ ].each do |type, archiver, command|
12
+ extension = "." + type.to_s.tr("_", ".")
13
+
14
+ context archiver do
15
+ setup do
16
+ project = Releasy::Project.new
17
+ project.name = "Test App"
18
+ project.version = "0.1"
19
+ archiver.new project
20
+ end
21
+ teardown { Rake::Task.clear }
22
+
23
+ asserts(:type).equals type
24
+ asserts(:extension).equals extension
25
+ asserts(:command, "f").equals command
26
+ asserts(:package, "f").equals "f#{extension}"
27
+
28
+ context "setting extension with a . changes package path" do
29
+ hookup { topic.extension = ".wobble" }
30
+
31
+ asserts(:extension).equals ".wobble"
32
+ asserts(:package, "f").equals "f.wobble"
33
+ end
34
+
35
+ context "setting extension without a . still adds one" do
36
+ hookup { topic.extension = "wobble" }
37
+
38
+ asserts(:extension).equals "wobble"
39
+ asserts(:package, "f").equals "f.wobble"
40
+ end
41
+
42
+ context "generated tasks" do
43
+ hookup { topic.send :generate_tasks, "source", "frog" }
44
+
45
+ tasks = [
46
+ [:FileTask, "frog#{extension}", %w[frog]],
47
+ [:Task, "package:source:#{type}", ["frog#{extension}"]],
48
+ ]
49
+
50
+ test_tasks tasks
51
+ end
52
+
53
+ context "class" do
54
+ setup { topic.class }
55
+
56
+ asserts("#{archiver}::TYPE") { topic::TYPE }.equals type
57
+
58
+ if type == :exe
59
+ asserts("#{archiver}::SFX_NAME") { topic::SFX_NAME }.equals "7z.sfx"
60
+ asserts("#{archiver}::SFX_FILE") { topic::SFX_FILE }.equals File.expand_path("bin/7z.sfx", $original_path)
61
+ asserts("sfx file included") { File.exists? topic::SFX_FILE }
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,51 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>BuildMachineOSBuild</key>
6
+ <string>11C74</string>
7
+ <key>CFBundleDevelopmentRegion</key>
8
+ <string>English</string>
9
+ <key>CFBundleExecutable</key>
10
+ <string>Test App</string>
11
+ <key>CFBundleIconFile</key>
12
+ <string>test_app</string>
13
+ <key>CFBundleIdentifier</key>
14
+ <string>org.frog.fish</string>
15
+ <key>CFBundleInfoDictionaryVersion</key>
16
+ <string>6.0</string>
17
+ <key>CFBundlePackageType</key>
18
+ <string>APPL</string>
19
+ <key>CFBundleSignature</key>
20
+ <string>????</string>
21
+ <key>CFBundleVersion</key>
22
+ <string>1.0</string>
23
+ <key>DTCompiler</key>
24
+ <string>4.0</string>
25
+ <key>DTPlatformBuild</key>
26
+ <string>10M2518</string>
27
+ <key>DTPlatformVersion</key>
28
+ <string>PG</string>
29
+ <key>DTSDKBuild</key>
30
+ <string>8S2167</string>
31
+ <key>DTSDKName</key>
32
+ <string>macosx10.4</string>
33
+ <key>DTXcode</key>
34
+ <string>0400</string>
35
+ <key>DTXcodeBuild</key>
36
+ <string>10M2518</string>
37
+ <key>LSMinimumSystemVersionByArchitecture</key>
38
+ <dict>
39
+ <key>i386</key>
40
+ <string>10.4.0</string>
41
+ <key>ppc</key>
42
+ <string>10.4.0</string>
43
+ <key>x86_64</key>
44
+ <string>10.6.0</string>
45
+ </dict>
46
+ <key>NSMainNibFile</key>
47
+ <string>MainMenu</string>
48
+ <key>NSPrincipalClass</key>
49
+ <string>NSApplication</string>
50
+ </dict>
51
+ </plist>
@@ -0,0 +1,12 @@
1
+ Dir[File.expand_path("../vendor/gems/*/lib", __FILE__)].each do |lib|
2
+ $LOAD_PATH.unshift lib
3
+ end
4
+
5
+ OSX_EXECUTABLE_FOLDER = File.expand_path("../../..", __FILE__)
6
+
7
+ # Really hacky fudge-fix for something oddly missing in the .app.
8
+ class Encoding
9
+ UTF_7 = UTF_16BE = UTF_16LE = UTF_32BE = UTF_32LE = Encoding.list.first
10
+ end
11
+
12
+ load 'application/bin/test_app'
@@ -0,0 +1 @@
1
+ load 'bin/test_app'
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ chmod a+x "./Test App.app/Contents/MacOS/Test App"
3
+ echo "Made Test App.app executable"
@@ -0,0 +1,47 @@
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.quiet
11
+ project.output_path = output_path
12
+
13
+ project
14
+ end
15
+
16
+ # Hack to allow test to work using a different gemfile than Releasy's.
17
+ def clear_bundler_env
18
+ gemfile, bin_path = ENV['BUNDLE_GEMFILE'], ENV['BUNDLE_BIN_PATH']
19
+ ENV['BUNDLE_GEMFILE'], ENV['BUNDLE_BIN_PATH'] = '', ''
20
+ ret_val = yield
21
+ ENV['BUNDLE_GEMFILE'], ENV['BUNDLE_BIN_PATH'] = gemfile, bin_path
22
+ ret_val
23
+ end
24
+
25
+ def clear_all_env
26
+ rubylib, rubyopts = ENV['RUBYLIB'], ENV['RUBYOPTS']
27
+ ENV['RUBYLIB'], ENV['RUBYOPTS'] = '', ''
28
+ ret_val = clear_bundler_env { yield }
29
+ ENV['RUBYLIB'], ENV['RUBYOPTS'] = rubylib, rubyopts
30
+ ret_val
31
+ end
32
+
33
+ def data_file(file)
34
+ File.expand_path("test/releasy/builders/data/#{file}", $original_path)
35
+ end
36
+
37
+ def gemspecs_to_use
38
+ # Don't add Releasy since it is may be being run locally and thus not work at all.
39
+ Gem.loaded_specs.values.find_all {|s| %w[bundler cri ocra thor].include? s.name }
40
+ end
41
+
42
+ def link_file
43
+ <<END
44
+ [InternetShortcut]
45
+ URL=http://spooner.github.com/libraries/releasy/
46
+ END
47
+ end
@@ -0,0 +1,37 @@
1
+ require File.expand_path("helpers/helper", File.dirname(__FILE__))
2
+
3
+ context Releasy::Builders::OcraBuilder do
4
+ setup do
5
+ Class.new(Releasy::Builders::OcraBuilder) do
6
+ const_set :DEFAULT_FOLDER_SUFFIX, ''
7
+ end.new new_project
8
+ end
9
+
10
+ hookup do
11
+ topic.send(:setup)
12
+ end
13
+
14
+ asserts_topic.kind_of Releasy::Builders::WindowsBuilder
15
+ asserts(:ocra_parameters).equals ""
16
+ asserts(:icon).nil
17
+ asserts("setting incorrect icon") { topic.icon = "frog.png" }.raises ArgumentError, /icon must be a .ico file/
18
+ asserts(:ocra_command).raises Releasy::ConfigError, /Unless the executable file extension is .rbw or .rb, then #executable_type must be explicitly :windows or :console/
19
+
20
+ context "#icon=" do
21
+ hookup { topic.icon = "icon.ico" }
22
+ asserts(:icon).equals "icon.ico"
23
+ end
24
+
25
+ context "#ocra_command" do
26
+ hookup do
27
+ topic.exclude_encoding
28
+ topic.ocra_parameters = "--wobble"
29
+ topic.project.executable = source_files.first
30
+ topic.executable_type = :console
31
+ topic.icon = "icon.ico"
32
+ end
33
+
34
+ helper(:command) { %[ocra "bin/test_app" --console --no-enc --wobble --icon "icon.ico" "lib/test_app.rb" "lib/test_app/stuff.rb" "README.txt" "LICENSE.txt" "Gemfile.lock" "Gemfile"] }
35
+ asserts(:ocra_command).equals { %[bundle exec #{command}] }
36
+ end
37
+ end
@@ -0,0 +1,107 @@
1
+ require File.expand_path("helpers/helper", File.dirname(__FILE__))
2
+
3
+ folder = File.join(output_path, "test_app_0_1_OSX")
4
+ app_folder = File.join(folder, "Test App.app")
5
+
6
+ osx_app_wrapper = Dir.chdir(project_path) { Dir["../wrappers/gosu-mac-wrapper-*.tar.gz"].first }
7
+ if osx_app_wrapper
8
+ context Releasy::Builders::OsxApp do
9
+ setup { Releasy::Builders::OsxApp.new new_project }
10
+
11
+ teardown do
12
+ Dir.chdir $original_path
13
+ Rake::Task.clear
14
+ end
15
+
16
+ hookup do
17
+ Dir.chdir project_path
18
+ end
19
+
20
+ asserts(:folder_suffix).equals "OSX"
21
+ asserts(:icon=, "test_app.ico").raises Releasy::ConfigError, /icon must be a .icns file/
22
+ denies(:gemspecs).empty
23
+
24
+ context "no wrapper" do
25
+ hookup do
26
+ topic.url = "org.frog.fish"
27
+ end
28
+ asserts(:generate_tasks).raises Releasy::ConfigError, /wrapper not set/
29
+ end
30
+
31
+ context "invalid wrapper" do
32
+ hookup do
33
+ topic.url = "org.frog.fish"
34
+ topic.wrapper = "whatever"
35
+ end
36
+
37
+ asserts(:generate_tasks).raises Releasy::ConfigError, /wrapper not valid/
38
+ end
39
+
40
+ context "no url" do
41
+ hookup do
42
+ topic.wrapper = osx_app_wrapper
43
+ end
44
+ asserts(:generate_tasks).raises Releasy::ConfigError, /url not set/
45
+ end
46
+
47
+ context "valid" do
48
+ hookup do
49
+ topic.url = "org.frog.fish"
50
+ topic.wrapper = osx_app_wrapper
51
+ topic.icon = "test_app.icns"
52
+ topic.gemspecs = gemspecs_to_use
53
+ topic.send :generate_tasks
54
+ end
55
+
56
+ asserts(:folder_suffix).equals "OSX"
57
+ asserts(:app_name).equals "Test App.app"
58
+ asserts(:url).equals "org.frog.fish"
59
+ asserts(:wrapper).equals osx_app_wrapper
60
+ asserts("gemspecs correct") { topic.gemspecs == gemspecs_to_use }
61
+
62
+ context "tasks" do
63
+ tasks = [
64
+ [ :Task, "build:osx:app", [folder] ],
65
+ [ :FileCreationTask, '..', [] ], # byproduct of using #directory
66
+ [ :FileCreationTask, output_path, [] ], # byproduct of using #directory
67
+ [ :FileCreationTask, folder, source_files + [osx_app_wrapper]],
68
+ ]
69
+
70
+ test_tasks tasks
71
+ end
72
+
73
+ context "generate" do
74
+ hookup { Rake::Task["build:osx:app"].invoke }
75
+
76
+ asserts("files copied inside app") { source_files.all? {|f| same_contents? "#{app_folder}/Contents/Resources/application/#{f}", f } }
77
+ asserts("readme copied to folder") { same_contents? "#{folder}/README.txt", "README.txt" }
78
+ asserts("license copied to folder") { same_contents? "#{folder}/LICENSE.txt", "LICENSE.txt" }
79
+
80
+ asserts("executable renamed") { File.exists?("#{app_folder}/Contents/MacOS/Test App") }
81
+ if Gem.win_platform?
82
+ asserts("set_app_executable.sh created and with correct line endings") { File.read("#{folder}/set_app_executable.sh") == File.read(data_file("set_app_executable.sh")) }
83
+ else
84
+ asserts("app is an executable") { File.executable?("#{app_folder}/Contents/MacOS/Test App") }
85
+ denies("set_app_executable.sh created") { File.exists? "#{folder}/set_app_executable.sh" }
86
+ end
87
+
88
+ asserts("Gosu icon deleted") { not File.exists? "#{app_folder}/Contents/Resources/Gosu.icns" }
89
+ asserts("icon is copied to correct location") { File.exists? "#{app_folder}/Contents/Resources/test_app.icns" }
90
+ asserts("Main.rb is correct") { same_contents? "#{app_folder}/Contents/Resources/Main.rb", data_file("Main.rb") }
91
+ asserts("Info.plist is correct") { same_contents? "#{app_folder}/Contents/Info.plist", data_file("Info.plist") }
92
+
93
+ gemspecs_to_use.each do |gemspec|
94
+ name = "#{gemspec.name}-#{gemspec.version}"
95
+ asserts("#{name} gem folder copied") { File.directory? "#{app_folder}/Contents/Resources/vendor/gems/#{name}" }
96
+ asserts("#{name} spec copied") { File.exists? "#{app_folder}/Contents/Resources/vendor/specifications/#{name}.gemspec" }
97
+ end
98
+
99
+ denies("default chingu gem left in app") { File.exists?("#{app_folder}/Contents/Resources/lib/chingu") }
100
+
101
+ if RUBY_PLATFORM =~ /darwin/
102
+ asserts("program output") { clear_all_env { %x["./#{app_folder}/Contents/MacOS/Test App"] } }.equals "test run!\n"
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end