ocra 1.3.10 → 1.3.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7aea8c543e947bab9fd80bdd43d5d0b9c6d4b3f2
4
- data.tar.gz: a5934881e20aef9ada0e3c207f8289f32cb216fb
2
+ SHA256:
3
+ metadata.gz: 33fd02398c27f8491311f8b7e3730c0fde066e5cd1dcc56345228356abef1745
4
+ data.tar.gz: 6fbd5d50421e8613cf94fa33533e578bbdb8fdd163fa9b99709ba202dfc9af78
5
5
  SHA512:
6
- metadata.gz: c49768dc85800112527d7ad489a41d40c1bd271c35b75448a722d3b1d75b70dd86c1ec9ef0552d4b7d5558e86c27c3cd005db54d906f57211f00b7e7193aa621
7
- data.tar.gz: 2cab95aaa7178760fd337044c1190f091e09a31beb44d8670543e5c9f515db89f6a92c7d1da793113554f847d453e77211e2e011d8c3deeb3aece42c396aa19e
6
+ metadata.gz: 0f7d2a3bb8b879ba3d662152557f79a6f42798a50aa217cf23d1e6ee3cd46c791cf90e0c5fbcaf5b268700046f8f11c159421022f75116e209ca5b53401766f5
7
+ data.tar.gz: dd104a15c4dbb5e2cd8f96fbe174d24b381e4defd71b6f5c90f0d31feebbc0b46421ccc1e4170a98386b331b9b8d78d830720def9167d96c3d3c1fa02bfbfc25
@@ -1,3 +1,12 @@
1
+ === 1.3.11
2
+
3
+ * Support Ruby 2.2-2.7
4
+ * Add ruby2_keywords.rb to ignored modules
5
+ * Update lzma.exe to version 19.00
6
+ * Workaround for warning about deprecated Object#=~
7
+ * Use Fiddle instead of Win32API
8
+ * Fix for invalid argument to relative_path_from
9
+
1
10
  === 1.3.10
2
11
 
