Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROD-899] report name and version in X-Pusher-Library header #103

Merged
merged 4 commits into from Aug 2, 2016

Conversation

jameshfisher
Copy link
Contributor

No description provided.

# Copied from https://github.com/bundler/bundler/blob/524add155d6b90c679db21b03f0bd9f877f21ab0/bundler.gemspec#L3-L5
# but made less cryptic
$LOAD_PATH.unshift(File.expand_path('../lib/', __FILE__))
require "pusher/version"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or load the file directly. Ruby 1.9+ resolves the file to the absolute file anyways.

require File.expand_path('../lib/pusher/version', __FILE__)

Copy link
Contributor

@zimbatm zimbatm Aug 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 2.3+ it will be even nicer:

require File.join(__dir__, 'lib', 'pusher', 'version')

Copy link
Contributor

@zimbatm zimbatm Aug 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also this version but require_relative is not reliably in an eval context (which rubygems tends to do unfortunately)

require_relative './lib/pusher/version'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this one: require File.expand_path('../lib/pusher/version', __FILE__)

I initially used require_relative but Ruby 1.9.3 didn't like it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's a shame require_relative isn't more reliable when all the information is clearly available in the context.

@jameshfisher jameshfisher merged commit 67e968a into master Aug 2, 2016
@jameshfisher jameshfisher deleted the 899-report-name-and-version branch August 2, 2016 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants