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

Capistrano 3 support #43

Merged
merged 10 commits into from
Feb 13, 2014
Merged

Capistrano 3 support #43

merged 10 commits into from
Feb 13, 2014

Conversation

clofresh
Copy link
Contributor

@clofresh clofresh commented Feb 6, 2014

In addition to supporting capistrano 3, also splits the capistrano integration code by version to make it easier to support future version

@@ -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/).
Copy link
Contributor

Choose a reason for hiding this comment

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

awesome

@clofresh
Copy link
Contributor Author

fixes #40

@cap_version = :v2
else
@cap_version = :v3
end
Copy link
Contributor

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.

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 don't really like it, looks like line noise.

@cap_version = Configuration.respond_to?(:instance) ? :v2 : :v3

I think it's just personal preference.

Copy link
Contributor

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.

Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor

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.

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 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

Copy link
Contributor

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.

clofresh added a commit that referenced this pull request Feb 13, 2014
@clofresh clofresh merged commit 8e075f4 into master Feb 13, 2014
@clofresh clofresh deleted the capistrano3 branch February 13, 2014 19:08
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.

3 participants