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.
- Install
asdfto 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
asdfinstall the required version by runningasdf install - Run
bundle installto install dependencies
- Build the
posthog-rubygem by calling:gem build posthog-ruby.gemspec. - Install the gem locally:
gem install ./posthog-ruby-<version>.gem - Run
ruby example.rb
- Run
bin/test(this ends up callingbundle exec rspec) - An example of running specific tests:
bin/test spec/posthog/client_spec.rb:26
- Get access to RubyGems from @dmarticus, @daibhin or @mariusandra
- Install
ghand authenticate withgh auth login - Update
lib/posthog/version.rbwith the new version & add toCHANGELOG.mdmaking sure to add the current date. Commit the changes:
VERSION=1.2.3 # Replace with the new version here
git commit -am "Version $VERSION"
git tag -a $VERSION -m "Version $VERSION"
git push && git push --tags
gh release create $VERSION --generate-notes --fail-on-no-commits-
Trigger "Publish Release" GitHub Action
-
Authenticate with your RubyGems account and approve the publish!