sshkit 1.18.0 → 1.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.docker/Dockerfile +6 -0
  3. data/.docker/ubuntu_setup.sh +22 -0
  4. data/.github/dependabot.yml +16 -0
  5. data/.github/release-drafter.yml +25 -0
  6. data/.github/workflows/ci.yml +98 -0
  7. data/.github/workflows/push.yml +12 -0
  8. data/.gitignore +0 -1
  9. data/.rubocop.yml +63 -0
  10. data/.rubocop_todo.yml +630 -0
  11. data/CHANGELOG.md +1 -769
  12. data/CONTRIBUTING.md +2 -2
  13. data/Dangerfile +1 -1
  14. data/EXAMPLES.md +35 -13
  15. data/Gemfile +0 -12
  16. data/README.md +35 -17
  17. data/RELEASING.md +4 -5
  18. data/Rakefile +3 -10
  19. data/docker-compose.yml +8 -0
  20. data/examples/simple_connection.rb +9 -0
  21. data/lib/sshkit/backends/abstract.rb +9 -6
  22. data/lib/sshkit/backends/connection_pool/cache.rb +12 -5
  23. data/lib/sshkit/backends/connection_pool.rb +8 -4
  24. data/lib/sshkit/backends/netssh/known_hosts.rb +8 -8
  25. data/lib/sshkit/backends/netssh/scp_transfer.rb +26 -0
  26. data/lib/sshkit/backends/netssh/sftp_transfer.rb +46 -0
  27. data/lib/sshkit/backends/netssh.rb +38 -8
  28. data/lib/sshkit/command.rb +18 -13
  29. data/lib/sshkit/deprecation_logger.rb +2 -0
  30. data/lib/sshkit/host.rb +31 -4
  31. data/lib/sshkit/version.rb +1 -1
  32. data/sshkit.gemspec +6 -1
  33. data/test/functional/backends/netssh_transfer_tests.rb +83 -0
  34. data/test/functional/backends/test_local.rb +18 -0
  35. data/test/functional/backends/test_netssh.rb +24 -79
  36. data/test/functional/backends/test_netssh_scp.rb +23 -0
  37. data/test/functional/backends/test_netssh_sftp.rb +23 -0
  38. data/test/helper.rb +5 -43
  39. data/test/support/docker_wrapper.rb +71 -0
  40. data/test/unit/backends/test_abstract.rb +13 -1
  41. data/test/unit/backends/test_netssh.rb +55 -0
  42. data/test/unit/formatters/test_pretty.rb +1 -1
  43. data/test/unit/test_command.rb +32 -7
  44. data/test/unit/test_command_map.rb +8 -8
  45. data/test/unit/test_deprecation_logger.rb +1 -1
  46. data/test/unit/test_host.rb +44 -0
  47. metadata +58 -18
  48. data/.travis.yml +0 -14
  49. data/Vagrantfile +0 -15
  50. data/test/boxes.json +0 -17
  51. data/test/functional/test_ssh_server_comes_up_for_functional_tests.rb +0 -24
  52. data/test/support/vagrant_wrapper.rb +0 -55
