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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bebf3a96075e905b11a3f52b5e75064e49f5d710c375ae2c39c7bbd93b7d76bd
4
- data.tar.gz: e8d9ab9ec716df400ce730ebc82c74a32c23c83e0edc52b778e74a5cba8055ee
3
+ metadata.gz: f40ad7a1382ef707a259094c945692f08c44392e0bba7c37fe4099e748301a5e
4
+ data.tar.gz: 72f3fea395eaaa0036dd701c04692e75c379867465cffaa4ac6cdf1c4f647813
5
5
  SHA512:
6
- metadata.gz: e91cf1cbcff6c0dfaef0f2a05a6843f5312f8091b6b55fbc24022cc4e688c29fce690ac09d3b6cb33a9e8c42ba6bcb1441479f5fdf40d111f862ff55bb3b9122
7
- data.tar.gz: 3e50dc789ef3dff1ecd3041f89c332bc5883157c9ab2f007148e0c025f47f3a2941bab046661f45dcaa5f4880493674d34ff142df660f19a7eaf82b0c9e5da41
6
+ metadata.gz: ab28074eba7cb9bdbfcbca9857f5e74fc89ed06acdf872148fcb7329b45754a714c658dacd879fead076de3bbd2541d84bcfd8ef66369007a1444b3edc2b3ac3
7
+ data.tar.gz: a6d0deb01db101ba2a41dcfcd861a10c7604b17ebe5e25981eebe6d74a0b5c9a9ea345d2dcbb45a4ba30952b571b6736f3bdcd7721d7d8fe684db772cc723700
@@ -0,0 +1,6 @@
1
+ FROM ubuntu:22.04
2
+ WORKDIR /provision
3
+ COPY ./ubuntu_setup.sh ./
4
+ RUN ./ubuntu_setup.sh
5
+ EXPOSE 22
6
+ CMD ["/usr/sbin/sshd", "-D"]
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ export DEBIAN_FRONTEND=noninteractive
6
+ apt -y update
7
+
8
+ # Create `deployer` user that can sudo without a password
9
+ apt-get -y install sudo
10
+ adduser --disabled-password deployer < /dev/null
11
+ echo "deployer:topsecret" | chpasswd
12
+ echo "deployer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
13
+
14
+ # Install and configure sshd
15
+ apt-get -y install openssh-server
16
+ {
17
+ echo "Port 22"
18
+ echo "PasswordAuthentication yes"
19
+ echo "ChallengeResponseAuthentication no"
20
+ } >> /etc/ssh/sshd_config
21
+ mkdir /var/run/sshd
22
+ chmod 0755 /var/run/sshd
@@ -0,0 +1,16 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: monthly
7
+ open-pull-requests-limit: 10
8
+ ignore:
9
+ - dependency-name: rubocop
10
+ versions:
11
+ - "> 0.49.1"
12
+ - package-ecosystem: "github-actions"
13
+ directory: "/"
14
+ schedule:
15
+ interval: monthly
16
+ open-pull-requests-limit: 10
@@ -0,0 +1,25 @@
1
+ name-template: "$RESOLVED_VERSION"
2
+ tag-template: "v$RESOLVED_VERSION"
3
+ categories:
4
+ - title: "⚠️ Breaking Changes"
5
+ label: "⚠️ Breaking"
6
+ - title: "✨ New Features"
7
+ label: "✨ Feature"
8
+ - title: "🐛 Bug Fixes"
9
+ label: "🐛 Bug Fix"
10
+ - title: "📚 Documentation"
11
+ label: "📚 Docs"
12
+ - title: "🏠 Housekeeping"
13
+ label: "🏠 Housekeeping"
14
+ version-resolver:
15
+ minor:
16
+ labels:
17
+ - "⚠️ Breaking"
18
+ - "✨ Feature"
19
+ default: patch
20
+ change-template: "- $TITLE (#$NUMBER) @$AUTHOR"
21
+ no-changes-template: "- No changes"
22
+ template: |
23
+ $CHANGES
24
+
25
+ **Full Changelog:** https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
@@ -0,0 +1,98 @@
1
+ name: test on CI
2
+ on:
3
+ push:
4
+ branches: [master]
5
+ pull_request:
6
+ jobs:
7
+ test:
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ matrix:
11
+ ruby:
12
+ [
13
+ "2.3",
14
+ "2.4",
15
+ "2.5",
16
+ "2.6",
17
+ "2.7",
18
+ "3.0",
19
+ "3.1",
20
+ "3.2",
21
+ "3.3",
22
+ "head",
23
+ ]
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby }}
30
+ bundler-cache: true
31
+ - name: Run tests
32
+ run: bundle exec rake test:units
33
+
34
+ test-legacy:
35
+ runs-on: ubuntu-20.04
36
+ strategy:
37
+ matrix:
38
+ ruby: ["2.0", "2.1", "2.2"]
39
+ steps:
40
+ - uses: actions/checkout@v4
41
+ - name: Set up Ruby
42
+ uses: ruby/setup-ruby@v1
43
+ with:
44
+ ruby-version: ${{ matrix.ruby }}
45
+ bundler-cache: true
46
+ - name: Run tests
47
+ run: bundle exec rake test:units
48
+
49
+ test-all:
50
+ runs-on: ubuntu-latest
51
+ needs: [test, test-legacy]
52
+ if: always()
53
+ steps:
54
+ - name: All tests ok
55
+ if: ${{ !(contains(needs.*.result, 'failure')) }}
56
+ run: exit 0
57
+ - name: Some tests failed
58
+ if: ${{ contains(needs.*.result, 'failure') }}
59
+ run: exit 1
60
+
61
+ rubocop:
62
+ runs-on: ubuntu-latest
63
+ steps:
64
+ - uses: actions/checkout@v4
65
+ - name: Set up Ruby
66
+ uses: ruby/setup-ruby@v1
67
+ with:
68
+ ruby-version: "2.7"
69
+ bundler-cache: true
70
+ - name: Run rubocop
71
+ run: bundle exec rake lint
72
+
73
+ functional:
74
+ runs-on: ubuntu-latest
75
+ strategy:
76
+ matrix:
77
+ ruby: ["2.0", "ruby"]
78
+ steps:
79
+ - uses: actions/checkout@v4
80
+ - name: Set up Ruby
81
+ uses: ruby/setup-ruby@v1
82
+ with:
83
+ ruby-version: ${{ matrix.ruby }}
84
+ bundler-cache: true
85
+ - name: Run functional tests
86
+ run: bundle exec rake test:functional
87
+
88
+ functional-all:
89
+ runs-on: ubuntu-latest
90
+ needs: [functional]
91
+ if: always()
92
+ steps:
93
+ - name: All tests ok
94
+ if: ${{ !(contains(needs.*.result, 'failure')) }}
95
+ run: exit 0
96
+ - name: Some tests failed
97
+ if: ${{ contains(needs.*.result, 'failure') }}
98
+ run: exit 1
@@ -0,0 +1,12 @@
1
+ on: push
2
+ name: Push
3
+ jobs:
4
+ draftRelease:
5
+ name: Draft Release
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@master
9
+ - name: Draft Release
10
+ uses: toolmantim/release-drafter@v6.0.0
11
+ env:
12
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
data/.gitignore CHANGED
@@ -3,6 +3,5 @@
3
3
  bin/rake
