aibika 1.3.12

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.
data/README.adoc ADDED
@@ -0,0 +1,564 @@
1
+ = Aibika: Ruby applications in a single executable on Windows
2
+
3
+ == Purpose
4
+
5
+ Aibika packages a Ruby application into a single executable for the Windows
6
+ platform.
7
+
8
+ The resulting executable is self-extracting and self-running, containing:
9
+
10
+ * the Ruby interpreter;
11
+ * packaged Ruby source code; and
12
+ * any additionally needed Ruby libraries or DLLs.
13
+
14
+ NOTE: Aibika was created from the Metanorma-enhanced fork of the
15
+ https://github.com/larsch/ocra[One-click Ruby Application "Ocra" packager].
16
+ The first Aibkika version was launched as 1.3.12. The last version of Ocra
17
+ was 1.3.11 from 2020.
18
+
19
+ NOTE: Aibika is considered a temporary solution to the full-fledged
20
+ functionality of https://github.com/tamatebako/tebako[Tebako], which provides a
21
+ user-space mounted-disk experience with minimal intervention.
22
+
23
+
24
+ == Supported platforms
25
+
26
+ Aibika only supports Windows.
27
+
28
+
29
+ == Supported Ruby versions
30
+
31
+ The Aibika packager supports the following versions of Ruby for packaging:
32
+
33
+ * 2.7.7
34
+ * 3.0.6
35
+ * 3.1.4
36
+ * 3.2.2
37
+
38
+
39
+ == Features
40
+
41
+ * LZMA Compression (optional, default on)
42
+ * Both windowed/console mode supported
43
+ * Includes gems based on usage, or from a Bundler Gemfile
44
+
45
+
46
+ == Installation
47
+
48
+ [source,sh]
49
+ ----
50
+ gem install aibika
51
+ ----
52
+
53
+ // Stand-alone version: Get abika.rb from
54
+ // https://github.com/tamatebako/aibika/releases/
55
+ // Requires nothing but a working Ruby and MinGW installations on Windows
56
+
57
+ == Migration from Ocra
58
+
59
+ Aibika 1.3.12 is fully compatible with Ocra 1.13.11
60
+ In order to migrate your build scripts replace ocra invokations with aibika.
61
+
62
+ == Synopsis
63
+
64
+ === Building an executable
65
+
66
+ [source,sh]
67
+ ----
68
+ $ aibika script.rb
69
+ ----
70
+
71
+ Will package `script.rb`, the Ruby interpreter and all
72
+ dependencies (gems and DLLs) into an executable named
73
+ `script.exe`.
74
+
75
+ === Command line
76
+
77
+ [source,sh]
78
+ ----
79
+ $ aibika [options] script.rb [<other files> ...] [-- <script arguments> ...]
80
+ ----
81
+
82
+ === Options
83
+
84
+ [source,sh]
85
+ ----
86
+ $ aibika --help
87
+ ----
88
+
89
+ Aibika options:
90
+
91
+ [source]
92
+ ----
93
+ --help Display this information.
94
+ --quiet Suppress output while building executable.
95
+ --verbose Show extra output while building executable.
96
+ --version Display version number and exit.
97
+ ----
98
+
99
+ Packaging options:
100
+
101
+ [source]
102
+ ----
103
+ --dll dllname Include additional DLLs from the Ruby bindir.
104
+ --add-all-core Add all core ruby libraries to the executable.
105
+ --gemfile <file> Add all gems and dependencies listed in a Bundler Gemfile.
106
+ --no-enc Exclude encoding support files
107
+ --allow-self Include self (aibika gem) if detected or specified
108
+ This option is required only if aibika gem is deployed as a part
109
+ of broader bundled your solution
110
+ ----
111
+
112
+ Gem content detection modes:
113
+
114
+ [source]
115
+ ----
116
+ --gem-minimal[=gem1,..] Include only loaded scripts
117
+ --gem-guess=[gem1,...] Include loaded scripts & best guess (DEFAULT)
118
+ --gem-all[=gem1,..] Include all scripts & files
119
+ --gem-full[=gem1,..] Include EVERYTHING
120
+ --gem-spec[=gem1,..] Include files in gemspec (Does not work with Rubygems 1.7+)
121
+
122
+ --[no-]gem-scripts[=..] Other script files than those loaded
123
+ --[no-]gem-files[=..] Other files (e.g. data files)
124
+ --[no-]gem-extras[=..] Extra files (README, etc.)
125
+ ----
126
+
127
+ Gem modes:
128
+
129
+ * *minimal*: loaded scripts
130
+ * *guess*: loaded scripts and other files
131
+ * *all*: loaded scripts, other scripts, other files (except extras)
132
+ * *full*: Everything found in the gem directory
133
+
134
+ File groups:
135
+
136
+ * *scripts*: .rb/.rbw files
137
+ * *extras*: C/C++ sources, object files, test, spec, README
138
+ * *files*: all other files
139
+
140
+ Auto-detection options:
141
+
142
+ ----
143
+ --no-dep-run Don't run script.rb to check for dependencies.
144
+ --no-autoload Don't load/include script.rb's autoloads.
145
+ --no-autodll Disable detection of runtime DLL dependencies.
146
+ ----
147
+
148
+ Output options:
149
+
150
+ ----
151
+ --output <file> Name the exe to generate. Defaults to ./<scriptname>.exe.
152
+ --no-lzma Disable LZMA compression of the executable.
153
+ --innosetup <file> Use given Inno Setup script (.iss) to create an installer.
154
+ ----
155
+
156
+ Executable options:
157
+
158
+ ----
159
+ --windows Force Windows application (rubyw.exe)
160
+ --console Force console application (ruby.exe)
161
+ --chdir-first When exe starts, change working directory to app dir.
162
+ --icon <ico> Replace icon with a custom one.
163
+ --debug Executable will be verbose.
164
+ --debug-extract Executable will unpack to local dir and not delete after.
165
+ ----
166
+
167
+
168
+ === Compilation
169
+
170
+ * Aibika will load your script (using `Kernel#load`) and build
171
+ the executable when it exits.
172
+
173
+ * Your program should 'require' all necessary files when invoked without
174
+ arguments, so Aibika can detect all dependencies.
175
+
176
+ * DLLs are detected automatically but only those located in your Ruby
177
+ installation are included.
178
+
179
+ * .rb files will become console applications. .rbw files will become
180
+ windowed application (without a console window popping
181
+ up). Alternatively, use the `--console` or
182
+ `--windows` options.
183
+
184
+ === Running your application
185
+
186
+ * The 'current working directory' is not changed by Aibika when running
187
+ your application. You must change to the installation or temporary
188
+ directory yourself. See also below.
189
+ * When the application is running, the `AIBIKA_EXECUTABLE` environment
190
+ variable points to the .exe (with full path).
191
+ * The temporary location of the script can be obtained by inspected
192
+ the `$0` variable.
193
+ * Aibika does not set up the include path. Use `$:.unshift File.dirname($0)`
194
+ at the start of your script if you need to `require` additional source files
195
+ from the same directory as your main script.
196
+
197
+ === Pitfalls
198
+
199
+ * Avoid modifying load paths at run time. Specify load paths using -I
200
+ or `RUBYLIB` if you must, but don't expect Aibika to preserve them for
201
+ runtime. Aibika may pack sources into other directories than you
202
+ expect.
203
+ * If you use `.rbw` files or the `--windows` option, then check
204
+ that your application works with `rubyw.exe` before trying with Aibika.
205
+ * Avoid absolute paths in your code and when invoking Aibika.
206
+
207
+ == Requirements
208
+
209
+ * Windows
210
+ * Working Ruby installation
211
+ * MinGW Installation
212
+
213
+ === Stand-alone version
214
+
215
+ Get aibikasa.rb from http://rubyforge.org/frs/?group_id=8185. Requires
216
+ nothing but a working Ruby installation on Windows.
217
+
218
+ == Technical details
219
+
220
+ Aibika first runs the target script in order to detect any files that
221
+ are loaded and used at runtime (Using `Kernel#require` and
222
+ `Kernel#load`).
223
+
224
+ Aibika embeds everything needed to run a Ruby script into a single
225
+ executable file. The file contains the .exe stub which is compiled
226
+ from C-code, and a custom opcode format containing instructions to
227
+ create directories, save files, set environment variables and run
228
+ programs. The Aibika script generates this executable and the
229
+ instructions to be run when it is launched.
230
+
231
+ When executed, the Aibika stub extracts the Ruby interpreter and your
232
+ scripts into a temporary directory. The directory will contains the
233
+ same directory layout as your Ruby installation. The source files for
234
+ your application will be put in the 'src' subdirectory.
235
+
236
+ === Libraries
237
+
238
+ Any code that is loaded through `Kernel#require` when your
239
+ script is executed will be included in the Aibika
240
+ executable. Conditionally loaded code will not be loaded and included
241
+ in the executable unless the code is actually run when Aibika invokes
242
+ your script. Otherwise, Aibika won't know about it and will not include
243
+ the source files.
244
+
245
+ RubyGems are handled specially. Whenever a file from a Gem is
246
+ detected, Aibika will attempt to include all the required files from
247
+ that specific Gem, expect some unlikely needed files such as readme's
248
+ and other documentation. This behaviour can be controlled by using the
249
+ `--gem-*` options. Behaviour can be changed for all gems or specific
250
+ gems using `--gem-*=gemname`.
251
+
252
+ Libraries found in non-standard path (for example, if you invoke Aibika
253
+ with `ruby -I some/path`) will be placed into the site `dir`
254
+ (`lib/ruby/site_ruby`). Avoid changing `$LOAD_PATH` or
255
+ `$:` from your script to include paths outside your source
256
+ tree, since Aibika may place the files elsewhere when extracted into the
257
+ temporary directory.
258
+
259
+ In case your script (or any of its dependencies) sets up autoloaded
260
+ module using `Kernel#autoload`, Aibika will automatically try to
261
+ load them to ensure that they are all included in the
262
+ executable. Modules that doesn't exist will be ignored (a warning will
263
+ be logged).
264
+
265
+ Dynamic link libraries (`.dll` files, for example `WxWidgets`, or other
266
+ source files) will be detected and included by Aibika.
267
+
268
+ === Including libraries non-automatically
269
+
270
+ If an application or framework is complicated enough that it tends
271
+ to confuse Aibika's automatic dependency resolution, then you can
272
+ use other means to specify what needs to be packaged with your app.
273
+
274
+ To disable automatic dependency resolution, use the `--no-dep-run`
275
+ option; with it, Aibika will skip executing your program during the
276
+ build process. This on the other hand requires using `--gem-full` option
277
+ (see more below); otherwise Aibika will not include all the necessary
278
+ files for the gems.
279
+
280
+ You will also probably need to use the `--add-all-core` option to
281
+ include the Ruby core libraries.
282
+
283
+ If your app uses gems, then you can specify them in a
284
+ Bundler Gemfile, then use the --gemfile
285
+ option to supply it to Aibika. Aibika will automatically include all
286
+ gems specified, and all their dependencies.
287
+
288
+ NOTE: This assumes that the gems are installed in your system,
289
+ *not* locally packaged inside the app directory by "bundle package".
290
+
291
+ These options are particularly useful for packaging Rails
292
+ applications. For example, to package a Rails 3 app in the
293
+ directory "someapp" and create an exe named "someapp.exe", without
294
+ actually running the app during the build, you could use the
295
+ following command:
296
+
297
+ [source,sh]
298
+ ----
299
+ $ aibika someapp/script/rails someapp --output someapp.exe --add-all-core \
300
+ --gemfile someapp/Gemfile --no-dep-run --gem-full --chdir-first -- server
301
+ ----
302
+
303
+ Note the space between `--` and `server`! It's important; `server` is
304
+ an argument to be passed to rails when the script is ran.
305
+
306
+ Rails 2 apps can be packaged similarly, though you will have to
307
+ integrate them with Bundler first.
308
+
309
+ === Gem handling
310
+
311
+ By default, Aibika includes all scripts that are loaded by your script
312
+ when it is run before packaging. Aibika detects which gems are using and
313
+ includes any additional non-script files from those gems, except
314
+ trivial files such as C/C++ source code, object files, READMEs, unit
315
+ tests, specs, etc.
316
+
317
+ This behaviour can be changed by using the --gem-* options. There are
318
+ four possible modes:
319
+
320
+ * *minimal*: Include only loaded scripts
321
+ * *guess*: Include loaded scripts and important files (DEFAULT)
322
+ * *all*: Include all scripts and important files
323
+ * *full*: Include all files
324
+
325
+ If you find that files are missing from the resulting executable, try
326
+ first with `--gem-all=gemname` for the gem that is missing, and if that
327
+ does not work, try `--gem-full=gemname`. The paranoid can use `--gem-full`
328
+ to include all files for all required gems.
329
+
330
+ === Creating an installer for your application
331
+
332
+ To make your application start up quicker, or to allow it to
333
+ keep files in its application directory between runs, or if
334
+ you just want to make your program seem more like a "regular"
335
+ Windows application, you can have Aibika generate an installer
336
+ for your app with the free Inno Setup software.
337
+
338
+ You will first have to download and install Inno Setup 5 or
339
+ later, and also add its directory to your `PATH` (so that Aibika
340
+ can find the ISCC compiler program). Once you've done that,
341
+ you can use the `--innosetup` option to Aibika to supply an
342
+ Inno Setup script. Do not add any `[Files]` or `[Dirs]` sections
343
+ to the script; Aibika will figure those out itself.
344
+
345
+ To continue the Rails example above, let's package the Rails 3
346
+ app into an installer. Save the following as `someapp.iss`:
347
+
348
+ [source,toml]
349
+ ----
350
+ [Setup]
351
+ AppName=SomeApp
352
+ AppVersion=0.1
353
+ DefaultDirName={pf}\SomeApp
354
+ DefaultGroupName=SomeApp
355
+ OutputBaseFilename=SomeAppInstaller
356
+
357
+ [Icons]
358
+ Name: "{group}\SomeApp"; Filename: "{app}\someapp.exe"
359
+ Name: "{group}\Uninstall SomeApp"; Filename: "{uninstallexe}"
360
+ ----
361
+
362
+ Then run this command:
363
+
364
+ [source,sh]
365
+ ----
366
+ $ aibika someapp/script/rails someapp --output someapp.exe --add-all-core \
367
+ --gemfile someapp/Gemfile --no-dep-run --gem-full --chdir-first --no-lzma \
368
+ --innosetup someapp.iss -- server
369
+ ----
370
+
371
+ If all goes well, a file named "SomeAppInstaller.exe" will be placed
372
+ into the Output directory.
373
+
374
+ === Environment variables
375
+
376
+ Aibika executables clear the `RUBYLIB` environment variable before your
377
+ script is launched. This is done to ensure that your script does not
378
+ use load paths from the end user's Ruby installation.
379
+
380
+ Aibika executables set the `RUBYOPT` environment variable to the value it
381
+ had when you invoked Aibika. For example, if you had `"RUBYOPT=rubygems"`
382
+ on your build PC, Aibika ensures that it is also set on PC's running the
383
+ executables.
384
+
385
+ Aibika executables set `OCRA_EXECUTABLE` to the full path of the
386
+ executable, for example:
387
+
388
+ [source,rb]
389
+ ----
390
+ ENV["AIBIKA_EXECUTABLE"] # => C:\Program Files\MyApp\MyApp.exe
391
+ ----
392
+
393
+ === Working directory
394
+
395
+ The Aibika executable does not change the working directory when it is
396
+ launched, unless you use the `--chdir-first` option.
397
+
398
+ You should not assume that the current working directory when invoking
399
+ an executable built with .exe is the location of the source script. It
400
+ can be the directory where the executable is placed (when invoked
401
+ through the Windows Explorer), the users' current working directory
402
+ (when invoking from the Command Prompt), or even
403
+ `C:\\WINDOWS\\SYSTEM32` when the executable is invoked through
404
+ a file association.
405
+
406
+ With the `--chdir-first` option, the working directory will
407
+ always be the common parent directory of your source files. This
408
+ should be fine for most applications. However, if your application
409
+ is designed to run from the command line and take filenames as
410
+ arguments, then you cannot use this option.
411
+
412
+ If you wish to maintain the user's working directory, but need to
413
+ `require` additional Ruby scripts from the source directory, you can
414
+ add the following line to your script:
415
+
416
+ [source,rb]
417
+ ----
418
+ $LOAD_PATH.unshift File.dirname($0)
419
+ ----
420
+
421
+ === Load path mangling
422
+
423
+ Adding paths to `$LOAD_PATH` or `$:` at runtime is not
424
+ recommended. Adding relative load paths depends on the working
425
+ directory being the same as where the script is located (See
426
+ above). If you have additional library files in directories below the
427
+ directory containing your source script you can use this idiom:
428
+
429
+ [source,rb]
430
+ ----
431
+ $LOAD_PATH.unshift File.join(File.dirname($0), 'path/to/script')
432
+ ----
433
+
434
+ === Detecting
435
+
436
+ You can detect whether Aibika is currently building your script by
437
+ looking for the 'Aibika' constant. If it is defined, Aibika is currently
438
+ building the executable from your script. For example, you can use
439
+ this to avoid opening a GUI window when compiling executables:
440
+
441
+ [source,rb]
442
+ ----
443
+ app = MyApp.new
444
+ app.main_loop unless defined?(Aibika)
445
+ ----
446
+
447
+ === Additional files and resources
448
+
449
+ You can add additional files to the Aibika executable (for example
450
+ images) by appending them to the command line. They should be placed
451
+ in the source directory with your main script (or a subdirectory).
452
+
453
+ [source,sh]
454
+ ----
455
+ $ aibika mainscript.rb someimage.jpeg docs/document.txt
456
+ ----
457
+
458
+ This will create the following layout in the temporary directory when
459
+ your program is executed:
460
+
461
+ ----
462
+ src/mainscript.rb
463
+ src/someimage.jpeg
464
+ src/docs/document.txt
465
+ ----
466
+
467
+ Both files, directories and glob patterns can be specified on the
468
+ command line. Files will be added as-is. If a directory is specified,
469
+ Aibika will include all files found below that directory.
470
+
471
+ Glob patterns (See `Dir.glob`) can be used to specify a specific set of files,
472
+ for example:
473
+
474
+ [source,sh]
475
+ ----
476
+ $ aibika script.rb assets/**/*.png
477
+ ----
478
+
479
+ === Command Line Arguments
480
+
481
+ To pass command line argument to your script (both while building and
482
+ when run from the resulting executable), specify them after a
483
+ `--` marker. For example:
484
+
485
+ [source,sh]
486
+ ----
487
+ $ aibika script.rb -- --some-options=value
488
+ ----
489
+
490
+ This will pass `--some-options=value` to the script when
491
+ build and when running the executable. Any extra argument specified by
492
+ the user when invoking the executable will be appended after the
493
+ compile-time arguments.
494
+
495
+ === Window/Console
496
+
497
+ By default, Aibika builds console application from `.rb` files and
498
+ windowed applications (without console window) from `.rbw` files.
499
+
500
+ Ruby on Windows provides two executables: `ruby.exe` is a console mode
501
+ application and `rubyw.exe` is a windowed application which does not
502
+ bring up a console window when launched using the Windows Explorer.
503
+ By default, or if the `--console` option is used, Aibika will
504
+ use the console runtime (`ruby.exe`). Aibika will automatically select the
505
+ windowed runtime when your script has the ".rbw" extension, or if you
506
+ specify the `--windows` command line option.
507
+
508
+ If your application works in console mode but not in windowed mode,
509
+ first check if your script works without Aibika using `rubyw.exe`. A
510
+ script that prints to standard output (using puts, print etc.) will
511
+ eventually cause an exception when run with `rubyw.exe` (when the IO
512
+ buffers run full).
513
+
514
+ You can also try wrapping your script in an exception handler that
515
+ logs any errors to a file:
516
+
517
+ [source,ruby]
518
+ ----
519
+ begin
520
+ # your script here
521
+ rescue Exception => e
522
+ File.open("except.log") do |f|
523
+ f.puts e.inspect
524
+ f.puts e.backtrace
525
+ end
526
+ end
527
+ ----
528
+
529
+
530
+ == Credits
531
+
532
+ Thanks for Igor Pavlov for the LZMA compressor and decompressor. The
533
+ source code used was place into Public Domain by Igor Pavlov.
534
+
535
+ Erik Veenstra for `rubyscript2exe` which provided inspiration.
536
+
537
+ Dice for the default `.exe` icon (`vit-ruby.ico`,
538
+ http://ruby.morphball.net/vit-ruby-ico_en.html)
539
+
540
+
541
+ == License
542
+
543
+ MIT. See link:LICENSE.md[].
544
+
545
+
546
+ == Trivia: origin of name
547
+
548
+ Aibika started as a fork of the
549
+ https://github.com/larsch/ocra[One-click Ruby Application "Ocra" packager].
550
+ "Ocra" happens to be a wordplay on "okra", the plant name, so the name
551
+ of the _flower okra_ plant, "aibika" was adopted.
552
+
553
+ The _flower okra_ is named as it blooms flowers similar to the okra, and refers to the
554
+ _https://en.wikipedia.org/wiki/Abelmoschus_manihot[Abelmoschus manihot]_ plant.
555
+ _Aibika_ refers to the Spanish name of the flower okra.
556
+
557
+ Aibika, called トロロアオイ (黄蜀葵, tororoaoi), is a key ingredient to the
558
+ creation of Washi (和紙, Japanese paper).
559
+
560
+ Japanese paper is thin, durable and long-lasting because of its use of aibika.
561
+ In the manufacturing of Japanese paper, mucus extracted from the root of aibika
562
+ is used to uniformize the spread of fibers. Without this mucus in the
563
+ solution, fibers will quickly get excluded from the solution, resulting in
564
+ fibers not scattered evenly.
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rubocop/rake_task'
5
+ require 'minitest/test_task'
6
+
7
+ RuboCop::RakeTask.new
8
+ Minitest::TestTask.create
9
+
10
+ task default: %i[test]
11
+
12
+ desc 'Build Aibika stubs'
13
+ task :build_stub do
14
+ system('mingw32-make -C src')
15
+ cp 'src/stub.exe', 'share/aibika/stub.exe'
16
+ cp 'src/stubw.exe', 'share/aibika/stubw.exe'
17
+ cp 'src/edicon.exe', 'share/aibika/edicon.exe'
18
+ end
19
+
20
+ file 'share/aibika/stub.exe' => :build_stub
21
+ file 'share/aibika/stubw.exe' => :build_stub
22
+ file 'share/aibika/edicon.exe' => :build_stub
23
+
24
+ task test: :build_stub
25
+
26
+ task :clean do
27
+ rm_f Dir['{bin,samples}/*.exe']
28
+ rm_f Dir['share/aibika/{stub,stubw,edicon}.exe']
29
+ system('mingw32-make -C src clean')
30
+ end
data/aibika.gemspec ADDED
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/aibika'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'aibika'
7
+ spec.version = Aibika::VERSION
8
+ spec.authors = ['Ribose Inc.']
9
+ spec.email = ['open.source@ribose.com']
10
+ spec.license = 'MIT'
11
+
12
+ spec.summary = 'Ruby applications packager to a single executable on Windows'
13
+ spec.description = <<~SUM
14
+ Aibika packages a Ruby application into a single executable for the Windows
15
+ platform.
16
+
17
+ The resulting executable is self-extracting and self-running, containing:
18
+
19
+ * the Ruby interpreter;
20
+ * packaged Ruby source code; and
21
+ * any additionally needed Ruby libraries or DLLs.
22
+
23
+ NOTE: Aibika was created from the Metanorma-enhanced fork of the
24
+ https://github.com/larsch/ocra[One-click Ruby Application "Ocra" packager].
25
+ The first Aibkika version was launched as 1.3.12. The last version of Ocra
26
+ was 1.3.11 from 2020.
27
+
28
+ NOTE: Aibika is considered a temporary solution to the full-fledged
29
+ functionality of https://github.com/tamatebako/tebako[Tebako], which provides a
30
+ user-space mounted-disk experience with minimal intervention.
31
+
32
+ SUM
33
+ spec.homepage = 'https://github.com/tamatebako/aibika'
34
+ spec.required_ruby_version = '>= 2.7.0'
35
+
36
+ spec.metadata['homepage_uri'] = spec.homepage
37
+ spec.metadata['source_code_uri'] = 'https://github.com/tamatebako/aibika'
38
+
39
+ # Specify which files should be added to the gem when it is released.
40
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
41
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
42
+ `git ls-files --recurse-submodules -z`.split("\x0").reject do |f|
43
+ (f == __FILE__) ||
44
+ f.match(%r{\A(?:(?:test)/|\.(?:git|cirrus|autotest|rubocop))})
45
+ end
46
+ end
47
+ spec.bindir = 'bin'
48
+ spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
49
+ spec.require_paths = %w[bin lib samples share src]
50
+ end
data/bin/aibika ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'English'
5
+ require_relative '../lib/aibika'
6
+
7
+ if File.basename(__FILE__) == File.basename($PROGRAM_NAME)
8
+ Aibika.init(ARGV)
9
+ ARGV.replace(Aibika.arg)
10
+
11
+ Aibika.fatal_error "#{Aibika.files[0]} was not found!" unless Aibika.files.first.exist?
12
+
13
+ at_exit do
14
+ if $ERROR_INFO.nil? || $ERROR_INFO.is_a?(SystemExit)
15
+ Aibika.build_exe
16
+ exit 0
17
+ end
18
+ end
19
+
20
+ if Aibika.run_script
21
+ Aibika.msg 'Loading script to check dependencies'
22
+ $0 = Aibika.files.first
23
+ load Aibika.files.first
24
+ end
25
+ end