ocra 1.2.0.rc1 → 1.2.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/Rakefile +2 -52
- data/bin/ocra +7 -4
- 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 +21 -9
- metadata +3 -3
data/History.txt
CHANGED
@@ -31,6 +31,9 @@
|
|
31
31
|
your script after a "--" marker. Arguments will be passed both at
|
32
32
|
compile time and run time. (#27815)
|
33
33
|
|
34
|
+
* Now works if the source files are located beneath Ruby's
|
35
|
+
exec_prefix. (#28505)
|
36
|
+
|
34
37
|
=== 1.1.4
|
35
38
|
|
36
39
|
* The tempdir marker is now pretty-printed as "<tempdir>" in the
|
data/Rakefile
CHANGED
@@ -66,11 +66,9 @@ file 'bin/ocrasa.rb' => [ 'bin/ocra', 'share/ocra/stub.exe', 'share/ocra/stubw.e
|
|
66
66
|
end
|
67
67
|
|
68
68
|
task :clean do
|
69
|
-
|
69
|
+
rm_f Dir["{bin,samples}/*.exe"]
|
70
|
+
rm_f Dir["share/ocra/{stub,stubw,edicon}.exe"]
|
70
71
|
sh "mingw32-make -C src clean"
|
71
|
-
rm_f 'share/ocra/stub.exe'
|
72
|
-
rm_f 'share/ocra/stubw.exe'
|
73
|
-
rm_f 'share/ocra/edicon.exe'
|
74
72
|
end
|
75
73
|
|
76
74
|
task :test_standalone => :standalone do
|
@@ -79,54 +77,6 @@ task :test_standalone => :standalone do
|
|
79
77
|
ENV['TESTED_OCRA'] = nil
|
80
78
|
end
|
81
79
|
|
82
|
-
def each_ruby_version
|
83
|
-
raise "Set RUBIES to point to where you have various versions of Ruby installed" if ENV['RUBIES'].nil?
|
84
|
-
root = ENV['RUBIES'].tr '\\', '/'
|
85
|
-
Dir.glob(File.join(root, 'ruby*','bin')).each do |path|
|
86
|
-
path.tr!('/','\\')
|
87
|
-
pathenv = ENV['PATH']
|
88
|
-
ENV['PATH'] = path
|
89
|
-
begin
|
90
|
-
yield
|
91
|
-
ensure
|
92
|
-
ENV['PATH'] = pathenv
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
task :setup_all_ruby do
|
98
|
-
ENV['RUBYOPT'] = nil
|
99
|
-
rubygemszip = "rubygems-1.3.4.zip"
|
100
|
-
rubygemsdir = rubygemszip.gsub(/\.zip$/,'')
|
101
|
-
sh "unzip rubygems-1.3.4.zip"
|
102
|
-
begin
|
103
|
-
cd "rubygems-1.3.4" do
|
104
|
-
each_ruby_version do
|
105
|
-
system("ruby -v")
|
106
|
-
system("ruby setup.rb")
|
107
|
-
system("gem install win32-api")
|
108
|
-
end
|
109
|
-
end
|
110
|
-
ensure
|
111
|
-
rm_rf "rubygems-1.3.4"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
desc 'Run test suite with all version of Ruby found in ENV["RUBIES"]'
|
116
|
-
task :test_all_rubies do
|
117
|
-
each_ruby_version do
|
118
|
-
system("ruby -v")
|
119
|
-
system("ruby test/test_ocra.rb")
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
desc 'List all version of Ruby found in ENV["RUBIES"]'
|
124
|
-
task :list_all_rubies do
|
125
|
-
each_ruby_version do
|
126
|
-
system "ruby -v"
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
80
|
task :release_docs => :redocs do
|
131
81
|
sh "pscp -r doc/* larsch@ocra.rubyforge.org:/var/www/gforge-projects/ocra"
|
132
82
|
end
|
data/bin/ocra
CHANGED
@@ -11,7 +11,7 @@ module Ocra
|
|
11
11
|
OP_SETENV = 5
|
12
12
|
OP_POST_CREATE_PROCESS = 6
|
13
13
|
|
14
|
-
VERSION = "1.2.0.
|
14
|
+
VERSION = "1.2.0.rc2"
|
15
15
|
|
16
16
|
IGNORE_MODULES = /^enumerator.so$/
|
17
17
|
|
@@ -57,7 +57,7 @@ module Ocra
|
|
57
57
|
end
|
58
58
|
|
59
59
|
# Returns a binary blob store embedded in the current Ruby script.
|
60
|
-
def get_next_embedded_image
|
60
|
+
def Ocra.get_next_embedded_image
|
61
61
|
DATA.read(DATA.readline.to_i).unpack("m")[0]
|
62
62
|
end
|
63
63
|
|
@@ -406,6 +406,7 @@ EOF
|
|
406
406
|
windowed = (Ocra.files[0] =~ /\.rbw$/ || Ocra.force_windows) && !Ocra.force_console
|
407
407
|
|
408
408
|
puts "=== Building #{executable}" unless Ocra.quiet
|
409
|
+
target_script = nil
|
409
410
|
OcraBuilder.new(executable, windowed) do |sb|
|
410
411
|
# Add explicitly mentioned files
|
411
412
|
Ocra.files.each do |file|
|
@@ -419,6 +420,8 @@ EOF
|
|
419
420
|
target = File.join('src', File.basename(file))
|
420
421
|
end
|
421
422
|
|
423
|
+
target_script ||= target
|
424
|
+
|
422
425
|
if File.directory?(file)
|
423
426
|
sb.ensuremkdir(target)
|
424
427
|
else
|
@@ -472,13 +475,13 @@ EOF
|
|
472
475
|
|
473
476
|
# Set environment variable
|
474
477
|
sb.setenv('RUBYOPT', ENV['RUBYOPT'] || '')
|
475
|
-
sb.setenv('RUBYLIB', load_path.uniq.join(';'))
|
478
|
+
sb.setenv('RUBYLIB', load_path.map{|path| dospath(path)}.uniq.join(';'))
|
476
479
|
sb.setenv('GEM_PATH', "#{TEMPDIR_MARKER}\\gemhome")
|
477
480
|
|
478
481
|
# Launch the script
|
479
482
|
extra_arg = Ocra.arg.map { |a| ' "' + a.gsub(/\"/,'\\"') + '"' }.join
|
480
483
|
sb.postcreateprocess(TEMPDIR_MARKER + "\\bin\\" + rubyexe,
|
481
|
-
"#{rubyexe} \"\xff\\
|
484
|
+
"#{rubyexe} \"\xff\\" + Ocra.dospath(target_script) + "\"#{extra_arg}")
|
482
485
|
|
483
486
|
puts "=== Compressing" unless Ocra.quiet or not Ocra.lzma_mode
|
484
487
|
end
|
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
@@ -3,8 +3,6 @@ require "tmpdir"
|
|
3
3
|
require "fileutils"
|
4
4
|
require "rbconfig"
|
5
5
|
|
6
|
-
require 'rbconfig'
|
7
|
-
|
8
6
|
begin
|
9
7
|
require "rubygems"
|
10
8
|
gem 'win32-api', '>=1.2.0'
|
@@ -19,7 +17,8 @@ include FileUtils
|
|
19
17
|
class TestOcra < Test::Unit::TestCase
|
20
18
|
|
21
19
|
# Default arguments for invoking OCRA when running tests.
|
22
|
-
DefaultArgs = [ '--
|
20
|
+
DefaultArgs = [ '--no-lzma' ]
|
21
|
+
DefaultArgs << "--quiet" unless ENV["OCRA_VERBOSE_TEST"]
|
23
22
|
DefaultArgs.push '--no-autodll' if not $have_win32_api
|
24
23
|
|
25
24
|
# Name of the tested ocra script.
|
@@ -54,9 +53,9 @@ class TestOcra < Test::Unit::TestCase
|
|
54
53
|
# Sets up an directory with a copy of a fixture and yields to the
|
55
54
|
# block, then cleans up everything. A fixture here is a hierachy of
|
56
55
|
# files located in test/fixtures.
|
57
|
-
def with_fixture(name)
|
56
|
+
def with_fixture(name, target_path = nil)
|
58
57
|
path = File.join(FixturePath, name)
|
59
|
-
with_tmpdir do
|
58
|
+
with_tmpdir([], target_path) do
|
60
59
|
cp_r path, '.'
|
61
60
|
cd name do
|
62
61
|
yield
|
@@ -82,9 +81,9 @@ class TestOcra < Test::Unit::TestCase
|
|
82
81
|
end
|
83
82
|
end
|
84
83
|
|
85
|
-
def with_tmpdir(files = [])
|
86
|
-
tempdirname = File.join(ENV['TEMP'], ".ocratest-#{$$}-#{rand 2**32}").tr('\\','/')
|
87
|
-
|
84
|
+
def with_tmpdir(files = [], path = nil)
|
85
|
+
tempdirname = path || File.join(ENV['TEMP'], ".ocratest-#{$$}-#{rand 2**32}").tr('\\','/')
|
86
|
+
mkdir_p tempdirname
|
88
87
|
begin
|
89
88
|
cp files, tempdirname
|
90
89
|
FileUtils.cd tempdirname do
|
@@ -389,7 +388,7 @@ class TestOcra < Test::Unit::TestCase
|
|
389
388
|
|
390
389
|
# Test that ocra.rb accepts --version and outputs the version number.
|
391
390
|
def test_version
|
392
|
-
assert_match(/^Ocra \d+(\.\d)+(.
|
391
|
+
assert_match(/^Ocra \d+(\.\d)+(.[a-z]+\d+)?$/, `ruby \"#{ocra}\" --version`)
|
393
392
|
end
|
394
393
|
|
395
394
|
# Test that ocra.rb accepts --icon.
|
@@ -561,5 +560,18 @@ class TestOcra < Test::Unit::TestCase
|
|
561
560
|
end
|
562
561
|
end
|
563
562
|
end
|
563
|
+
|
564
|
+
# Would be nice if OCRA could build from source located beneath the
|
565
|
+
# Ruby installation too.
|
566
|
+
def test_exec_prefix
|
567
|
+
path = File.join(RbConfig::CONFIG["exec_prefix"], "ocratempsrc")
|
568
|
+
with_fixture "helloworld", path do
|
569
|
+
assert system("ruby", ocra, "helloworld.rb", *DefaultArgs)
|
570
|
+
assert File.exist?("helloworld.exe")
|
571
|
+
pristine_env "helloworld.exe" do
|
572
|
+
assert system("helloworld.exe")
|
573
|
+
end
|
574
|
+
end
|
575
|
+
end
|
564
576
|
|
565
577
|
end
|
metadata
CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 1
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.2.0.
|
9
|
+
- rc2
|
10
|
+
version: 1.2.0.rc2
|
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-08-
|
18
|
+
date: 2010-08-29 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|