data/CHANGELOG.md CHANGED
@@ -1,769 +1 @@
1
- ## Changelog
2
-
3
- This file is written in reverse chronological order, newer releases will
4
- appear at the top.
5
-
6
- ## [Unreleased][]
7
-
8
- * Your contribution here!
9
-
10
- ## [1.18.0][] (2018-10-21)
11
-
12
- * [#435](https://github.com/capistrano/sshkit/pull/435): Consistent verbosity configuration #capture and #test methods - [@NikolayRys](https://github.com/NikolayRys)
13
-
14
- ## [1.17.0][] (2018-07-07)
15
-
16
- * [#430](https://github.com/capistrano/sshkit/pull/430): [Feature] Command Argument STDOUT/capistrano.log Hiding - [@NorseGaud](https://github.com/NorseGaud)
17
-
18
- ## [1.16.1][] (2018-05-20)
19
-
20
- * [#425](https://github.com/capistrano/sshkit/pull/425): Command#group incorrectly escapes double quotes, resulting in a a syntax error when specifying the group execution using `as`. This issue manifested when user command quotes changed from double quotes to single quotes. This fix removes the double quote escaping - [@pblesi](https://github.com/pblesi).
21
-
22
- ## [1.16.0][] (2018-02-03)
23
-
24
- * [#417](https://github.com/capistrano/sshkit/pull/417): Cache key generation for connections becomes slow when `known_hosts` is a valid `net/ssh` options and `known_hosts` file is big. This changes the cache key generation and fixes performance issue - [@ElvinEfendi](https://github.com/ElvinEfendi).
25
-
26
- ## [1.15.1][] (2017-11-18)
27
-
28
- This is a small bug-fix release that fixes problems with `upload!` and `download!` that were inadvertently introduced in 1.15.0.
29
-
30
- ### Breaking changes
31
-
32
- * None
33
-
34
- ### Bug fixes
35
-
36
- * [#410](https://github.com/capistrano/sshkit/pull/410): fix NoMethodError when using upload!/download! with Pathnames - [@UnderpantsGnome](https://github.com/UnderpantsGnome)
37
- * [#411](https://github.com/capistrano/sshkit/pull/410): fix upload!/download! when using relative paths outside of `within` blocks - [@Fjan](https://github.com/Fjan)
38
-
39
- ## [1.15.0][] (2017-11-03)
40
-
41
- ### New features
42
-
43
- * [#408](https://github.com/capistrano/sshkit/pull/408): upload! and download! now respect `within` - [@sj26](https://github.com/sj26)
44
-
45
- ### Potentially breaking changes
46
-
47
- * `upload!` and `download!` now support remote paths which are
48
- relative to the `within` working directory. They were previously documented
49
- as only supporting absolute paths, but relative paths still worked relative
50
- to the remote working directory. If you rely on the previous behaviour you
51
- may need to adjust your code.
52
-
53
- ## [1.14.0][] (2017-06-30)
54
-
55
- ### Breaking changes
56
-
57
- * None
58
-
59
- ### New features
60
-
61
- * [#401](https://github.com/capistrano/sshkit/pull/401): Add :log_percent option to specify upload!/download! transfer log percentage - [@aubergene](https://github.com/aubergene)
62
-
63
- ## [1.13.1][] (2017-03-31)
64
-
65
- ### Breaking changes
66
-
67
- * None
68
-
69
- ### Bug fixes
70
-
71
- * [#397](https://github.com/capistrano/sshkit/pull/397): Fix NoMethodError assign_defaults with net-ssh older than 4.0.0 - [@shirosaki](https://github.com/shirosaki)
72
-
73
- ## [1.13.0][] (2017-03-24)
74
-
75
- ### Breaking changes
76
-
77
- * None
78
-
79
- ### New features
80
-
81
- * [#372](https://github.com/capistrano/sshkit/pull/372): Use cp_r in local backend with recursive option - [@okuramasafumi](https://github.com/okuramasafumi)
82
-
83
- ### Bug fixes
84
-
85
- * [#390](https://github.com/capistrano/sshkit/pull/390): Properly wrap Ruby StandardError w/ add'l context - [@mattbrictson](https://github.com/mattbrictson)
86
- * [#392](https://github.com/capistrano/sshkit/pull/392): Fix open two connections with changed cache key - [@shirosaki](https://github.com/shirosaki)
87
-
88
- ## [1.12.0][] (2017-02-10)
89
-
90
- ### Breaking changes
91
-
92
- * None
93
-
94
- ### New features
95
-
96
- * Add `SSHKit.config.default_runner_config` option that allows overriding default runner configs.
97
-
98
- ## [1.11.5][] (2016-12-16)
99
-
100
- ### Bug fixes
101
-
102
- * Do not prefix `exec` command
103
- [PR #378](https://github.com/capistrano/sshkit/pull/378) @dreyks
104
-
105
- ## [1.11.4][] (2016-11-02)
106
-
107
- * Use string interpolation for environment variables to avoid escaping issues
108
- with sprintf
109
- [PR #280](https://github.com/capistrano/sshkit/pull/280)
110
- @Sinjo - Chris Sinjakli
111
-
112
- ## [1.11.3][] (2016-09-16)
113
-
114
- * Fix known_hosts caching to match on the entire hostlist
115
- [PR #364](https://github.com/capistrano/sshkit/pull/364) @byroot
116
-
117
- ## [1.11.2][] (2016-07-29)
118
-
119
- ### Bug fixes
120
-
121
- * Fixed a crash occurring when `Host@keys` was set to a non-Enumerable.
122
- @xavierholt [PR #360](https://github.com/capistrano/sshkit/pull/360)
123
-
124
- ## [1.11.1][] (2016-06-17)
125
-
126
- ### Bug fixes
127
-
128
- * Fixed a regression in 1.11.0 that would cause
129
- `ArgumentError: invalid option(s): known_hosts` in some older versions of
130
- net-ssh. @byroot [#357](https://github.com/capistrano/sshkit/issues/357)
131
-
132
- ## [1.11.0][] (2016-06-14)
133
-
134
- ### Bug fixes
135
-
136
- * Fixed colorized output alignment in Logger::Pretty. @xavierholt
137
- [PR #349](https://github.com/capistrano/sshkit/pull/349)
138
- * Fixed a bug that prevented nested `with` calls
139
- [#43](https://github.com/capistrano/sshkit/issues/43)
140
-
141
- ### Other changes
142
-
143
- * Known hosts lookup optimization is now enabled by default. @byroot
144
-
145
- ## 1.10.0 (2016-04-22)
146
-
147
- * You can now opt-in to caching of SSH's known_hosts file for a speed boost
148
- when deploying to a large fleet of servers. Refer to the
149
- [README](https://github.com/capistrano/sshkit/tree/v1.10.0#known-hosts-caching) for
150
- details. We plan to turn this on by default in a future version of SSHKit.
151
- [PR #330](https://github.com/capistrano/sshkit/pull/330) @byroot
152
- * SSHKit now explicitly closes its pooled SSH connections when Ruby exits;
153
- this fixes `zlib(finalizer): the stream was freed prematurely` warnings
154
- [PR #343](https://github.com/capistrano/sshkit/pull/343) @mattbrictson
155
- * Allow command map entries (`SSHKit::CommandMap#[]`) to be Procs
156
- [PR #310](https://github.com/capistrano/sshkit/pull/310)
157
- @mikz
158
-
159
- ## 1.9.0
160
-
161
- **Refer to the 1.9.0.rc1 release notes for a full list of new features, fixes,
162
- and potentially breaking changes since SSHKit 1.8.1.** There are no changes
163
- since 1.9.0.rc1.
164
-
165
- ## 1.9.0.rc1
166
-
167
- ### Potentially breaking changes
168
-
169
- * The SSHKit DSL is no longer automatically included when you `require` it.
170
- **This means you must now explicitly `include SSHKit::DSL`.**
171
- See [PR #219](https://github.com/capistrano/sshkit/pull/219) for details.
172
- @beatrichartz
173
- * `SSHKit::Backend::Printer#test` now always returns true
174
- [PR #312](https://github.com/capistrano/sshkit/pull/312) @mikz
175
-
176
- ### New features
177
-
178
- * `SSHKit::Formatter::Abstract` now accepts an optional Hash of options
179
- [PR #308](https://github.com/capistrano/sshkit/pull/308) @mattbrictson
180
- * Add `SSHKit::Backend.current` so that Capistrano plugin authors can refactor
181
- helper methods and still have easy access to the currently-executing Backend
182
- without having to use global variables.
183
- * Add `SSHKit.config.default_runner` options that allows to override default command runner.
184
- This option also accepts a name of the custom runner class.
185
- * The ConnectionPool has been rewritten in this release to be more efficient
186
- and have a cleaner internal API. You can still completely disable the pool
187
- by setting `SSHKit::Backend::Netssh.pool.idle_timeout = 0`.
188
- @mattbrictson @byroot [PR #328](https://github.com/capistrano/sshkit/pull/328)
189
-
190
- ### Bug fixes
191
-
192
- * make sure working directory for commands is properly cleared after `within` blocks
193
- [PR #307](https://github.com/capistrano/sshkit/pull/307)
194
- @steved
195
- * display more accurate string for commands with spaces being output in `Formatter::Pretty`
196
- [PR #304](https://github.com/capistrano/sshkit/pull/304)
197
- @steved
198
- [PR #319](https://github.com/capistrano/sshkit/pull/319) @mattbrictson
199
- * Fix a race condition experienced in JRuby that could cause multi-server
200
- deploys to fail. [PR #322](https://github.com/capistrano/sshkit/pull/322)
201
- @mattbrictson
202
-
203
- ## 1.8.1
204
-
205
- * Change license to MIT, thanks to all the patient contributors who gave
206
- their permissions.
207
-
208
- ## 1.8.0
209
-
210
- * add SSHKit::Backend::ConnectionPool#close_connections
211
- [PR #285](https://github.com/capistrano/sshkit/pull/285)
212
- @akm
213
- * Clean up rubocop lint warnings
214
- [PR #275](https://github.com/capistrano/sshkit/pull/275)
215
- @cshaffer
216
- * Prepend unused parameter names with an underscore
217
- * Prefer “safe assignment in condition”
218
- * Disambiguate regexp literals with parens
219
- * Prefer `sprintf` over `String#%`
220
- * No longer shadow `caller_line` variable in `DeprecationLogger`
221
- * Rescue `StandardError` instead of `Exception`
222
- * Remove useless `private` access modifier in `TestAbstract`
223
- * Disambiguate block operator with parens
224
- * Disambiguate between grouped expression and method params
225
- * Remove assertion in `TestHost#test_assert_hosts_compare_equal` that compares something with itself
226
- * Export environment variables and execute command in a subshell.
227
- [PR #273](https://github.com/capistrano/sshkit/pull/273)
228
- @kuon
229
- * Introduce `log_command_start`, `log_command_data`, `log_command_exit` methods on `Formatter`
230
- [PR #257](https://github.com/capistrano/sshkit/pull/257)
231
- @robd
232
- * Deprecate `@stdout` and `@stderr` accessors on `Command`
233
- * Add support for deprecation logging options.
234
- [README](README.md#deprecation-warnings),
235
- [PR #258](https://github.com/capistrano/sshkit/pull/258)
236
- @robd
237
- * Quote environment variable values.
238
- [PR #250](https://github.com/capistrano/sshkit/pull/250)
239
- @Sinjo - Chris Sinjakli
240
- * Simplified formatter hierarchy.
241
- [PR #248](https://github.com/capistrano/sshkit/pull/248)
242
- @robd
243
- * `SimpleText` formatter now extends `Pretty`, rather than duplicating.
244
- * Hide ANSI color escape sequences when outputting to a file.
245
- [README](README.md#output-colors),
246
- [Issue #245](https://github.com/capistrano/sshkit/issues/245),
247
- [PR #246](https://github.com/capistrano/sshkit/pull/246)
248
- @robd
249
- * Now only color the output if it is associated with a tty,
250
- or the `SSHKIT_COLOR` environment variable is set.
251
- * Removed broken support for assigning an `IO` to the `output` config option.
252
- [Issue #243](https://github.com/capistrano/sshkit/issues/243),
253
- [PR #244](https://github.com/capistrano/sshkit/pull/244)
254
- @robd
255
- * Use `SSHKit.config.output = SSHKit::Formatter::SimpleText.new($stdin)` instead
256
- * Added support for `:interaction_handler` option on commands.
257
- [PR #234](https://github.com/capistrano/sshkit/pull/234),
258
- [PR #242](https://github.com/capistrano/sshkit/pull/242)
259
- @robd
260
- * Removed partially supported `TRACE` log level.
261
- [2aa7890](https://github.com/capistrano/sshkit/commit/2aa78905f0c521ad9f697e7a4ed04ba438d5ee78)
262
- @robd
263
- * Add support for the `:strip` option to the `capture` method and strip by default on the `Local` backend.
264
- [PR #239](https://github.com/capistrano/sshkit/pull/239),
265
- [PR #249](https://github.com/capistrano/sshkit/pull/249)
266
- @robd
267
- * The `Local` backend now strips by default to be consistent with the `Netssh` one.
268
- * This reverses change [7d15a9a](https://github.com/capistrano/sshkit/commit/7d15a9aebfcc43807c8151bf6f3a4bc038ce6218) to the `Local` capture API to remove stripping by default.
269
- * If you require the raw, unstripped output, pass the `strip: false` option: `capture(:ls, strip: false)`
270
- * Simplified backend hierarchy.
271
- [PR #235](https://github.com/capistrano/sshkit/pull/235),
272
- [PR #237](https://github.com/capistrano/sshkit/pull/237)
273
- @robd
274
- * Moved duplicate implementations of `make`, `rake`, `test`, `capture`, `background` on to `Abstract` backend.
275
- * Backend implementations now only need to implement `execute_command`, `upload!` and `download!`
276
- * Removed `Printer` from backend hierarchy for `Local` and `Netssh` backends (they now just extend `Abstract`)
277
- * Removed unused `Net::SSH:LogLevelShim`
278
- * Removed dependency on the `colorize` gem. SSHKit now implements its own ANSI color logic, with no external dependencies. Note that SSHKit now only supports the `:bold` or plain modes. Other modes will be gracefully ignored. [#263](https://github.com/capistrano/sshkit/issues/263)
279
- * New API for setting the formatter: `use_format`. This differs from `format=` in that it accepts options or arguments that will be passed to the formatter's constructor. The `format=` syntax will be deprecated in a future release. [#295](https://github.com/capistrano/sshkit/issues/295)
280
- * SSHKit now immediately raises a `NameError` if you try to set a formatter that does not exist. [#295](https://github.com/capistrano/sshkit/issues/295)
281
- * Fix error message when the formatter does not exist. [#301](https://github.com/capistrano/sshkit/pull/301)
282
-
283
- ## 1.7.1
284
-
285
- * Fix a regression in 1.7.0 that caused command completion messages to be removed from log output. @mattbrictson
286
-
287
- ## 1.7.0
288
-
289
- * Update Vagrantfile to use multi-provider Hashicorp precise64 box - remove URLs. @townsen
290
- * Merge host ssh_options and Netssh defaults @townsen
291
- Previously if host-level ssh_options were defined the Netssh defaults
292
- were ignored.
293
- * Merge host ssh_options and Netssh defaults
294
- * Fixed race condition where output of failed command would be empty. @townsen
295
- Caused random failures of `test_execute_raises_on_non_zero_exit_status_and_captures_stdout_and_stderr`
296
- Also fixes output handling in failed commands, and generally buggy output.
297
- * Remove override of backtrace() and backtrace_locations() from ExecuteError. @townsen
298
- This interferes with rake default behaviour and creates duplicate stacktraces.
299
- * Allow running local commands using `on(:local)`
300
- * Implement the upload! and download! methods for the local backend
301
-
302
- ## 1.6.0
303
-
304
- * Fix colorize to use the correct API (@fazibear)
305
- * Lock colorize (sorry guys) version at >= 0.7.0
306
-
307
- ## 1.6.0 (Yanked, because of colorize.)
308
-
309
- * Force dependency on colorize v0.6.0
310
- * Add your entries here, remember to credit yourself however you want to be
311
- credited!
312
- * Remove strip from capture to preserve whitespace. Nick Townsend
313
- * Add vmware_fusion Vagrant provider. Nick Townsend
314
- * Add some padding to the pretty log formatter
315
-
316
- ## 1.5.1
317
-
318
- * Use `sudo -u` rather than `sudo su` to switch users. Mat Trudel
319
-
320
- ## 1.5.0
321
-
322
- * Deprecate background helper - too many badly behaved pseudo-daemons. Lee Hambley
323
- * Don't colourize unless $stdout is a tty. Lee Hambley
324
- * Remove out of date "Known Issues" section from README. Lee Hambley
325
- * Dealy variable interpolation inside `as()` block. Nick Townsend
326
- * Fixes for functional tests under modern Vagrant. Lewis Marshal
327
- * Fixes for connection pooling. Chris Heald
328
- * Add `localhost` hostname to local backend. Adam Mckaig
329
- * Wrap execptions to include hostname. Brecht Hoflack
330
- * Remove `shellwords` stdlib dependency Bruno Sutic
331
- * Remove unused `cooldown` accessor. Bruno Sutic
332
- * Replace Term::ANSIColor with a lighter solution. Tom Clements
333
- * Documentation fixes. Matt Brictson
334
-
335
- ## 1.4.0
336
-
337
- https://github.com/capistrano/sshkit/compare/v1.3.0...v1.4.0
338
-
339
- * Removed `invoke` alias for [`SSHKit::Backend::Printer.execute`](https://github.com/capistrano/sshkit/blob/master/lib/sshkit/backends/printer.rb#L20). This is to prevent collisions with
340
- methods in capistrano with similar names, and to provide a cleaner API. See [capistrano issue 912](https://github.com/capistrano/capistrano/issues/912) and [issue 107](https://github.com/capistrano/sshkit/issues/107) for more details.
341
- * Connection pooling now uses a thread local to store connection pool, giving each thread its own connection pool. Thank you @mbrictson see [#101](https://github.com/capistrano/sshkit/pull/101) for more.
342
- * Command map indifferent towards strings and symbols thanks to @thomasfedb see [#91](https://github.com/capistrano/sshkit/pull/91)
343
- * Moved vagrant wrapper to `support` directory, added ability to run tests with vagrant using ssh. @miry see [#64](https://github.com/capistrano/sshkit/pull/64)
344
- * Removed unnecessary require `require_relative '../sshkit'` in `lib/sshkit/dsl.rb` prevents warnings thanks @brabic.
345
- * Doc fixes thanks @seanhandley @vojto
346
-
347
- ## 1.3.0
348
-
349
- https://github.com/capistrano/sshkit/compare/v1.2.0...v1.3.0
350
-
351
- * Connection pooling. SSH connections are reused across multiple invocations
352
- of `on()`, which can result in significant performance gains. See:
353
- https://github.com/capistrano/sshkit/pull/70. Matt @mbrictson Brictson.
354
- * Fixes to the Formatter::Dot and to the formatter class name resolver. @hab287:w
355
- * Added the license to the Gemspec. @anatol.
356
- * Fix :limit handling for the `in: :groups` run mode. Phil @phs Smith
357
- * Doc fixes @seanhandley, @sergey-alekseev.
358
-
359
- ## 1.2.0
360
-
361
- https://github.com/capistrano/sshkit/compare/v1.1.0...v1.2.0
362
-
363
- * Support picking up a project local SSH config file, if a SSH config file
364
- exists at ./.ssh/config it will be merged with the ~/.ssh/config. This is
365
- ideal for defining project-local proxies/gateways, etc. Thanks to Alex
366
- @0rca Vzorov.
367
- * Tests and general improvements to the Printer backends (mostly used
368
- internally). Thanks to Michael @miry Nikitochkin.
369
- * Update the net-scp dependency version. Thanks again to Michael @miry
370
- Nikitochkin.
371
- * Improved command map. This feature allows mapped variables to be pushed
372
- and unshifted onto the mapping so that the Capistrano extensions for
373
- rbenv and bundler, etc can work together. For discussion about the reasoning
374
- see https://github.com/capistrano/capistrano/issues/639 and
375
- https://github.com/capistrano/sshkit/pull/45. A big thanks to Kir @kirs
376
- Shatrov.
377
- * `test()` and `capture()` now behave as expected inside a `run_locally` block
378
- meaning that they now run on your local machine, rather than erring out. Thanks
379
- to Kentaro @kentaroi Imai.
380
- * The `:wait` option is now successfully passed to the runner now. Previously the
381
- `:wait` option was ignored. Thanks to Jordan @jhollinger Hollinger for catching
382
- the mistake in our test coverage.
383
- * Fixes and general improvements to the `download()` method which until now was
384
- quite naïve. Thanks to @chqr.
385
-
386
- ## 1.1.0
387
-
388
- https://github.com/capistrano/sshkit/compare/v1.0.0...v1.1.0
389
-
390
- * Please see the Git history. `git rebase` ate our changelog (we should have been
391
- more careful)
392
-
393
- ## 1.0.0
394
-
395
- * The gem now supports a run_locally, although it's nothing to do with SSH,
396
- it makes a nice API. There are examples in the EXAMPLES.md.
397
-
398
- ## 0.0.34
399
-
400
- * Allow the setting of global SSH options on the `backend.ssh` as a hash,
401
- these options are the same as Net::SSH configure expects. Thanks to Rafał
402
- @lisukorin Lisowski
403
-
404
- ## 0.0.32
405
-
406
- * Lots of small changes since 0.0.27.
407
- * Particularly working around a possible NaN issue when uploading
408
- comparatively large files.
409
-
410
- ## 0.0.27
411
-
412
- * Don't clobber SSH options with empty values. This allows Net::SSH to
413
- do the right thing most of the time, and look into the SSH configuration
414
- files.
415
-
416
- ## 0.0.26
417
-
418
- * Pretty output no longer prints white text. ("Command.....")
419
- * Fixed a double-output bug, where upon receiving the exit status from a
420
- remote command, the last data packet that it sent would be re-printed
421
- by the pretty formatter.
422
- * Integration tests now use an Ubuntu Precise 64 Vagrant base box.
423
- * Additional host declaration syntax, `SSHKit::Host` can now take a hash of
424
- host properties in addition to a number of new (common sense) DSN type
425
- syntaxes.
426
- * Changes to the constants used for logging, we no longer re-define a
427
- `Logger::TRACE` constant on the global `Logger` class, rather everyhing
428
- now uses `SSHKit::Logger` (Thanks to Rafa Garcia)
429
- * Various syntax and documentation fixes.
430
-
431
- ## 0.0.25
432
-
433
- * `upload!` and `download!` now log to different levels depending on
434
- completion percentage. When the upload is 0 percent complete or a number
435
- indivisible by 10, the message is logged to `Logger::DEBUG` otherwise the
436
- message is logged to `Logger::INFO`, this should mean that normal users at
437
- a sane log level should see upload progress jump to `100%` for small
438
- files, and otherwise for larger files they'll see output every `10%`.
439
-
440
- ## 0.0.24
441
-
442
- * Pretty output now streams stdout and stderr. Previous versions would
443
- append (`+=`) chunks of data written by the remote host to the `Command`
444
- instance, and the `Pretty` formatter would only print stdout/stderr if the
445
- command was `#complete?`. Historically this lead to issues where the
446
- remote process was blocking for input, had written the prompt to stdout,
447
- but it was not visible on the client side.
448
-
449
- Now each time the command is passed to the output stream, the
450
- stdout/stderr are replaced with the lines returned from the remote server
451
- in this chunk. (i.e were yielded to the callback block). Commands now have
452
- attribute accessors for `#full_stdout` and `#full_stderr` which are appended
453
- in the way that `#stdout` and `#stderr` were previously.
454
-
455
- This should be considered a private API, and one should beware of relying
456
- on `#full_stdout` or `#full_stderr`, they will likely be replaced with a
457
- cleaner soltion eventually.
458
-
459
- * `upload!` and `download!` now print progress reports at the `Logger::INFO`
460
- verbosity level.
461
-
462
- ## 0.0.23
463
-
464
- * Explicitly rely on `net-scp` gem.
465
-
466
- ## 0.0.22
467
-
468
- * Added naïve implementations of `upload!()` and `download!()` (syncoronous) to
469
- the Net::SSH backend. See `EXAMPLES.md` for more extensive usage examples.
470
-
471
- The `upload!()` method can take a filename, or an `IO`, this reflects the way
472
- the underlying Net::SCP implementation works. The same is true of
473
- `download!()`, when called with a single argument it captures the file's
474
- contents, otherwise it downloads the file to the local disk.
475
-
476
- on hosts do |host|
477
- upload!(StringIO.new('some-data-here'), '~/.ssh/authorized_keys')
478
- upload!('~/.ssh/id_rsa.pub', '~/.ssh/authorized_keys')
479
- puts download!('/etc/monit/monitrc')
480
- download!('/etc/monit/monitrc', '~/monitrc')
481
- end
482
-
483
- ## 0.0.21
484
-
485
- * Fixed an issue with default formatter
486
- * Modified `SSHKit.config.output_verbosity=` to accept different objects:
487
-
488
- SSHKit.config.output_verbosity = Logger::INFO
489
- SSHKit.config.output_verbosity = :info
490
- SSHKit.config.output_verbosity = 1
491
-
492
- ## 0.0.20
493
-
494
- * Fixed a bug where the log level would be assigned, not compared in the
495
- pretty formatter, breaking the remainder of the output verbosity.
496
-
497
- ## 0.0.19
498
-
499
- * Modified the `Pretty` formatter to include the log level in front of
500
- executed commands.
501
-
502
- * Modified the `Pretty` formatter not to print stdout and stderr by default,
503
- the log level must be raised to Logger::DEBUG to see the command outputs.
504
-
505
- * Modified the `Pretty` formatter to use `Command#to_s` when printing the
506
- command, this prints the short form (without modifications/wrappers applied
507
- to the command for users, groups, directories, umasks, etc).
508
-
509
- ## 0.0.18
510
-
511
- * Enable `as()` to take either a string/symbol as previously, but also now
512
- accepts a hash of `{user: ..., group: ...}`. In case that your host system
513
- supports the command `sg` (`man 1 sg`) to switch your effective group ID
514
- then one can work on files as a team group user.
515
-
516
- on host do |host|
517
- as user: :peter, group: griffin do
518
- execute :touch, 'somefile'
519
- end
520
- end
521
-
522
- will result in a file with the following permissions:
523
-
524
- -rw-r--r-- 1 peter griffin 0 Jan 27 08:12 somefile
525
-
526
- This should make it much easier to share deploy scripts between team
527
- members.
528
-
529
- **Note:** `sg` has some very strict user and group password requirements
530
- (the user may not have a password (`passwd username -l` to lock an account
531
- that already has a password), and the group may not have a password.)
532
-
533
- Additionally, and unsurprisingly *the user must also be a member of the
534
- group.*
535
-
536
- `sg` was chosen over `newgrp` as it's easier to embed in a one-liner
537
- command, `newgrp` could be used with a heredoc, but my research suggested
538
- that it might be better to use sg, as it better represents my intention, a
539
- temporary switch to a different effective group.
540
-
541
- * Fixed a bug with environmental variables and umasking introduced in 0.0.14.
542
- Since that version the environmental variables were being presented to the
543
- umask command's subshell, and not to intended command's subshell.
544
-
545
- incorrect: `ENV=var umask 002 && env`
546
- correct: `umask 002 && ENV=var env`
547
-
548
- * Changed the exception handler, if a command returns with a non-zero exit
549
- status then the output will be prefixed with the command name and which
550
- channel any output was written to, for example:
551
-
552
- Command.new("echo ping; false")
553
- => echo stdout: ping
554
- echo stderr: Nothing written
555
-
556
- In this contrived example that's more or less useless, however with badly
557
- behaved commands that write errors to stdout, and don't include their name
558
- in the program output, it can help a lot with debugging.
559
-
560
- ## 0.0.17
561
-
562
- * Fixed a bug introduced in 0.0.16 where the capture() helper returned
563
- the name of the command that had been run, not it's output.
564
-
565
- * Classify the pre-directory switch, and pre-user switch command guards
566
- as having a DEBUG log level to exclude them from the logs.
567
-
568
- ## 0.0.16
569
-
570
- * Fixed a bug introduced in 0.0.15 where the capture() helper returned
571
- boolean, discarding any output from the server.
572
-
573
- ## 0.0.15
574
-
575
- * `Command` now takes a `verbosity` option. This defaults to `Logger::INFO`
576
- and can be set to any of the Ruby logger level constants. You can also set
577
- it to the symbol `:debug` (and friends) which will be expanded into the correct
578
- constants.
579
-
580
- The log verbosity level is set to Logger::INFO by default, and can be
581
- overridden by setting `SSHKit.config.output_verbosity = Logger::{...}`,
582
- pick a level that works for you.
583
-
584
- By default `test()` and `capture()` calls are surpressed, and not printed
585
- by the pretty logger as of this version.
586
-
587
- ## 0.0.14
588
-
589
- * Umasks can now be set on `Command` instances. It can be set globally with
590
- `SSHKit.config.umask` (default, nil; meaning take the system default). This
591
- can be used to set, for example a umask of `007` for allowing users with
592
- the same primary group to share code without stepping on eachother's toes.
593
-
594
- ## 0.0.13
595
-
596
- * Correctly quote `as(user)` commands, previously it would expand to:
597
- `sudo su user -c /usr/bin/env echo "Hello World"`, in which the command to
598
- run was taken as simply `/usr/bin/env`. By quoting all arguments it should
599
- now work as expected. `sudo su user -c "/usr/bin/env echo \""Hello World\""`
600
-
601
- ## 0.0.12
602
-
603
- * Also print anything the program wrote to stdout when the exit status is
604
- non-zero and the command raises an error. (assits debugging badly behaved
605
- programs that fail, and write their error output to stdout.)
606
-
607
- ## 0.0.11
608
-
609
- * Implementing confuguration objects on the backends (WIP, undocumented)
610
- * Implement `SSHKit.config.default_env`, a hash which can be modified and
611
- will act as a global `with`.
612
- * Fixed #9 (with(a: 'b', c: 'c') being parsed as `A=bC=d`. Now properly space
613
- separated.
614
- * Fixed #10 (overly aggressive shell escaping), one can now do:
615
- `with(path: 'foo:$PATH') without the $ being escaped too early.
616
-
617
- ## 0.0.10
618
-
619
- * Include more attributes in `Command#to_hash`.
620
-
621
- ## 0.0.9
622
-
623
- * Include more attributes in `Command#to_hash`.
624
-
625
- ## 0.0.8
626
-
627
- * Added DSL method `background()` this sends a task to the background using
628
- `nohup` and redirects it's output to `/dev/null` so as to avoid littering
629
- the filesystem with `nohup.out` files.
630
-
631
- **Note:** Backgrounding a task won't work as you expect if you give it a
632
- string, that is you must do `background(:sleep, 5)` and not `background("sleep 5")`
633
- according to the rules by which a command is not processed in any way **if it
634
- contains a spaca character in it's first argument**.
635
-
636
- Usage Example:
637
-
638
- on hosts do
639
- background :rake, "assets:precompile" # typically takes 5 minutes!
640
- end
641
-
642
- **Further:** Many programs are badly behaved and no not work well with `nohup`
643
- it has to do with the way nohup works, reopening the processe's file
644
- descriptors and redirecting them. Programs that re-open, or otherwise
645
- manipulate their own file descriptors may lock up when the SSH session is
646
- disconnected, often they block writing to, or reading from stdin/out.
647
-
648
- ## 0.0.7
649
-
650
- * DSL method `execute()` will now raise `SSHKit::Command::Failed` when the
651
- exit status is non-zero. The message of the exception will be whatever the
652
- process had written to stdout.
653
- * New DSL method `test()` behaves as `execute()` used to until this version.
654
- * `Command` now raises an error in `#exit_status=()` if the exit status given
655
- is not zero. (see below)
656
- * All errors raised by error conditions of SSHKit are defined as subclasses of
657
- `SSHKit::StandardError` which is itself a subclass of `StandardError`.
658
-
659
- The `Command` objects can be set to not raise, by passing `raise_on_non_zero_exit: false`
660
- when instantiating them, this is exactly what `test()` does internally.
661
-
662
- Example:
663
-
664
- on hosts do |host
665
- if test "[ -d /opt/sites ]" do
666
- within "/opt/sites" do
667
- execute :git, :pull
668
- end
669
- else
670
- execute :git, :clone, 'some-repository', '/opt/sites'
671
- end
672
- end
673
-
674
- ## 0.0.6
675
-
676
- * Support arbitrary properties on Host objects. (see below)
677
-
678
- Starting with this version, the `Host` class supports arbitrary properties,
679
- here's a proposed use-case:
680
-
681
- servers = %w{one.example.com two.example.com
682
- three.example.com four.example.com}.collect do |s|
683
- h = SSHKit::Host.new(s)
684
- if s.match /(one|two)/
685
- h.properties.roles = [:web]
686
- else
687
- h.properties.roles = [:app]
688
- end
689
- end
690
-
691
- on servers do |host|
692
- if host.properties.roles.include?(:web)
693
- # Do something pertinent to web servers
694
- elsif host.properties.roles.include?(:app)
695
- # Do something pertinent to application servers
696
- end
697
- end
698
-
699
- Naturally, this is a contrived example, the `#properties` attribute on the
700
- Host instance is implemented as an [`OpenStruct`](http://ruby-doc.org/stdlib-1.9.3/libdoc/ostruct/rdoc/OpenStruct.html) and
701
- will behave exactly as such.
702
-
703
- ## 0.0.5
704
-
705
- * Removed configuration option `SSHKit.config.format` (see below)
706
- * Removed configuration option `SSHKit.config.runner` (see below)
707
-
708
- The format should now be set by doing:
709
-
710
- SSHKit.config.output = File.open('/dev/null')
711
- SSHKit.config.output = MyFormatterClass.new($stdout)
712
-
713
- The library ships with three formatters, `BlackHole`, `Dot` and `Pretty`.
714
-
715
- The default is `Pretty`, but can easily be changed:
716
-
717
- SSHKit.config.output = SSHKit::Formatter::Pretty.new($stdout)
718
- SSHKit.config.output = SSHKit::Formatter::Dot.new($stdout)
719
- SSHKit.config.output = SSHKit::Formatter::BlackHole.new($stdout)
720
-
721
- The one and only argument to the formatter is the *String/StringIO*ish object
722
- to which the output should be sent. (It should be possible to stack
723
- formatters, or build a multi-formatter to log, and stream to the screen, for
724
- example)
725
-
726
- The *runner* is now set by `default_options` on the Coordinator class. The
727
- default is still *:parallel*, and can be overridden on the `on()` (or
728
- `Coordinator#each`) calls directly.
729
-
730
- There is no global way to change the runner style for all `on()` calls as of
731
- version `0.0.5`.
732
-
733
- ## 0.0.4
734
-
735
- * Rename the ConnectionManager class to Coordinator, connections are handled
736
- in the backend, if it needs to create some connections.
737
-
738
- ## 0.0.3
739
-
740
- * Refactor the runner classes into an abstract heirarchy.
741
-
742
- ## 0.0.2
743
-
744
- * Include a *Pretty* formatter
745
- * Modify example to use Pretty formatter.
746
- * Move common behaviour to an abstract formatter.
747
- * Formatters no longer inherit StringIO
748
-
749
- ## 0.0.1
750
-
751
- First release.
752
-
753
- [Unreleased]: https://github.com/capistrano/sshkit/compare/v1.18.0...HEAD
754
- [1.18.0]: https://github.com/capistrano/sshkit/compare/v1.17.0...v1.18.0
755
- [1.17.0]: https://github.com/capistrano/sshkit/compare/v1.16.1...v1.17.0
756
- [1.16.1]: https://github.com/capistrano/sshkit/compare/v1.16.0...v1.16.1
757
- [1.16.0]: https://github.com/capistrano/sshkit/compare/v1.15.1...v1.16.0
758
- [1.15.1]: https://github.com/capistrano/sshkit/compare/v1.15.0...v1.15.1
759
- [1.15.0]: https://github.com/capistrano/sshkit/compare/v1.14.0...v1.15.0
760
- [1.14.0]: https://github.com/capistrano/sshkit/compare/v1.13.1...v1.14.0
761
- [1.13.1]: https://github.com/capistrano/sshkit/compare/v1.13.0...v1.13.1
762
- [1.13.0]: https://github.com/capistrano/sshkit/compare/v1.12.0...v1.13.0
763
- [1.12.0]: https://github.com/capistrano/sshkit/compare/v1.11.5...v1.12.0
764
- [1.11.5]: https://github.com/capistrano/sshkit/compare/v1.11.4...v1.11.5
765
- [1.11.4]: https://github.com/capistrano/sshkit/compare/v1.11.3...v1.11.4
766
- [1.11.3]: https://github.com/capistrano/sshkit/compare/v1.11.2...v1.11.3
767
- [1.11.2]: https://github.com/capistrano/sshkit/compare/v1.11.1...v1.11.2
768
- [1.11.1]: https://github.com/capistrano/sshkit/compare/v1.11.0...v1.11.1
769
- [1.11.0]: https://github.com/capistrano/sshkit/compare/v1.10.0...v1.11.0
1
+ Release notes for this project are kept here: https://github.com/capistrano/sshkit/releases