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

Improved command map #45

Merged
merged 1 commit into from Nov 22, 2013
Merged

Improved command map #45

merged 1 commit into from Nov 22, 2013

Conversation

kirs
Copy link
Member

@kirs kirs commented Nov 9, 2013

As I wrote in capistrano/capistrano#639, we need more ways to configure command map behaviour.

This PR adds prefixes feature.

@kirs
Copy link
Member Author

kirs commented Nov 9, 2013

@leehambley after your review, I'm going to make new versions of rvm/rbenv/bundler integrations using this code.

@leehambley
Copy link
Member

@kirs looks good, the only thing I would have done differently is to specify whether add is a prefix, or suffix. (i.e does add push or unshift onto the list).

Given that this is mostly an internal API it doesn't matter if we just call it add, but perhaps we could also use push and/or unshift or something to be clear that sometimes you might combine them (i.e unshift rvm support to make sure it's ALWAYS first), and push for things such as bundler that always go right before the command?

I'd be happy to merge this as it is, and mark the API as private, and re-visit if you think we could benefit from push and unshift when you begin working on the integrations for the ruby switchers, and bundler, etc?

@kirs
Copy link
Member Author

kirs commented Nov 11, 2013

Do you mean the API like this?

SSHKit.config.command_map.prefix[:rake].push("bundle exec")
SSHKit.config.command_map.prefix[:rake].unshift("rbenv exec")

?

@leehambley
Copy link
Member

Do you mean the API like this?

Yes, exactly, so that capistrano-{rvm,rbenv,chruby} can be included before, or after capistrano-bundler without problems, and they speficy really whether they are prefixes or suffixes.

I'm kind of afraid of load ordering issues, and of unclean terms like "add". But that change looks like exactly what I had in mind.

I assume it's possible to do something like prefixing everything in the command map, as we do in some places now, like pushing a general suffix, not just for rake?

(then maybe the map could be empty, and we could push /usr/bin/env as a prefix? )

@kirs
Copy link
Member Author

kirs commented Nov 11, 2013

There is a priority option that works like unshift now: SSHKit.config.command_map.add_prefix(:rake, "/usr/local/rbenv/bin exec", priority: :first)

But I'll rework it anyway with the syntax I wrote in the previous comment.

I don't have a clear idea how to prefix everything yet.

With push/unshift prefixes
@kirs
Copy link
Member Author

kirs commented Nov 15, 2013

@leehambley updated

@kirs
Copy link
Member Author

kirs commented Nov 17, 2013

@leehambley what do you think about a new release of SSHKit with this API?

This will give us an opportunity to release new rubygems.org versions of capistrano-* plugins.

@leehambley
Copy link
Member

I'd like to do it all for 3.1
On 17 Nov 2013 14:43, "Kir Shatrov" notifications@github.com wrote:

@leehambley https://github.com/leehambley what do you think about a new
release of SSHKit with this API?

This will give us an opportunity to release new rubygems.org versions of
capistrano-* plugins.


Reply to this email directly or view it on GitHubhttps://github.com//pull/45#issuecomment-28648629
.

@kirs
Copy link
Member Author

kirs commented Nov 19, 2013

I've prepared few changes to try prefixes:

capistrano/rbenv#14
capistrano/rvm#22
capistrano/bundler#16

@leehambley
Copy link
Member

Awesome, thanks - let's try and get all of this out on Friday, will you
have time?

Lee Hambley

http://lee.hambley.name/
+49 (0) 170 298 5667

On 19 November 2013 08:50, Kir Shatrov notifications@github.com wrote:

I've prepared few changes to try prefixes:

capistrano/rbenv#14 capistrano/rbenv#14
capistrano/rvm#22 capistrano/rvm#22
capistrano/bundler#16 capistrano/bundler#16


Reply to this email directly or view it on GitHubhttps://github.com//pull/45#issuecomment-28771641
.

@kirs
Copy link
Member Author

kirs commented Nov 19, 2013

Hopefully 😄

leehambley added a commit that referenced this pull request Nov 22, 2013
Improved command map (possible breaking change, see the changelog.)
@leehambley leehambley merged commit 7e2da3c into capistrano:master Nov 22, 2013
@kirs kirs deleted the command-map branch November 23, 2013 12:16
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