-
Notifications
You must be signed in to change notification settings - Fork 88
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
Capistrano 3 support #43
Conversation
@@ -7,7 +7,7 @@ To set up your Capfile: | |||
require "capistrano/datadog" | |||
set :datadog_api_key, "my_api_key" | |||
|
|||
You can find your Datadog API key [here](https://app.datad0g.com/account/settings#api). If you don't have a Datadog account, you can sign up for one [here](http://www.datadoghq.com/). | |||
You can find your Datadog API key [here](https://app.datadoghq.com/account/settings#api). If you don't have a Datadog account, you can sign up for one [here](http://www.datadoghq.com/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome
fixes #40 |
@cap_version = :v2 | ||
else | ||
@cap_version = :v3 | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might be better expressed as a ternary operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like it, looks like line noise.
@cap_version = Configuration.respond_to?(:instance) ? :v2 : :v3
I think it's just personal preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STYLE WARS
the only thing I like about the ternary operator is that it's clear in a single place that you want to assign to the same thing in either condition. but yea, it's not a great fit with ruby's end_bool_with?
convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely a stylistic change - I honestly think one line to express v2 vs v3 is cleaner than 5 lines, but it's no blocker by any stretch of imagination.
@@ -52,6 +11,34 @@ def self.reporter() | |||
@reporter || @reporter = Reporter.new | |||
end | |||
|
|||
def self.cap_version() | |||
if @cap_version.nil? then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then
is not needed and should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As well as other locations where if
is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't fix that today. Maybe we can update the linting rules to take that into account and fix all the lint errors in the whole library in a single pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I've got some tricks up my sleeve for that, and was thinking we possibly defer that for the newer datadog.rb lib.
In addition to supporting capistrano 3, also splits the capistrano integration code by version to make it easier to support future version