3
12
  * Reduce memory usage while building & compressing (avoids out of
@@ -1,6 +1,6 @@
1
1
  History.txt
2
2
  Manifest.txt
3
- README.rdoc
3
+ README.md
4
4
  Rakefile
5
5
  bin/ocra
6
6
  share/ocra/lzma.exe
@@ -1,24 +1,25 @@
1
- = ocra
1
+ # ocra
2
2
 
3
- * https://github.com/larsch/ocra/
4
- * Issue tracker: http://github.com/larsch/ocra/issues
5
- * Google Group: http://groups.google.com/group/ruby-ocra
3
+ home :: https://github.com/larsch/ocra/
6
4
 
7
- == DESCRIPTION:
5
+ issues :: http://github.com/larsch/ocra/issues
6
+
7
+ forum :: http://groups.google.com/group/ruby-ocra
8
+
9
+ ## Description
8
10
 
9
11
  OCRA (One-Click Ruby Application) builds Windows executables from Ruby
10
12
  source code. The executable is a self-extracting, self-running
11
13
  executable that contains the Ruby interpreter, your source code and
12
14
  any additionally needed ruby libraries or DLL.
13
15
 
14
- == FEATURES
16
+ ## Features
15
17
 
16
18
  * LZMA Compression (optional, default on)
17
- * Ruby 1.8.7, 1.9.3, 2.0.0 and 2.1.5 support
18
19
  * Both windowed/console mode supported
19
20
  * Includes gems based on usage, or from a Bundler Gemfile
20
21
 
21
- == PROBLEMS & BUG REPORTING:
22
+ ## Problems & Bug Reporiting
22
23
 
23
24
  * Windows support only
24
25
 
@@ -27,11 +28,11 @@ the issue tracker on GitHub (http://github.com/larsch/ocra/issues).
27
28
  You can also join the Google Group discussion forum to ask questions
28
29
  and get help (http://groups.google.com/group/ruby-ocra).
29
30
 
30
- == INSTALLATION:
31
+ ## Installation
31
32
 
32
33
  Gem:
33
34
 
34
- gem install ocra
35
+ gem install ocra
35
36
 
36
37
  Alternatively you can download the gem at either
37
38
  http://rubygems.org/gems/ocra or
@@ -41,23 +42,23 @@ Stand-alone Version: Get ocrasa.rb from
41
42
  https://github.com/larsch/ocra/releases/. Requires nothing but a
42
43
  working Ruby installation on Windows.
43
44
 
44
- == SYNOPSIS:
45
+ ## Synopsis
45
46
 
46
- === Building an executable:
47
+ ### Building an executable:
47
48
 
48
- ocra script.rb
49
+ ocra script.rb
49
50
 
50
- Will package "<tt>script.rb</tt>", the Ruby interpreter and all
51
+ Will package `script.rb`, the Ruby interpreter and all
51
52
  dependencies (gems and DLLs) into an executable named
52
- "<tt>script.exe</tt>".
53
+ `script.exe`.
53
54
 
54
- === Command line:
55
+ ### Command line:
55
56
 
56
- ocra [options] script.rb [<other files> ...] [-- <script arguments> ...]
57
+ ocra [options] script.rb [<other files> ...] [-- <script arguments> ...]
57
58
 
58
- === Options:
59
+ ### Options:
59
60
 
60
- ocra --help
61
+ ocra --help
61
62
 
62
63
  Ocra options:
63
64
 
@@ -81,23 +82,27 @@ Gem content detection modes:
81
82
  --gem-full[=gem1,..] Include EVERYTHING
82
83
  --gem-spec[=gem1,..] Include files in gemspec (Does not work with Rubygems 1.7+)
83
84
 
84
- minimal: loaded scripts
85
- guess: loaded scripts and other files
86
- all: loaded scripts, other scripts, other files (except extras)
87
- full: Everything found in the gem directory
88
-
89
85
  --[no-]gem-scripts[=..] Other script files than those loaded
90
86
  --[no-]gem-files[=..] Other files (e.g. data files)
91
87
  --[no-]gem-extras[=..] Extra files (README, etc.)
92
88
 
93
- scripts: .rb/.rbw files
94
- extras: C/C++ sources, object files, test, spec, README
95
- files: all other files
89
+ Gem modes:
90
+
91
+ * *minimal*: loaded scripts
92
+ * *guess*: loaded scripts and other files
93
+ * *all*: loaded scripts, other scripts, other files (except extras)
94
+ * *full*: Everything found in the gem directory
95
+
96
+ File groups:
97
+
98
+ * *scripts*: .rb/.rbw files
99
+ * *extras*: C/C++ sources, object files, test, spec, README
100
+ * *files*: all other files
96
101
 
97
102
  Auto-detection options:
98
103
 
99
104
  --no-dep-run Don't run script.rb to check for dependencies.
100
- --no-autoload Don't load/include script.rb's autoloads.
105
+ --no-autoload Don't load/include script.rb's autoloads.
101
106
  --no-autodll Disable detection of runtime DLL dependencies.
102
107
 
103
108
  Output options:
@@ -116,9 +121,9 @@ Executable options:
116
121
  --debug-extract Executable will unpack to local dir and not delete after.
117
122
 
118
123
 
119
- === Compilation:
124
+ ### Compilation:
120
125
 
121
- * OCRA will load your script (using <tt>Kernel#load</tt>) and build
126
+ * OCRA will load your script (using `Kernel#load`) and build
122
127
  the executable when it exits.
123
128
 
124
129
  * Your program should 'require' all necessary files when invoked without
@@ -129,57 +134,49 @@ Executable options:
129
134
 
130
135
  * .rb files will become console applications. .rbw files will become
131
136
  windowed application (without a console window popping
132
- up). Alternatively, use the "<tt>--console</tt>" or
133
- "<tt>--windows</tt>" options.
137
+ up). Alternatively, use the `--console` or
138
+ `--windows` options.
134
139
 
135
- === Running your application:
140
+ ### Running your application:
136
141
 
137
142
  * The 'current working directory' is not changed by OCRA when running
138
143
  your application. You must change to the installation or temporary
139
144
  directory yourself. See also below.
140
-
141
145
  * When the application is running, the OCRA_EXECUTABLE environment
142
146
  variable points to the .exe (with full path).
143
-
144
147
  * The temporary location of the script can be obtained by inspected
145
148
  the $0 variable.
146
-
147
- * OCRA does not set up the include path. Use <tt>$:.unshift
148
- File.dirname($0)</tt> at the start of your script if you need to
149
+ * OCRA does not set up the include path. Use `$:.unshift
150
+ File.dirname($0)` at the start of your script if you need to
149
151
  'require' additional source files from the same directory as your
150
152
  main script.
151
153
 
152
- === Pitfalls:
154
+ ### Pitfalls:
153
155
 
154
156
  * Avoid modifying load paths at run time. Specify load paths using -I
155
157
  or RUBYLIB if you must, but don't expect OCRA to preserve them for
156
158
  runtime. OCRA may pack sources into other directories than you
157
159
  expect.
158
-
159
- * If you use .rbw files or the <tt>--windows</tt> option, then check
160
+ * If you use .rbw files or the `--windows` option, then check
160
161
  that your application works with rubyw.exe before trying with OCRA.
161
-
162
162
  * Avoid absolute paths in your code and when invoking OCRA.
163
163
 
164
- == REQUIREMENTS:
164
+ ## REQUIREMENTS:
165
165
 
166
166
  * Windows
167
-
168
- * Working Ruby installation. Ocra is tested with RubyInstaller
169
- 1.8.7p374, 1.9.3p545, and 2.0.0p481 (32 and 64 bit).
170
-
167
+ * Working Ruby installation.
171
168
  * MinGW Installation (when working with the source code only)
172
169
 
173
- === Stand-alone version
170
+ ### Stand-alone version
174
171
 
175
172
  Get ocrasa.rb from http://rubyforge.org/frs/?group_id=8185. Requires
176
173
  nothing but a working Ruby installation on Windows.
177
174
 
178
- == TECHNICAL DETAILS
175
+ ## Technical details
179
176
 
180
177
  OCRA first runs the target script in order to detect any files that
181
- are loaded and used at runtime (Using <tt>Kernel#require</tt> and
182
- <tt>Kernel#load</tt>).
178
+ are loaded and used at runtime (Using `Kernel#require` and
179
+ `Kernel#load`).
183
180
 
184
181
  OCRA embeds everything needed to run a Ruby script into a single
185
182
  executable file. The file contains the .exe stub which is compiled
@@ -193,9 +190,9 @@ scripts into a temporary directory. The directory will contains the
193
190
  same directory layout as your Ruby installlation. The source files for
194
191
  your application will be put in the 'src' subdirectory.
195
192
 
196
- === Libraries
193
+ ### Libraries
197
194
 
198
- Any code that is loaded through <tt>Kernel#require</tt> when your
195
+ Any code that is loaded through `Kernel#require` when your
199
196
  script is executed will be included in the OCRA
200
197
  executable. Conditionally loaded code will not be loaded and included
201
198
  in the executable unless the code is actually run when OCRA invokes
@@ -211,13 +208,13 @@ gems using --gem-*=gemname.
211
208
 
212
209
  Libraries found in non-standard path (for example, if you invoke OCRA
213
210
  with "ruby -I some/path") will be placed into the site dir
214
- (lib/ruby/site_ruby). Avoid changing <tt>$LOAD_PATH</tt> or
215
- <tt>$:</tt> from your script to include paths outside your source
211
+ (lib/ruby/site_ruby). Avoid changing `$LOAD_PATH` or
212
+ `$:` from your script to include paths outside your source
216
213
  tree, since OCRA may place the files elsewhere when extracted into the
217
214
  temporary directory.
218
215
 
219
216
  In case your script (or any of its dependencies) sets up autoloaded
220
- module using <tt>Kernel#autoload</tt>, OCRA will automatically try to
217
+ module using `Kernel#autoload`, OCRA will automatically try to
221
218
  load them to ensure that they are all included in the
222
219
  executable. Modules that doesn't exist will be ignored (a warning will
223
220
  be logged).
@@ -225,19 +222,19 @@ be logged).
225
222
  Dynamic link libraries (.dll files, for example WxWidgets, or other
226
223
  source files) will be detected and included by OCRA.
227
224
 
228
- === Including libraries non-automatically
225
+ ### Including libraries non-automatically
229
226
 
230
227
  If an application or framework is complicated enough that it tends
231
228
  to confuse Ocra's automatic dependency resolution, then you can
232
229
  use other means to specify what needs to be packaged with your app.
233
230
 
234
- To disable automatic dependency resolution, use the --no-dep-run
231
+ To disable automatic dependency resolution, use the `--no-dep-run`
235
232
  option; with it, Ocra will skip executing your program during the
236
- build process. This on the other hand requires using --gem-full option
233
+ build process. This on the other hand requires using `--gem-full` option
237
234
  (see more below); otherwise Ocra will not include all the necessary
238
235
  files for the gems.
239
236
 
240
- You will also probably need to use the --add-all-core option to
237
+ You will also probably need to use the `--add-all-core` option to
241
238
  include the Ruby core libraries.
242
239
 
243
240
  If your app uses gems, then you can specify them in a
@@ -254,16 +251,17 @@ directory "someapp" and create an exe named "someapp.exe", without
254
251
  actually running the app during the build, you could use the
255
252
  following command:
256
253
 
257
- ocra someapp/script/rails someapp --output someapp.exe --add-all-core \
258
- --gemfile someapp/Gemfile --no-dep-run --gem-full --chdir-first -- server
254
+ ocra someapp/script/rails someapp --output someapp.exe --add-all-core \
255
+ --gemfile someapp/Gemfile --no-dep-run --gem-full --chdir-first -- server
259
256
 
260
- Note the space between "--" and "server"! It's important; "server" is an argument to be passed to rails when the script is ran.
257
+ Note the space between `--` and `server`! It's important; `server` is
258
+ an argument to be passed to rails when the script is ran.
261
259
 
262
260
  Rails 2 apps can be packaged similarly, though you will have to
263
261
  integrate them with Bundler (http://gembundler.com/rails23.html)
264
262
  first.
265
263
 
266
- === Gem handling
264
+ ### Gem handling
267
265
 
268
266
  By default, Ocra includes all scripts that are loaded by your script
269
267
  when it is run before packaging. Ocra detects which gems are using and
@@ -274,17 +272,17 @@ tests, specs, etc.
274
272
  This behaviour can be changed by using the --gem-* options. There are
275
273
  four possible modes:
276
274
 
277
- minimal: Include only loaded scripts
278
- guess: Include loaded scripts and important files (DEFAULT)
279
- all: Include all scripts and important files
280
- full: Include all files
275
+ * *minimal*: Include only loaded scripts
276
+ * *guess*: Include loaded scripts and important files (DEFAULT)
277
+ * *all*: Include all scripts and important files
278
+ * *full*: Include all files
281
279
 
282
280
  If you find that files are missing from the resulting executable, try
283
281
  first with --gem-all=gemname for the gem that is missing, and if that
284
282
  does not work, try --gem-full=gemname. The paranoid can use --gem-full
285
283
  to include all files for all required gems.
286
284
 
287
- === Creating an installer for your application
285
+ ### Creating an installer for your application
288
286
 
289
287
  To make your application start up quicker, or to allow it to
290
288
  keep files in its application directory between runs, or if
@@ -295,12 +293,12 @@ for your app with the free Inno Setup software.
295
293
  You will first have to download and install Inno Setup 5 or
296
294
  later, and also add its directory to your PATH (so that Ocra
297
295
  can find the ISCC compiler program). Once you've done that,
298
- you can use the --innosetup option to Ocra to supply an
296
+ you can use the `--innosetup` option to Ocra to supply an
299
297
  Inno Setup script. Do not add any [Files] or [Dirs] sections
300
298
  to the script; Ocra will figure those out itself.
301
299
 
302
300
  To continue the Rails example above, let's package the Rails 3
303
- app into an installer. Save the following as "<tt>someapp.iss</tt>":
301
+ app into an installer. Save the following as `someapp.iss`:
304
302
 
305
303
  [Setup]
306
304
  AppName=SomeApp
@@ -315,14 +313,14 @@ app into an installer. Save the following as "<tt>someapp.iss</tt>":
315
313
 
316
314
  Then, run Ocra with this command:
317
315
 
318
- ocra someapp/script/rails someapp --output someapp.exe --add-all-core \
319
- --gemfile someapp/Gemfile --no-dep-run --gem-full --chdir-first --no-lzma \
320
- --innosetup someapp.iss -- server
316
+ ocra someapp/script/rails someapp --output someapp.exe --add-all-core \
317
+ --gemfile someapp/Gemfile --no-dep-run --gem-full --chdir-first --no-lzma \
318
+ --innosetup someapp.iss -- server
321
319
 
322
320
  If all goes well, a file named "SomeAppInstaller.exe" will be placed
323
321
  into the Output directory.
324
322
 
325
- === Environment variables
323
+ ### Environment variables
326
324
 
327
325
  OCRA executables clear the RUBYLIB environment variable before your
328
326
  script is launched. This is done to ensure that your script does not
@@ -336,69 +334,67 @@ executables.
336
334
  OCRA executables set OCRA_EXECUTABLE to the full path of the
337
335
  executable, for example
338
336
 
339
- ENV["OCRA_EXECUTABLE"] # => C:\Program Files\MyApp\MyApp.exe
337
+ ENV["OCRA_EXECUTABLE"] # => C:\Program Files\MyApp\MyApp.exe
340
338
 
341
- === Working directory
339
+ ### Working directory
342
340
 
343
341
  The OCRA executable does not change the working directory when it is
344
- launched, unless you use the "<tt>--chdir-first</tt>" option.
342
+ launched, unless you use the `--chdir-first` option.
345
343
 
346
344
  You should not assume that the current working directory when invoking
347
345
  an executable built with .exe is the location of the source script. It
348
346
  can be the directory where the executable is placed (when invoked
349
347
  through the Windows Explorer), the users' current working directory
350
348
  (when invoking from the Command Prompt), or even
351
- <tt>C:\\WINDOWS\\SYSTEM32</tt> when the executable is invoked through
349
+ `C:\\WINDOWS\\SYSTEM32` when the executable is invoked through
352
350
  a file association.
353
351
 
354
- With the "<tt>--chdir-first</tt>" option, the working directory will
352
+ With the `--chdir-first` option, the working directory will
355
353
  always be the common parent directory of your source files. This
356
354
  should be fine for most applications. However, if your application
357
355
  is designed to run from the command line and take filenames as
358
356
  arguments, then you cannot use this option.
359
357
 
360
358
  If you wish to maintain the user's working directory, but need to
361
- 'require' additional Ruby scripts from the source directory, you can
359
+ `require` additional Ruby scripts from the source directory, you can
362
360
  add the following line to your script:
363
361
 
364
- $LOAD_PATH.unshift File.dirname($0)
362
+ $LOAD_PATH.unshift File.dirname($0)
365
363
 
366
- === Load path mangling
364
+ ### Load path mangling
367
365
 
368
- Adding paths to <tt>$LOAD_PATH</tt> or <tt>$:</tt> at runtime is not
366
+ Adding paths to `$LOAD_PATH` or `$:` at runtime is not
369
367
  recommended. Adding relative load paths depends on the working
370
368
  directory being the same as where the script is located (See
371
369
  above). If you have additional library files in directories below the
372
370
  directory containing your source script you can use this idiom:
373
371
 
374
- $LOAD_PATH.unshift File.join(File.dirname($0), 'path/to/script')
372
+ $LOAD_PATH.unshift File.join(File.dirname($0), 'path/to/script')
375
373
 
376
- === Detecting OCRA
374
+ ### Detecting
377
375
 
378
376
  You can detect whether OCRA is currently building your script by
379
377
  looking for the 'Ocra' constant. If it is defined, OCRA is currenly
380
378
  building the executable from your script. For example, you can use
381
379
  this to avoid opening a GUI window when compiling executables:
382
380
 
383
- app = MyApp.new
384
- if not defined?(Ocra)
385
- app.main_loop
386
- end
381
+ app = MyApp.new
382
+ app.main_loop unless defined?(Ocra)
387
383
 
388
- === Additional files and resources
384
+ ### Additional files and resources
389
385
 
390
386
  You can add additional files to the OCRA executable (for example
391
387
  images) by appending them to the command line. They should be placed
392
388
  in the source directory with your main script (or a subdirectory).
393
389
 
394
- ocra mainscript.rb someimage.jpeg docs/document.txt
390
+ ocra mainscript.rb someimage.jpeg docs/document.txt
395
391
 
396
392
  This will create the following layout in the temporary directory when
397
393
  your program is executed:
398
394
 
399
- src/mainscript.rb
400
- src/someimage.jpeg
401
- src/docs/document.txt
395
+ src/mainscript.rb
396
+ src/someimage.jpeg
397
+ src/docs/document.txt
402
398
 
403
399
  Both files, directoriess and glob patterns can be specified on the
404
400
  command line. Files will be added as-is. If a directory is specified,
@@ -406,22 +402,22 @@ OCRA will include all files found below that directory. Glob patterns
406
402
  (See Dir.glob) can be used to specify a specific set of files, for
407
403
  example:
408
404
 
409
- ocra script.rb assets/**/*.png
405
+ ocra script.rb assets/**/*.png
410
406
 
411
- === Command Line Arguments
407
+ ### Command Line Arguments
412
408
 
413
409
  To pass command line argument to your script (both while building and
414
410
  when run from the resulting executable), specify them after a
415
- "<tt>--</tt>" marker. For example:
411
+ `--` marker. For example:
416
412
 
417
- ocra script.rb -- --some-options=value
413
+ ocra script.rb -- --some-options=value
418
414
 
419
- This will pass "<tt>--some-options=value</tt>" to the script when
415
+ This will pass `--some-options=value` to the script when
420
416
  build and when running the executable. Any extra argument specified by
421
417
  the user when invoking the executable will be appended after the
422
418
  compile-time arguments.
423
419
 
424
- === Window/Console
420
+ ### Window/Console
425
421
 
426
422
  By default, OCRA builds console application from .rb-files and
427
423
  windowed applications (without console window) from .rbw-files.
@@ -429,10 +425,10 @@ windowed applications (without console window) from .rbw-files.
429
425
  Ruby on Windows provides two executables: ruby.exe is a console mode
430
426
  application and rubyw.exe is a windowed application which does not
431
427
  bring up a console window when launched using the Windows Explorer.
432
- By default, or if the "<tt>--console</tt>" option is used, OCRA will
428
+ By default, or if the `--console` option is used, OCRA will
433
429
  use the console runtime (ruby.exe). OCRA will automatically select the
434
430
  windowed runtime when your script has the ".rbw" extension, or if you
435
- specify the "<tt>--windows</tt>" command line option.
431
+ specify the `--windows` command line option.
436
432
 
437
433
  If your application works in console mode but not in windowed mode,
438
434
  first check if your script works without OCRA using rubyw.exe. A
@@ -443,16 +439,16 @@ buffers run full).
443
439
  You can also try wrapping your script in an exception handler that
444
440
  logs any errors to a file:
445
441
 
446
- begin
447
- # your script here
448
- rescue Exception => e
449
- File.open("except.log") do |f|
450
- f.puts e.inspect
451
- f.puts e.backtrace
442
+ begin
443
+ # your script here
444
+ rescue Exception => e
445
+ File.open("except.log") do |f|
446
+ f.puts e.inspect
447
+ f.puts e.backtrace
448
+ end
452
449
  end
453
- end
454
450
 
455
- == CREDITS:
451
+ ## CREDITS:
456
452
 
457
453
  Thanks for Igor Pavlov for the LZMA compressor and decompressor. The
458
454
  source code used was place into Public Domain by Igor Pavlov.
@@ -462,11 +458,11 @@ Erik Veenstra for rubyscript2exe which provided inspiration.
462
458
  Dice for the default .exe icon (vit-ruby.ico,
463
459
  http://ruby.morphball.net/vit-ruby-ico_en.html)
464
460
 
465
- == LICENSE:
461
+ ## LICENSE:
466
462
 
467
463
  (The MIT License)
468
464
 
469
- Copyright (c) 2009-2010 Lars Christensen
465
+ Copyright (c) 2009-2020 Lars Christensen
470
466
 
471
467
  Permission is hereby granted, free of charge, to any person obtaining
472
468
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -1,66 +1,66 @@
1
1
  # -*- ruby -*-
2
2
 
3
- require 'rubygems'
4
- require 'hoe'
3
+ require "rubygems"
4
+ require "hoe"
5
5
 
6
6
  Hoe.plugin :minitest
7
7
 
8
- spec = Hoe.spec 'ocra' do
8
+ spec = Hoe.spec "ocra" do
9
9
  developer "Lars Christensen", "larsch@belunktum.dk"
10
10
  license "MIT"
11
11
  end
12
12
 
13
- spec.urls.each { |url| url.chomp! }
13
+ spec.urls.each { |key, url| url.chomp! }
14
14
 
15
15
  task :build_stub do
16
16
  sh "mingw32-make -C src"
17
- cp 'src/stub.exe', 'share/ocra/stub.exe'
18
- cp 'src/stubw.exe', 'share/ocra/stubw.exe'
19
- cp 'src/edicon.exe', 'share/ocra/edicon.exe'
17
+ cp "src/stub.exe", "share/ocra/stub.exe"
18
+ cp "src/stubw.exe", "share/ocra/stubw.exe"
19
+ cp "src/edicon.exe", "share/ocra/edicon.exe"
20
20
  end
21
21
 
22
- file 'share/ocra/stub.exe' => :build_stub
23
- file 'share/ocra/stubw.exe' => :build_stub
24
- file 'share/ocra/edicon.exe' => :build_stub
22
+ file "share/ocra/stub.exe" => :build_stub
23
+ file "share/ocra/stubw.exe" => :build_stub
24
+ file "share/ocra/edicon.exe" => :build_stub
25
25
 
26
26
  task :test => :build_stub
27
27
 
28
- task :standalone => [ 'bin/ocrasa.rb' ]
28
+ task :standalone => ["bin/ocrasa.rb"]
29
29
 
30
- standalone_zip = "bin/ocrasa-#{ENV['VERSION']}.zip"
30
+ standalone_zip = "bin/ocrasa-#{ENV["VERSION"]}.zip"
31
31
 
32
- file standalone_zip => 'bin/ocrasa.rb' do
33
- chdir 'bin' do
34
- sh "zip", "ocrasa-#{ENV['VERSION']}.zip", "ocrasa.rb"
32
+ file standalone_zip => "bin/ocrasa.rb" do
33
+ chdir "bin" do
34
+ sh "zip", "ocrasa-#{ENV["VERSION"]}.zip", "ocrasa.rb"
35
35
  end
36
36
  end
37
37
 
38
38
  task :release_standalone => standalone_zip do
39
- load 'bin/ocra'
39
+ load "bin/ocra"
40
40
  sh "rubyforge add_release ocra ocra-standalone #{Ocra::VERSION} #{standalone_zip}"
41
41
  end
42
42
 
43
- file 'bin/ocrasa.rb' => [ 'bin/ocra', 'share/ocra/stub.exe', 'share/ocra/stubw.exe', 'share/ocra/lzma.exe', 'share/ocra/edicon.exe' ] do
44
- cp 'bin/ocra', 'bin/ocrasa.rb'
43
+ file "bin/ocrasa.rb" => ["bin/ocra", "share/ocra/stub.exe", "share/ocra/stubw.exe", "share/ocra/lzma.exe", "share/ocra/edicon.exe"] do
44
+ cp "bin/ocra", "bin/ocrasa.rb"
45
45
  File.open("bin/ocrasa.rb", "a") do |f|
46
46
  f.puts "__END__"
47
47
 
48
- stub = File.open("share/ocra/stub.exe", "rb") {|g| g.read}
48
+ stub = File.open("share/ocra/stub.exe", "rb") { |g| g.read }
49
49
  stub64 = [stub].pack("m")
50
50
  f.puts stub64.size
51
51
  f.puts stub64
52
52
 
53
- stub = File.open("share/ocra/stubw.exe", "rb") {|g| g.read}
53
+ stub = File.open("share/ocra/stubw.exe", "rb") { |g| g.read }
54
54
  stub64 = [stub].pack("m")
55
55
  f.puts stub64.size
56
56
  f.puts stub64
57
57
 
58
- lzma = File.open("share/ocra/lzma.exe", "rb") {|g| g.read}
58
+ lzma = File.open("share/ocra/lzma.exe", "rb") { |g| g.read }
59
59
  lzma64 = [lzma].pack("m")
60
60
  f.puts lzma64.size
61
61
  f.puts lzma64
62
62
 
63
- lzma = File.open("share/ocra/edicon.exe", "rb") {|g| g.read}
63
+ lzma = File.open("share/ocra/edicon.exe", "rb") { |g| g.read }
64
64
  lzma64 = [lzma].pack("m")
65
65
  f.puts lzma64.size
66
66
  f.puts lzma64
@@ -74,14 +74,13 @@ task :clean do
74
74
  end
75
75
 
76
76
  task :test_standalone => :standalone do
77
- ENV['TESTED_OCRA'] = 'ocrasa.rb'
77
+ ENV["TESTED_OCRA"] = "ocrasa.rb"
78
78
  system("rake test")
79
- ENV['TESTED_OCRA'] = nil
79
+ ENV["TESTED_OCRA"] = nil
80
80
  end
81
81
 
82
82
  task :release_docs => :redocs do
83
83
  sh "pscp -r doc/* larsch@ocra.rubyforge.org:/var/www/gforge-projects/ocra"
84
84
  end
85
85
 
86
-
87
86
  # vim: syntax=Ruby
data/bin/ocra CHANGED
@@ -8,7 +8,7 @@ module Ocra
8
8
  # separators.
9
9
  class Pathname
10
10
  def Pathname.pwd
11
- Pathname.new(Dir.pwd.encode('UTF-8'))
11
+ Pathname.new(Dir.pwd.encode("UTF-8"))
12
12
  end
13
13
 
14
14
  def Pathname.pathequal(a, b)
@@ -23,7 +23,7 @@ module Ocra
23
23
  ABSOLUTE_PAT = /\A([A-Z]:)?#{SEPARATOR_PAT}/i
24
24
 
25
25
  def initialize(path)
26
- @path = path && path.encode('UTF-8')
26
+ @path = path && path.encode("UTF-8")
27
27
  end
28
28
 
29
29
  def to_native
@@ -45,8 +45,8 @@ module Ocra
45
45
  b.shift
46
46
  end
47
47
  return other if Pathname.new(b.first).absolute?
48
- b.size.times { a.unshift '..' }
49
- return Pathname.new(a.join('/'))
48
+ b.size.times { a.unshift ".." }
49
+ return Pathname.new(a.join("/"))
50
50
  end
51
51
 
52
52
  # Determines if 'src' is contained in 'tgt' (i.e. it is a subpath of
@@ -66,7 +66,7 @@ module Ocra
66
66
  if other.absolute?
67
67
  other
68
68
  else
69
- Ocra.Pathname(@path + '/' + other.path)
69
+ Ocra.Pathname(@path + "/" + other.path)
70
70
  end
71
71
  end
72
72
 
@@ -87,7 +87,7 @@ module Ocra
87
87
  end
88
88
 
89
89
  def entries
90
- Dir.entries(@path).map { |e| self / e.encode('UTF-8') }
90
+ Dir.entries(@path).map { |e| self / e.encode("UTF-8") }
91
91
  end
92
92
 
93
93
  # Recursively find all files which match a specified regular
@@ -147,28 +147,35 @@ module Ocra
147
147
  module Host
148
148
  class << self
149
149
  def exec_prefix
150
- @exec_prefix ||= Ocra.Pathname(RbConfig::CONFIG['exec_prefix'])
150
+ @exec_prefix ||= Ocra.Pathname(RbConfig::CONFIG["exec_prefix"])
151
151
  end
152
+
152
153
  def sitelibdir
153
- @sitelibdir ||= Ocra.Pathname(RbConfig::CONFIG['sitelibdir'])
154
+ @sitelibdir ||= Ocra.Pathname(RbConfig::CONFIG["sitelibdir"])
154
155
  end
156
+
155
157
  def bindir
156
- @bindir ||= Ocra.Pathname(RbConfig::CONFIG['bindir'])
158
+ @bindir ||= Ocra.Pathname(RbConfig::CONFIG["bindir"])
157
159
  end
160
+
158
161
  def libruby_so
159
- @libruby_so ||= Ocra.Pathname(RbConfig::CONFIG['LIBRUBY_SO'])
162
+ @libruby_so ||= Ocra.Pathname(RbConfig::CONFIG["LIBRUBY_SO"])
160
163
  end
164
+
161
165
  def exeext
162
- RbConfig::CONFIG['EXEEXT'] || ".exe"
166
+ RbConfig::CONFIG["EXEEXT"] || ".exe"
163
167
  end
168
+
164
169
  def rubyw_exe
165
- @rubyw_exe ||= (RbConfig::CONFIG['rubyw_install_name'] || "rubyw") + exeext
170
+ @rubyw_exe ||= (RbConfig::CONFIG["rubyw_install_name"] || "rubyw") + exeext
166
171
  end
172
+
167
173
  def ruby_exe
168
- @ruby_exe ||= (RbConfig::CONFIG['ruby_install_name'] || "ruby") + exeext
174
+ @ruby_exe ||= (RbConfig::CONFIG["ruby_install_name"] || "ruby") + exeext
169
175
  end
176
+
170
177
  def tempdir
171
- @tempdir ||= Ocra.Pathname(ENV['TEMP'])
178
+ @tempdir ||= Ocra.Pathname(ENV["TEMP"])
172
179
  end
173
180
  end
174
181
  end
@@ -179,9 +186,9 @@ module Ocra
179
186
  a.sort.inject([]) { |r, e| r.last == e ? r : r << e }
180
187
  end
181
188
 
182
- VERSION = "1.3.10"
189
+ VERSION = "1.3.11"
183
190
 
184
- IGNORE_MODULES = /\/(enumerator.so|rational.so|complex.so|thread.rb)$/
191
+ IGNORE_MODULE_NAMES = /\/(enumerator.so|rational.so|complex.so|thread.rb|ruby2_keywords.rb)$/
185
192
 
186
193
  GEM_SCRIPT_RE = /\.rbw?$/
187
194
  GEM_EXTRA_RE = %r{(
@@ -202,11 +209,13 @@ module Ocra
202
209
  # Alias for the temporary directory where files are extracted.
203
210
  TEMPDIR_ROOT = Pathname.new("|")
204
211
  # Directory for source files in temporary directory.
205
- SRCDIR = Pathname.new('src')
212
+ SRCDIR = Pathname.new("src")
206
213
  # Directory for Ruby binaries in temporary directory.
207
- BINDIR = Pathname.new('bin')
214
+ BINDIR = Pathname.new("bin")
208
215
  # Directory for GEMHOME files in temporary directory.
209
- GEMHOMEDIR = Pathname.new('gemhome')
216
+ GEMHOMEDIR = Pathname.new("gemhome")
217
+
218
+ IGNORE_MODULES = []
210
219
 
211
220
  @options = {
212
221
  :lzma_mode => true,
@@ -230,7 +239,7 @@ module Ocra
230
239
  :debug_extract => false,
231
240
  :arg => [],
232
241
  :enc => true,
233
- :gem => []
242
+ :gem => [],
234
243
  }
235
244
 
236
245
  @options.each_key { |opt| eval("def self.#{opt}; @options[:#{opt}]; end") }
@@ -281,17 +290,17 @@ module Ocra
281
290
  @stubimage = get_next_embedded_image
282
291
  @stubwimage = get_next_embedded_image
283
292
  lzmaimage = get_next_embedded_image
284
- @lzmapath = Host.tempdir / 'lzma.exe'
293
+ @lzmapath = Host.tempdir / "lzma.exe"
285
294
  File.open(@lzmapath, "wb") { |file| file << lzmaimage }
286
295
  ediconimage = get_next_embedded_image
287
- @ediconpath = Host.tempdir / 'edicon.exe'
296
+ @ediconpath = Host.tempdir / "edicon.exe"
288
297
  File.open(@ediconpath, "wb") { |file| file << ediconimage }
289
298
  else
290
299
  ocrapath = Pathname(File.dirname(__FILE__))
291
- @stubimage = File.open(ocrapath / '../share/ocra/stub.exe', "rb") { |file| file.read }
292
- @stubwimage = File.open(ocrapath / '../share/ocra/stubw.exe', "rb") { |file| file.read }
293
- @lzmapath = (ocrapath / '../share/ocra/lzma.exe').expand
294
- @ediconpath = (ocrapath / '../share/ocra/edicon.exe').expand
300
+ @stubimage = File.open(ocrapath / "../share/ocra/stub.exe", "rb") { |file| file.read }
301
+ @stubwimage = File.open(ocrapath / "../share/ocra/stubw.exe", "rb") { |file| file.read }
302
+ @lzmapath = (ocrapath / "../share/ocra/lzma.exe").expand
303
+ @ediconpath = (ocrapath / "../share/ocra/edicon.exe").expand
295
304
  end
296
305
  end
297
306
 
@@ -408,7 +417,7 @@ EOF
408
417
  when /\A--(no-)?gem-(\w+)(?:=(.*))?$/
409
418
  negate, group, list = $1, $2, $3
410
419
  @options[:gem] ||= []
411
- @options[:gem] << [negate, group.to_sym, list && list.split(",") ]
420
+ @options[:gem] << [negate, group.to_sym, list && list.split(",")]
412
421
  when /\A--help\z/, /\A--./
413
422
  puts usage
414
423
  exit 0
@@ -439,7 +448,7 @@ EOF
439
448
  end
440
449
 
441
450
  @options[:files].map! { |path|
442
- path = path.encode('UTF-8').tr('\\','/')
451
+ path = path.encode("UTF-8").tr('\\', "/")
443
452
  if File.directory?(path)
444
453
  # If a directory is passed, we want all files under that directory
445
454
  path = "#{path}/**/*"
@@ -454,6 +463,7 @@ EOF
454
463
  save_environment
455
464
  parseargs(argv)
456
465
  find_stubs
466
+ IGNORE_MODULES.push(*ObjectSpace.each_object(Module).to_a)
457
467
  end
458
468
 
459
469
  # Force loading autoloaded constants. Searches through all modules
@@ -461,6 +471,7 @@ EOF
461
471
  # ones, then attempts to load them.
462
472
  def Ocra.attempt_load_autoload
463
473
  modules_checked = {}
474
+ IGNORE_MODULES.each { |m| modules_checked[m] = true }
464
475
  loop do
465
476
  modules_to_check = []
466
477
  ObjectSpace.each_object(Module) do |mod|
@@ -555,7 +566,7 @@ EOF
555
566
  if Ocra.gemfile
556
567
  Ocra.msg "Scanning Gemfile"
557
568
  # Load Rubygems and Bundler so we can scan the Gemfile
558
- ['rubygems', 'bundler'].each do |lib|
569
+ ["rubygems", "bundler"].each do |lib|
559
570
  begin
560
571
  require lib
561
572
  rescue LoadError
@@ -563,13 +574,13 @@ EOF
563
574
  end
564
575
  end
565
576
 
566
- ENV['BUNDLE_GEMFILE'] = Ocra.gemfile
577
+ ENV["BUNDLE_GEMFILE"] = Ocra.gemfile
567
578
  Bundler.load.specs.each do |spec|
568
579
  Ocra.verbose_msg "From Gemfile, adding gem #{spec.full_name}"
569
580
  gems[spec.name] ||= spec
570
581
  end
571
582
 
572
- unless gems.any?{|dir, name| name =~ /^bundler-[.0-9]+/}
583
+ unless gems.any? { |name, spec| name == "bundler" }
573
584
  # Bundler itself wasn't added for some reason, let's put it in directly
574
585
  Ocra.verbose_msg "From Gemfile, forcing inclusion of bundler gem itself"
575
586
  bundler_spec = Gem.loaded_specs["bundler"]
@@ -599,8 +610,8 @@ EOF
599
610
  geminstallpath = Pathname(gempath) / "gems"
600
611
  if feature.subpath?(geminstallpath)
601
612
  gemlocalpath = feature.relative_path_from(geminstallpath)
602
- fullgemname = gemlocalpath.path.split('/').first
603
- gemspecpath = gempath / 'specifications' / "#{fullgemname}.gemspec"
613
+ fullgemname = gemlocalpath.path.split("/").first
614
+ gemspecpath = gempath / "specifications" / "#{fullgemname}.gemspec"
604
615
  if spec = Gem::Specification.load(gemspecpath)
605
616
  gems[spec.name] ||= spec
606
617
  features_from_gems << feature
@@ -617,20 +628,20 @@ EOF
617
628
  @gemspecs << Pathname(spec.spec_file) if File.exist?(spec.spec_file)
618
629
 
619
630
  # Determine which set of files to include for this particular gem
620
- include = [ :loaded, :files ]
631
+ include = [:loaded, :files]
621
632
  Ocra.gem.each do |negate, option, list|
622
633
  if list.nil? or list.include?(spec.name)
623
634
  case option
624
635
  when :minimal
625
- include = [ :loaded ]
636
+ include = [:loaded]
626
637
  when :guess
627
- include = [ :loaded, :files ]
638
+ include = [:loaded, :files]
628
639
  when :all
629
- include = [ :scripts, :files ]
640
+ include = [:scripts, :files]
630
641
  when :full
631
- include = [ :scripts, :files, :extras ]
642
+ include = [:scripts, :files, :extras]
632
643
  when :spec
633
- include = [ :spec ]
644
+ include = [:spec]
634
645
  when :scripts
635
646
  if negate
636
647
  include.delete(:scripts)
@@ -653,12 +664,12 @@ EOF
653
664
  end
654
665
  end
655
666
 
656
- Ocra.msg "Detected gem #{spec.full_name} (#{include.join(', ')})"
667
+ Ocra.msg "Detected gem #{spec.full_name} (#{include.join(", ")})"
657
668
 
658
669
  gem_root = Pathname(spec.gem_dir)
659
- gem_extension = (gem_root / '..' / '..' / 'extensions').expand
670
+ gem_extension = (gem_root / ".." / ".." / "extensions").expand
660
671
  if gem_extension.exist?
661
- build_complete = gem_extension.find_all_files(/gem.build_complete/).select{|p| p.dirname.basename.to_s == spec.full_name}
672
+ build_complete = gem_extension.find_all_files(/gem.build_complete/).select { |p| p.dirname.basename.to_s == spec.full_name }
662
673
  else
663
674
  build_complete = nil
664
675
  end
@@ -729,12 +740,12 @@ EOF
729
740
 
730
741
  # Find gemspecs to include
731
742
  if defined?(Gem)
732
- @gemspecs = Gem.loaded_specs.map { |name,info| Pathname(info.loaded_from) }
743
+ @gemspecs = Gem.loaded_specs.map { |name, info| Pathname(info.loaded_from) }
733
744
  else
734
745
  @gemspecs = []
735
746
  end
736
747
 
737
- require 'rbconfig'
748
+ require "rbconfig"
738
749
  instsitelibdir = Host.sitelibdir.relative_path_from(Host.exec_prefix)
739
750
 
740
751
  load_path = []
@@ -754,7 +765,7 @@ EOF
754
765
  encpath = path / "enc"
755
766
  if encpath.exist?
756
767
  encfiles = encpath.find_all_files(/\.so$/)
757
- size = encfiles.inject(0) { |sum,pn| sum + pn.size }
768
+ size = encfiles.inject(0) { |sum, pn| sum + pn.size }
758
769
  Ocra.msg "Including #{encfiles.size} encoding support files (#{size} bytes, use --no-enc to exclude)"
759
770
  features.push(*encfiles)
760
771
  end
@@ -780,12 +791,12 @@ EOF
780
791
  if fullpath.subpath?(Host.exec_prefix)
781
792
  # Features found in the Ruby installation are put in the
782
793
  # temporary Ruby installation.
783
- libs << [ fullpath, fullpath.relative_path_from(Host.exec_prefix) ]
794
+ libs << [fullpath, fullpath.relative_path_from(Host.exec_prefix)]
784
795
  elsif defined?(Gem) and gemhome = Gem.path.find { |pth| fullpath.subpath?(pth) }
785
796
  # Features found in any other Gem path (e.g. ~/.gems) is put
786
797
  # in a special 'gemhome' folder.
787
- targetpath = GEMHOMEDIR / fullpath.relative_path_from(gemhome)
788
- libs << [ fullpath, targetpath ]
798
+ targetpath = GEMHOMEDIR / fullpath.relative_path_from(Pathname(gemhome))
799
+ libs << [fullpath, targetpath]
789
800
  elsif fullpath.subpath?(src_prefix) || path == working_directory
790
801
  # Any feature found inside the src_prefix automatically gets
791
802
  # added as a source file (to go in 'src').
@@ -803,7 +814,7 @@ EOF
803
814
  # All other feature that can not be resolved go in the the
804
815
  # Ruby sitelibdir. This is automatically in the load path
805
816
  # when Ruby starts.
806
- libs << [ fullpath, instsitelibdir / feature ]
817
+ libs << [fullpath, instsitelibdir / feature]
807
818
  end
808
819
  end
809
820
  end
@@ -821,10 +832,10 @@ EOF
821
832
  # GEMHOME.
822
833
  gem_files.each do |gemfile|
823
834
  if gemfile.subpath?(Host.exec_prefix)
824
- libs << [ gemfile, gemfile.relative_path_from(Host.exec_prefix) ]
835
+ libs << [gemfile, gemfile.relative_path_from(Host.exec_prefix)]
825
836
  elsif defined?(Gem) and gemhome = Gem.path.find { |pth| gemfile.subpath?(pth) }
826
837
  targetpath = GEMHOMEDIR / gemfile.relative_path_from(Pathname(gemhome))
827
- libs << [ gemfile, targetpath ]
838
+ libs << [gemfile, targetpath]
828
839
  else
829
840
  Ocra.fatal_error "Don't know where to put gemfile #{gemfile}"
830
841
  end
@@ -836,7 +847,7 @@ EOF
836
847
  @load_path_before.each do |lp|
837
848
  path = Pathname.new(lp)
838
849
  next unless path.to_posix =~
839
- /\/(ruby\/(?:site_ruby\/|vendor_ruby\/)?[0-9.]+)\/?$/i
850
+ /\/(ruby\/(?:site_ruby\/|vendor_ruby\/)?[0-9.]+)\/?$/i
840
851
  subdir = $1
841
852
  Dir["#{lp}/**/*"].each do |f|
842
853
  fpath = Pathname.new(f)
@@ -857,11 +868,11 @@ EOF
857
868
  if Ocra.output_override
858
869
  executable = Ocra.output_override
859
870
  else
860
- executable = Ocra.files.first.basename.ext('.exe')
871
+ executable = Ocra.files.first.basename.ext(".exe")
861
872
  executable.append_to_filename!("-debug") if Ocra.debug
862
873
  end
863
874
 
864
- windowed = (Ocra.files.first.ext?('.rbw') || Ocra.force_windows) && !Ocra.force_console
875
+ windowed = (Ocra.files.first.ext?(".rbw") || Ocra.force_windows) && !Ocra.force_console
865
876
 
866
877
  Ocra.msg "Building #{executable}"
867
878
  target_script = nil
@@ -886,7 +897,7 @@ EOF
886
897
  begin
887
898
  sb.createfile(file, target)
888
899
  rescue Errno::ENOENT
889
- raise unless file =~ IGNORE_MODULES
900
+ raise unless file =~ IGNORE_MODULE_NAMES
890
901
  end
891
902
  end
892
903
  end
@@ -948,16 +959,16 @@ EOF
948
959
  end
949
960
 
950
961
  # Set environment variable
951
- sb.setenv('RUBYOPT', ENV['RUBYOPT'] || '')
952
- sb.setenv('RUBYLIB', load_path.map{|path| path.to_native}.uniq.join(';'))
953
- sb.setenv('GEM_PATH', (TEMPDIR_ROOT / GEMHOMEDIR).to_native)
962
+ sb.setenv("RUBYOPT", ENV["RUBYOPT"] || "")
963
+ sb.setenv("RUBYLIB", load_path.map { |path| path.to_native }.uniq.join(";"))
964
+ sb.setenv("GEM_PATH", (TEMPDIR_ROOT / GEMHOMEDIR).to_native)
954
965
 
955
966
  # Add the opcode to launch the script
956
- extra_arg = Ocra.arg.map { |arg| ' "' + arg.gsub("\"","\\\"") + '"' }.join
967
+ extra_arg = Ocra.arg.map { |arg| ' "' + arg.gsub("\"", "\\\"") + '"' }.join
957
968
  installed_ruby_exe = TEMPDIR_ROOT / BINDIR / rubyexe
958
969
  launch_script = (TEMPDIR_ROOT / target_script).to_native
959
970
  sb.postcreateprocess(installed_ruby_exe,
960
- "#{rubyexe} \"#{launch_script}\"#{extra_arg}")
971
+ "#{rubyexe} \"#{launch_script}\"#{extra_arg}")
961
972
  end
962
973
 
963
974
  unless Ocra.inno_script
@@ -966,12 +977,31 @@ EOF
966
977
  end
967
978
 
968
979
  module LibraryDetector
969
- def LibraryDetector.loaded_dlls
970
- require 'Win32API'
980
+ def LibraryDetector.init_fiddle
981
+ require "fiddle"
982
+ require "fiddle/types"
983
+ module_eval {
984
+ extend Fiddle::Importer
985
+ dlload "psapi.dll"
986
+ include Fiddle::Win32Types
987
+ extern "BOOL EnumProcessModules(HANDLE, HMODULE*, DWORD, DWORD*)"
988
+ extend Fiddle::Importer
989
+ dlload "kernel32.dll"
990
+ include Fiddle::Win32Types
991
+ typealias "HMODULE", "uintptr_t"
992
+ typealias "LPWSTR", "char*"
993
+ extern "DWORD GetModuleFileNameW(HMODULE, LPWSTR, DWORD)"
994
+ extern "HANDLE GetCurrentProcess(void)"
995
+ }
996
+ end
971
997
 
972
- enumprocessmodules = Win32API.new('psapi', 'EnumProcessModules', ['L','P','L','P'], 'L')
973
- getmodulefilename = Win32API.new('kernel32', 'GetModuleFileNameW', ['L','P','L'], 'L')
974
- getcurrentprocess = Win32API.new('kernel32', 'GetCurrentProcess', [], 'L')
998
+ def LibraryDetector.loaded_dlls
999
+ require "fiddle"
1000
+ psapi = Fiddle.dlopen("psapi")
1001
+ enumprocessmodules = Fiddle::Function.new(psapi["EnumProcessModules"], [Fiddle::TYPE_UINTPTR_T, Fiddle::TYPE_VOIDP, Fiddle::TYPE_LONG, Fiddle::TYPE_VOIDP], Fiddle::TYPE_LONG)
1002
+ kernel32 = Fiddle.dlopen("kernel32")
1003
+ getcurrentprocess = Fiddle::Function.new(kernel32["GetCurrentProcess"], [], Fiddle::TYPE_LONG)
1004
+ getmodulefilename = Fiddle::Function.new(kernel32["GetModuleFileNameW"], [Fiddle::TYPE_UINTPTR_T, Fiddle::TYPE_VOIDP, Fiddle::TYPE_LONG], Fiddle::TYPE_LONG)
975
1005
 
976
1006
  bytes_needed = 4 * 32
977
1007
  module_handle_buffer = nil
@@ -988,7 +1018,7 @@ EOF
988
1018
  handles.select { |handle| handle > 0 }.map do |handle|
989
1019
  str = "\x00\x00" * 256
990
1020
  modulefilename_length = getmodulefilename.call(handle, str, str.size)
991
- modulefilename = str[0, modulefilename_length * 2].force_encoding('UTF-16LE').encode('UTF-8')
1021
+ modulefilename = str[0, modulefilename_length * 2].force_encoding("UTF-16LE").encode("UTF-8")
992
1022
  Ocra.Pathname(modulefilename)
993
1023
  end
994
1024
  end
@@ -996,7 +1026,7 @@ EOF
996
1026
  def LibraryDetector.detect_dlls
997
1027
  loaded = loaded_dlls
998
1028
  exec_prefix = Host.exec_prefix
999
- loaded.select { |path| path.subpath?(exec_prefix) && path.basename.ext?('.dll') && path.basename != Host.libruby_so }
1029
+ loaded.select { |path| path.subpath?(exec_prefix) && path.basename.ext?(".dll") && path.basename != Host.libruby_so }
1000
1030
  end
1001
1031
  end
1002
1032
 
@@ -1039,10 +1069,10 @@ EOF
1039
1069
  opcode_offset = File.size(path)
1040
1070
 
1041
1071
  File.open(path, "ab") do |ocrafile|
1042
- tmpinpath = 'tmpin'
1072
+ tmpinpath = "tmpin"
1043
1073
 
1044
1074
  if Ocra.lzma_mode
1045
- @of = File.open(tmpinpath, 'wb')
1075
+ @of = File.open(tmpinpath, "wb")
1046
1076
  else
1047
1077
  @of = ocrafile
1048
1078
  end
@@ -1059,11 +1089,11 @@ EOF
1059
1089
  @of.close if Ocra.lzma_mode
1060
1090
 
1061
1091
  if Ocra.lzma_mode and not Ocra.inno_script
1062
- tmpoutpath = 'tmpout'
1092
+ tmpoutpath = "tmpout"
1063
1093
  begin
1064
1094
  data_size = File.size(tmpinpath)
1065
1095
  Ocra.msg "Compressing #{data_size} bytes"
1066
- system(Ocra.lzmapath, 'e', tmpinpath, tmpoutpath) or fail
1096
+ system(Ocra.lzmapath, "e", tmpinpath, tmpoutpath) or fail
1067
1097
  compressed_data_size = File.size?(tmpoutpath)
1068
1098
  ocrafile.write([OP_DECOMPRESS_LZMA, compressed_data_size].pack("VV"))
1069
1099
  IO.copy_stream(tmpoutpath, ocrafile)
@@ -1094,7 +1124,7 @@ EOF
1094
1124
  @files.each do |tgt, src|
1095
1125
  src_escaped = src.to_s.gsub('"', '""')
1096
1126
  target_dir_escaped = Pathname.new(tgt).dirname.to_s.gsub('"', '""')
1097
- iss << "Source: \"#{src_escaped}\"; DestDir: \"{app}/#{target_dir_escaped}\"\n" unless src_escaped =~ IGNORE_MODULES
1127
+ iss << "Source: \"#{src_escaped}\"; DestDir: \"{app}/#{target_dir_escaped}\"\n" unless src_escaped =~ IGNORE_MODULE_NAMES
1098
1128
  end
1099
1129
  iss << "\n"
1100
1130
 
@@ -1185,9 +1215,7 @@ EOF
1185
1215
  def showtempdir(x)
1186
1216
  x.to_s.gsub(TEMPDIR_ROOT, "<tempdir>")
1187
1217
  end
1188
-
1189
1218
  end # class OcraBuilder
1190
-
1191
1219
  end # module Ocra
1192
1220
 
1193
1221
  if File.basename(__FILE__) == File.basename($0)
@@ -1,3 +1,3 @@
1
1
  class Ocra
2
- VERSION = '1.3.10'
2
+ VERSION = '1.3.11'
3
3
  end
Binary file
Binary file
Binary file
Binary file
@@ -513,7 +513,7 @@ class TestOcra < MiniTest::Test
513
513
 
514
514
  # Test that ocra.rb accepts --version and outputs the version number.
515
515
  def test_version
516
- assert_match(/^Ocra \d+(\.\d)+(.[a-z]+\d+)?$/, `ruby \"#{ocra}\" --version`)
516
+ assert_match(/^Ocra \d+(\.\d)+(.(:?[a-z]+)?\d+)?\n$/, `ruby \"#{ocra}\" --version`)
517
517
  end
518
518
 
519
519
  # Test that ocra.rb accepts --icon.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.10
4
+ version: 1.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Christensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-14 00:00:00.000000000 Z
11
+ date: 2020-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -16,42 +16,48 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.10'
19
+ version: '5.14'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.10'
26
+ version: '5.14'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '7'
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '4.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '7'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: hoe
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '3.16'
53
+ version: '3.22'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '3.16'
60
+ version: '3.22'
55
61
  description: |-
56
62
  OCRA (One-Click Ruby Application) builds Windows executables from Ruby
57
63
  source code. The executable is a self-extracting, self-running
@@ -65,11 +71,11 @@ extensions: []
65
71
  extra_rdoc_files:
66
72
  - History.txt
67
73
  - Manifest.txt
68
- - README.rdoc
74
+ - README.md
69
75
  files:
70
76
  - History.txt
71
77
  - Manifest.txt
72
- - README.rdoc
78
+ - README.md
73
79
  - Rakefile
74
80
  - bin/ocra
75
81
  - lib/ocra.rb
@@ -81,11 +87,12 @@ files:
81
87
  homepage: https://github.com/larsch/ocra/
82
88
  licenses:
83
89
  - MIT
84
- metadata: {}
90
+ metadata:
91
+ homepage_uri: https://github.com/larsch/ocra/
85
92
  post_install_message:
86
93
  rdoc_options:
87
94
  - "--main"
88
- - README.rdoc
95
+ - README.md
89
96
  require_paths:
90
97
  - lib
91
98
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -99,8 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
106
  - !ruby/object:Gem::Version
100
107
  version: '0'
101
108
  requirements: []
102
- rubyforge_project:
103
- rubygems_version: 2.6.13
109
+ rubygems_version: 3.1.2
104
110
  signing_key:
105
111
  specification_version: 4
106
112
  summary: OCRA (One-Click Ruby Application) builds Windows executables from Ruby source