A Ruby Compiler
Tue May 29 20:09:00 UTC 2007
Erik Veenstra <[email protected]>
2. Internals
3. Usage
4. Examples
5. License
6. Download
7. Known Issues
![Mac Mac](/uploads/1/3/4/1/134152113/499477078.png)
Check If Mac Is Stolen
Parameter | Description |
---|---|
--rubyscript2exe-rubyw | Avoid the popping up of a DOS box. (It's annoying in the test period.. No puts and p anymore.. Only use it for distributing your application. See Logging.) |
--rubyscript2exe-ruby | Force the popping up of a DOS box (default). |
--rubyscript2exe-nostrip | Avoid stripping. The binaries (ruby and *.so) on Linux and Darwin are stripped by default to reduce the size of the resulting executable. |
--rubyscript2exe-strace | Start the embedded application with strace (Linux only, for debugging only). |
--rubyscript2exe-tk | (experimental) Embed not only the Ruby bindings for TK, but TK itself as well. |
--rubyscript2exe-verbose | Verbose mode. |
--rubyscript2exe-quiet | Quiet mode. |
![App App](/uploads/1/3/4/1/134152113/768547104.png)
Parameter | Description |
---|---|
--eee-list | Just list the contents of the executable. (Doesn't work in combination with rubyw.) |
--eee-info | Just show the information stored in the executable. (Doesn't work in combination with rubyw.) |
--eee-justextract | Just extract the original files from the executable into the current directory (no subdirectory!). |
Method | Useful at Compile-Time | Useful at Run-Time | Default |
---|---|---|---|
RUBYSCRIPT2EXE.dlls= | x | [] | |
RUBYSCRIPT2EXE.bin= | x | [] | |
RUBYSCRIPT2EXE.lib= | x | [] | |
RUBYSCRIPT2EXE.tempdir= | x | nil | |
RUBYSCRIPT2EXE.tk= | x | false | |
RUBYSCRIPT2EXE.rubyw= | x | false | |
RUBYSCRIPT2EXE.strip= | x | true | |
RUBYSCRIPT2EXE.is_compiling? | x | ||
RUBYSCRIPT2EXE.is_compiled? | x | ||
RUBYSCRIPT2EXE.appdir | x | ||
RUBYSCRIPT2EXE.userdir | x | ||
RUBYSCRIPT2EXE.exedir | x | ||
RUBYSCRIPT2EXE.executable | x |
- The moment the developer creates the executable. This can be detected with RUBYSCRIPT2EXE.is_compiling?.
- The moment the customer runs the executable. This can be detected with RUBYSCRIPT2EXE.is_compiled?.
Constant | Set to | Replaced by |
---|---|---|
RUBYSCRIPT2EXE::APPEXE | Filename of the generated executable. | RUBYSCRIPT2EXE.executable and RUBYSCRIPT2EXE.exedir |
RUBYSCRIPT2EXE::EEEEXE | eee.exe or eeew.exe or eee_linux or eee_darwin. | |
RUBYSCRIPT2EXE::TEMPDIR | Temporary directory in which the application resides. | RUBYSCRIPT2EXE.appdir |
RUBYSCRIPT2EXE::PARMS | Parameters from the command line. | |
RUBYSCRIPT2EXE::QUOTEDPARMS | Quoted parameters from the command line. |
Distribution | Size (bytes) |
---|---|
Cygwin | 1287227 |
RubyInstaller | 641840 |
MinGW | 428898 |
MSWin32 | 467110 |
Linux, Ruby 1.6.7 | 551858 |
Linux, Ruby 1.8.2 | 574015 |
- Red Hat Linux 8.0 with Ruby 1.6.7
- Red Hat Linux 8.0 with Ruby 1.8.1
- Red Hat Linux 8.0 with Ruby 1.8.2
- Windows 95 with Ruby 1.8
- Windows 98 with Ruby 1.6 (Very slow!)
- Windows 98 with Ruby 1.8
- Windows 2000 with Ruby 1.8
- Windows 2000 with Ruby 1.8 (Cygwin)
- Windows XP with Ruby 1.8
- Windows XP with Ruby 1.8 (Cygwin)
- Get eee.pas from the archive.
- Download the compiler.
- Compile (fpc -Xs -B eee.pas).
- Rename eee to eee_darwin.
- In rubyscript2exe.rb (or rubyscript2exe/ when using rubyscript2exe.tar.gz).
- In the directory in which rubyscript2exe.rb is located.
- In the current directory.
- Extract rubyscript2exe.tar.gz, or extract rubyscript2exe.rb (rubyrubyscript2exe.rb--tar2rubyscript-justextract)
- Copy eee_darwin to rubyscript2exe/.
- Recreate rubyscript2exe.rb (rubytar2rubyscript.rbrubyscript2exe/) (optional)
- Don't use long application names (as in thisisalongnameofanapplication.rb). Long application names result in non-working executables. Somehow gzread, used to read a block from the archive, returns -2 if '#{eeedir}eee.#{application}.exe.2eee.gz'.length >= 80.
- RubyScript2Exe is tested with RubyGems 0.9.0. It might be necessary to add include 'fileutils' in your application.
- If you someday run into trouble when trying to generate RDOC documentation from within the generated executable, have a look at Zoran Lazarevic's page.
- Because of the way Ruby is started from within RubyScript2Exe on Linux, $stdin doesn't work anymore. On Windows, it works. FIXED IN 0.3.4!
- My latest change in RubyScript2Exe was to ignore RUBYOPT when running the generated executable. This means that I do generate the fake rubygems.rb and do embed it into the executable, but it isn't necessarily required by anything in the application or in the environment. So, you have to do a require 'rubygems'explicitly in your application, when using one or more gems. FIXED IN 0.3.3!
- Running the generated executable from within a non-SH-compatible shell (e.g. TCSH), is currently not possible. FIXED IN 0.3.3!
- There is a problem when running the generated executable in an environment in which the environment variable RUBYOPT is set. (The One-Click Ruby Installer (ruby182-14.exe) does this.) The embedded ruby.exe encounters RUBYOPT and tries to load the mentioned libraries (e.g. ubygems) which it obviously can't find, because the search paths are pointing to the embedded environment and not to the original environment. So, creating an executable in an environment in which RUBYOPT is set is not a problem, whereas running the generated executable in such an environment is a problem. The workaround is to open a DOS-box, do a set RUBYOPT= and run the executable from within the DOS-box. FIXED IN 0.3.2!
aior all allinone allinoneruby applications archive bin browser code codesnippet codesnippets compile compiler computer computerlanguage dialog dialogs distribute distributing distributingrubyapplications distribution eee eee-file eeefile erik erikveen erikveenstra exe executable exerb file graphical graphicaluserinterface gui gz html http httpserver iloveruby interface jar jit just justintime lang language one pack package packaging packing packingrubyapplications programming programminglanguage rar rb rb2bin rb2exe rba rbarchive rbtobin rbtoexe rbw ruby ruby2bin ruby2exe rubyapplications rubyarchive rubycompiler rubyscript rubyscript2 rubyscript2exe rubyscripts rubyscripttoexe rubytobin rubytoexe rubyweb rubywebdialog rubywebdialogs script scripts server snippet snippets t2rb t2rs tar tar2rb tar2rbscript tar2rs tar2rscript time ui user userinterface veenstra web webbrowser webdialog webdialogs window windowinbrowser windows wrap wrapper wxruby zip
Define the project
Dockerfile
. To begin with, the Dockerfile consists of:Gemfile
which just loads Rails. It’ll be overwrittenin a moment by rails new
.Gemfile.lock
to build our Dockerfile
.server.pid
file pre-exists.This script will be executed every time the container gets started.entrypoint.sh
consists of:docker-compose.yml
is where the magic happens. This file describesthe services that comprise your app (a database and a web app), how to get eachone’s Docker image (the database just runs on a pre-made PostgreSQL image, andthe web app is built from the current directory), and the configuration neededto link them together and expose the web app’s port..yml
or .yaml
extension for this file.Build the project
web
service using the Dockerfile
.The --no-deps
tells Compose not to start linked services. Then it runsrails new
inside a new container, using that image. Once it’s done, youshould have generated a fresh app.rails new
created are owned byroot. This happens because the container runs as the root user. If this is thecase, change the ownership of the new files.rails new
.Ruby Check If App Is Running Macros
Gemfile
or the Dockerfile, should be the only times you’ll needto rebuild.)Connect the database
localhost
- so you need to point it at thedb
container instead. You also need to change the database and username toalign with the defaults set by the postgres
image.config/database.yml
with the following:View the Rails welcome page!
Ruby Check If App Is Running Macos
http://localhost:3000
on a webbrowser to see the Rails Welcome.Stop the application
Restart the application
docker-compose up
in the project directory.Rebuild the application
docker-compose up --build
, but a full rebuild requires a re-run ofdocker-compose run web bundle install
to sync changes in the Gemfile.lock
tothe host, followed by docker-compose up --build
.3000
in our first example to 3001
. Make the change to the Compose file to exposeport 3000
on the container through a new port, 3001
, on the host, and savethe changes:docker-compose up --build
.3000
, butthe Rails Welcome is now available on http://localhost:3001
on your localhost.