4
4
  .bundle
5
5
  .yardoc
6
- .vagrant*
7
6
  test/tmp
8
7
  Gemfile.lock
data/.rubocop.yml ADDED
@@ -0,0 +1,63 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ DisplayCopNames: true
5
+ DisplayStyleGuide: true
6
+ TargetRubyVersion: 2.0
7
+
8
+ Lint/AmbiguousBlockAssociation:
9
+ Enabled: false
10
+ Metrics/BlockLength:
11
+ Exclude:
12
+ - "sshkit.gemspec"
13
+ - "spec/**/*"
14
+ - "lib/**/*.rake"
15
+ Style/BarePercentLiterals:
16
+ EnforcedStyle: percent_q
17
+ Style/ClassAndModuleChildren:
18
+ Enabled: false
19
+ Style/DoubleNegation:
20
+ Enabled: false
21
+ Style/FileName:
22
+ Exclude:
23
+ - "Dangerfile"
24
+ Style/IndentHeredoc:
25
+ Enabled: false
26
+ Style/SpaceAroundEqualsInParameterDefault:
27
+ EnforcedStyle: no_space
28
+ Style/StringLiterals:
29
+ EnforcedStyle: double_quotes
30
+ Style/TrivialAccessors:
31
+ AllowPredicates: true
32
+ Style/PercentLiteralDelimiters:
33
+ Enabled: false
34
+ Style/SingleLineBlockParams:
35
+ Enabled: false
36
+ Style/ModuleFunction:
37
+ Enabled: false
38
+
39
+ # Enable someday
40
+ Style/Documentation:
41
+ Enabled: false
42
+
43
+ # Needs refactors
44
+ Metrics/PerceivedComplexity:
45
+ Enabled: false
46
+ Metrics/CyclomaticComplexity:
47
+ Enabled: false
48
+ Metrics/MethodLength:
49
+ Enabled: false
50
+ Style/PredicateName:
51
+ Enabled: false
52
+ Metrics/LineLength:
53
+ Enabled: false
54
+ Metrics/AbcSize:
55
+ Enabled: false
56
+ Style/PerlBackrefs:
57
+ Enabled: false
58
+ Metrics/ClassLength:
59
+ Enabled: false
60
+ Metrics/ModuleLength:
61
+ Enabled: false
62
+ Style/AccessorMethodName:
63
+ Enabled: false