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

allow procs as command map values #310

Merged
merged 1 commit into from
Feb 24, 2016

Conversation

mikz
Copy link
Contributor

@mikz mikz commented Dec 28, 2015

so this example works properly:

SSHKit.config.command_map[:bundle] = -> { "#{fetch(:ruby_cmd)} /usr/bin/local/bundle" }

@leehambley
Copy link
Member

@mattbrictson could I get a 2nd opinion on this please?

@leehambley
Copy link
Member

@mikz looks like recently merged PRs have caused some conflicts, would you mind rebasing?

@mikz
Copy link
Contributor Author

mikz commented Dec 29, 2015

@leehambley rebased

@leehambley
Copy link
Member

@leehambley rebased

Cheers :)

@mattbrictson
Copy link
Member

@leehambley I am not really a big user of the command map (the only entry I ever have is :rake => "bundle exec rake"), so I don't have an intuition for the use cases here. But otherwise the code and test look solid and I don't see any harm in adding Proc support. It makes the prefixes and maps now work consistently in that respect.

@leehambley
Copy link
Member

so I don't have an intuition for the use cases here.

That's my take too, so @mikz if you can rebase this so we can merge it, I'd be more than happy. Thanks

@mikz
Copy link
Contributor Author

mikz commented Dec 30, 2015

@leehambley rebased. Cheers.

The use case here is to use ruby2.2 & friends instead of ruby, rake etc. More fixes follow in #311.

@leehambley
Copy link
Member

@mikz merging because I totally see the usecase, and applaud you for using your distro's package manager rather than putting rbenv and rvm in places I don't think they belong! 👍

Caveat: there's a few open issues around the command map, and we're addressing them on a first-come-first-served basis, as matt and I aren't huge consumers of this feature... Everything subject to change. ..

@mattbrictson
Copy link
Member

@leehambley Looks like you meant to merge this one?

so this example works properly:

  SSHKit.config.command_map[:bundle] = -> { "#{fetch(:ruby_cmd)} /usr/bin/local/bundle" }
@mikz
Copy link
Contributor Author

mikz commented Feb 24, 2016

@mattbrictson @leehambley rebased this. This could be merged regardless the future of #311.

leehambley added a commit that referenced this pull request Feb 24, 2016
allow procs as command map values
@leehambley leehambley merged commit cdb8002 into capistrano:master Feb 24, 2016
@leehambley
Copy link
Member

🚀 thanks @mikz

@mikz mikz deleted the improve-command-map branch February 24, 2016 10:11
@mattbrictson mattbrictson added this to the 1.10.0 milestone Mar 10, 2016
@mattbrictson
Copy link
Member

FYI, this didn't make the cut for SSHKit 1.9. It will go in 1.10.

jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Oct 17, 2016
## [1.11.3][] (2016-09-16)

  * Fix known_hosts caching to match on the entire hostlist
    [PR #364](capistrano/sshkit#364) @byroot

## [1.11.2][] (2016-07-29)

### Bug fixes

  * Fixed a crash occurring when `Host@keys` was set to a non-Enumerable.
    @xavierholt [PR #360](capistrano/sshkit#360)

## [1.11.1][] (2016-06-17)

### Bug fixes

  * Fixed a regression in 1.11.0 that would cause
    `ArgumentError: invalid option(s): known_hosts` in some older versions of
    net-ssh. @byroot [#357](capistrano/sshkit#357)

## [1.11.0][] (2016-06-14)

### Bug fixes

  * Fixed colorized output alignment in Logger::Pretty. @xavierholt
    [PR #349](capistrano/sshkit#349)
  * Fixed a bug that prevented nested `with` calls
    [#43](capistrano/sshkit#43)

### Other changes

  * Known hosts lookup optimization is now enabled by default. @byroot

## 1.10.0 (2016-04-22)

  * You can now opt-in to caching of SSH's known_hosts file for a speed boost
    when deploying to a large fleet of servers. Refer to the
    [README](https://github.com/capistrano/sshkit/tree/v1.10.0#known-hosts-caching) for
    details. We plan to turn this on by default in a future version of SSHKit.
    [PR #330](capistrano/sshkit#330) @byroot
  * SSHKit now explicitly closes its pooled SSH connections when Ruby exits;
    this fixes `zlib(finalizer): the stream was freed prematurely` warnings
    [PR #343](capistrano/sshkit#343) @mattbrictson
  * Allow command map entries (`SSHKit::CommandMap#[]`) to be Procs
    [PR #310](capistrano/sshkit#310)
    @mikz

## 1.9.0

**Refer to the 1.9.0.rc1 release notes for a full list of new features, fixes,
and potentially breaking changes since SSHKit 1.8.1.** There are no changes
since 1.9.0.rc1.

## 1.9.0.rc1

### Potentially breaking changes

  * The SSHKit DSL is no longer automatically included when you `require` it.
    **This means you  must now explicitly `include SSHKit::DSL`.**
    See [PR #219](capistrano/sshkit#219) for details.
    @beatrichartz
  * `SSHKit::Backend::Printer#test` now always returns true
    [PR #312](capistrano/sshkit#312) @mikz

### New features

  * `SSHKit::Formatter::Abstract` now accepts an optional Hash of options
    [PR #308](capistrano/sshkit#308) @mattbrictson
  * Add `SSHKit::Backend.current` so that Capistrano plugin authors can refactor
    helper methods and still have easy access to the currently-executing Backend
    without having to use global variables.
  * Add `SSHKit.config.default_runner` options that allows to override default command runner.
    This option also accepts a name of the custom runner class.
  * The ConnectionPool has been rewritten in this release to be more efficient
    and have a cleaner internal API. You can still completely disable the pool
    by setting `SSHKit::Backend::Netssh.pool.idle_timeout = 0`.
    @mattbrictson @byroot [PR #328](capistrano/sshkit#328)

### Bug fixes

  * make sure working directory for commands is properly cleared after `within` blocks
    [PR #307](capistrano/sshkit#307)
    @steved
  * display more accurate string for commands with spaces being output in `Formatter::Pretty`
    [PR #304](capistrano/sshkit#304)
    @steved
    [PR #319](capistrano/sshkit#319) @mattbrictson
  * Fix a race condition experienced in JRuby that could cause multi-server
    deploys to fail. [PR #322](capistrano/sshkit#322)
    @mattbrictson
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