I installed the new posthog-rails gem and noticed PostHog wasn't being loaded and the new rails generator didn't exist.
I believe the issue has to do with the way it is being release. As you can see in the new rails gemspec we are loading lib directory: https://github.com/PostHog/posthog-ruby/blob/main/posthog-rails/posthog-rails.gemspec#L8
spec.files = Dir.glob('lib/**/*')
Note that we are using Dir.glob which is relative to the working directory.
Then in the github action release we are building from the project working directory like: https://github.com/PostHog/posthog-ruby/blob/main/.github/workflows/release.yml#L114
run: gem build posthog-rails/posthog-rails.gemspec
I believe that the projects root lib directory is being loaded as a result. I think it either needs to change how it is being built or change how the gemspec specifies those files. We might want to change the working directory temporarily to build since there may be other consequences with loading other things relative to the posthog-rails gemspec.
PS: Great work on the posthog-rails gem, I am VERY excited about it 🎉
I installed the new
posthog-railsgem and noticedPostHogwasn't being loaded and the new rails generator didn't exist.I believe the issue has to do with the way it is being release. As you can see in the new rails gemspec we are loading
libdirectory: https://github.com/PostHog/posthog-ruby/blob/main/posthog-rails/posthog-rails.gemspec#L8Note that we are using
Dir.globwhich is relative to the working directory.Then in the github action release we are building from the project working directory like: https://github.com/PostHog/posthog-ruby/blob/main/.github/workflows/release.yml#L114
I believe that the projects root
libdirectory is being loaded as a result. I think it either needs to change how it is being built or change how the gemspec specifies those files. We might want to change the working directory temporarily to build since there may be other consequences with loading other things relative to the posthog-rails gemspec.PS: Great work on the posthog-rails gem, I am VERY excited about it 🎉