Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an executable file that runs on Ubuntu. #51

Open
leandrosardi opened this issue Feb 1, 2025 · 5 comments
Open

Create an executable file that runs on Ubuntu. #51

leandrosardi opened this issue Feb 1, 2025 · 5 comments
Assignees
Labels
feature New feature or request

Comments

@leandrosardi
Copy link
Owner

leandrosardi commented Feb 1, 2025

Before starting, we recommend you read the project documentation.

Revised Requirement Prompt

You have 12 Ruby scripts in a single folder, each handling a different operation:

  • alerts.rb
  • deploy.rb
  • install.rb
  • list.rb
  • migrations.rb
  • proc.rb
  • source.rb
  • ssh.rb
  • start.rb
  • stop.rb
  • version.rb

Each script can be run with command-line arguments, for example:

ruby deploy.rb --node=foo --root

Master Script (saas.rb)

There is a master script, saas.rb, which:

  1. Reads the first command-line argument to determine which operation to run (e.g., deploy).
  2. Passes any remaining arguments to the specified operation script.

For example:

ruby saas.rb deploy --node=foo --root

Goal

We must to create an executable saas command using rubyc.

The saas command, deployed into /usr/local/bin must work like this:

saas deploy --node=foo --root
  1. Adapt the source code of the **master script ** and operation scripts in order to be able to compile it with rubyc.

  2. Provide the exact command line with arguments to compile future versions of the saas comman.

Constraints

  1. Use Ruby Packer (rubyc) to compile everything into one binary.
  2. Adjust the Ruby embedd the code of the ruby operation scripts into the master scripts, so all will be bunlded into one single script that I can package easy with rubyc.
  3. Example compilation command (may need modification):
rubyc -o saas saas.rb
@leandrosardi
Copy link
Owner Author

leandrosardi commented Feb 1, 2025

How to Install rubyc

Download rubyc binary.

Visit the releases page and download rubyc
https://github.com/pmq20/ruby-packer/releases

Move the Binary into Your PATH

Example

sudo mv rubyc /usr/local/bin/
sudo chmod +x /usr/local/bin/rubyc

Verify Installation

rubyc --version

Problems Resolution Procedure

  1. Be sure you have not the rubyc gem installed.
gem unisntall rubyc

@alemorozov
Copy link

If you'll run into any issue, try using tebako. It was developed in a team, in which I worked, as a replacement for ruby-packer.

@sherazp995
Copy link
Contributor

It's done in here

@leandrosardi
Copy link
Owner Author

It's fixed here.

@leandrosardi leandrosardi added the feature New feature or request label Feb 10, 2025
@leandrosardi
Copy link
Owner Author

leandrosardi commented Feb 10, 2025

How to Generate an Executable

The rubyc command is not working with the version 3.1.2 of Ruby we are using in our standard stack.
So, we have to download and compile our own version of rubyc.

git clone https://github.com/sherazp995/ruby-packer
  • then checkout to branch named bump-ruby3.1.0-3.1.2
cd ruby-packer
git checkout bump-ruby3.1.0-3.1.2
  • Then run
bundle install
exec rake rubyc

It will create the executable for rubyc with ruby3.1.2

After that. You can just generate your saas using this command.

rubyc --root=. --output=saas cli/saas.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants