ocran 1.3.18 → 1.4.0

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.txt +306 -292
  3. data/LICENSE.txt +22 -22
  4. data/README.md +549 -533
  5. data/exe/ocran +5 -5
  6. data/ext/extconf.rb +15 -0
  7. data/lib/ocran/build_constants.rb +16 -16
  8. data/lib/ocran/build_facade.rb +17 -17
  9. data/lib/ocran/build_helper.rb +110 -105
  10. data/lib/ocran/command_output.rb +22 -22
  11. data/lib/ocran/dir_builder.rb +162 -0
  12. data/lib/ocran/direction.rb +623 -458
  13. data/lib/ocran/file_path_set.rb +69 -69
  14. data/lib/ocran/gem_spec_queryable.rb +172 -172
  15. data/lib/ocran/host_config_helper.rb +57 -44
  16. data/lib/ocran/inno_setup_script_builder.rb +111 -111
  17. data/lib/ocran/launcher_batch_builder.rb +85 -85
  18. data/lib/ocran/library_detector.rb +61 -61
  19. data/lib/ocran/library_detector_posix.rb +55 -0
  20. data/lib/ocran/option.rb +323 -273
  21. data/lib/ocran/refine_pathname.rb +104 -104
  22. data/lib/ocran/runner.rb +115 -105
  23. data/lib/ocran/runtime_environment.rb +46 -46
  24. data/lib/ocran/stub_builder.rb +298 -264
  25. data/lib/ocran/version.rb +5 -5
  26. data/lib/ocran/windows_command_escaping.rb +15 -15
  27. data/lib/ocran.rb +7 -7
  28. data/share/ocran/lzma.exe +0 -0
  29. data/src/Makefile +75 -0
  30. data/src/edicon.c +161 -0
  31. data/src/error.c +100 -0
  32. data/src/error.h +66 -0
  33. data/src/inst_dir.c +334 -0
  34. data/src/inst_dir.h +157 -0
  35. data/src/lzma/7zTypes.h +529 -0
  36. data/src/lzma/Compiler.h +43 -0
  37. data/src/lzma/LzmaDec.c +1363 -0
  38. data/src/lzma/LzmaDec.h +236 -0
  39. data/src/lzma/Precomp.h +10 -0
  40. data/src/script_info.c +246 -0
  41. data/src/script_info.h +7 -0
  42. data/src/stub.c +133 -0
  43. data/src/stub.manifest +29 -0
  44. data/src/stub.rc +3 -0
  45. data/src/system_utils.c +1002 -0
  46. data/src/system_utils.h +209 -0
  47. data/src/system_utils_posix.c +500 -0
  48. data/src/unpack.c +574 -0
  49. data/src/unpack.h +85 -0
  50. data/src/vit-ruby.ico +0 -0
  51. metadata +52 -16
  52. data/share/ocran/edicon.exe +0 -0
  53. data/share/ocran/stub.exe +0 -0
  54. data/share/ocran/stubw.exe +0 -0
