ocran 1.3.16 → 1.3.17
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.
- checksums.yaml +4 -4
- data/CHANGELOG.txt +272 -0
- data/LICENSE.txt +23 -0
- data/README.md +531 -0
- data/lib/ocran/version.rb +1 -1
- data/share/ocran/edicon.exe +0 -0
- data/share/ocran/stub.exe +0 -0
- data/share/ocran/stubw.exe +0 -0
- metadata +22 -5
- /data/{bin → exe}/ocran +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9a3cbb0a7f0f5d9eecc89b8f14d8c538abf146f9e95e982ece04a0fe1e58278
|
4
|
+
data.tar.gz: acd0b94387b943c42ca1bbbd336faaacddaf209768e69bd446baff44995ac3cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ce6b73b6a11d76d91c9ba09ce79e71c09de420f68d0ac52a8d6636c95167b669a6ccea3ad3ae171232db80b6335479240363d9e38042c52b3c0fa806b539a41
|
7
|
+
data.tar.gz: 36334319b2735ff7498cd03f49b85810c2e2a7ea902ec7a9a14a4378e4ec52af56507c551f8d92ee6139883388c91542f1e8c8da0269c0fff4b23660b6472703
|
data/CHANGELOG.txt
ADDED
@@ -0,0 +1,272 @@
|
|
1
|
+
=== 1.3.17
|
2
|
+
- Modified `rake test` to no longer build stubs during test execution. Use `rake build_stub` when stub generation is necessary.
|
3
|
+
- New `rake build` task as a unified build entry point, delegating to `build_stub`.
|
4
|
+
- Updated GitHub Actions and internal scripts to use `rake build` instead of `rake build_stub`.
|
5
|
+
- Add full support for multibyte (UTF-8) names across executables, scripts, and resources. Requires Windows 10 version 1903 or later.
|
6
|
+
- Added UTF-8 manifest to stub.exe to enable UTF-8 support in ANSI API calls.
|
7
|
+
- Update Bundler from 2.5.10 to 2.5.23. This is the last Bundler version officially supporting Ruby 3.0.
|
8
|
+
- Added `bin/setup` and `bin/console` scripts for development (both Bash and Windows .bat versions).
|
9
|
+
- `bin/setup` now installs dependencies and builds stub executables automatically.
|
10
|
+
- Improved `spec.files` to explicitly include README, LICENSE, and CHANGELOG.
|
11
|
+
- Introduced a `Development` section in the README with setup instructions and Windows shell compatibility.
|
12
|
+
- Updated copyright year in README and LICENSE.
|
13
|
+
|
14
|
+
=== 1.3.16
|
15
|
+
- Support for Ruby 3.0 and above. Drop ruby 2.6 and 2.7 support.
|
16
|
+
- At startup, OCRAN no longer automatically removes directories that were previously deployed but couldn't be deleted. This change has been made to enhance security by preventing processes other than the startup process from manipulating temporary files created by them.
|
17
|
+
- The ability for the stub to launch any script during the unpacking of application files has been removed. This feature was not in use.
|
18
|
+
- The exit code from the Ruby application is now returned when the stub is terminated.
|
19
|
+
- The packed data no longer contains redundant directory information.
|
20
|
+
- Fixed errors in the --debug option.
|
21
|
+
- Upgraded LZMA decoder to version 22.01
|
22
|
+
- The directory generation for file extraction has been changed to use unique directory names created with high-resolution timestamps. Additionally, a retry limit for directory creation has been introduced, reducing the risk of infinite loops due to name collisions.
|
23
|
+
- Implemented variable-length buffer handling for path strings in stub, eliminating the risk of buffer overruns dependent on MAX_PATH.
|
24
|
+
- In order to reduce security risks during the cleanup process before application termination, we have implemented a safe current directory change from the system directory and the root of the C drive to the user's temporary directory and the directory of the app executable.
|
25
|
+
- The 'stub' executable has been enhanced for security, ensuring it prevents directory traversal attacks by verifying that path elements do not contain relative notations like '.' or '..'.
|
26
|
+
- Removed OcranBuilder and split functionality into StubBuilder and InnoSetupBuilder to introduce delayed loading and improve resource efficiency.
|
27
|
+
- InnoSetup installer now operates independently of stub, launching through its own batch file.
|
28
|
+
- Moved LibraryDetector to a separate file for modularity and implemented delayed loading with standardized Fiddle usage.
|
29
|
+
- Update Bundler from 2.4.13 to 2.5.10.
|
30
|
+
- Fixed issue where the gem.build_complete file was not included in the package due to an incorrect change.
|
31
|
+
- Changed error output from standard output to standard error (stderr).
|
32
|
+
- ocransa (Ocran-stand-alone) has been discontinued.
|
33
|
+
- The implementation of bin/ocran.rb has been refactored and split into multiple files. These files have been relocated to the lib directory.
|
34
|
+
|
35
|
+
=== 1.3.15
|
36
|
+
- Support for Ruby 2.6 and above.
|
37
|
+
- Properly display errors from InnoSetup.
|
38
|
+
- Fixed errors when creating an installer using InnoSetup. Previously, installer creation was not possible due to errors related to file sharing, which occurred only on Windows.
|
39
|
+
- Retrieve the path of runtime DLLs even when the path is long. Note that stubs still do not support long paths, so creating executable files with long paths is not yet possible.
|
40
|
+
- Fixed bugs in tests. All tests can now be executed.
|
41
|
+
- Improved the speed of manifest file discovery. This manifest file is only required in the RubyInstaller environment.
|
42
|
+
- Fixed bugs in the regular expressions of GEM_EXTRA_RE. This allows excluding C source files, etc., from the ocran executable package based on command options.
|
43
|
+
- Added methods to Ocran::Pathname, making it closer to the implementation of Ruby's Pathname.
|
44
|
+
- Reimplemented certain parts to match the implementation of Ruby 2.6 era, for compatibility with older Ruby versions. Therefore, the ocran command cannot be executed on Ruby versions earlier than 2.6.
|
45
|
+
|
46
|
+
=== 1.3.14
|
47
|
+
- Add option to suppress or override RUBYOPT environment variable #3 by ccorn90
|
48
|
+
|
49
|
+
=== 1.3.13
|
50
|
+
- Fixed the bug why Innosetup did not run because of missing encode method
|
51
|
+
- Fix an issue where rubyinstaller did not find the msys path by putting in an empty msys-2.0.dll into msys64/usr/bin/msys-2.0.dll
|
52
|
+
- compatibility with the tiny_tds gem (see above)
|
53
|
+
- GitHub builds through github action: making sure you can trust the included binaries.
|
54
|
+
- Added some samples including the glimmer-libui GUI example. GUI that starts fast.
|
55
|
+
|
56
|
+
=== 1.3.12
|
57
|
+
* Forked from Ocra
|
58
|
+
* Support Ruby up to 3.2
|
59
|
+
* Update lzma.exe to version 22.01
|
60
|
+
|
61
|
+
=== 1.3.11
|
62
|
+
|
63
|
+
* Support Ruby 2.2-2.7
|
64
|
+
* Add ruby2_keywords.rb to ignored modules
|
65
|
+
* Update lzma.exe to version 19.00
|
66
|
+
* Workaround for warning about deprecated Object#=~
|
67
|
+
* Use Fiddle instead of Win32API
|
68
|
+
* Fix for invalid argument to relative_path_from
|
69
|
+
|
70
|
+
=== 1.3.10
|
71
|
+
|
72
|
+
* Reduce memory usage while building & compressing (avoids out of
|
73
|
+
memory issue on really big programs).
|
74
|
+
|
75
|
+
* Compile stub.exe with 32-bit compiler again
|
76
|
+
|
77
|
+
=== 1.3.9
|
78
|
+
|
79
|
+
* Support Ruby 2.4.1p111 (include manifest)
|
80
|
+
|
81
|
+
=== 1.3.8
|
82
|
+
|
83
|
+
* Use GetModuleFileNameW for DLL detection
|
84
|
+
|
85
|
+
=== 1.3.7
|
86
|
+
|
87
|
+
* Workaround for handling of file names and directory name with
|
88
|
+
non-ASCII characters (e.g. "invalid byte sequence in UTF-8")
|
89
|
+
|
90
|
+
=== 1.3.6
|
91
|
+
|
92
|
+
* More robust cleanup of temporary files. Deletes using manual
|
93
|
+
recursive method instead of using the shell. Will mark files for
|
94
|
+
later deletion both using Windows (requires Administrator
|
95
|
+
privileges) and a custom method that will remove old temporary files
|
96
|
+
when the executable is restarted.
|
97
|
+
|
98
|
+
=== 1.3.5
|
99
|
+
|
100
|
+
* Fixes for Ruby 2.2.2p95
|
101
|
+
|
102
|
+
=== 1.3.4
|
103
|
+
|
104
|
+
* Workarounds for Ruby 2.1.5
|
105
|
+
|
106
|
+
=== 1.3.3
|
107
|
+
|
108
|
+
* Rebuild executables with MinGW GCC 4.8.1-4.
|
109
|
+
|
110
|
+
=== 1.3.2
|
111
|
+
|
112
|
+
* Refactored Gemfile handling for better compatibility with Ruby
|
113
|
+
version.
|
114
|
+
|
115
|
+
=== 1.3.1
|
116
|
+
|
117
|
+
* Now includes $LOADED_FEATURES even when script is not run to check
|
118
|
+
dependencies. This fixes compatability with Ruby 1.9.3 where
|
119
|
+
rubygems is always loaded.
|
120
|
+
|
121
|
+
* Fixed compatability with Ruby 2.0.0: Temp-path alias in binary
|
122
|
+
changed to be valid UTF-8 character.
|
123
|
+
|
124
|
+
* README.txt updated related to --no-dep-run (karhatsu).
|
125
|
+
|
126
|
+
* Fixes for Bundler handling (DavidMikeSimon).
|
127
|
+
|
128
|
+
=== 1.3.0
|
129
|
+
|
130
|
+
* Fixed some additional corner cases with absolute and relative
|
131
|
+
require & load paths. Extended test suite to cover a lot more
|
132
|
+
cases.
|
133
|
+
|
134
|
+
* Now provides a meaningful exit status code (1 on error, 0 on
|
135
|
+
success). (DavidMikeSimon)
|
136
|
+
|
137
|
+
* New option to _not_ run the script to detect dependencies
|
138
|
+
(--no-dep-run). (DavidMikeSimon)
|
139
|
+
|
140
|
+
* Bundler support using the --gemfile option. (DavidMikeSimon)
|
141
|
+
|
142
|
+
* Debug mode support in the stub (--debug). Also --debug-extract to
|
143
|
+
keep extracted files from executable. (DavidMikeSimon)
|
144
|
+
|
145
|
+
* New gem behaviour yet again due to changes in Rubygems. See README
|
146
|
+
file.
|
147
|
+
|
148
|
+
=== 1.2.0
|
149
|
+
|
150
|
+
* Ignore console events (Ctrl-C, Ctrl-Break). Ruby process handles
|
151
|
+
them anyway and exist, allowing the stub to clean up temporary
|
152
|
+
files.
|
153
|
+
|
154
|
+
* Temporary memory used for decompression is now freed before the ruby
|
155
|
+
interpreter is launched by the stub.
|
156
|
+
|
157
|
+
* Progress dialog is no longer displayed when removing temporary
|
158
|
+
files.
|
159
|
+
|
160
|
+
* Now includes most files from any require'd Rubygem (Now works with
|
161
|
+
mime-types, oledb and other gems that load additional data files
|
162
|
+
from the Gem installation). Some files are still ignored
|
163
|
+
(e.g. Readme's). Use "--no-gem-filter" to make Ocra unconditionally
|
164
|
+
include all files listed in the Gem specification (Thanks to Jorge
|
165
|
+
L. Cangas for patch & ideas).
|
166
|
+
|
167
|
+
* NameErrors are now rescued when attempting to load autoloadable
|
168
|
+
constants. Hopefully resolves issues with ActiveRecord [#28488].
|
169
|
+
|
170
|
+
* Now works if the script changes environment or working directory
|
171
|
+
while running.
|
172
|
+
|
173
|
+
* Fixed a regression in 1.1.4 when resource files are specified;
|
174
|
+
directory layout would not be maintained, e.g. when running "ocra
|
175
|
+
bin/script share/data.dat".
|
176
|
+
|
177
|
+
* Added support for passing arguments to script. Specify argument to
|
178
|
+
your script after a "--" marker. Arguments will be passed both at
|
179
|
+
compile time and run time. (#27815)
|
180
|
+
|
181
|
+
* Now works if the source files are located beneath Ruby's
|
182
|
+
exec_prefix. (#28505)
|
183
|
+
|
184
|
+
=== 1.1.4
|
185
|
+
|
186
|
+
* The tempdir marker is now pretty-printed as "<tempdir>" in the
|
187
|
+
output.
|
188
|
+
|
189
|
+
* Fixed various issues with path and filenames being handled case
|
190
|
+
sensitive.
|
191
|
+
|
192
|
+
* Now uses config settings for Ruby executable names (should now also
|
193
|
+
work with ruby installations built with --program-suffix).
|
194
|
+
|
195
|
+
* Supported invoking ocra with an absolute path to the script. Will
|
196
|
+
assume that the script is in the root of the source hierachy.
|
197
|
+
|
198
|
+
=== 1.1.3
|
199
|
+
|
200
|
+
* Use Win32API (provided with Ruby) instead of win32-api (gem).
|
201
|
+
|
202
|
+
* No longer sets GEM_HOME (which would override the default gem
|
203
|
+
path). Instead sets GEM_PATH. Resolves issues with gems not loading
|
204
|
+
on Ruby 1.9.
|
205
|
+
|
206
|
+
=== 1.1.2
|
207
|
+
|
208
|
+
* Warnings can be disabled using --no-warnings.
|
209
|
+
|
210
|
+
* Fixed not .exe being generated when script calls 'exit'.
|
211
|
+
|
212
|
+
* Path to the generated executable is now avilable to the running
|
213
|
+
script in the OCRA_EXECUTABLE environment variable.
|
214
|
+
|
215
|
+
* Directories on the command line will now be created.
|
216
|
+
|
217
|
+
* Supports path globs, fx. "ocra script.rb assets/**/*.png". (See
|
218
|
+
documentation for Ruby's Dir class).
|
219
|
+
|
220
|
+
* Fixed issue with spaces in temporary path (TMP environment).
|
221
|
+
|
222
|
+
* Improved path comparison to ignore case (this is Windows after all)
|
223
|
+
and be a bit more robust.
|
224
|
+
|
225
|
+
* Added support for RubyGems installed in GEM_HOME (or other part
|
226
|
+
handled by RubyGems). If not installed in the Ruby hierarchy, they
|
227
|
+
will now be installed in a directory named 'gemhome' under the
|
228
|
+
temporary directory.
|
229
|
+
|
230
|
+
=== 1.1.1
|
231
|
+
|
232
|
+
* Fixed duplicate entries in the RUBYLIB environment variable.
|
233
|
+
|
234
|
+
* Another slight fix for relative load paths.
|
235
|
+
|
236
|
+
* RUBYOPT is now set to the value it had when OCRA was invoked.
|
237
|
+
|
238
|
+
=== 1.1.0
|
239
|
+
|
240
|
+
* Added an icon to the executable. Can be replaced from a .ico file
|
241
|
+
using the --icon <ico> option.
|
242
|
+
|
243
|
+
* Improved handling of load paths added either from the command line
|
244
|
+
(ruby -I), RUBYLIB environment variable or during the script (by
|
245
|
+
modifying $: or $LOAD_PATH).
|
246
|
+
|
247
|
+
* Now automatically detects loaded DLLs through Win32::API. Disable
|
248
|
+
with --no-autodll.
|
249
|
+
|
250
|
+
=== 1.0.3 / 2009-05-25
|
251
|
+
|
252
|
+
* Fixed invokation of executables with spaces in path names (#25966).
|
253
|
+
|
254
|
+
* Fixed inverted handling of --windows & --console (#25974)
|
255
|
+
|
256
|
+
* Fixed installation issue with RubyGems (missing "lib")
|
257
|
+
|
258
|
+
=== 1.0.2 / 2009-05-10
|
259
|
+
|
260
|
+
* Added stubw.exe to gem (was missing 1.0.1)
|
261
|
+
|
262
|
+
=== 1.0.1 / 2009-05-05
|
263
|
+
|
264
|
+
* Added stub with windows runtime for windowed applications
|
265
|
+
(e.g. wxRuby) and fixed issue where OCRA would use ruby.exe instead
|
266
|
+
of rubyw.exe for such programs. [#25774]
|
267
|
+
|
268
|
+
=== 1.0.0 / 2009-04-05
|
269
|
+
|
270
|
+
* 1 major enhancement
|
271
|
+
|
272
|
+
* Birthday!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2009-2020 Lars Christensen
|
4
|
+
Copyright (c) 2020-2025 The OCRAN Committers Team
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
'Software'), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
21
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
22
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
23
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,531 @@
|
|
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.0
|
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 binaries, we have taken actions to insure your safety.
|
39
|
+
The gem releases are built on Github Actions. Feel free verify that it matches the version on rubygems.
|
40
|
+
It ships with seb.exe and LZMA.exe in this repository, which come from official sources.
|
41
|
+
|
42
|
+
## Installation
|
43
|
+
|
44
|
+
Gem:
|
45
|
+
|
46
|
+
gem install ocran
|
47
|
+
|
48
|
+
Alternatively you can download the gem at either
|
49
|
+
http://rubygems.org/gems/ocran or
|
50
|
+
https://github.com/largo/ocran/releases/.
|
51
|
+
|
52
|
+
## Synopsis
|
53
|
+
|
54
|
+
### Building an executable:
|
55
|
+
|
56
|
+
ocran script.rb
|
57
|
+
|
58
|
+
Will package `script.rb`, the Ruby interpreter and all
|
59
|
+
dependencies (gems and DLLs) into an executable named
|
60
|
+
`script.exe`.
|
61
|
+
|
62
|
+
### Command line:
|
63
|
+
|
64
|
+
ocran [options] script.rb [<other files> ...] [-- <script arguments> ...]
|
65
|
+
|
66
|
+
### Options:
|
67
|
+
|
68
|
+
ocran --help
|
69
|
+
|
70
|
+
Ocran options:
|
71
|
+
|
72
|
+
--help Display this information.
|
73
|
+
--quiet Suppress output while building executable.
|
74
|
+
--verbose Show extra output while building executable.
|
75
|
+
--version Display version number and exit.
|
76
|
+
|
77
|
+
Packaging options:
|
78
|
+
|
79
|
+
--dll dllname Include additional DLLs from the Ruby bindir.
|
80
|
+
--add-all-core Add all core ruby libraries to the executable.
|
81
|
+
--gemfile <file> Add all gems and dependencies listed in a Bundler Gemfile.
|
82
|
+
--no-enc Exclude encoding support files
|
83
|
+
|
84
|
+
Gem content detection modes:
|
85
|
+
|
86
|
+
--gem-minimal[=gem1,..] Include only loaded scripts
|
87
|
+
--gem-guess=[gem1,...] Include loaded scripts & best guess (DEFAULT)
|
88
|
+
--gem-all[=gem1,..] Include all scripts & files
|
89
|
+
--gem-full[=gem1,..] Include EVERYTHING
|
90
|
+
--gem-spec[=gem1,..] Include files in gemspec (Does not work with Rubygems 1.7+)
|
91
|
+
|
92
|
+
--[no-]gem-scripts[=..] Other script files than those loaded
|
93
|
+
--[no-]gem-files[=..] Other files (e.g. data files)
|
94
|
+
--[no-]gem-extras[=..] Extra files (README, etc.)
|
95
|
+
|
96
|
+
Gem modes:
|
97
|
+
|
98
|
+
* *minimal*: loaded scripts
|
99
|
+
* *guess*: loaded scripts and other files
|
100
|
+
* *all*: loaded scripts, other scripts, other files (except extras)
|
101
|
+
* *full*: Everything found in the gem directory
|
102
|
+
|
103
|
+
File groups:
|
104
|
+
|
105
|
+
* *scripts*: .rb/.rbw files
|
106
|
+
* *extras*: C/C++ sources, object files, test, spec, README
|
107
|
+
* *files*: all other files
|
108
|
+
|
109
|
+
Auto-detection options:
|
110
|
+
|
111
|
+
--no-dep-run Don't run script.rb to check for dependencies.
|
112
|
+
--no-autoload Don't load/include script.rb's autoloads.
|
113
|
+
--no-autodll Disable detection of runtime DLL dependencies.
|
114
|
+
|
115
|
+
Output options:
|
116
|
+
|
117
|
+
--output <file> Name the exe to generate. Defaults to ./<scriptname>.exe.
|
118
|
+
--no-lzma Disable LZMA compression of the executable.
|
119
|
+
--innosetup <file> Use given Inno Setup script (.iss) to create an installer.
|
120
|
+
|
121
|
+
Executable options:
|
122
|
+
|
123
|
+
--windows Force Windows application (rubyw.exe)
|
124
|
+
--console Force console application (ruby.exe)
|
125
|
+
--chdir-first When exe starts, change working directory to app dir.
|
126
|
+
--icon <ico> Replace icon with a custom one.
|
127
|
+
--rubyopt <str> Set the RUBYOPT environment variable when running the executable
|
128
|
+
--debug Executable will be verbose.
|
129
|
+
--debug-extract Executable will unpack to local dir and not delete after.
|
130
|
+
|
131
|
+
|
132
|
+
### Compilation:
|
133
|
+
|
134
|
+
* OCRAN will load your script (using `Kernel#load`) and build
|
135
|
+
the executable when it exits.
|
136
|
+
|
137
|
+
* Your program should 'require' all necessary files when invoked without
|
138
|
+
arguments, so OCRAN can detect all dependencies.
|
139
|
+
|
140
|
+
* DLLs are detected automatically but only those located in your Ruby
|
141
|
+
installation are included.
|
142
|
+
|
143
|
+
* .rb files will become console applications. .rbw files will become
|
144
|
+
windowed application (without a console window popping
|
145
|
+
up). Alternatively, use the `--console` or
|
146
|
+
`--windows` options.
|
147
|
+
|
148
|
+
### Running your application:
|
149
|
+
|
150
|
+
* The 'current working directory' is not changed by OCRAN when running
|
151
|
+
your application. You must change to the installation or temporary
|
152
|
+
directory yourself. See also below.
|
153
|
+
* When the application is running, the OCRAN_EXECUTABLE environment
|
154
|
+
variable points to the .exe (with full path).
|
155
|
+
* The temporary location of the script can be obtained by inspected
|
156
|
+
the $0 variable.
|
157
|
+
* OCRAN does not set up the include path. Use `$:.unshift
|
158
|
+
File.dirname($0)` at the start of your script if you need to
|
159
|
+
'require' additional source files from the same directory as your
|
160
|
+
main script.
|
161
|
+
|
162
|
+
### Pitfalls:
|
163
|
+
|
164
|
+
* Avoid modifying load paths at run time. Specify load paths using -I
|
165
|
+
or RUBYLIB if you must, but don't expect OCRAN to preserve them for
|
166
|
+
runtime. OCRAN may pack sources into other directories than you
|
167
|
+
expect.
|
168
|
+
* If you use .rbw files or the `--windows` option, then check
|
169
|
+
that your application works with rubyw.exe before trying with OCRAN.
|
170
|
+
* Avoid absolute paths in your code and when invoking OCRAN.
|
171
|
+
|
172
|
+
### Multibyte path and filename support:
|
173
|
+
|
174
|
+
* OCRAN-built executables can correctly handle multibyte paths and filenames
|
175
|
+
(e.g., Japanese or emoji) on Windows. To use this feature, the executable
|
176
|
+
must be run on Windows 10 version 1903 or later.
|
177
|
+
* When using OCRAN-built executables from the console, we recommend running
|
178
|
+
`chcp 65001` to switch the code page to UTF-8. This ensures proper
|
179
|
+
input/output of multibyte characters in Command Prompt (CMD) and
|
180
|
+
PowerShell.
|
181
|
+
|
182
|
+
## REQUIREMENTS:
|
183
|
+
|
184
|
+
* Windows
|
185
|
+
* Working Ruby installation.
|
186
|
+
* Ruby Installation with devkit from rubyinstaller (when working with the source code only)
|
187
|
+
|
188
|
+
## Development
|
189
|
+
|
190
|
+
### Quick start
|
191
|
+
|
192
|
+
Quickly set up the development environment and run the full test suite:
|
193
|
+
|
194
|
+
git clone https://github.com/largo/ocran.git
|
195
|
+
cd ocran
|
196
|
+
bin/setup # install Bundler & all dev gems, generate stub for tests
|
197
|
+
bundle exec rake # run the entire Minitest suite
|
198
|
+
|
199
|
+
### Developer Utilities (bin/ scripts)
|
200
|
+
|
201
|
+
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.
|
202
|
+
|
203
|
+
| Script | Purpose |
|
204
|
+
|---------------|--------------------------------------------------------------------------|
|
205
|
+
| `bin/setup` | Installs Bundler and all required development gems, then builds stub.exe |
|
206
|
+
| `bin/console` | Launches an IRB console with OCRAN preloaded |
|
207
|
+
|
208
|
+
|
209
|
+
### Rake tasks (Windows compatible)
|
210
|
+
|
211
|
+
| Task | Purpose |
|
212
|
+
|--------------|------------------------------------------------------------------------|
|
213
|
+
| `rake build` | Compile stub.exe (requires MSVC or mingw‑w64 + DevKit) |
|
214
|
+
| `rake clean` | Remove generated binaries (e.g., stub.exe); temp files are not deleted |
|
215
|
+
| `rake test` | Execute all unit & integration tests |
|
216
|
+
|
217
|
+
## Technical details
|
218
|
+
|
219
|
+
OCRAN first runs the target script in order to detect any files that
|
220
|
+
are loaded and used at runtime (Using `Kernel#require` and
|
221
|
+
`Kernel#load`).
|
222
|
+
|
223
|
+
OCRAN embeds everything needed to run a Ruby script into a single
|
224
|
+
executable file. The file contains the .exe stub which is compiled
|
225
|
+
from C-code, and a custom opcode format containing instructions to
|
226
|
+
create directories, save files, set environment variables and run
|
227
|
+
programs. The OCRAN script generates this executable and the
|
228
|
+
instructions to be run when it is launched.
|
229
|
+
|
230
|
+
When executed, the OCRAN stub extracts the Ruby interpreter and your
|
231
|
+
scripts into a temporary directory. The directory will contains the
|
232
|
+
same directory layout as your Ruby installlation. The source files for
|
233
|
+
your application will be put in the 'src' subdirectory.
|
234
|
+
|
235
|
+
### Libraries
|
236
|
+
|
237
|
+
Any code that is loaded through `Kernel#require` when your
|
238
|
+
script is executed will be included in the OCRAN
|
239
|
+
executable. Conditionally loaded code will not be loaded and included
|
240
|
+
in the executable unless the code is actually run when OCRAN invokes
|
241
|
+
your script. Otherwise, OCRAN won't know about it and will not include
|
242
|
+
the source files.
|
243
|
+
|
244
|
+
RubyGems are handled specially. Whenever a file from a Gem is
|
245
|
+
detected, OCRAN will attempt to include all the required files from
|
246
|
+
that specific Gem, expect some unlikely needed files such as readme's
|
247
|
+
and other documentation. This behaviour can be controlled by using the
|
248
|
+
--gem-* options. Behaviour can be changed for all gems or specific
|
249
|
+
gems using --gem-*=gemname.
|
250
|
+
|
251
|
+
Libraries found in non-standard path (for example, if you invoke OCRAN
|
252
|
+
with "ruby -I some/path") will be placed into the site dir
|
253
|
+
(lib/ruby/site_ruby). Avoid changing `$LOAD_PATH` or
|
254
|
+
`$:` from your script to include paths outside your source
|
255
|
+
tree, since OCRAN may place the files elsewhere when extracted into the
|
256
|
+
temporary directory.
|
257
|
+
|
258
|
+
In case your script (or any of its dependencies) sets up autoloaded
|
259
|
+
module using `Kernel#autoload`, OCRAN will automatically try to
|
260
|
+
load them to ensure that they are all included in the
|
261
|
+
executable. Modules that doesn't exist will be ignored (a warning will
|
262
|
+
be logged).
|
263
|
+
|
264
|
+
Dynamic link libraries (.dll files, for example WxWidgets, or other
|
265
|
+
source files) will be detected and included by OCRAN.
|
266
|
+
|
267
|
+
### Including libraries non-automatically
|
268
|
+
|
269
|
+
If an application or framework is complicated enough that it tends
|
270
|
+
to confuse Ocran's automatic dependency resolution, then you can
|
271
|
+
use other means to specify what needs to be packaged with your app.
|
272
|
+
|
273
|
+
To disable automatic dependency resolution, use the `--no-dep-run`
|
274
|
+
option; with it, Ocran will skip executing your program during the
|
275
|
+
build process. This on the other hand requires using `--gem-full` option
|
276
|
+
(see more below); otherwise Ocran will not include all the necessary
|
277
|
+
files for the gems.
|
278
|
+
|
279
|
+
You will also probably need to use the `--add-all-core` option to
|
280
|
+
include the Ruby core libraries.
|
281
|
+
|
282
|
+
If your app uses gems, then you can specify them in a
|
283
|
+
Bundler (http://gembundler.com) Gemfile, then use the --gemfile
|
284
|
+
option to supply it to Ocran. Ocran will automatically include all
|
285
|
+
gems specified, and all their dependencies.
|
286
|
+
|
287
|
+
(Note: This assumes that the gems are installed in your system,
|
288
|
+
*not* locally packaged inside the app directory by "bundle package")
|
289
|
+
|
290
|
+
These options are particularly useful for packaging Rails
|
291
|
+
applications. For example, to package a Rails 3 app in the
|
292
|
+
directory "someapp" and create an exe named "someapp.exe", without
|
293
|
+
actually running the app during the build, you could use the
|
294
|
+
following command:
|
295
|
+
|
296
|
+
ocran someapp/script/rails someapp --output someapp.exe --add-all-core \
|
297
|
+
--gemfile someapp/Gemfile --no-dep-run --gem-full --chdir-first -- server
|
298
|
+
|
299
|
+
Note the space between `--` and `server`! It's important; `server` is
|
300
|
+
an argument to be passed to rails when the script is ran.
|
301
|
+
|
302
|
+
Rails 2 apps can be packaged similarly, though you will have to
|
303
|
+
integrate them with Bundler (http://gembundler.com/rails23.html)
|
304
|
+
first.
|
305
|
+
|
306
|
+
### Gem handling
|
307
|
+
|
308
|
+
By default, Ocran includes all scripts that are loaded by your script
|
309
|
+
when it is run before packaging. Ocran detects which gems are using and
|
310
|
+
includes any additional non-script files from those gems, except
|
311
|
+
trivial files such as C/C++ source code, object files, READMEs, unit
|
312
|
+
tests, specs, etc.
|
313
|
+
|
314
|
+
This behaviour can be changed by using the --gem-* options. There are
|
315
|
+
four possible modes:
|
316
|
+
|
317
|
+
* *minimal*: Include only loaded scripts
|
318
|
+
* *guess*: Include loaded scripts and important files (DEFAULT)
|
319
|
+
* *all*: Include all scripts and important files
|
320
|
+
* *full*: Include all files
|
321
|
+
|
322
|
+
If you find that files are missing from the resulting executable, try
|
323
|
+
first with --gem-all=gemname for the gem that is missing, and if that
|
324
|
+
does not work, try --gem-full=gemname. The paranoid can use --gem-full
|
325
|
+
to include all files for all required gems.
|
326
|
+
|
327
|
+
### Creating an installer for your application
|
328
|
+
|
329
|
+
To make your application start up quicker, or to allow it to
|
330
|
+
keep files in its application directory between runs, or if
|
331
|
+
you just want to make your program seem more like a "regular"
|
332
|
+
Windows application, you can have Ocran generate an installer
|
333
|
+
for your app with the free Inno Setup software.
|
334
|
+
|
335
|
+
You will first have to download and install Inno Setup 5 or
|
336
|
+
later, and also add its directory to your PATH (so that Ocran
|
337
|
+
can find the ISCC compiler program). Once you've done that,
|
338
|
+
you can use the `--innosetup` option to Ocran to supply an
|
339
|
+
Inno Setup script. Do not add any [Files] or [Dirs] sections
|
340
|
+
to the script; Ocran will figure those out itself.
|
341
|
+
|
342
|
+
To continue the Rails example above, let's package the Rails 3
|
343
|
+
app into an installer. Save the following as `someapp.iss`:
|
344
|
+
|
345
|
+
[Setup]
|
346
|
+
AppName=SomeApp
|
347
|
+
AppVersion=0.1
|
348
|
+
DefaultDirName={pf}\SomeApp
|
349
|
+
DefaultGroupName=SomeApp
|
350
|
+
OutputBaseFilename=SomeAppInstaller
|
351
|
+
|
352
|
+
[Icons]
|
353
|
+
Name: "{group}\SomeApp"; Filename: "{app}\someapp.bat"; IconFilename: "{app}\someapp.ico"; Flags: runminimized;
|
354
|
+
Name: "{group}\Uninstall SomeApp"; Filename: "{uninstallexe}"
|
355
|
+
|
356
|
+
Then, run Ocran with this command:
|
357
|
+
|
358
|
+
ocran someapp/script/rails someapp --output someapp.exe --add-all-core \
|
359
|
+
--gemfile someapp/Gemfile --no-dep-run --gem-full --chdir-first --no-lzma \
|
360
|
+
--icon someapp.ico --innosetup someapp.iss -- server
|
361
|
+
|
362
|
+
If all goes well, a file named "SomeAppInstaller.exe" will be placed
|
363
|
+
into the Output directory.
|
364
|
+
|
365
|
+
### Environment variables
|
366
|
+
|
367
|
+
OCRAN executables clear the RUBYLIB environment variable before your
|
368
|
+
script is launched. This is done to ensure that your script does not
|
369
|
+
use load paths from the end user's Ruby installation.
|
370
|
+
|
371
|
+
OCRAN executables set the RUBYOPT environment variable to the value it
|
372
|
+
had when you invoked OCRAN. For example, if you had "RUBYOPT=rubygems"
|
373
|
+
on your build PC, OCRAN ensures that it is also set on PC's running the
|
374
|
+
executables.
|
375
|
+
|
376
|
+
OCRAN executables set OCRAN_EXECUTABLE to the full path of the
|
377
|
+
executable, for example
|
378
|
+
|
379
|
+
ENV["OCRAN_EXECUTABLE"] # => C:\Program Files\MyApp\MyApp.exe
|
380
|
+
|
381
|
+
### Working directory
|
382
|
+
|
383
|
+
The OCRAN executable does not change the working directory when it is
|
384
|
+
launched, unless you use the `--chdir-first` option.
|
385
|
+
|
386
|
+
You should not assume that the current working directory when invoking
|
387
|
+
an executable built with .exe is the location of the source script. It
|
388
|
+
can be the directory where the executable is placed (when invoked
|
389
|
+
through the Windows Explorer), the users' current working directory
|
390
|
+
(when invoking from the Command Prompt), or even
|
391
|
+
`C:\\WINDOWS\\SYSTEM32` when the executable is invoked through
|
392
|
+
a file association.
|
393
|
+
|
394
|
+
With the `--chdir-first` option, the working directory will
|
395
|
+
always be the common parent directory of your source files. This
|
396
|
+
should be fine for most applications. However, if your application
|
397
|
+
is designed to run from the command line and take filenames as
|
398
|
+
arguments, then you cannot use this option.
|
399
|
+
|
400
|
+
If you wish to maintain the user's working directory, but need to
|
401
|
+
`require` additional Ruby scripts from the source directory, you can
|
402
|
+
add the following line to your script:
|
403
|
+
|
404
|
+
$LOAD_PATH.unshift File.dirname($0)
|
405
|
+
|
406
|
+
### Load path mangling
|
407
|
+
|
408
|
+
Adding paths to `$LOAD_PATH` or `$:` at runtime is not
|
409
|
+
recommended. Adding relative load paths depends on the working
|
410
|
+
directory being the same as where the script is located (See
|
411
|
+
above). If you have additional library files in directories below the
|
412
|
+
directory containing your source script you can use this idiom:
|
413
|
+
|
414
|
+
$LOAD_PATH.unshift File.join(File.dirname($0), 'path/to/script')
|
415
|
+
|
416
|
+
### Detecting
|
417
|
+
|
418
|
+
You can detect whether OCRAN is currently building your script by
|
419
|
+
looking for the 'Ocran' constant. If it is defined, OCRAN is currenly
|
420
|
+
building the executable from your script. For example, you can use
|
421
|
+
this to avoid opening a GUI window when compiling executables:
|
422
|
+
|
423
|
+
app = MyApp.new
|
424
|
+
app.main_loop unless defined?(Ocran)
|
425
|
+
|
426
|
+
### Additional files and resources
|
427
|
+
|
428
|
+
You can add additional files to the OCRAN executable (for example
|
429
|
+
images) by appending them to the command line. They should be placed
|
430
|
+
in the source directory with your main script (or a subdirectory).
|
431
|
+
|
432
|
+
ocran mainscript.rb someimage.jpeg docs/document.txt
|
433
|
+
|
434
|
+
This will create the following layout in the temporary directory when
|
435
|
+
your program is executed:
|
436
|
+
|
437
|
+
src/mainscript.rb
|
438
|
+
src/someimage.jpeg
|
439
|
+
src/docs/document.txt
|
440
|
+
|
441
|
+
Both files, directoriess and glob patterns can be specified on the
|
442
|
+
command line. Files will be added as-is. If a directory is specified,
|
443
|
+
OCRAN will include all files found below that directory. Glob patterns
|
444
|
+
(See Dir.glob) can be used to specify a specific set of files, for
|
445
|
+
example:
|
446
|
+
|
447
|
+
ocran script.rb assets/**/*.png
|
448
|
+
|
449
|
+
### Command Line Arguments
|
450
|
+
|
451
|
+
To pass command line argument to your script (both while building and
|
452
|
+
when run from the resulting executable), specify them after a
|
453
|
+
`--` marker. For example:
|
454
|
+
|
455
|
+
ocran script.rb -- --some-options=value
|
456
|
+
|
457
|
+
This will pass `--some-options=value` to the script when
|
458
|
+
build and when running the executable. Any extra argument specified by
|
459
|
+
the user when invoking the executable will be appended after the
|
460
|
+
compile-time arguments.
|
461
|
+
|
462
|
+
### Window/Console
|
463
|
+
|
464
|
+
By default, OCRAN builds console application from .rb-files and
|
465
|
+
windowed applications (without console window) from .rbw-files.
|
466
|
+
|
467
|
+
Ruby on Windows provides two executables: ruby.exe is a console mode
|
468
|
+
application and rubyw.exe is a windowed application which does not
|
469
|
+
bring up a console window when launched using the Windows Explorer.
|
470
|
+
By default, or if the `--console` option is used, OCRAN will
|
471
|
+
use the console runtime (ruby.exe). OCRAN will automatically select the
|
472
|
+
windowed runtime when your script has the ".rbw" extension, or if you
|
473
|
+
specify the `--windows` command line option.
|
474
|
+
|
475
|
+
If your application works in console mode but not in windowed mode,
|
476
|
+
first check if your script works without OCRAN using rubyw.exe. A
|
477
|
+
script that prints to standard output (using puts, print etc.) will
|
478
|
+
eventually cause an exception when run with rubyw.exe (when the IO
|
479
|
+
buffers run full).
|
480
|
+
|
481
|
+
You can also try wrapping your script in an exception handler that
|
482
|
+
logs any errors to a file:
|
483
|
+
|
484
|
+
begin
|
485
|
+
# your script here
|
486
|
+
rescue Exception => e
|
487
|
+
File.open("except.log") do |f|
|
488
|
+
f.puts e.inspect
|
489
|
+
f.puts e.backtrace
|
490
|
+
end
|
491
|
+
end
|
492
|
+
|
493
|
+
## CREDITS:
|
494
|
+
|
495
|
+
Lars Christensen and contributors for the OCRA project which this is forked from.
|
496
|
+
|
497
|
+
Kevin Walzer of codebykevin, Maxim Samsonov for ocra2, John Mair for codesigining support (to be merged)
|
498
|
+
|
499
|
+
Thanks for Igor Pavlov for the LZMA compressor and decompressor. The
|
500
|
+
source code used was place into Public Domain by Igor Pavlov.
|
501
|
+
|
502
|
+
Erik Veenstra for rubyscript2exe which provided inspiration.
|
503
|
+
|
504
|
+
Dice for the default .exe icon (vit-ruby.ico,
|
505
|
+
http://ruby.morphball.net/vit-ruby-ico_en.html)
|
506
|
+
|
507
|
+
## LICENSE:
|
508
|
+
|
509
|
+
(The MIT License)
|
510
|
+
|
511
|
+
Copyright (c) 2009-2020 Lars Christensen
|
512
|
+
Copyright (c) 2020-2025 The OCRAN Committers Team
|
513
|
+
|
514
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
515
|
+
a copy of this software and associated documentation files (the
|
516
|
+
'Software'), to deal in the Software without restriction, including
|
517
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
518
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
519
|
+
permit persons to whom the Software is furnished to do so, subject to
|
520
|
+
the following conditions:
|
521
|
+
|
522
|
+
The above copyright notice and this permission notice shall be
|
523
|
+
included in all copies or substantial portions of the Software.
|
524
|
+
|
525
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
526
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
527
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
528
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
529
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
530
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
531
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/ocran/version.rb
CHANGED
data/share/ocran/edicon.exe
CHANGED
Binary file
|
data/share/ocran/stub.exe
CHANGED
Binary file
|
data/share/ocran/stubw.exe
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,16 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ocran
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andi Idogawa
|
8
8
|
- Lars Christensen
|
9
9
|
autorequire:
|
10
|
-
bindir:
|
10
|
+
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
12
|
+
date: 2025-05-02 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: fiddle
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.0'
|
14
28
|
description: "OCRAN (One-Click Ruby Application Next) builds Windows executables from
|
15
29
|
Ruby source code. \n The executable is a self-extracting, self-running executable
|
16
30
|
that contains the Ruby interpreter, your source code and any additionally needed
|
@@ -27,7 +41,10 @@ executables:
|
|
27
41
|
extensions: []
|
28
42
|
extra_rdoc_files: []
|
29
43
|
files:
|
30
|
-
-
|
44
|
+
- CHANGELOG.txt
|
45
|
+
- LICENSE.txt
|
46
|
+
- README.md
|
47
|
+
- exe/ocran
|
31
48
|
- lib/ocran.rb
|
32
49
|
- lib/ocran/build_constants.rb
|
33
50
|
- lib/ocran/build_facade.rb
|
/data/{bin → exe}/ocran
RENAMED
File without changes
|