releasy 0.2.0rc1

Sign up to get free protection for your applications and to get access to all the features.
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,61 @@
1
+ require File.expand_path("../teststrap", File.dirname(__FILE__))
2
+
3
+ if Gem.win_platform?
4
+ require File.expand_path("../../lib/releasy/windows_wrapper_maker", File.dirname(__FILE__))
5
+
6
+ folder = windows_folder_wrapper
7
+
8
+ context Releasy::WindowsWrapperMaker do
9
+ setup { Releasy::WindowsWrapperMaker.new }
10
+
11
+ context '#build_executable' do
12
+ hookup do
13
+ # Can't mock on Ocra::OcraBuilder unless it has been loaded already.
14
+ topic.send(:load_ocra) unless defined? Ocra::OcraBuilder
15
+ end
16
+
17
+ helper :mock_ocra do |exe, script, ruby_exe, windows, options|
18
+ builder = Object.new
19
+ mock(builder).setenv("RUBYOPT", options[:rubyopt] || '')
20
+ mock(builder).setenv("RUBYLIB", options[:rubylib] || '')
21
+ mock(builder).setenv("BUNDLE_GEMFILE", '')
22
+ mock(builder).setenv("BUNDLE_BIN_PATH", '')
23
+ mock(builder).setenv("GEM_PATH", "\xFF\\#{options[:gem_path] || "vendor"}")
24
+ mock(builder).postcreateprocess(Ocra::Pathname("\xFF\\bin\\#{ruby_exe}"), "#{ruby_exe} \"\xFF\\#{script}\"")
25
+
26
+ mock(Ocra::OcraBuilder).new(exe, windows).yields(builder)
27
+ end
28
+
29
+ helper :check_options do |icon|
30
+ options = Ocra.instance_variable_get(:@options)
31
+ options[:lzma_mode] == false and
32
+ options[:chdir_first] == true and
33
+ options[:icon_filename] == icon
34
+ end
35
+
36
+ should "make a windows exe" do
37
+ mock_ocra 's.exe', 's.rb', 'rubyw.exe', true, {}
38
+ topic.build_executable "s.exe", "s.rb", :windows => true
39
+ check_options nil
40
+ end
41
+
42
+ should "make a console exe" do
43
+ mock_ocra 's.exe', 's.rb', 'ruby.exe', false, {}
44
+ topic.build_executable "s.exe", "s.rb"
45
+ check_options nil
46
+ end
47
+
48
+ should "add an icon" do
49
+ mock_ocra 's.exe', 's.rb', 'ruby.exe', false, {}
50
+ topic.build_executable "s.exe", "s.rb", :icon => "icon.ico"
51
+ check_options "icon.ico"
52
+ end
53
+
54
+ should "set up correct environment" do
55
+ mock_ocra 's.exe', 's.rb', 'ruby.exe', false, :rubyopt => "x", :rubylib => "y", :gem_path => "z"
56
+ topic.build_executable "s.exe", "s.rb", :rubyopt => "x", :rubylib => "y", :gem_path => "z"
57
+ check_options nil
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,52 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'riot'
4
+ require 'riot/rr'
5
+ require 'fileutils'
6
+
7
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
8
+ require 'releasy'
9
+
10
+ def source_files
11
+ %w[bin/test_app lib/test_app.rb lib/test_app/stuff.rb README.txt LICENSE.txt Gemfile.lock Gemfile]
12
+ end
13
+
14
+ def project_path
15
+ File.expand_path("../../test_project", __FILE__)
16
+ end
17
+
18
+ def test_tasks(tasks)
19
+ tasks.each do |type, name, prerequisites|
20
+ asserts("task #{name}") { Rake::Task[name] }.kind_of Rake.const_get(type)
21
+ asserts("task #{name} prerequisites") { Rake::Task[name].prerequisites }.same_elements prerequisites
22
+ end
23
+
24
+ asserts("no other tasks created") { (Rake::Task.tasks - tasks.map {|d| Rake::Task[d[1]] }).empty? }
25
+ end
26
+
27
+ def active_builders_valid
28
+ asserts("#active_builders are valid") { topic.send(:active_builders).all?(&:valid_for_platform?) }
29
+ end
30
+
31
+ def osx_platform?; !!(RUBY_PLATFORM =~ /darwin/); end
32
+
33
+ def windows_folder_wrapper; "windows_wrapper/ruby_#{RUBY_VERSION.tr(".", "_")}p#{RUBY_PATCHLEVEL}_win32_wrapper"; end
34
+
35
+ def same_contents?(file1, file2)
36
+ File.readlines(file1).map(&:strip) == File.readlines(file2).map(&:strip)
37
+ end
38
+ $original_path = Dir.pwd
39
+
40
+ def output_path; "../test_output"; end
41
+
42
+ # Ensure that the output directory is clean before starting tests, but don't do it for every test.
43
+ output_dir = "test_output"
44
+ if File.directory? output_dir
45
+ puts "Deleting existing test outputs"
46
+ rm_r FileList["#{output_dir}/*"], :verbose => false
47
+ else
48
+ mkdir output_dir
49
+ end
50
+
51
+
52
+
@@ -0,0 +1,61 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'yard'
4
+
5
+ require File.expand_path('../teststrap', __FILE__)
6
+
7
+ def run_riot(example, index, filename)
8
+ file_description = "#{filename} example ##{index}"
9
+
10
+ context "example ##{index + 1}" do
11
+ if example =~ /#=>/
12
+
13
+ code_so_far = ''
14
+ example.scan(/(.*?)#=>\s*([^\n]+)\n?/m).each_with_index do |(code, expected), i|
15
+ code_so_far += code + "\n"
16
+
17
+ result = binding.eval(code_so_far, file_description)
18
+ expected = binding.eval("#{code_so_far}\n#{expected}", file_description)
19
+ if expected.is_a? Enumerable
20
+ asserts(code.split("\n").last) { result }.same_elements expected
21
+ else
22
+ asserts(code.split("\n").last) { result }.equals expected
23
+ end
24
+ end
25
+ else
26
+ should('runs without error') { binding.eval(example, file_description); true }
27
+ end
28
+ end
29
+ end
30
+
31
+ def process_method(method)
32
+ if method.has_tag? :example
33
+ context method.name do
34
+ method.tags(:example).each_with_index {|e, i| run_riot e.text, i, "#{method.name} #{e.object}" }
35
+ end
36
+ end
37
+ end
38
+
39
+ context "YARD @examples" do
40
+ YARD.parse('lib/**/*.rb')
41
+
42
+ YARD::Registry.all(:class, :module).each do |object|
43
+ context object do
44
+ object.tags(:example).each_with_index {|e, i| run_riot e.text, i, e.object.to_s }
45
+ object.meths(:inherited => false, :included => false).each do |method|
46
+ process_method(method)
47
+ method.tags(:overload).each_with_index {|overload| process_method(overload) }
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ module AlphaChannel
54
+ VERSION = "1.2.2"
55
+ end
56
+
57
+ ['README.md'].each do |filename|
58
+ context "#{filename} examples" do
59
+ File.read(filename).scan(/#<<<.*#>>>/m).each_with_index {|e, i| run_riot e, i, filename }
60
+ end
61
+ end
@@ -0,0 +1,9 @@
1
+ # Hacky gemfile to ensure that we can generate output in tests from this sub-project.
2
+ # That is, so we can avoid using the Releasy gemfile.
3
+
4
+ source :rubygems
5
+
6
+ # Just include some gems that we know must be installed on the system that has Releasy.
7
+ gem "cri"
8
+ gem "ocra"
9
+ gem "thor"
@@ -0,0 +1 @@
1
+ Do what you want!
@@ -0,0 +1,2 @@
1
+ This is a project that we package as part of testing.
2
+ It is about as unremarkable as you can imagine!
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
3
+ require 'test_app'
@@ -0,0 +1,6 @@
1
+ # Required only so we know the gem is being copied properly.
2
+ require 'rubygems'
3
+ require 'bundler/setup' unless defined? OSX_EXECUTABLE_FOLDER # Can't require bundler because the current OSX wrapper is broken.
4
+ require 'cri'
5
+
6
+ require 'test_app/stuff'
@@ -0,0 +1 @@
1
+ puts "test run!"
Binary file
@@ -0,0 +1,17 @@
1
+ Put RubyInstaller distributions here for testing (Other Downloads - 7-zip archives).
2
+
3
+ http://rubyinstaller.org/downloads/
4
+
5
+ e.g. releasy/wrappers/ruby-1.9.3-p0-i386-mingw32.7z
6
+
7
+ ------------------------------------
8
+
9
+ Put Ruby OSX wrappers here (compiled by jlnr from libgosu.org).
10
+
11
+ http://www.libgosu.org/downloads/
12
+
13
+ e.g. releasy/wrappers/gosu-mac-wrapper-0.7.41.tar.gz
14
+
15
+ ------------------------------------
16
+
17
+ When using Releasy normally, you can specify the location of wrappers; this is ONLY for testing purposes.
metadata ADDED
@@ -0,0 +1,236 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: releasy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0rc1
5
+ prerelease: 5
6
+ platform: ruby
7
+ authors:
8
+ - Bil Bas (Spooner)
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ocra
16
+ requirement: &3178992 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.3.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *3178992
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &3191196 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 0.9.2.2
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *3191196
36
+ - !ruby/object:Gem::Dependency
37
+ name: cri
38
+ requirement: &3188400 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 2.1.0
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *3188400
47
+ - !ruby/object:Gem::Dependency
48
+ name: thor
49
+ requirement: &3201468 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.14.6
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *3201468
58
+ - !ruby/object:Gem::Dependency
59
+ name: riot
60
+ requirement: &3209964 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 0.12.5
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *3209964
69
+ - !ruby/object:Gem::Dependency
70
+ name: rr
71
+ requirement: &3208116 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 1.0.4
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *3208116
80
+ - !ruby/object:Gem::Dependency
81
+ name: yard
82
+ requirement: &3207192 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: 0.7.4
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *3207192
91
+ - !ruby/object:Gem::Dependency
92
+ name: redcarpet
93
+ requirement: &3206124 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ~>
97
+ - !ruby/object:Gem::Version
98
+ version: 2.0.1
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *3206124
102
+ description: ! 'Releasy helps to make Ruby application releases simpler, by creating
103
+ and archiving source folders, Windows folders,
104
+
105
+ standalone executables, installers and OS X app bundles.
106
+
107
+ '
108
+ email:
109
+ - bil.bagpuss@gmail.com
110
+ executables:
111
+ - releasy
112
+ extensions: []
113
+ extra_rdoc_files: []
114
+ files:
115
+ - .gitignore
116
+ - .yardopts
117
+ - CHANGELOG.md
118
+ - Gemfile
119
+ - LICENSE.txt
120
+ - README.md
121
+ - Rakefile
122
+ - bin/7z.sfx
123
+ - bin/releasy
124
+ - 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
+ - lib/releasy/builders.rb
135
+ - lib/releasy/builders/builder.rb
136
+ - lib/releasy/builders/ocra_builder.rb
137
+ - lib/releasy/builders/osx_app.rb
138
+ - lib/releasy/builders/source.rb
139
+ - lib/releasy/builders/windows_builder.rb
140
+ - lib/releasy/builders/windows_folder.rb
141
+ - lib/releasy/builders/windows_folder_from_ruby_dist.rb
142
+ - lib/releasy/builders/windows_installer.rb
143
+ - lib/releasy/builders/windows_standalone.rb
144
+ - lib/releasy/cli.rb
145
+ - lib/releasy/cli/install_sfx.rb
146
+ - lib/releasy/dsl_wrapper.rb
147
+ - lib/releasy/mixins/exec.rb
148
+ - lib/releasy/mixins/has_archivers.rb
149
+ - lib/releasy/mixins/has_gemspecs.rb
150
+ - lib/releasy/mixins/register.rb
151
+ - lib/releasy/project.rb
152
+ - lib/releasy/version.rb
153
+ - lib/releasy/windows_wrapper_maker.rb
154
+ - lib/releasy/windows_wrapper_maker/Gemfile
155
+ - media/releasy.png
156
+ - releasy.gemspec
157
+ - test/releasy/archivers_test.rb
158
+ - test/releasy/builders/data/Info.plist
159
+ - test/releasy/builders/data/Main.rb
160
+ - test/releasy/builders/data/relapse_runner.rb
161
+ - test/releasy/builders/data/set_app_executable.sh
162
+ - test/releasy/builders/helpers/helper.rb
163
+ - test/releasy/builders/ocra_builder_test.rb
164
+ - test/releasy/builders/osx_app_test.rb
165
+ - test/releasy/builders/source_test.rb
166
+ - test/releasy/builders/windows_builder_test.rb
167
+ - test/releasy/builders/windows_folder_from_ruby_dist_test.rb
168
+ - test/releasy/builders/windows_folder_test.rb
169
+ - test/releasy/builders/windows_installer_test.rb
170
+ - test/releasy/builders/windows_standalone_test.rb
171
+ - test/releasy/cli/install_sfx_test.rb
172
+ - test/releasy/dsl_wrapper_test.rb
173
+ - test/releasy/integration/source_test.rb
174
+ - test/releasy/mixins/register_test.rb
175
+ - test/releasy/project_test.rb
176
+ - test/releasy/windows_wrapper_maker_test.rb
177
+ - test/teststrap.rb
178
+ - test/yard_test.rb
179
+ - test_project/Gemfile
180
+ - test_project/LICENSE.txt
181
+ - test_project/README.txt
182
+ - test_project/bin/test_app
183
+ - test_project/lib/test_app.rb
184
+ - test_project/lib/test_app/stuff.rb
185
+ - test_project/test_app.icns
186
+ - test_project/test_app.ico
187
+ - wrappers/put_wrappers_here_for_testing.txt
188
+ homepage: http://spooner.github.com/libraries/releasy/
189
+ licenses:
190
+ - MIT
191
+ - GNU LGPL
192
+ post_install_message:
193
+ rdoc_options: []
194
+ require_paths:
195
+ - lib
196
+ required_ruby_version: !ruby/object:Gem::Requirement
197
+ none: false
198
+ requirements:
199
+ - - ! '>='
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ segments:
203
+ - 0
204
+ hash: 921787251
205
+ required_rubygems_version: !ruby/object:Gem::Requirement
206
+ none: false
207
+ requirements:
208
+ - - ! '>'
209
+ - !ruby/object:Gem::Version
210
+ version: 1.3.1
211
+ requirements:
212
+ - 7z (optional; used to generate archives)
213
+ - InnoSetup (optional on Windows; used to make Win32 installer)
214
+ rubyforge_project: releasy
215
+ rubygems_version: 1.8.11
216
+ signing_key:
217
+ specification_version: 3
218
+ summary: Releasy helps to make Ruby application releases simpler
219
+ test_files:
220
+ - test/releasy/archivers_test.rb
221
+ - test/releasy/builders/ocra_builder_test.rb
222
+ - test/releasy/builders/osx_app_test.rb
223
+ - test/releasy/builders/source_test.rb
224
+ - test/releasy/builders/windows_builder_test.rb
225
+ - test/releasy/builders/windows_folder_from_ruby_dist_test.rb
226
+ - test/releasy/builders/windows_folder_test.rb
227
+ - test/releasy/builders/windows_installer_test.rb
228
+ - test/releasy/builders/windows_standalone_test.rb
229
+ - test/releasy/cli/install_sfx_test.rb
230
+ - test/releasy/dsl_wrapper_test.rb
231
+ - test/releasy/integration/source_test.rb
232
+ - test/releasy/mixins/register_test.rb
233
+ - test/releasy/project_test.rb
234
+ - test/releasy/windows_wrapper_maker_test.rb
235
+ - test/yard_test.rb
236
+ has_rdoc: