PostHog Ruby
Please see the main PostHog docs.
Specifically, the Ruby integration details.
Important
Supports Ruby 3.2 and above
We will lag behind but generally not support versions which are end-of-life as listed here https://www.ruby-lang.org/en/downloads/branches/
All 2.x versions of the PostHog Ruby library are compatible with Ruby 2.0 and above if you need Ruby 2.0 support.
Developing Locally
- Install
asdf
to manage your Ruby version:brew install asdf
- Install Ruby's plugin via
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
- Make
asdf
install the required version by runningasdf install
- Run
bundle install
to install dependencies
Running example file
- Build the
posthog-ruby
gem by calling:gem build posthog-ruby.gemspec
. - Install the gem locally:
gem install ./posthog-ruby-<version>.gem
- Run
ruby example.rb
Testing
- Run
bin/test
(this ends up callingbundle exec rspec
) - An example of running specific tests:
bin/test spec/posthog/client_spec.rb:26
How to release
- Get access to RubyGems from @dmarticus, @daibhin or @mariusandra
- Update
lib/posthog/version.rb
with the new version & add toCHANGELOG.md
. Commit the changes:
git commit -am "Version 1.2.3"
git tag -a 1.2.3 -m "Version 1.2.3"
git push && git push --tags
- Run
gem build posthog-ruby.gemspec
gem push posthog-ruby-1.2.3.gem
- Authenticate with your RubyGems account and approve the publish!