data/README.md CHANGED
@@ -1,533 +1,549 @@
1
- # ocran
2
-
3
- home :: https://github.com/largo/ocran/
4
-
5
- issues :: http://github.com/largo/ocran/issues
6
-
7
- ## Description
8
-
9
- OCRAN (One-Click Ruby Application Next) builds Windows executables from Ruby
10
- source code. The executable is a self-extracting, self-running
11
- executable that contains the Ruby interpreter, your source code and
12
- any additionally needed ruby libraries or DLL.
13
-
14
- OCRAN is a fork of Ocra (https://github.com/larsch/ocra) in order to
15
- maintain compatibility with newer Ruby versions after 3.2
16
-
17
- ## Recommended usage
18
- Most commonly you will needs this, when you want to ship your program to windows servers / users that don't have Ruby installed.
19
- By default each time the .exe is opened it will extract the ruby interpeter along with the code to the temp directory.
20
- Since this process takes time, we recommend using the innosetup edition which will install your program together with the ruby intepreter into
21
- a directory.
22
-
23
- ## Features
24
-
25
- * LZMA Compression (optional, default on)
26
- * Both windowed/console mode supported
27
- * Includes gems based on usage, or from a Bundler Gemfile
28
-
29
- ## Problems & Bug Reporting
30
-
31
- * Windows support only
32
-
33
- If you experience problems with OCRAN or have found a bug, please use
34
- the issue tracker on GitHub (http://github.com/largo/ocran/issues).
35
-
36
- ## Safety
37
-
38
- As this gem comes with binary blobs, we have taken actions to insure your safety.
39
- The gem releases are securely built on Github Actions. Feel free verify that it matches the version on rubygems.
40
- This repository ships with LZMA.exe from [The official release of ip7z/7zip](https://github.com/ip7z/7zip/releases): Version 22.01 from lzma2201.7z
41
- The LZMA.exe is used to compress the executable.
42
- Other files such as stub.exe, stubw.exe and edicon.exe are built from source code in the repository.
43
-
44
- ## Installation
45
-
46
- Gem:
47
-
48
- gem install ocran
49
-
50
- Alternatively you can download the gem at either
51
- http://rubygems.org/gems/ocran or
52
- https://github.com/largo/ocran/releases/.
53
-
54
- ## Synopsis
55
-
56
- ### Building an executable:
57
-
58
- ocran script.rb
59
-
60
- Will package `script.rb`, the Ruby interpreter and all
61
- dependencies (gems and DLLs) into an executable named
62
- `script.exe`.
63
-
64
- ### Command line:
65
-
66
- ocran [options] script.rb [<other files> ...] [-- <script arguments> ...]
67
-
68
- ### Options:
69
-
70
- ocran --help
71
-
72
- Ocran options:
73
-
74
- --help Display this information.
75
- --quiet Suppress output while building executable.
76
- --verbose Show extra output while building executable.
77
- --version Display version number and exit.
78
-
79
- Packaging options:
80
-
81
- --dll dllname Include additional DLLs from the Ruby bindir.
82
- --add-all-core Add all core ruby libraries to the executable.
83
- --gemfile <file> Add all gems and dependencies listed in a Bundler Gemfile.
84
- --no-enc Exclude encoding support files
85
-
86
- Gem content detection modes:
87
-
88
- --gem-minimal[=gem1,..] Include only loaded scripts
89
- --gem-guess=[gem1,...] Include loaded scripts & best guess (DEFAULT)
90
- --gem-all[=gem1,..] Include all scripts & files
91
- --gem-full[=gem1,..] Include EVERYTHING
92
- --gem-spec[=gem1,..] Include files in gemspec (Does not work with Rubygems 1.7+)
93
-
94
- --[no-]gem-scripts[=..] Other script files than those loaded
95
- --[no-]gem-files[=..] Other files (e.g. data files)
96
- --[no-]gem-extras[=..] Extra files (README, etc.)
97
-
98
- Gem modes:
99
-
100
- * *minimal*: loaded scripts
101
- * *guess*: loaded scripts and other files
102
- * *all*: loaded scripts, other scripts, other files (except extras)
103
- * *full*: Everything found in the gem directory
104
-
105
- File groups:
106
-
107
- * *scripts*: .rb/.rbw files
108
- * *extras*: C/C++ sources, object files, test, spec, README
109
- * *files*: all other files
110
-
111
- Auto-detection options:
112
-
113
- --no-dep-run Don't run script.rb to check for dependencies.
114
- --no-autoload Don't load/include script.rb's autoloads.
115
- --no-autodll Disable detection of runtime DLL dependencies.
116
-
117
- Output options:
118
-
119
- --output <file> Name the exe to generate. Defaults to ./<scriptname>.exe.
120
- --no-lzma Disable LZMA compression of the executable.
121
- --innosetup <file> Use given Inno Setup script (.iss) to create an installer.
122
-
123
- Executable options:
124
-
125
- --windows Force Windows application (rubyw.exe)
126
- --console Force console application (ruby.exe)
127
- --chdir-first When exe starts, change working directory to app dir.
128
- --icon <ico> Replace icon with a custom one.
129
- --rubyopt <str> Set the RUBYOPT environment variable when running the executable
130
- --debug Executable will be verbose.
131
- --debug-extract Executable will unpack to local dir and not delete after.
132
-
133
-
134
- ### Compilation:
135
-
136
- * OCRAN will load your script (using `Kernel#load`) and build
137
- the executable when it exits.
138
-
139
- * Your program should 'require' all necessary files when invoked without
140
- arguments, so OCRAN can detect all dependencies.
141
-
142
- * DLLs are detected automatically but only those located in your Ruby
143
- installation are included.
144
-
145
- * .rb files will become console applications. .rbw files will become
146
- windowed application (without a console window popping
147
- up). Alternatively, use the `--console` or
148
- `--windows` options.
149
-
150
- ### Running your application:
151
-
152
- * The 'current working directory' is not changed by OCRAN when running
153
- your application. You must change to the installation or temporary
154
- directory yourself. See also below.
155
- * When the application is running, the OCRAN_EXECUTABLE environment
156
- variable points to the .exe (with full path).
157
- * The temporary location of the script can be obtained by inspected
158
- the $0 variable.
159
- * OCRAN does not set up the include path. Use `$:.unshift
160
- File.dirname($0)` at the start of your script if you need to
161
- 'require' additional source files from the same directory as your
162
- main script.
163
-
164
- ### Pitfalls:
165
-
166
- * Avoid modifying load paths at run time. Specify load paths using -I
167
- or RUBYLIB if you must, but don't expect OCRAN to preserve them for
168
- runtime. OCRAN may pack sources into other directories than you
169
- expect.
170
- * If you use .rbw files or the `--windows` option, then check
171
- that your application works with rubyw.exe before trying with OCRAN.
172
- * Avoid absolute paths in your code and when invoking OCRAN.
173
-
174
- ### Multibyte path and filename support:
175
-
176
- * OCRAN-built executables can correctly handle multibyte paths and filenames
177
- (e.g., Japanese or emoji) on Windows. To use this feature, the executable
178
- must be run on Windows 10 version 1903 or later.
179
- * When using OCRAN-built executables from the console, we recommend running
180
- `chcp 65001` to switch the code page to UTF-8. This ensures proper
181
- input/output of multibyte characters in Command Prompt (CMD) and
182
- PowerShell.
183
-
184
- ## REQUIREMENTS:
185
-
186
- * Windows
187
- * Working Ruby installation.
188
- * Ruby Installation with devkit from rubyinstaller (when working with the source code only)
189
-
190
- ## Development
191
-
192
- ### Quick start
193
-
194
- Quickly set up the development environment and run the full test suite:
195
-
196
- git clone https://github.com/largo/ocran.git
197
- cd ocran
198
- bin/setup # install Bundler & all dev gems, generate stub for tests
199
- bundle exec rake # run the entire Minitest suite
200
-
201
- ### Developer Utilities (bin/ scripts)
202
-
203
- All scripts in the `bin/` directory are designed for developers and can be executed in any standard Windows shell, including Command Prompt (CMD), PowerShell, and Git Bash.
204
-
205
- | Script | Purpose |
206
- |---------------|--------------------------------------------------------------------------|
207
- | `bin/setup` | Installs Bundler and all required development gems, then builds stub.exe |
208
- | `bin/console` | Launches an IRB console with OCRAN preloaded |
209
-
210
-
211
- ### Rake tasks (Windows compatible)
212
-
213
- | Task | Purpose |
214
- |--------------|------------------------------------------------------------------------|
215
- | `rake build` | Compile stub.exe (requires MSVC or mingw‑w64 + DevKit) |
216
- | `rake clean` | Remove generated binaries (e.g., stub.exe); temp files are not deleted |
217
- | `rake test` | Execute all unit & integration tests |
218
-
219
- ## Technical details
220
-
221
- OCRAN first runs the target script in order to detect any files that
222
- are loaded and used at runtime (Using `Kernel#require` and
223
- `Kernel#load`).
224
-
225
- OCRAN embeds everything needed to run a Ruby script into a single
226
- executable file. The file contains the .exe stub which is compiled
227
- from C-code, and a custom opcode format containing instructions to
228
- create directories, save files, set environment variables and run
229
- programs. The OCRAN script generates this executable and the
230
- instructions to be run when it is launched.
231
-
232
- When executed, the OCRAN stub extracts the Ruby interpreter and your
233
- scripts into a temporary directory. The directory will contains the
234
- same directory layout as your Ruby installlation. The source files for
235
- your application will be put in the 'src' subdirectory.
236
-
237
- ### Libraries
238
-
239
- Any code that is loaded through `Kernel#require` when your
240
- script is executed will be included in the OCRAN
241
- executable. Conditionally loaded code will not be loaded and included
242
- in the executable unless the code is actually run when OCRAN invokes
243
- your script. Otherwise, OCRAN won't know about it and will not include
244
- the source files.
245
-
246
- RubyGems are handled specially. Whenever a file from a Gem is
247
- detected, OCRAN will attempt to include all the required files from
248
- that specific Gem, expect some unlikely needed files such as readme's
249
- and other documentation. This behaviour can be controlled by using the
250
- --gem-* options. Behaviour can be changed for all gems or specific
251
- gems using --gem-*=gemname.
252
-
253
- Libraries found in non-standard path (for example, if you invoke OCRAN
254
- with "ruby -I some/path") will be placed into the site dir
255
- (lib/ruby/site_ruby). Avoid changing `$LOAD_PATH` or
256
- `$:` from your script to include paths outside your source
257
- tree, since OCRAN may place the files elsewhere when extracted into the
258
- temporary directory.
259
-
260
- In case your script (or any of its dependencies) sets up autoloaded
261
- module using `Kernel#autoload`, OCRAN will automatically try to
262
- load them to ensure that they are all included in the
263
- executable. Modules that doesn't exist will be ignored (a warning will
264
- be logged).
265
-
266
- Dynamic link libraries (.dll files, for example WxWidgets, or other
267
- source files) will be detected and included by OCRAN.
268
-
269
- ### Including libraries non-automatically
270
-
271
- If an application or framework is complicated enough that it tends
272
- to confuse Ocran's automatic dependency resolution, then you can
273
- use other means to specify what needs to be packaged with your app.
274
-
275
- To disable automatic dependency resolution, use the `--no-dep-run`
276
- option; with it, Ocran will skip executing your program during the
277
- build process. This on the other hand requires using `--gem-full` option
278
- (see more below); otherwise Ocran will not include all the necessary
279
- files for the gems.
280
-
281
- You will also probably need to use the `--add-all-core` option to
282
- include the Ruby core libraries.
283
-
284
- If your app uses gems, then you can specify them in a
285
- Bundler (http://gembundler.com) Gemfile, then use the --gemfile
286
- option to supply it to Ocran. Ocran will automatically include all
287
- gems specified, and all their dependencies.
288
-
289
- (Note: This assumes that the gems are installed in your system,
290
- *not* locally packaged inside the app directory by "bundle package")
291
-
292
- These options are particularly useful for packaging Rails
293
- applications. For example, to package a Rails 3 app in the
294
- directory "someapp" and create an exe named "someapp.exe", without
295
- actually running the app during the build, you could use the
296
- following command:
297
-
298
- ocran someapp/script/rails someapp --output someapp.exe --add-all-core \
299
- --gemfile someapp/Gemfile --no-dep-run --gem-full --chdir-first -- server
300
-
301
- Note the space between `--` and `server`! It's important; `server` is
302
- an argument to be passed to rails when the script is ran.
303
-
304
- Rails 2 apps can be packaged similarly, though you will have to
305
- integrate them with Bundler (http://gembundler.com/rails23.html)
306
- first.
307
-
308
- ### Gem handling
309
-
310
- By default, Ocran includes all scripts that are loaded by your script
311
- when it is run before packaging. Ocran detects which gems are using and
312
- includes any additional non-script files from those gems, except
313
- trivial files such as C/C++ source code, object files, READMEs, unit
314
- tests, specs, etc.
315
-
316
- This behaviour can be changed by using the --gem-* options. There are
317
- four possible modes:
318
-
319
- * *minimal*: Include only loaded scripts
320
- * *guess*: Include loaded scripts and important files (DEFAULT)
321
- * *all*: Include all scripts and important files
322
- * *full*: Include all files
323
-
324
- If you find that files are missing from the resulting executable, try
325
- first with --gem-all=gemname for the gem that is missing, and if that
326
- does not work, try --gem-full=gemname. The paranoid can use --gem-full
327
- to include all files for all required gems.
328
-
329
- ### Creating an installer for your application
330
-
331
- To make your application start up quicker, or to allow it to
332
- keep files in its application directory between runs, or if
333
- you just want to make your program seem more like a "regular"
334
- Windows application, you can have Ocran generate an installer
335
- for your app with the free Inno Setup software.
336
-
337
- You will first have to download and install Inno Setup 5 or
338
- later, and also add its directory to your PATH (so that Ocran
339
- can find the ISCC compiler program). Once you've done that,
340
- you can use the `--innosetup` option to Ocran to supply an
341
- Inno Setup script. Do not add any [Files] or [Dirs] sections
342
- to the script; Ocran will figure those out itself.
343
-
344
- To continue the Rails example above, let's package the Rails 3
345
- app into an installer. Save the following as `someapp.iss`:
346
-
347
- [Setup]
348
- AppName=SomeApp
349
- AppVersion=0.1
350
- DefaultDirName={pf}\SomeApp
351
- DefaultGroupName=SomeApp
352
- OutputBaseFilename=SomeAppInstaller
353
-
354
- [Icons]
355
- Name: "{group}\SomeApp"; Filename: "{app}\someapp.bat"; IconFilename: "{app}\someapp.ico"; Flags: runminimized;
356
- Name: "{group}\Uninstall SomeApp"; Filename: "{uninstallexe}"
357
-
358
- Then, run Ocran with this command:
359
-
360
- ocran someapp/script/rails someapp --output someapp.exe --add-all-core \
361
- --gemfile someapp/Gemfile --no-dep-run --gem-full --chdir-first --no-lzma \
362
- --icon someapp.ico --innosetup someapp.iss -- server
363
-
364
- If all goes well, a file named "SomeAppInstaller.exe" will be placed
365
- into the Output directory.
366
-
367
- ### Environment variables
368
-
369
- OCRAN executables clear the RUBYLIB environment variable before your
370
- script is launched. This is done to ensure that your script does not
371
- use load paths from the end user's Ruby installation.
372
-
373
- OCRAN executables set the RUBYOPT environment variable to the value it
374
- had when you invoked OCRAN. For example, if you had "RUBYOPT=rubygems"
375
- on your build PC, OCRAN ensures that it is also set on PC's running the
376
- executables.
377
-
378
- OCRAN executables set OCRAN_EXECUTABLE to the full path of the
379
- executable, for example
380
-
381
- ENV["OCRAN_EXECUTABLE"] # => C:\Program Files\MyApp\MyApp.exe
382
-
383
- ### Working directory
384
-
385
- The OCRAN executable does not change the working directory when it is
386
- launched, unless you use the `--chdir-first` option.
387
-
388
- You should not assume that the current working directory when invoking
389
- an executable built with .exe is the location of the source script. It
390
- can be the directory where the executable is placed (when invoked
391
- through the Windows Explorer), the users' current working directory
392
- (when invoking from the Command Prompt), or even
393
- `C:\\WINDOWS\\SYSTEM32` when the executable is invoked through
394
- a file association.
395
-
396
- With the `--chdir-first` option, the working directory will
397
- always be the common parent directory of your source files. This
398
- should be fine for most applications. However, if your application
399
- is designed to run from the command line and take filenames as
400
- arguments, then you cannot use this option.
401
-
402
- If you wish to maintain the user's working directory, but need to
403
- `require` additional Ruby scripts from the source directory, you can
404
- add the following line to your script:
405
-
406
- $LOAD_PATH.unshift File.dirname($0)
407
-
408
- ### Load path mangling
409
-
410
- Adding paths to `$LOAD_PATH` or `$:` at runtime is not
411
- recommended. Adding relative load paths depends on the working
412
- directory being the same as where the script is located (See
413
- above). If you have additional library files in directories below the
414
- directory containing your source script you can use this idiom:
415
-
416
- $LOAD_PATH.unshift File.join(File.dirname($0), 'path/to/script')
417
-
418
- ### Detecting
419
-
420
- You can detect whether OCRAN is currently building your script by
421
- looking for the 'Ocran' constant. If it is defined, OCRAN is currenly
422
- building the executable from your script. For example, you can use
423
- this to avoid opening a GUI window when compiling executables:
424
-
425
- app = MyApp.new
426
- app.main_loop unless defined?(Ocran)
427
-
428
- ### Additional files and resources
429
-
430
- You can add additional files to the OCRAN executable (for example
431
- images) by appending them to the command line. They should be placed
432
- in the source directory with your main script (or a subdirectory).
433
-
434
- ocran mainscript.rb someimage.jpeg docs/document.txt
435
-
436
- This will create the following layout in the temporary directory when
437
- your program is executed:
438
-
439
- src/mainscript.rb
440
- src/someimage.jpeg
441
- src/docs/document.txt
442
-
443
- Both files, directoriess and glob patterns can be specified on the
444
- command line. Files will be added as-is. If a directory is specified,
445
- OCRAN will include all files found below that directory. Glob patterns
446
- (See Dir.glob) can be used to specify a specific set of files, for
447
- example:
448
-
449
- ocran script.rb assets/**/*.png
450
-
451
- ### Command Line Arguments
452
-
453
- To pass command line argument to your script (both while building and
454
- when run from the resulting executable), specify them after a
455
- `--` marker. For example:
456
-
457
- ocran script.rb -- --some-options=value
458
-
459
- This will pass `--some-options=value` to the script when
460
- build and when running the executable. Any extra argument specified by
461
- the user when invoking the executable will be appended after the
462
- compile-time arguments.
463
-
464
- ### Window/Console
465
-
466
- By default, OCRAN builds console application from .rb-files and
467
- windowed applications (without console window) from .rbw-files.
468
-
469
- Ruby on Windows provides two executables: ruby.exe is a console mode
470
- application and rubyw.exe is a windowed application which does not
471
- bring up a console window when launched using the Windows Explorer.
472
- By default, or if the `--console` option is used, OCRAN will
473
- use the console runtime (ruby.exe). OCRAN will automatically select the
474
- windowed runtime when your script has the ".rbw" extension, or if you
475
- specify the `--windows` command line option.
476
-
477
- If your application works in console mode but not in windowed mode,
478
- first check if your script works without OCRAN using rubyw.exe. A
479
- script that prints to standard output (using puts, print etc.) will
480
- eventually cause an exception when run with rubyw.exe (when the IO
481
- buffers run full).
482
-
483
- You can also try wrapping your script in an exception handler that
484
- logs any errors to a file:
485
-
486
- begin
487
- # your script here
488
- rescue Exception => e
489
- File.open("except.log") do |f|
490
- f.puts e.inspect
491
- f.puts e.backtrace
492
- end
493
- end
494
-
495
- ## CREDITS:
496
-
497
- Lars Christensen and contributors for the OCRA project which this is forked from.
498
-
499
- Kevin Walzer of codebykevin, Maxim Samsonov for ocra2, John Mair for codesigining support (to be merged)
500
-
501
- Thanks for Igor Pavlov for the LZMA compressor and decompressor. The
502
- source code used was place into Public Domain by Igor Pavlov.
503
-
504
- Erik Veenstra for rubyscript2exe which provided inspiration.
505
-
506
- Dice for the default .exe icon (vit-ruby.ico,
507
- http://ruby.morphball.net/vit-ruby-ico_en.html)
508
-
509
- ## LICENSE:
510
-
511
- (The MIT License)
512
-
513
- Copyright (c) 2009-2020 Lars Christensen
514
- Copyright (c) 2020-2025 The OCRAN Committers Team
515
-
516
- Permission is hereby granted, free of charge, to any person obtaining
517
- a copy of this software and associated documentation files (the
518
- 'Software'), to deal in the Software without restriction, including
519
- without limitation the rights to use, copy, modify, merge, publish,
520
- distribute, sublicense, and/or sell copies of the Software, and to
521
- permit persons to whom the Software is furnished to do so, subject to
522
- the following conditions:
523
-
524
- The above copyright notice and this permission notice shall be
525
- included in all copies or substantial portions of the Software.
526
-
527
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
528
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
529
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
530
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
531
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
532
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
533
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ # ocran
2
+
3
+ home :: https://github.com/largo/ocran/
4
+
5
+ issues :: http://github.com/largo/ocran/issues
6
+
7
+ ## Description
8
+
9
+ OCRAN (One-Click Ruby Application Next) packages Ruby applications for
10
+ distribution. It bundles your script, the Ruby interpreter, gems, and native
11
+ libraries into a single self-contained artifact that runs without requiring
12
+ Ruby to be installed on the target machine.
13
+
14
+ OCRAN supports four output formats, all cross-platform:
15
+
16
+ * **Self-extracting executable** — bundles everything into a single binary that unpacks and runs transparently, with no Ruby installation required. Produces a `.exe` on Windows, and a native executable on Linux and macOS.
17
+ * **macOS app bundle** (`--macosx-bundle`) — wraps the executable in a `.app` bundle for Finder integration, Dock icons, and code signing.
18
+ * **Directory** (`--output-dir`) copies all files into a folder with a ready-to-run launch script (`.sh` on Linux/macOS, `.bat` on Windows).
19
+ * **Zip archive** (`--output-zip`) same as directory output, packed into a `.zip`.
20
+
21
+ OCRAN is a fork of [OCRA](https://github.com/larsch/ocra) maintained for
22
+ Ruby 3.2+ compatibility.
23
+
24
+ ## Recommended usage
25
+
26
+ The most common use-case is shipping a program to Windows servers or users
27
+ who do not have Ruby installed. By default, each time the `.exe` is opened it
28
+ extracts the Ruby interpreter and your code to a temporary directory and runs
29
+ them from there.
30
+
31
+ Because extraction takes time on each launch, consider using the Inno Setup
32
+ option (`--innosetup`) to produce a proper installer that extracts once to a
33
+ permanent directory.
34
+
35
+ For cross-platform packaging or CI artifacts, use `--output-dir` or
36
+ `--output-zip` to produce a portable directory/archive that runs with the
37
+ bundled Ruby on Linux, macOS, or Windows.
38
+
39
+ ## Features
40
+
41
+ * **Windows/Linux/macOS executable** self-extracting, self-running executable (primary output)
42
+ * **macOS app bundle** `.app` bundle with `Info.plist` for Finder/Dock/code-signing (`--macosx-bundle`)
43
+ * **Directory output** — portable directory with a launch script (`--output-dir`)
44
+ * **Zip archive output** — portable zip with a launch script (`--output-zip`)
45
+ * LZMA compression (optional, default on, for `.exe` only)
46
+ * Both windowed and console mode supported (Windows)
47
+ * Gems included based on actual usage, or from a Bundler Gemfile
48
+ * Code-signing compatible
49
+ * Multibyte (UTF-8) path support on Windows 10 1903+
50
+
51
+ ## Problems & Bug Reporting
52
+
53
+ If you experience problems with OCRAN or have found a bug, please use the
54
+ issue tracker on GitHub (http://github.com/largo/ocran/issues).
55
+
56
+ ## Safety
57
+
58
+ As this gem ships with binary blobs, releases are securely built on GitHub
59
+ Actions. Feel free to verify that the published gem matches the source.
60
+
61
+ This repository includes `lzma.exe` from the
62
+ [official ip7z/7zip release](https://github.com/ip7z/7zip/releases)
63
+ (version 22.01, from `lzma2201.7z`), used to compress Windows executables.
64
+
65
+ `stub.exe`, `stubw.exe`, and `edicon.exe` are compiled from source in this
66
+ repository.
67
+
68
+ ## Installation
69
+
70
+ gem install ocran
71
+
72
+ Alternatively, download from http://rubygems.org/gems/ocran or
73
+ https://github.com/largo/ocran/releases/.
74
+
75
+ ## Synopsis
76
+
77
+ ### Building a Windows executable:
78
+
79
+ ocran script.rb
80
+
81
+ Packages `script.rb`, the Ruby interpreter, and all dependencies (gems and
82
+ DLLs) into `script.exe`.
83
+
84
+ ### Building a portable directory (Linux / macOS / Windows):
85
+
86
+ ocran --output-dir myapp/ script.rb
87
+
88
+ Copies all files into `myapp/` and writes a `script.sh` (or `script.bat` on
89
+ Windows) launch script.
90
+
91
+ ### Building a macOS app bundle:
92
+
93
+ ocran --macosx-bundle script.rb
94
+
95
+ Produces `script.app/` a standard macOS `.app` bundle containing the
96
+ self-extracting executable at `Contents/MacOS/script` and an `Info.plist`.
97
+ Open it with `open script.app` or double-click it in Finder.
98
+
99
+ ocran --macosx-bundle --output MyApp --bundle-id com.example.myapp --icon icon.icns script.rb
100
+
101
+ Custom name, bundle identifier and icon (must be `.icns` format). The icon is
102
+ placed at `Contents/Resources/AppIcon.icns` and referenced in `Info.plist`.
103
+
104
+ ### Building a zip archive:
105
+
106
+ ocran --output-zip myapp.zip script.rb
107
+
108
+ Same as `--output-dir`, but packages the result into a zip file. Requires
109
+ `zip` on Linux/macOS or PowerShell on Windows.
110
+
111
+ ### Command line:
112
+
113
+ ocran [options] script.rb [<other files> ...] [-- <script arguments> ...]
114
+
115
+ ### Options:
116
+
117
+ ocran --help
118
+
119
+ #### General options:
120
+
121
+ * `--help`: Display available command-line options.
122
+ * `--quiet`: Suppress all output during the build process.
123
+ * `--verbose`: Provide detailed output during the build process.
124
+ * `--version`: Display the OCRAN version number and exit.
125
+
126
+ #### Packaging options:
127
+
128
+ * `--dll <dllname>`: Include additional DLLs from the Ruby `bin` directory.
129
+ * `--add-all-core`: Add all standard Ruby core libraries to the executable.
130
+ * `--gemfile <file>`: Include all gems and dependencies listed in a Bundler `Gemfile`.
131
+ * `--no-enc`: Exclude encoding support files to reduce output size.
132
+
133
+ #### Gem content detection modes:
134
+
135
+ These options control which files from included gems are added to the output.
136
+
137
+ * `--gem-minimal[=gem1,..]`: Include only scripts actually loaded during the dependency run.
138
+ * `--gem-guess[=gem1,..]`: Include loaded scripts and a best guess of other needed files (DEFAULT).
139
+ * `--gem-all[=gem1,..]`: Include all scripts and important files from the gem.
140
+ * `--gem-full[=gem1,..]`: Include every file in the gem directory.
141
+ * `--gem-spec[=gem1,..]`: Include files listed in the gemspec (not compatible with newer RubyGems).
142
+
143
+ Fine-tuning flags:
144
+
145
+ * `--[no-]gem-scripts[=..]`: Include/exclude non-loaded script files (`.rb`, `.rbw`).
146
+ * `--[no-]gem-files[=..]`: Include/exclude data files.
147
+ * `--[no-]gem-extras[=..]`: Include/exclude extras (READMEs, tests, C sources).
148
+
149
+ #### Auto-detection options:
150
+
151
+ * `--no-dep-run`: Skip running the script to detect dependencies. Use this if your script has side effects during load or if you are manually specifying all dependencies. Requires `--add-all-core` and `--gem-full`.
152
+ * `--no-autoload`: Do not attempt to load `autoload`ed constants.
153
+ * `--no-autodll`: Disable automatic detection of runtime DLL dependencies.
154
+
155
+ #### Output options:
156
+
157
+ * `--output <file>`: Name the generated executable. Defaults to `./<scriptname>.exe` on Windows and `./<scriptname>` on Linux/macOS.
158
+ * `--output-dir <dir>`: Output all files to a directory with a launch script instead of building an executable. Works on Linux, macOS, and Windows.
159
+ * `--output-zip <file>`: Output a zip archive containing all files and a launch script. Requires `zip` (Linux/macOS) or PowerShell (Windows).
160
+ * `--macosx-bundle`: Build a macOS `.app` bundle. Use `--output` to set the bundle name (default: `<scriptname>.app`). (macOS)
161
+ * `--bundle-id <id>`: Set the `CFBundleIdentifier` in `Info.plist` (default: `com.example.<appname>`). Used with `--macosx-bundle`.
162
+ * `--no-lzma`: Disable LZMA compression (faster build, larger executable).
163
+ * `--innosetup <file>`: Use an Inno Setup script (`.iss`) to create a Windows installer.
164
+
165
+ #### Executable options:
166
+
167
+ * `--windows`: Force a Windows GUI application (uses `rubyw.exe`). (Windows only)
168
+ * `--console`: Force a console application (uses `ruby.exe`). (Windows only)
169
+ * `--chdir-first`: Change working directory to the app's extraction directory before the script starts.
170
+ * `--icon <ico>`: Replace the default icon with a custom `.ico` file.
171
+ * `--rubyopt <str>`: Set `RUBYOPT` when the executable runs.
172
+ * `--debug`: Enable verbose output when the generated executable runs.
173
+ * `--debug-extract`: Unpack to a local directory and do not delete after execution (useful for troubleshooting).
174
+
175
+ ### Compilation:
176
+
177
+ * OCRAN runs your script (using `Kernel#load`) and builds the output when it exits.
178
+ * Your program should `require` all necessary files when invoked without arguments so OCRAN can detect all dependencies.
179
+ * DLLs are detected automatically; only those within your Ruby installation are included.
180
+ * `.rb` files become console applications; `.rbw` files become windowed applications (without a console window popping up on Windows). Use `--console` or `--windows` to override.
181
+
182
+ ### Running your application:
183
+
184
+ * The working directory is not changed by OCRAN unless you use `--chdir-first`. You must change to the installation or temporary
185
+ directory yourself. See also below.
186
+ * When a `.exe` is running, `OCRAN_EXECUTABLE` points to the `.exe` with its full path.
187
+ * The temporary location of the script is available via `$0`.
188
+ * OCRAN does not set up the include path. Add `$:.unshift File.dirname($0)` at the start of your script if you need to `require` additional files from the same directory as your main script.
189
+
190
+ ### Directory and zip output (Linux / macOS / Windows):
191
+
192
+ When using `--output-dir` or `--output-zip`, OCRAN produces the same file
193
+ layout as a `.exe` would extract to:
194
+
195
+ bin/ # Ruby interpreter and shared libraries
196
+ lib/ # Ruby standard library
197
+ gems/ # Bundled gems
198
+ src/ # Your application source files
199
+ script.sh # Launch script (Linux/macOS) or script.bat on Windows
200
+
201
+ The launch script sets `RUBYLIB`, `GEM_HOME`, `GEM_PATH`, and any other
202
+ environment variables, then runs your script with the bundled Ruby.
203
+
204
+ On Linux/macOS, make the script executable and run it:
205
+
206
+ chmod +x myapp/script.sh
207
+ ./myapp/script.sh
208
+
209
+ On Windows, run the batch file:
210
+
211
+ myapp\script.bat
212
+
213
+ ### Pitfalls:
214
+
215
+ * Avoid modifying load paths at runtime. Use `-I` or `RUBYLIB` if needed, but don't expect OCRAN to preserve them for runtime. OCRAN may pack sources into other directories than you
216
+ expect
217
+ * If you use `.rbw` files or `--windows`, verify your application works with `rubyw.exe` before building.
218
+ * Avoid absolute paths in your code and when invoking OCRAN.
219
+
220
+ ### Multibyte path and filename support:
221
+
222
+ * OCRAN-built executables correctly handle multibyte paths (e.g. Japanese, emoji) on Windows 10 1903+.
223
+ * When using the executable from the console, run `chcp 65001` first to switch to UTF-8 on windows.
224
+
225
+ ## Requirements
226
+
227
+ * Ruby 3.2+
228
+ * For building Windows `.exe`: Windows with RubyInstaller DevKit (mingw-w64), or Wine on Linux/macOS
229
+ * For `--output-dir` / `--output-zip`: any platform with Ruby 3.2+
230
+ * For `--output-zip` on Linux/macOS: the `zip` command must be available
231
+ * For `--output-zip` on Windows: PowerShell (included in Windows 8+)
232
+
233
+ ### Output architecture
234
+
235
+ The architecture of the generated executable matches the Ruby interpreter used to run OCRAN:
236
+
237
+ * **macOS (Intel / Apple Silicon)** — The output binary targets the same CPU as your Ruby installation. If you build with an ARM64 Ruby (Apple Silicon), the result is an ARM64 executable and will not run on Intel Macs. Build on Intel (or with an Intel Ruby under Rosetta) to produce a universally compatible x86-64 binary.
238
+
239
+ * **Windows on ARM (Windows 11 ARM)** — RubyInstaller recently started shipping ARM64 builds; Installing the ARM64 RubyInstaller on a Windows ARM machine and running OCRAN from it will produce an ARM64 `.exe`. These run on ARM Windows natively. Installing the standard x86-64 RubyInstaller on a Windows ARM machine and running OCRAN from it will (probably?) produce an x86-64 `.exe`. These run on ARM Windows via the built-in x86-64 emulation layer, so the executables work on both ARM and x86-64 Windows targets. If you use `--no-lzma`, note that `lzma.exe` (the bundled compressor) is also x86-64 and relies on the same emulation.
240
+
241
+ ## Development
242
+
243
+ ### Quick start
244
+
245
+ git clone https://github.com/largo/ocran.git
246
+ cd ocran
247
+ bin/setup # install Bundler & all dev gems, build stubs
248
+ bundle exec rake # run the full Minitest suite
249
+ exe/ocran filename.rb # build filename.rb as an executable
250
+
251
+ ### Developer utilities (`bin/` scripts)
252
+
253
+ | Script | Purpose |
254
+ |---------------|--------------------------------------------------------------------------|
255
+ | `bin/setup` | Installs Bundler and all required development gems, then builds stub.exe |
256
+ | `bin/console` | Launches an IRB console with OCRAN preloaded |
257
+
258
+ ### Rake tasks
259
+
260
+ | Task | Purpose |
261
+ |--------------|------------------------------------------------------------------------|
262
+ | `rake build` | Compile stub(.exe) (requires MSVC or mingw-w64 + DevKit or Unix build tools) |
263
+ | `rake clean` | Remove generated binaries |
264
+ | `rake test` | Execute all unit & integration tests |
265
+
266
+ ## Technical details
267
+
268
+ OCRAN first runs the target script to detect files loaded at runtime (via
269
+ `Kernel#require` and `Kernel#load`).
270
+
271
+ For `.exe` output, OCRAN embeds everything into a single executable: a C stub,
272
+ and a custom opcode stream containing instructions to create directories,
273
+ extract files, set environment variables, and launch the script. The stub
274
+ extracts everything to a temporary directory at runtime and runs the script.
275
+
276
+ For `--output-dir` / `--output-zip`, OCRAN performs the same file collection
277
+ but writes directly to the filesystem and generates a shell/batch launch
278
+ script instead of an opcode stream.
279
+
280
+ ### Libraries
281
+
282
+ Any code loaded through `Kernel#require` when your script runs is included.
283
+ Conditionally loaded code is only included if it is actually executed during
284
+ the OCRAN build run.
285
+ Otherwise, OCRAN won't know about it and will not include
286
+ the source files.
287
+ You can use `defined?(OCRAN)` to check if the script is running while OCRAN is building it and exit the script after dependencies are loaded but before the main logic runs.
288
+
289
+ RubyGems are handled specially: when a file from a gem is detected, OCRAN
290
+ includes the required files from that gem. It does not automatically include all the files of the Gem, which could be required at runtime. This behavior is controlled with
291
+ the `--gem-*` options.
292
+
293
+ Libraries found in non-standard path (for example, if you invoke OCRAN
294
+ with "ruby -I some/path") will be placed into the site dir
295
+ (lib/ruby/site_ruby). Avoid changing `$LOAD_PATH` or
296
+ `$:` from your script to include paths outside your source
297
+ tree, since OCRAN may place the files elsewhere when extracted into the
298
+ temporary directory.
299
+
300
+ If your script uses `Kernel#autoload`, OCRAN will attempt to load those
301
+ constants so they are included in the output. Missing modules are ignored
302
+ with a warning.
303
+
304
+ Dynamic link libraries (.dll files, for example WxWidgets, or other
305
+ source files) will be detected and included by OCRAN.
306
+
307
+ ### Including libraries non-automatically
308
+
309
+ If automatic dependency resolution is insufficient, use `--no-dep-run` to
310
+ skip running your script. This requires `--gem-full` and typically
311
+ `--add-all-core`.
312
+
313
+ You can specify gems via a Bundler Gemfile with `--gemfile`. OCRAN includes
314
+ all listed gems and their dependencies (they must be installed, not vendored
315
+ via `bundle package`).
316
+
317
+ Example packaging a Rails app without running it:
318
+
319
+ ocran someapp/script/rails someapp --output someapp.exe --add-all-core \
320
+ --gemfile someapp/Gemfile --no-dep-run --gem-full --chdir-first -- server
321
+
322
+ Note the space between `--` and `server`! It's important; `server` is
323
+ an argument to be passed to rails when the script is ran.
324
+ ### Gem handling
325
+
326
+ By default, OCRAN includes all scripts loaded by your script plus important
327
+ non-script files from those gems, excluding C/C++ sources, object files,
328
+ READMEs, tests, and specs.
329
+
330
+ Four modes:
331
+
332
+ * *minimal*: Loaded scripts only
333
+ * *guess*: Loaded scripts and important files (DEFAULT)
334
+ * *all*: All scripts and important files
335
+ * *full*: All files in the gem directory
336
+
337
+ If files are missing from the output, try `--gem-all=gemname` first, then
338
+ `--gem-full=gemname`. Use `--gem-full` to include everything for all gems.
339
+
340
+ ### Code-signing a macOS app bundle
341
+
342
+ After building with `--macosx-bundle`, sign the bundle with your Developer ID:
343
+
344
+ codesign --deep --force --verify --verbose \
345
+ --sign "Developer ID Application: Your Name (TEAMID)" \
346
+ MyApp.app
347
+
348
+ Verify the signature:
349
+
350
+ codesign --verify --deep --strict --verbose=2 MyApp.app
351
+ spctl --assess --type execute --verbose MyApp.app
352
+
353
+ For distribution outside the Mac App Store, notarize with Apple:
354
+
355
+ # Submit for notarization (requires app-specific password or API key)
356
+ xcrun notarytool submit MyApp.app \
357
+ --apple-id you@example.com \
358
+ --team-id TEAMID \
359
+ --password APP_SPECIFIC_PASSWORD \
360
+ --wait
361
+
362
+ # Staple the notarization ticket so it works offline
363
+ xcrun stapler staple MyApp.app
364
+
365
+ Requirements:
366
+ * Xcode Command Line Tools (`xcode-select --install`)
367
+ * An Apple Developer account with a "Developer ID Application" certificate in Keychain
368
+
369
+ ### Creating a Windows installer
370
+
371
+ To make your application start faster or keep files between runs, use
372
+ `--innosetup` to generate an Inno Setup installer.
373
+
374
+ Install Inno Setup 5+ and add it to your `PATH`, then supply an `.iss` script:
375
+
376
+ Make sure that iss is in the PATH environment variable by running the command `iss` in your terminal.
377
+
378
+ Do not add any [Files] or [Dirs] sections
379
+ to the script; Ocran will figure those out itself.
380
+ To continue the Rails example above, let's package the Rails application
381
+ into an installer. Save the following as `someapp.iss`:
382
+
383
+ [Setup]
384
+ AppName=SomeApp
385
+ AppVersion=0.1
386
+ DefaultDirName={pf}\SomeApp
387
+ DefaultGroupName=SomeApp
388
+ OutputBaseFilename=SomeAppInstaller
389
+
390
+ [Icons]
391
+ Name: "{group}\SomeApp"; Filename: "{app}\someapp.bat"; IconFilename: "{app}\someapp.ico"; Flags: runminimized;
392
+ Name: "{group}\Uninstall SomeApp"; Filename: "{uninstallexe}"
393
+
394
+ ocran someapp/script/rails someapp --output someapp.exe --add-all-core \
395
+ --gemfile someapp/Gemfile --no-dep-run --gem-full --chdir-first --no-lzma \
396
+ --icon someapp.ico --innosetup someapp.iss -- server
397
+
398
+ If all goes well, a file named "SomeAppInstaller.exe" will be placed
399
+ into the Output directory.
400
+
401
+ ### Environment variables
402
+
403
+ OCRAN clears the `RUBYLIB` environment variable before running your script so it does not pick up load
404
+ paths from the end user's Ruby installation.
405
+
406
+ OCRAN sets the `RUBYOPT` environment variable to the value it had when you invoked OCRAN. For `.exe`
407
+ output, `OCRAN_EXECUTABLE` is set to the full path of the running executable:
408
+
409
+ ENV["OCRAN_EXECUTABLE"] # => C:\Program Files\MyApp\MyApp.exe
410
+
411
+ ### Working directory
412
+
413
+ The OCRAN executable does not change the working directory when it starts. It only changes the working directory when you use
414
+ `--chdir-first`.
415
+
416
+ You should not assume that the current working directory when invoking
417
+ an executable built with .exe is the location of the source script. It
418
+ can be the directory where the executable is placed (when invoked
419
+ through the Windows Explorer), the users' current working directory
420
+ (when invoking from the Command Prompt), or even
421
+ `C:\\WINDOWS\\SYSTEM32` when the executable is invoked through
422
+ a file association.
423
+
424
+ With `--chdir-first`, the working directory is always the common parent
425
+ directory of your source files. Do not use this if your application takes
426
+ filenames as command-line arguments.
427
+
428
+ To `require` additional files from the source directory while keeping the
429
+ user's working directory:
430
+
431
+ $LOAD_PATH.unshift File.dirname($0)
432
+
433
+ ### Detecting OCRAN at build time
434
+
435
+ Check for the `Ocran` constant to detect whether OCRAN is currently building
436
+ your script:
437
+
438
+ app = MyApp.new
439
+ app.main_loop unless defined?(Ocran)
440
+
441
+ ### Additional files and resources
442
+
443
+ Append extra files, directories, or glob patterns to the command line:
444
+
445
+ ocran mainscript.rb someimage.jpeg docs/document.txt
446
+ ocran script.rb assets/**/*.png
447
+
448
+ This produces the following layout in the output (temp dir for `.exe`,
449
+ or the output directory for `--output-dir`):
450
+
451
+ src/mainscript.rb
452
+ src/someimage.jpeg
453
+ src/docs/document.txt
454
+
455
+ Both files, directoriess and glob patterns can be specified on the
456
+ command line. Files will be added as-is. If a directory is specified,
457
+ OCRAN will include all files found below that directory. Glob patterns
458
+ (See Dir.glob) can be used to specify a specific set of files, for
459
+ example:
460
+
461
+ ocran script.rb assets/**/*.png
462
+
463
+ ### Command Line Arguments
464
+
465
+ Pass arguments to your script (both during the build run and at runtime)
466
+ after a `--` marker:
467
+
468
+ ocran script.rb -- --some-option=value
469
+
470
+ Extra arguments supplied by the user at runtime are appended after the
471
+ compile-time arguments.
472
+
473
+ ### Load path mangling
474
+
475
+ Adding paths to `$LOAD_PATH` or `$:` at runtime is not recommended. Adding
476
+ relative load paths depends on the working directory being the same as where
477
+ the script is located (see above). If you have additional library files in
478
+ directories below the directory containing your source script, use this idiom:
479
+
480
+ $LOAD_PATH.unshift File.join(File.dirname($0), 'path/to/script')
481
+
482
+ ### Window/Console
483
+
484
+ By default, OCRAN builds console applications from `.rb` files and windowed
485
+ applications (without a console window) from `.rbw` files.
486
+
487
+ Ruby on Windows provides two executables: `ruby.exe` is a console mode
488
+ application and `rubyw.exe` is a windowed application that does not bring up
489
+ a console window when launched from Windows Explorer. By default, or if
490
+ `--console` is used, OCRAN uses the console runtime. OCRAN automatically
491
+ selects the windowed runtime when your script has the `.rbw` extension, or
492
+ when you pass `--windows`.
493
+
494
+ If your application works in console mode but not in windowed mode, first
495
+ check that your script works without OCRAN using `rubyw.exe`. A script that
496
+ prints to standard output (`puts`, `print`, etc.) will eventually raise an
497
+ exception under `rubyw.exe` once the IO buffers fill up.
498
+
499
+ You can also wrap your script in an exception handler that logs errors to a
500
+ file:
501
+
502
+ begin
503
+ # your script here
504
+ rescue Exception => e
505
+ File.open("except.log", "w") do |f|
506
+ f.puts e.inspect
507
+ f.puts e.backtrace
508
+ end
509
+ end
510
+
511
+ ## Credits
512
+
513
+ Lars Christensen and contributors for the OCRA project which this is forked from.
514
+
515
+ Kevin Walzer of codebykevin, Maxim Samsonov for ocra2, John Mair for
516
+ codesigning support.
517
+
518
+ Igor Pavlov for the LZMA compressor and decompressor (Public Domain).
519
+
520
+ Erik Veenstra for rubyscript2exe, which provided inspiration.
521
+
522
+ Dice for the default `.exe` icon (vit-ruby.ico,
523
+ http://ruby.morphball.net/vit-ruby-ico_en.html).
524
+
525
+ ## License
526
+
527
+ (The MIT License)
528
+
529
+ Copyright (c) 2009-2020 Lars Christensen
530
+ Copyright (c) 2020-2025 The OCRAN Committers Team
531
+
532
+ Permission is hereby granted, free of charge, to any person obtaining
533
+ a copy of this software and associated documentation files (the
534
+ 'Software'), to deal in the Software without restriction, including
535
+ without limitation the rights to use, copy, modify, merge, publish,
536
+ distribute, sublicense, and/or sell copies of the Software, and to
537
+ permit persons to whom the Software is furnished to do so, subject to
538
+ the following conditions:
539
+
540
+ The above copyright notice and this permission notice shall be
541
+ included in all copies or substantial portions of the Software.
542
+
543
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
544
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
545
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
546
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
547
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
548
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
549
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.