Git Product home page Git Product logo

rb2exe's Introduction

Ruby to EXE

Gem Version

Turn ruby scripts into portable executable apps. This gem uses traveling-ruby gem.

Installation

gem install rb2exe

Usage

rb2exe RUBY_SCRIPT [options]
    -q, --quiet                      Do not run verbosely
    -a, --add=FOLDER                 Add an entire folder (eg. "--add=.")
    -i  --ignore-folder=FOLDER       Do not add a folder (default=".git")
    -ao --add-output                 Do not ignore output file when adding files
    -o, --output=OUTPUT              Output executable filename
    -d  --daemon                     Runs the app as a background task
    -r, --rails                      Rails support
    -t, --target=[osx|l32|l64|win]   Target platform (binary)
    -h, --help                       Help

Example

echo "puts 'Hello world'" > test.rb

rb2exe test.rb
./test
# Hello world

Example II - Multi source project

mkdir test
cd test
echo "STR = 'Hello world'" > a.rb
echo "load 'a.rb'" > main.rb
echo "puts STR" >> main.rb

rb2exe main.rb --add=.
./main
# Hello world

Example III - Gemfile support

mkdir test
cd test
echo "source 'https://rubygems.org'" > Gemfile
echo "gem 'faker'" >> Gemfile
echo "require 'faker'" > a.rb
echo 'puts "Hello #{Faker::Name.name}"' >> a.rb

rb2exe a.rb --add=.
./a
# Hello Abbigail Okuneva

Example IV - Rails support

rails new myproject
cd myproject

rb2exe --rails
./output
# => Booting Puma
# => Rails 5.0.0.1 application starting in production on http://0.0.0.0:3000
# => Run `rails server -h` for more startup options
# Puma starting in single mode...
# * Version 3.6.0 (ruby 2.2.2-p95), codename: Sleepy Sunday Serenity
# * Min threads: 5, max threads: 5
# * Environment: production
# * Listening on tcp://0.0.0.0:3000
# Use Ctrl-C to stop

Example V - OSX binary

rb2exe test.rb --target=osx

Security

rb2exe DOESN'T protects your source code.

In fact, the produced executable file contains all the source files and THEY CAN BE EASILY EXTRACTED.

You can see the list of the added source files when you run rb2exe.

rb2exe just packages your source files (plus a stand-alone ruby) in an auto-extract zip file. It doesn't protects your code in any way.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/loureirorg/rb2exe.

Changelog

  • 0.3.0: Includes a libruby.so.2.2 file copy;
  • 0.2.5: Ignore output file when adding files. Add "--add-output" option;
  • 0.2.4: Ignore '.git' folder by default. Add "--ignore-folder" option;
  • 0.2.3: add "--daemon" option;
  • 0.2.1: add missing "bundle" requirement;
  • 0.2.0: adding support to handle ARGV being passed to the ruby script (thanks @dabooze);

TODO

  • Windows executable output;
  • Allow ruby versions other than 2.2.2;
  • Testing suite;

You can also take a look on my article, where I explain how this gem works, step-by-step: http://www.learnwithdaniel.com/2016/08/ruby-to-portable-exe-app/

rb2exe's People

Contributors

general-cbic avatar loureirorg avatar ws avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.