-
Notifications
You must be signed in to change notification settings - Fork 10
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
Implementing a package definition file Tebafile
or tebako.yaml
?
#156
Comments
We also need to specify these paths in the Tebafile:
|
Perhaps we should call this the ---
# Gem source
source: "https://rubygems.org"
# Application metadata
name: "MyApp"
version: "1.0.0"
# Dependencies
dependencies:
- sinatra
- puma
- activerecord
- sinatra-activerecord
- sqlite3
- httparty
- json
# Main entry point
main: "app.rb"
# Working directory
working_directory: "/app"
# Execution command
run_command: "ruby -I. app.rb"
# Directories to include
include:
- config
- models
- db
# Environment variables
environment:
RACK_ENV: production
DATABASE_URL: "sqlite3:///app/db/production.sqlite3"
LOG_LEVEL: info
API_KEY: "your_api_key_here"
# Additional configuration
database:
development:
adapter: sqlite3
database: db/development.sqlite3
production:
adapter: sqlite3
database: db/production.sqlite3
# Any other Tebako-specific configurations
tebako_options:
output_dir: "build"
compress: true The environment variables would be set when the application is loaded and run by Tebako. This approach allows you to:
Remember that for security reasons, you should not commit sensitive information like actual API keys to version control. Instead, you might use placeholder values in the committed file and replace them with real values during the deployment process. If you need to handle more complex environment variable scenarios, you could potentially extend this to support:
The exact implementation would depend on Tebako's capabilities and your specific requirements. |
Tebafile
Tebafile
or tebako.yaml
?
Here are the sample
ruby:
version: 3.2.4
entry_point: my_script.rb
output:
name: simple_script_package
ruby:
version: 3.2.4
entry_point: my_gem_executable
gems:
- name: my_packaged_gem.gem
path: ./
output:
name: packaged_gem_package
ruby:
version: 3.2.4
entry_point: my_gem_executable
build:
gem:
name: my_gem
output:
name: gem_source_package
ruby:
version: 3.2.4
entry_point: my_gem_executable
build:
gem:
name: my_gem
bundler: true
output:
name: gem_source_bundler_package
ruby:
version: 3.2.4
entry_point: rails_app.rb
build:
bundler: true
include:
directories:
- app
- config
- db
- lib
- public
- vendor
output:
name: rails_project_package These |
Adding a "test" section to the
ruby:
version: 3.2.4
entry_point: my_script.rb
output:
name: simple_script_package
test:
commands:
- ./simple_script_package --version
- ./simple_script_package --help
expected_output:
- "Version 1.0.0"
- "Usage: simple_script_package [options]"
ruby:
version: 3.2.4
entry_point: my_gem_executable
gems:
- name: my_packaged_gem.gem
path: ./
output:
name: packaged_gem_package
test:
commands:
- ./packaged_gem_package --version
- echo "Hello, World!" | ./packaged_gem_package
expected_output:
- "my_packaged_gem version 1.0.0"
- "Processed input: Hello, World!"
ruby:
version: 3.2.4
entry_point: my_gem_executable
build:
gem:
name: my_gem
output:
name: gem_source_package
test:
commands:
- ./gem_source_package -h
- ./gem_source_package perform_action
expected_output:
- "Usage: gem_source_package [options]"
- "Action performed successfully"
ruby:
version: 3.2.4
entry_point: my_gem_executable
build:
gem:
name: my_gem
bundler: true
output:
name: gem_source_bundler_package
test:
commands:
- ./gem_source_bundler_package --version
- ./gem_source_bundler_package list_dependencies
expected_output:
- "my_gem version 1.0.0"
- "Dependencies: nokogiri, httparty"
ruby:
version: 3.2.4
entry_point: rails_app.rb
build:
bundler: true
include:
directories:
- app
- config
- db
- lib
- public
- vendor
output:
name: rails_project_package
test:
commands:
- ./rails_project_package --version
- ./rails_project_package about
expected_output:
- "Rails 7.0.4"
- "Ruby version: 3.2.4"
- "RubyGems version:"
- "Rack version:"
- "JavaScript Runtime: Node.js" In these examples, the
These test sections provide a way for users to quickly verify that the packaged executable is working as expected. The specific commands and expected outputs should be adjusted based on your application's functionality and requirements. You could also add more sophisticated tests, such as:
Remember to update these tests as your application evolves to ensure they remain relevant and useful for sanity checking the packaged executable. |
Minimal tebafile is implemented at #179 Improvements specified above cover not only tebafile but also require additional functionality that is not provided by tebako at this time. |
The
Tebafile
is a configuration file used by Tebako to define how your Ruby application should be packaged. It typically includes information about the application's dependencies, metadata, and the entry point for the application. This file contains directives that Tebako uses to bundle your application and its dependencies into a single, self-contained executable.Here's a detailed breakdown of the
Tebafile
components:Tebafile Components
Source
The
source
directive specifies the RubyGems source from which to fetch the gems. This is similar to thesource
directive in aGemfile
.Gem Dependencies
You list your application's dependencies just as you would in a
Gemfile
. These dependencies will be included in the packaged application.Tebako Block
The
tebako
block contains metadata and configuration settings for your application. Here are the key attributes you can define:Complete Example
Putting it all together, here’s a complete example of a
Tebafile
for a simple Sinatra application:Creating and Using a Tebafile
Step-by-Step Guide
Create a new directory for your project:
Create the application files:
Gemfile:
app.rb:
Install the dependencies:
Create the Tebafile:
Create a file named
Tebafile
with the following content:Run Tebako to package the application:
Run the packaged application:
build
directory:cd build
Open a web browser and go to
http://localhost:4567
to see your Sinatra application running.Benefits of Using a Tebafile
By properly configuring your
Tebafile
, you ensure that Tebako can correctly package and deploy your Ruby application with all necessary dependencies and configurations.More complex app
This example will include multiple dependencies, a database connection, and some additional configuration settings to illustrate how to handle a more sophisticated setup.
Example Tebafile for a Complex Ruby Application
Application Overview
For this example, let's assume we have a Ruby application that uses Sinatra for the web framework, ActiveRecord for ORM, SQLite3 as the database, and Puma as the web server. The application will also include some additional gems for functionality like HTTP requests and JSON parsing.
Directory Structure
Gemfile
First, here is the
Gemfile
for our application:app.rb
The main application file,
app.rb
, might look like this:config/database.yml
The database configuration file,
config/database.yml
, will look like this:models/user.rb
The
User
model,models/user.rb
, might look like this:Tebafile
Finally, here is the
Tebafile
for this complex Ruby application:Explanation of the Tebafile
Gemfile
.app.rb
).config
,models
, anddb
to ensure the database configuration, models, and database files are packaged.Steps to Package and Run the Application
Install Dependencies:
Run Tebako to Package the Application:
Run the Packaged Application:
Navigate to the
build
directory and execute the packaged application:cd build complex_app.exe
Access the Application:
Open a web browser and navigate to
http://localhost:4567
to see your application running. You can also access the/users
endpoint to see JSON data from the database and the/external_api
endpoint to fetch data from an external API.This example demonstrates how to configure a
Tebafile
for a more complex Ruby application, ensuring that all necessary components and configurations are included in the package.The text was updated successfully, but these errors were encountered: