ocra 1.2.0 → 1.3.0.rc1
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.
- data/History.txt +17 -0
- data/Manifest.txt +1 -1
- data/{README.txt → README.rdoc} +138 -63
- data/Rakefile +1 -4
- data/bin/ocra +492 -228
- data/lib/ocra.rb +1 -1
- data/share/ocra/edicon.exe +0 -0
- data/share/ocra/stub.exe +0 -0
- data/share/ocra/stubw.exe +0 -0
- data/test/test_ocra.rb +186 -65
- metadata +12 -14
data/lib/ocra.rb
CHANGED
data/share/ocra/edicon.exe
CHANGED
Binary file
|
data/share/ocra/stub.exe
CHANGED
Binary file
|
data/share/ocra/stubw.exe
CHANGED
Binary file
|
data/test/test_ocra.rb
CHANGED
@@ -2,6 +2,7 @@ require "test/unit"
|
|
2
2
|
require "tmpdir"
|
3
3
|
require "fileutils"
|
4
4
|
require "rbconfig"
|
5
|
+
require "pathname"
|
5
6
|
|
6
7
|
begin
|
7
8
|
require "rubygems"
|
@@ -94,13 +95,37 @@ class TestOcra < Test::Unit::TestCase
|
|
94
95
|
end
|
95
96
|
end
|
96
97
|
|
98
|
+
def each_path_combo(*files)
|
99
|
+
# In same directory as first file
|
100
|
+
basedir = Pathname.new(files[0]).realpath.parent
|
101
|
+
args = files.map{|p|Pathname.new(p).realpath.relative_path_from(basedir).to_s}
|
102
|
+
cd basedir do
|
103
|
+
yield(*args)
|
104
|
+
end
|
105
|
+
|
106
|
+
# In parent directory of first file
|
107
|
+
basedir = basedir.parent
|
108
|
+
args = files.map{|p|Pathname.new(p).realpath.relative_path_from(basedir).to_s}
|
109
|
+
cd basedir do
|
110
|
+
yield(*args)
|
111
|
+
end
|
112
|
+
|
113
|
+
# In a completely different directory
|
114
|
+
args = files.map{|p|Pathname.new(p).realpath.to_s}
|
115
|
+
with_tmpdir do
|
116
|
+
yield(*args)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
97
120
|
# Hello world test. Test that we can build and run executables.
|
98
121
|
def test_helloworld
|
99
122
|
with_fixture 'helloworld' do
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
123
|
+
each_path_combo "helloworld.rb" do |script|
|
124
|
+
assert system("ruby", ocra, script, *DefaultArgs)
|
125
|
+
assert File.exist?("helloworld.exe")
|
126
|
+
pristine_env "helloworld.exe" do
|
127
|
+
assert system("helloworld.exe")
|
128
|
+
end
|
104
129
|
end
|
105
130
|
end
|
106
131
|
end
|
@@ -121,11 +146,82 @@ class TestOcra < Test::Unit::TestCase
|
|
121
146
|
def test_writefile
|
122
147
|
with_fixture 'writefile' do
|
123
148
|
assert system("ruby", ocra, "writefile.rb", *DefaultArgs)
|
149
|
+
assert File.exist?("output.txt") # Make sure ocra ran the script during build
|
124
150
|
pristine_env "writefile.exe" do
|
125
151
|
assert File.exist?("writefile.exe")
|
126
152
|
assert system("writefile.exe")
|
127
153
|
assert File.exist?("output.txt")
|
128
|
-
|
154
|
+
assert_equal "output", File.read("output.txt")
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# With --no-dep-run, ocra should not run script during build
|
160
|
+
def test_nodeprun
|
161
|
+
with_fixture 'writefile' do
|
162
|
+
assert system("ruby", ocra, "writefile.rb", *(DefaultArgs + ["--no-dep-run"]))
|
163
|
+
assert !File.exist?("output.txt")
|
164
|
+
pristine_env "writefile.exe" do
|
165
|
+
assert File.exist?("writefile.exe")
|
166
|
+
assert system("writefile.exe")
|
167
|
+
assert File.exist?("output.txt")
|
168
|
+
assert_equal "output", File.read("output.txt")
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# With dep run disabled but including all core libs, should be able
|
174
|
+
# to use ruby standard libraries (i.e. cgi)
|
175
|
+
def test_rubycoreincl
|
176
|
+
with_fixture 'rubycoreincl' do
|
177
|
+
assert system("ruby", ocra, "rubycoreincl.rb", *(DefaultArgs + ["--no-dep-run", "--add-all-core"]))
|
178
|
+
pristine_env "rubycoreincl.exe" do
|
179
|
+
assert File.exist?("rubycoreincl.exe")
|
180
|
+
assert system("rubycoreincl.exe")
|
181
|
+
assert File.exist?("output.txt")
|
182
|
+
assert_equal "3 < 5", File.read("output.txt")
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
# With dep run disabled but including corelibs and using a Bundler Gemfile, specified gems should
|
188
|
+
# be automatically included and usable in packaged app
|
189
|
+
def test_gemfile
|
190
|
+
with_fixture 'bundlerusage' do
|
191
|
+
assert system("ruby", ocra, "bundlerusage.rb", "Gemfile", *(DefaultArgs + ["--no-dep-run", "--add-all-core", "--gemfile", "Gemfile"]))
|
192
|
+
pristine_env "bundlerusage.exe" do
|
193
|
+
assert system("bundlerusage.exe")
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
# With --debug-extract option, exe should unpack to local directory and leave it in place
|
199
|
+
def test_debug_extract
|
200
|
+
with_fixture 'helloworld' do
|
201
|
+
assert system("ruby", ocra, "helloworld.rb", *(DefaultArgs + ["--debug-extract"]))
|
202
|
+
pristine_env "helloworld.exe" do
|
203
|
+
assert_equal 0, Dir["ocr*"].size
|
204
|
+
assert system("helloworld.exe")
|
205
|
+
assert_equal 1, Dir["ocr*"].size
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
# Test that the --output option allows us to specify a different exe name
|
211
|
+
def test_output_option
|
212
|
+
with_fixture 'helloworld' do
|
213
|
+
assert system("ruby", ocra, "helloworld.rb", *(DefaultArgs + ["--output", "goodbyeworld.exe"]))
|
214
|
+
assert !File.exists?("helloworld.exe")
|
215
|
+
assert File.exists?("goodbyeworld.exe")
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
# Test that we can specify a directory to be recursively included
|
220
|
+
def test_directory_on_cmd_line
|
221
|
+
with_fixture 'subdir' do
|
222
|
+
assert system("ruby", ocra, "subdir.rb", "a", *DefaultArgs)
|
223
|
+
pristine_env "subdir.exe" do
|
224
|
+
assert system("subdir.exe")
|
129
225
|
end
|
130
226
|
end
|
131
227
|
end
|
@@ -295,97 +391,122 @@ class TestOcra < Test::Unit::TestCase
|
|
295
391
|
end
|
296
392
|
end
|
297
393
|
|
298
|
-
#
|
299
|
-
#
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
394
|
+
# Should find features via relative require paths, after script
|
395
|
+
# changes to the right directory (Only valid for Ruby < 1.9.2).
|
396
|
+
def test_relative_require_chdir_path
|
397
|
+
with_fixture "relloadpath" do
|
398
|
+
each_path_combo "bin/chdir1.rb" do |script|
|
399
|
+
assert system('ruby', ocra, script, *DefaultArgs)
|
400
|
+
assert File.exist?('chdir1.exe')
|
401
|
+
pristine_env "chdir1.exe" do
|
402
|
+
assert system('chdir1.exe')
|
403
|
+
end
|
307
404
|
end
|
308
405
|
end
|
309
406
|
end
|
310
407
|
|
311
|
-
#
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
assert
|
408
|
+
# Should find features via relative require paths prefixed with
|
409
|
+
# './', after script changes to the right directory.
|
410
|
+
def test_relative_require_chdir_dotpath
|
411
|
+
with_fixture "relloadpath" do
|
412
|
+
each_path_combo "bin/chdir2.rb" do |script|
|
413
|
+
assert system('ruby', ocra, script, *DefaultArgs)
|
414
|
+
assert File.exist?('chdir2.exe')
|
415
|
+
pristine_env "chdir2.exe" do
|
416
|
+
assert system('chdir2.exe')
|
417
|
+
end
|
318
418
|
end
|
319
419
|
end
|
320
420
|
end
|
321
421
|
|
322
|
-
#
|
323
|
-
#
|
324
|
-
#
|
325
|
-
def
|
326
|
-
with_fixture '
|
327
|
-
|
328
|
-
assert system('ruby',
|
329
|
-
assert File.exist?('
|
330
|
-
pristine_env "
|
331
|
-
assert system('
|
422
|
+
# Should pick up files from relative load paths specified using the
|
423
|
+
# -I option when invoking Ocra, and invoking from same directory as
|
424
|
+
# script.
|
425
|
+
def test_relative_require_i
|
426
|
+
with_fixture 'relloadpath' do
|
427
|
+
each_path_combo "bin/external.rb", "lib", "bin/sub" do |script, *loadpaths|
|
428
|
+
assert system('ruby', '-I', loadpaths[0], '-I', loadpaths[1], ocra, script, *DefaultArgs)
|
429
|
+
assert File.exist?('external.exe')
|
430
|
+
pristine_env "external.exe" do
|
431
|
+
assert system('external.exe')
|
332
432
|
end
|
333
433
|
end
|
334
434
|
end
|
335
435
|
end
|
336
436
|
|
337
|
-
#
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
437
|
+
# Should pick up files from relative load path specified using the
|
438
|
+
# RUBYLIB environment variable.
|
439
|
+
def test_relative_require_rubylib
|
440
|
+
with_fixture 'relloadpath' do
|
441
|
+
each_path_combo "bin/external.rb", "lib", "bin/sub" do |script, *loadpaths|
|
442
|
+
with_env 'RUBYLIB' => loadpaths.join(';') do
|
443
|
+
assert system('ruby', ocra, script, *DefaultArgs)
|
444
|
+
end
|
445
|
+
assert File.exist?('external.exe')
|
446
|
+
pristine_env "external.exe" do
|
447
|
+
assert system('external.exe')
|
345
448
|
end
|
346
449
|
end
|
347
450
|
end
|
348
451
|
end
|
349
|
-
|
350
|
-
#
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
assert
|
356
|
-
|
357
|
-
|
452
|
+
|
453
|
+
# Should pick up file when script modifies $LOAD_PATH by adding
|
454
|
+
# dirname of script.
|
455
|
+
def test_loadpath_mangling_dirname
|
456
|
+
with_fixture 'relloadpath' do
|
457
|
+
each_path_combo "bin/loadpath0.rb" do |script|
|
458
|
+
assert system('ruby', ocra, script, *DefaultArgs)
|
459
|
+
assert File.exist?('loadpath0.exe')
|
460
|
+
pristine_env "loadpath0.exe" do
|
461
|
+
assert system('loadpath0.exe')
|
358
462
|
end
|
359
463
|
end
|
360
464
|
end
|
361
465
|
end
|
362
466
|
|
363
|
-
#
|
364
|
-
#
|
365
|
-
def
|
366
|
-
with_fixture '
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
assert
|
467
|
+
# Should pick up file when script modifies $LOAD_PATH by adding
|
468
|
+
# relative paths, and invoking from same directory.
|
469
|
+
def test_loadpath_mangling_path
|
470
|
+
with_fixture 'relloadpath' do
|
471
|
+
each_path_combo "bin/loadpath1.rb" do |script|
|
472
|
+
# p [Dir.pwd, script]
|
473
|
+
assert system('ruby', ocra, script, *DefaultArgs)
|
474
|
+
assert File.exist?('loadpath1.exe')
|
475
|
+
pristine_env "loadpath1.exe" do
|
476
|
+
assert system('loadpath1.exe')
|
477
|
+
end
|
371
478
|
end
|
372
479
|
end
|
373
480
|
end
|
374
481
|
|
375
|
-
#
|
376
|
-
#
|
377
|
-
def
|
378
|
-
with_fixture '
|
379
|
-
|
380
|
-
assert system('ruby', ocra,
|
381
|
-
assert File.exist?('
|
382
|
-
pristine_env "
|
383
|
-
assert system('
|
482
|
+
# Should pick up file when script modifies $LOAD_PATH by adding
|
483
|
+
# relative paths with './'-prefix
|
484
|
+
def test_loadpath_mangling_dotpath
|
485
|
+
with_fixture 'relloadpath' do
|
486
|
+
each_path_combo "bin/loadpath2.rb" do |script|
|
487
|
+
assert system('ruby', ocra, script, *DefaultArgs)
|
488
|
+
assert File.exist?('loadpath2.exe')
|
489
|
+
pristine_env "loadpath2.exe" do
|
490
|
+
assert system('loadpath2.exe')
|
384
491
|
end
|
385
492
|
end
|
386
493
|
end
|
387
494
|
end
|
388
495
|
|
496
|
+
# Should pick up file when script modifies $LOAD_PATH by adding
|
497
|
+
# absolute paths.
|
498
|
+
def test_loadpath_mangling_abspath
|
499
|
+
with_fixture 'relloadpath' do
|
500
|
+
each_path_combo "bin/loadpath3.rb" do |script|
|
501
|
+
assert system('ruby', ocra, script, *DefaultArgs)
|
502
|
+
assert File.exist?('loadpath3.exe')
|
503
|
+
pristine_env "loadpath3.exe" do
|
504
|
+
assert system('loadpath3.exe')
|
505
|
+
end
|
506
|
+
end
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
389
510
|
# Test that ocra.rb accepts --version and outputs the version number.
|
390
511
|
def test_version
|
391
512
|
assert_match(/^Ocra \d+(\.\d)+(.[a-z]+\d+)?$/, `ruby \"#{ocra}\" --version`)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ocra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease: false
|
4
|
+
prerelease: true
|
6
5
|
segments:
|
7
6
|
- 1
|
8
|
-
-
|
7
|
+
- 3
|
9
8
|
- 0
|
10
|
-
|
9
|
+
- rc1
|
10
|
+
version: 1.3.0.rc1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lars Christensen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-19 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,7 +26,6 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 7
|
30
29
|
segments:
|
31
30
|
- 2
|
32
31
|
- 0
|
@@ -42,7 +41,6 @@ dependencies:
|
|
42
41
|
requirements:
|
43
42
|
- - ">="
|
44
43
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 21
|
46
44
|
segments:
|
47
45
|
- 2
|
48
46
|
- 6
|
@@ -63,11 +61,11 @@ extensions: []
|
|
63
61
|
extra_rdoc_files:
|
64
62
|
- History.txt
|
65
63
|
- Manifest.txt
|
66
|
-
- README.
|
64
|
+
- README.rdoc
|
67
65
|
files:
|
68
66
|
- History.txt
|
69
67
|
- Manifest.txt
|
70
|
-
- README.
|
68
|
+
- README.rdoc
|
71
69
|
- Rakefile
|
72
70
|
- bin/ocra
|
73
71
|
- share/ocra/lzma.exe
|
@@ -91,19 +89,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
89
|
requirements:
|
92
90
|
- - ">="
|
93
91
|
- !ruby/object:Gem::Version
|
94
|
-
hash: 3
|
95
92
|
segments:
|
96
93
|
- 0
|
97
94
|
version: "0"
|
98
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
96
|
none: false
|
100
97
|
requirements:
|
101
|
-
- - "
|
98
|
+
- - ">"
|
102
99
|
- !ruby/object:Gem::Version
|
103
|
-
hash: 3
|
104
100
|
segments:
|
105
|
-
-
|
106
|
-
|
101
|
+
- 1
|
102
|
+
- 3
|
103
|
+
- 1
|
104
|
+
version: 1.3.1
|
107
105
|
requirements: []
|
108
106
|
|
109
107
|
rubyforge_project: ocra
|