Skip to content

using bashly without ruby or docker #540

Description

@elee1766

Description

hi.

i really love bashly, it's honestly life changing, but i really hate that i either need a ruby install, or docker, to use it. it's the only thing i have ruby installed on my system for, since i dont like waiting for docker every time to build. (i guess i could create a daemon using compose that mounted my code dir and run the bashly commands there.... its lots of effort regardless)

i am not very familiar with ruby packaging and bundling, but I thought it might be a fun side-project to try to compile a giant redistributable bashly binary.

my thought was maybe i could try to bundle bashly and then just put that code into some binary with a ruby runtime and package that together.

i was curious if you had any experience with this, or if you knew of any weird libraries or ruby functionality that you are using within bashly which might make this difficult or impossible? or maybe i am on a wrong track and there is a hidden secret easy way to use bashly as single binary

if not i will try to do some research and see if i can hack something out.

Activity

  1. DannyBen commented on Jul 27, 2024

    @DannyBen
    Member

    I hear you. I also wish Ruby apps could be distributed as a single executable.
    I looked for some solutions in the past, none came close to attaining this goal gracefully enough.

    Also, if I recall correctly, one of the issues to consider are dependencies that need to be compiled - I think bashly has at least the YAML library (Psych) that is system-specific.

    I am curious to see if you find something new in this regard, feel free to share your progress - happy to help.

  2. elee1766 commented on Jul 28, 2024

    @elee1766
    Author

    seems this is a maintained tool for it https://github.com/tamatebako/tebako

    i will play around with it

    https://github.com/tamatebako/tebako/blob/6ccc63292ba92b7c51b99b2e7d79627eecca1ac2/tests-2/fixtures/gems-psych-5/Gemfile#L3

    they seem to have an example with psych 5 that works? but im not sure about other packages.

    naive compilation with tebako press --entry-point ./bin/bashly --root . --Ruby=3.2.4 failed with

       ... @ /home/a/.tebako/o/s/bin/bundle exec /home/a/.tebako/o/s/bin/gem build /home/a/repo/github.com/DannyBen/bashly/bashly.gemspec
    tebako-packager failed: Failed to run /home/a/.tebako/o/s/bin/bundle exec /home/a/.tebako/o/s/bin/gem build /home/a/repo/github.com/DannyBen/bashly/bashly.gemspec (pid 399942 exit 1):
     Ignoring debug-1.9.2 because its extensions are not built. Try: gem pristine debug --version 1.9.2
    Ignoring io-console-0.7.2 because its extensions are not built. Try: gem pristine io-console --version 0.7.2
    Ignoring strscan-3.1.0 because its extensions are not built. Try: gem pristine strscan --version 3.1.0
    Ignoring debug-1.9.2 because its extensions are not built. Try: gem pristine debug --version 1.9.2
    Ignoring io-console-0.7.2 because its extensions are not built. Try: gem pristine io-console --version 0.7.2
    Ignoring strscan-3.1.0 because its extensions are not built. Try: gem pristine strscan --version 3.1.0
    /home/a/.tebako/o/s/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/definition.rb:594:in `materialize': Could not find debug-1.9.2, psych-5.1.2, io-console-0.7.2, stringio-3.1.1, strscan-3.1.0 in locally installed gems (Bundler::GemNotFound)
            from /home/a/.tebako/o/s/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/definition.rb:193:in `specs'
            from /home/a/.tebako/o/s/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/definition.rb:259:in `specs_for'
            from /home/a/.tebako/o/s/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/runtime.rb:18:in `setup'
            from /home/a/.tebako/o/s/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler.rb:163:in `setup'
            from /home/a/.tebako/o/s/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/setup.rb:29:in `block in <top (required)>'
            from /home/a/.tebako/o/s/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/ui/shell.rb:159:in `with_level'
            from /home/a/.tebako/o/s/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/ui/shell.rb:111:in `silence'
            from /home/a/.tebako/o/s/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/setup.rb:29:in `<top (required)>'
            from <internal:/home/a/.tebako/o/s/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
            from <internal:/home/a/.tebako/o/s/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
            from /home/a/.tebako/o/s/lib/ruby/3.2.0/rubygems.rb:1370:in `<top (required)>'
            from <internal:gem_prelude>:2:in `require'
            from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
    

    maybe im just doing something wrong, might ask them for help.

  3. DannyBen commented on Jul 28, 2024

    @DannyBen
    Member

    Seems like they complain about some built-in Ruby gems - like the debug gem and io/console.
    One guess would be that the system this is built on does not have the proper OS dependencies to compile these gems.

    In my Alpine Ruby image for example, I am adding these dependencies:

    ENV BUILD_PACKAGES bash curl curl-dev ruby-dev build-base
    ENV RUBY_PACKAGES \
      ruby ruby-io-console ruby-irb \
      ruby-json ruby-etc ruby-bigdecimal ruby-rdoc \
      libffi-dev zlib-dev yaml-dev
  4. locked and limited conversation to collaborators on Jul 28, 2024
  5. converted this issue into a discussion #541 on Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions