Skip to content

Commit

Permalink
feat: updated gemspec_and_gemfile section per tamatebako/tebako#215 r…
Browse files Browse the repository at this point in the history
…eview
  • Loading branch information
maxirmx committed Jan 12, 2025
1 parent b960c5f commit 836dab0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tutorial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ jobs:
run: |
./lesson-1
- name: Package 2_packaging_scenarios gemfile sample
run: |
tebako press -r tutorial/2_packaging_scenarios/gemfile.sample -e ticker.rb -o ticker.tebako.
# Cannot run this sample since GH Actions does not allow such websocket connection to the outside world

- name: Package 2_packaging_scenarios gemspec and gemfile sample
Expand All @@ -60,6 +56,10 @@ jobs:
run: |
./table.tebako
- name: Package 2_packaging_scenarios gemfile sample
run: |
tebako press -r tutorial/2_packaging_scenarios/gemfile.sample -e ticker.rb -o ticker.tebako.
- name: Package 2_packaging_scenarios gemspec sample
run: |
tebako press -r tutorial/2_packaging_scenarios/gemspec.sample -e tebako-table-cli -o table.tebako
Expand Down
13 changes: 11 additions & 2 deletions tutorial/2_packaging_scenarios/Lesson-2.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,13 @@ But now Tebako recognizes that it packages a gem and applies a different deploym
... stripping the output
----

Tebako installs the gem into its Ruby environment and assumes the entry point is the wrapper created by the `gem` command in the `binary` directory.
Note that the entry point script must be explicitly specified as one of the gem executables.
Tebako uses the link:https://guides.rubygems.org/command-reference/#gem-install[`gem install` command] to place the application into its embedded filesystem.
The configuration created during this process is defined by the gem specification (`gemspec`).
For Tebako to process the `gemspec` correctly, it must define the link:https://guides.rubygems.org/specification-reference/#bindir[`bindir`]
and the link:https://guides.rubygems.org/specification-reference/#executables[`executables`] within the `bindir`. According to the gemspec documentation:
_“... you don’t specify the full path (as in bin/rake); all application-style files are expected to be found in bindir ...”_
Tebako adheres to this convention by expecting the entry point to be listed as an executable and located in the `bindir` specified in the `gemspec.
Tebako sets the `bindir` option of the `gem install` command to a path within its memory filesystem, such as `\__tebako_memfs__\bin`. This path is effectively the default `bindir` for `gem install` (typically, the folder where the Ruby executable resides). Notably, the gem specification does not indicate that the `bindir` option for `gem install` can be modified or restricted by the gem itself.

== Packaging a Gem Without Bundling

Expand Down Expand Up @@ -238,6 +243,10 @@ tebako press -r gem.sample -e tebako-table-cli -o table.tebako
The same limitations apply as in the previous option. This scenario may fail for gems with native extensions due to Tebako's limited control during configuration.
It is supported primarily for backward compatibility.

== Acknowledgements

The samples provided above were inspired by the contributions of https://github.com/bradgessler[bradgessler].

== Live Example

You can find the complete code for this lesson in the `tutorial/2_dependencies` directory of the `tebako-samples` repository.
Expand Down

0 comments on commit 836dab0

Please sign in to comment.