Cannot get started with development of a Logstash plugin: README incorrect?

I'm new to Ruby and Rails, so go easy on me :slight_smile: Maybe I'm missing something that's completely obvious to an experienced Ruby developer but not to this guy with 20 years on Java :man_shrugging:

The README information to set up a development environment doesn't work for me. I'm on macOS 14.5 and installed JRuby using Homebrew: which jruby returns /opt/homebrew/opt/jruby/bin/jruby.

The first step is to run bundle install but it gives me an error message:

Could not find gem 'logstash-devutils' in any of the gem sources listed in your Gemfile.

After some googling it seemed that because logstash-devutils is a Java-based module, I need to run jbundle instead of bundle.

That seems to work better, I get a bunch of "Fetching X", "Using X", "Installing X" messages on the console.

Great, on to the unit tests.

Per the README, I need to run bundle exec rspec.

So I do that, but then I get an error message

Could not find 'bundler' (2.3.26) required by your .../Gemfile.lock
To update to the latest version installed on your system, run bundle update --bundler.

So I run bundle update --bundler but that just tells me

You must use Bundler 2 or greater with this lockfile.

I give this up and give jbundle a try again: jbundle exec rspec

That fails with:

bundler: command not found: rspec
Install missing gem executables with bundle install

Which is ironic because I just ran bundle install a few seconds back.

What's going on here? Is it my setup? Are the instructions in the README just plain wrong?

Any help would be appreciated.

The particular plugin I'm trying to work on is GitHub - logstash-plugins/logstash-input-salesforce: Logstash input for pulling objects from salesforce, but from what I can tell the README is identical to that of other Logstash plugins so it's probably not particular to this plugin.

Thanks for any insights!
Frans

Sorry for the delay @frans-wtax, here are the steps:

/tmp $ mkdir sandbox
/tmp $ cd sandbox
/tmp/sandbox $ git clone git@github.com:logstash-plugins/logstash-input-salesforce.git
/tmp/sandbox $ curl https://artifacts.elastic.co/downloads/logstash/logstash-8.14.3-darwin-aarch64.tar.gz | tar -zxf -
/tmp/sandbox $ cd logstash-input-salesforce
/tmp/sandbox/logstash-input-salesforce $ export LOGSTASH_PATH=/tmp/sandbox/logstash-8.14.3 LOGSTASH_SOURCE=1 
/tmp/sandbox/logstash-input-salesforce $ bundle install --path=vendor/bundle
/tmp/sandbox/logstash-input-salesforce $ bundle exec rspec

The output can be seen here: gist:6b396a329243e8ee337fa2d31011897f · GitHub

Thank you!

When I run bundle install, it tells me

[!] There was an error while loading `logstash-core-plugin-api.gemspec`: The logstash-core-api need to be build on jruby. Bundler cannot continue.

Is your bundle somehow (sym)linked to jbundle? On my machine:

$ which bundle
/usr/bin/bundle
$ which jbundle
/opt/homebrew/opt/jruby/bin/jbundle

Thanks again,
Frans

Looks like you have two rubies, the C based ruby installed by macos and JRuby from homebrew.

The JRuby homebrew seems to install a jbundle to avoid clashing with the C ruby, so you can use jbundle where I used bundle.

An alternative is to install a ruby version manager like rvm (https://rvm.io/) to manage it for you (similar to sdkman or jenv).

OK great, I got the rspec tests to run this way! Thanks :slight_smile: