-
Notifications
You must be signed in to change notification settings - Fork 254
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
EXAMPLES.md corrections #527
Changes from all commits
8ee3341
3bde5d5
7d5feb0
735b8c5
b12e74e
99a5245
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,9 +121,6 @@ on hosts do |host| | |
end | ||
``` | ||
|
||
**Note:** The `upload!()` method doesn't honor the values of `as()` etc, this | ||
will be improved as the library matures, but we're not there yet. | ||
|
||
## Upload a file from a stream | ||
|
||
```ruby | ||
|
@@ -148,9 +145,6 @@ end | |
This spares one from having to figure out the correct escaping sequences for | ||
something like "echo(:cat, '...?...', '> /etc/sudoers.d/yolo')". | ||
|
||
**Note:** The `upload!()` method doesn't honor the values of `within()`, `as()` | ||
etc, this will be improved as the library matures, but we're not there yet. | ||
|
||
## Upload a directory of files | ||
|
||
```ruby | ||
|
@@ -160,7 +154,8 @@ end | |
``` | ||
|
||
In this case the `recursive: true` option mirrors the same options which are | ||
available to [`Net::{SCP,SFTP}`](http://net-ssh.github.io/net-scp/). | ||
available to [`Net::SCP`](https://github.com/net-ssh/net-scp) and | ||
[`Net::SFTP`](https://github.com/net-ssh/net-sftp). | ||
|
||
## Set the upload/download method (SCP or SFTP). | ||
|
||
|
@@ -252,16 +247,16 @@ end | |
|
||
```ruby | ||
# The default format is pretty, which outputs colored text | ||
SSHKit.config.format = :pretty | ||
SSHKit.config.use_format :pretty | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These appeared to have never been updated in 2cb6326. |
||
|
||
# Text with no coloring | ||
SSHKit.config.format = :simpletext | ||
SSHKit.config.use_format :simpletext | ||
|
||
# Red / Green dots for each completed step | ||
SSHKit.config.format = :dot | ||
SSHKit.config.use_format :dot | ||
|
||
# No output | ||
SSHKit.config.format = :blackhole | ||
SSHKit.config.use_format :blackhole | ||
``` | ||
|
||
## Implement a dirt-simple formatter class | ||
|
@@ -271,7 +266,7 @@ module SSHKit | |
module Formatter | ||
class MyFormatter < SSHKit::Formatter::Abstract | ||
def write(obj) | ||
case obj.is_a? SSHKit::Command | ||
if obj.is_a? SSHKit::Command | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At least with Ruby 3.2.2, this
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! |
||
# Do something here, see the SSHKit::Command documentation | ||
end | ||
end | ||
|
@@ -280,7 +275,7 @@ module SSHKit | |
end | ||
|
||
# If your formatter is defined in the SSHKit::Formatter module configure with the format option: | ||
SSHKit.config.format = :myformatter | ||
SSHKit.config.use_format :myformatter | ||
|
||
# Or configure the output directly | ||
SSHKit.config.output = MyFormatter.new($stdout) | ||
|
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 (and the above) appeared to be inaccurate based on my testing of #524.