ocra 1.0.0 → 1.0.1

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 (6) hide show
  1. data/History.txt +6 -0
  2. data/README.txt +11 -1
  3. data/Rakefile +13 -11
  4. data/bin/ocra.rb +17 -5
  5. data/share/ocra/stub.exe +0 -0
  6. metadata +3 -3
@@ -1,3 +1,9 @@
1
+ === 1.0.1 / 2009-05-05
2
+
3
+ * Added stub with windows runtime for windowed applications
4
+ (e.g. wxRuby) and fixed issue where OCRA would use ruby.exe instead
5
+ of rubyw.exe for such programs. [#25774]
6
+
1
7
  === 1.0.0 / 2009-04-05
2
8
 
3
9
  * 1 major enhancement
data/README.txt CHANGED
@@ -1,5 +1,6 @@
1
1
  = ocra
2
2
 
3
+ * http://rubyforge.org/projects/ocra/
3
4
  * http://github.com/larsch/ocra/
4
5
 
5
6
  == DESCRIPTION:
@@ -50,7 +51,16 @@ ocra.rb [option] your/script.rb
50
51
 
51
52
  == INSTALL:
52
53
 
53
- * FIX (sudo gem install, anything else)
54
+ === Gem
55
+
56
+ * gem install ocra
57
+
58
+ Can also be downloaded from http://rubyforge.org/frs/?group_id=8185
59
+
60
+ == Stand-alone
61
+
62
+ Get ocrasa.rb from http://rubyforge.org/frs/?group_id=8185. Requires
63
+ nothing but a working Ruby installation on Windows.
54
64
 
55
65
  == TECHNICAL DETAILS
56
66
 
data/Rakefile CHANGED
@@ -4,13 +4,9 @@ require 'rubygems'
4
4
  require 'hoe'
5
5
  require './lib/ocra.rb'
6
6
 
7
- r = Hoe.new('ocra', Ocra::VERSION) do |p|
8
- # p.rubyforge_name = 'ocrax' # if different than lowercase project name
9
- p.rubyforge_name = 'ocra'
7
+ Hoe.new('ocra', Ocra::VERSION) do |p|
10
8
  p.developer('Lars Christensen', 'larsch@belunktum.dk')
11
9
  end
12
- require 'pp'
13
- pp r
14
10
 
15
11
  task :stub do
16
12
  sh "mingw32-make -C src"
@@ -19,17 +15,27 @@ end
19
15
 
20
16
  task :test => :stub
21
17
 
22
- task :standalone => [ 'bin/ocrasa.rb', 'bin/ocrasa.exe' ]
18
+ task :standalone => [ 'bin/ocrasa.rb' ]
23
19
 
20
+ task :release_standalone => :standalone do
21
+ sh "rubyforge add_release ocra ocra-standalone #{Ocra::VERSION} bin/ocrasa.rb"
22
+ end
24
23
 
25
- file 'bin/ocrasa.rb' => [ 'bin/ocra.rb', 'share/ocra/stub.exe', 'share/ocra/lzma.exe' ] do
24
+ file 'bin/ocrasa.rb' => [ 'bin/ocra.rb', 'share/ocra/stub.exe', 'share/ocra/stubw.exe', 'share/ocra/lzma.exe' ] do
26
25
  cp 'bin/ocra.rb', 'bin/ocrasa.rb'
27
26
  File.open("bin/ocrasa.rb", "a") do |f|
28
27
  f.puts "__END__"
28
+
29
29
  stub = File.open("share/ocra/stub.exe", "rb") {|g| g.read}
30
30
  stub64 = [stub].pack("m")
31
31
  f.puts stub64.size
32
32
  f.puts stub64
33
+
34
+ stub = File.open("share/ocra/stubw.exe", "rb") {|g| g.read}
35
+ stub64 = [stub].pack("m")
36
+ f.puts stub64.size
37
+ f.puts stub64
38
+
33
39
  lzma = File.open("share/ocra/lzma.exe", "rb") {|g| g.read}
34
40
  lzma64 = [lzma].pack("m")
35
41
  f.puts lzma64.size
@@ -37,10 +43,6 @@ file 'bin/ocrasa.rb' => [ 'bin/ocra.rb', 'share/ocra/stub.exe', 'share/ocra/lzma
37
43
  end
38
44
  end
39
45
 
40
- file 'bin/ocrasa.exe' => [ 'bin/ocra.rb', 'bin/ocrasa.rb' ] do
41
- sh "ruby bin/ocra.rb bin/ocrasa.rb"
42
- end
43
-
44
46
  task :clean do
45
47
  rm_rf Dir.glob("bin/*.exe")
46
48
  sh "mingw32-make -C src clean"
@@ -20,6 +20,7 @@ module Ocra
20
20
  attr_accessor :quiet
21
21
  attr_reader :lzmapath
22
22
  attr_reader :stubimage
23
+ attr_reader :stubwimage
23
24
 
24
25
  def get_next_embedded_image
25
26
  DATA.read(DATA.readline.to_i).unpack("m")[0]
@@ -29,12 +30,14 @@ module Ocra
29
30
  def Ocra.initialize_ocra
30
31
  if defined?(DATA)
31
32
  @stubimage = get_next_embedded_image
33
+ @stubwimage = get_next_embedded_image
32
34
  lzmaimage = get_next_embedded_image
33
35
  @lzmapath = File.join(ENV['TEMP'], 'lzma.exe').tr('/','\\')
34
36
  File.open(@lzmapath, "wb") { |file| file << lzmaimage }
35
37
  else
36
38
  ocrapath = File.dirname(__FILE__)
37
39
  @stubimage = File.open(File.join(ocrapath, '../share/ocra/stub.exe'), "rb") { |file| file.read }
40
+ @stubwimage = File.open(File.join(ocrapath, '../share/ocra/stubw.exe'), "rb") { |file| file.read }
38
41
  @lzmapath = File.expand_path('../share/ocra/lzma.exe', ocrapath).tr('/','\\')
39
42
  raise "lzma.exe not found" unless File.exist?(@lzmapath)
40
43
  end
@@ -172,8 +175,10 @@ EOF
172
175
 
173
176
  executable = Ocra.files[0].sub(/(\.rbw?)?$/, '.exe')
174
177
 
178
+ windowed = (Ocra.files[0] =~ /\.rbw$/ && !Ocra.force_windows) || Ocra.force_console
179
+
175
180
  puts "=== Building #{executable}" unless Ocra.quiet
176
- OcraBuilder.new(executable) do |sb|
181
+ OcraBuilder.new(executable, windowed) do |sb|
177
182
  # Add explicitly mentioned files
178
183
  Ocra.files.each do |file|
179
184
  path = File.join('src', file).tr('/','\\')
@@ -181,8 +186,8 @@ EOF
181
186
  end
182
187
 
183
188
  # Add the ruby executable and DLL
184
- if (Ocra.files[0] =~ /\.rbw$/ && !Ocra.force_windows) || Ocra.force_console
185
- rubyexe = "ruby.exe"
189
+ if windowed
190
+ rubyexe = "rubyw.exe"
186
191
  else
187
192
  rubyexe = "ruby.exe"
188
193
  end
@@ -224,15 +229,22 @@ EOF
224
229
  end
225
230
 
226
231
  class OcraBuilder
227
- def initialize(path)
232
+ def initialize(path, windowed)
228
233
  @paths = {}
229
234
  File.open(path, "wb") do |ocrafile|
230
- ocrafile.write(Ocra.stubimage)
235
+
236
+ if windowed
237
+ ocrafile.write(Ocra.stubwimage)
238
+ else
239
+ ocrafile.write(Ocra.stubimage)
240
+ end
241
+
231
242
  if Ocra.lzma_mode
232
243
  @of = ""
233
244
  else
234
245
  @of = ocrafile
235
246
  end
247
+
236
248
  yield(self)
237
249
 
238
250
  if Ocra.lzma_mode
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Christensen
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-19 22:00:00 Z
12
+ date: 2009-05-05 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -47,7 +47,7 @@ files:
47
47
  - share/ocra/stub.exe
48
48
  - test/test_ocra.rb
49
49
  has_rdoc: true
50
- homepage: http://github.com/larsch/ocra/
50
+ homepage: http://rubyforge.org/projects/ocra/
51
51
  licenses: []
52
52
 
53
53
  post_install_message: