net-scp 4.1.3 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -3
- data/CHANGES.txt +10 -0
- data/README.md +5 -0
- data/lib/net/scp/version.rb +2 -2
- data/lib/net/scp.rb +34 -5
- data.tar.gz.sig +0 -0
- metadata +3 -17
- metadata.gz.sig +0 -0
- data/.github/pull_request_template.md +0 -1
- data/.github/workflows/changelog.yml +0 -18
- data/.github/workflows/ci.yml +0 -40
- data/.gitignore +0 -14
- data/CONTRIBUTING.md +0 -33
- data/Gemfile +0 -22
- data/Manifest +0 -17
- data/Rakefile +0 -185
- data/SECURITY.md +0 -4
- data/changelog.d/README.md +0 -1
- data/gemfiles/legacy.gemfile +0 -7
- data/net-scp-public_cert.pem +0 -21
- data/net-scp.gemspec +0 -50
- data/setup.rb +0 -1331
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee8ac18a34abb6482265e9cef492d7a2988d821feeda9bd25b13158ae9676987
|
|
4
|
+
data.tar.gz: b35016e03ea18a6a707e6c9f0236930db49fe6ba33e2e675b910b6913f525419
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d3a721c9a2310e338dc12f6f06bc712a3b0961f3236de4f69584541c04b2b4b83caf26954b104b8b4a834a93e8e5a4e50167057d7d9d238455d2012f6754ada6
|
|
7
|
+
data.tar.gz: aa7d1a69eeb9d67f622ca4af00576c91938bc39c68ce23e57a70b7ff2f156ec3337ecbc0c6fa4edf52780ce1a0ea95e8090e1fd53a23be42e46e86b675dcf8b2
|
checksums.yaml.gz.sig
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
�
|
|
1
|
+
Y�A�F�$E����
|
|
2
|
+
�w��<��
|
data/CHANGES.txt
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
=== 4.2.1
|
|
2
|
+
|
|
3
|
+
* Add a `:limit` option to `upload`/`download` to cap bandwidth in Kbit/s, like `scp -l`. Based on #53 by @marcelrouw [#119, #53]
|
|
4
|
+
|
|
5
|
+
=== 4.2.0
|
|
6
|
+
|
|
7
|
+
* BREAKING: Require Ruby 2.6 or later. Bundler on Ruby 2.3-2.5 resolves to 4.1.3. [#114]
|
|
8
|
+
* Package only `lib`, `CHANGES.txt`, `LICENSE.txt` and `README.md` in the gem, about 40% smaller. Thanks @yuri-zubov [#118]
|
|
9
|
+
* An exception raised during a transfer, such as `upload!` of a missing local file or an error from a progress callback, no longer leaves the channel registered and re-raises on later operations on the same session; the original error is raised once, library-opened files are closed and caller-passed IO is left open. Thanks @ThomasSevestre and @OskarEichler [#107, #26, #97]
|
|
10
|
+
|
|
1
11
|
=== 4.1.3
|
|
2
12
|
|
|
3
13
|
* Load again on Ruby 2.3-2.5 (4.1.2 needed 2.5), and declare `required_ruby_version >= 2.3` [#112, #110]
|
data/README.md
CHANGED
|
@@ -47,6 +47,11 @@ Net::SCP.download!("remote.host.com", "username",
|
|
|
47
47
|
"/remote/path", "/local/path",
|
|
48
48
|
:ssh => { :password => "password" })
|
|
49
49
|
|
|
50
|
+
# download with the bandwidth limited to 400 Kbit/s, like `scp -l 400`
|
|
51
|
+
Net::SCP.download!("remote.host.com", "username",
|
|
52
|
+
"/remote/path", "/local/path",
|
|
53
|
+
:ssh => { :password => "password" }, :limit => 400)
|
|
54
|
+
|
|
50
55
|
# download a file to an in-memory buffer
|
|
51
56
|
data = Net::SCP::download!("remote.host.com", "username", "/remote/path")
|
|
52
57
|
|
data/lib/net/scp/version.rb
CHANGED
|
@@ -49,10 +49,10 @@ module Net
|
|
|
49
49
|
MAJOR = 4
|
|
50
50
|
|
|
51
51
|
# The minor component of this version of the Net::SSH library
|
|
52
|
-
MINOR =
|
|
52
|
+
MINOR = 2
|
|
53
53
|
|
|
54
54
|
# The tiny component of this version of the Net::SSH library
|
|
55
|
-
TINY =
|
|
55
|
+
TINY = 1
|
|
56
56
|
|
|
57
57
|
# The prerelease component of this version of the Net::SSH library
|
|
58
58
|
# nil allowed
|
data/lib/net/scp.rb
CHANGED
|
@@ -94,6 +94,7 @@ module Net
|
|
|
94
94
|
# be sent to indicate the modification and access times of each file.
|
|
95
95
|
# * "-r" -- recursive transfers should be allowed. Without this, it is an
|
|
96
96
|
# error to upload or download a directory.
|
|
97
|
+
# * "-l" -- limit the bandwidth used by the transfer, in Kbit/s.
|
|
97
98
|
#
|
|
98
99
|
# After those flags, the name of the remote file/directory should be passed
|
|
99
100
|
# as the sole non-switch argument to scp.
|
|
@@ -267,6 +268,8 @@ module Net
|
|
|
267
268
|
# * :chunk_size - the size of each "chunk" that should be sent. Defaults
|
|
268
269
|
# to 2048. Changing this value may improve throughput at the expense
|
|
269
270
|
# of decreasing interactivity.
|
|
271
|
+
# * :limit - the bandwidth limit in Kbit/s, a positive Integer, like
|
|
272
|
+
# <tt>scp -l</tt>. The remote scp enforces it.
|
|
270
273
|
# * :quote - how +remote+ is quoted in the scp command run by the remote
|
|
271
274
|
# shell. :posix (the default) escapes it for a POSIX shell, leaving a
|
|
272
275
|
# leading "~" or "~/" unescaped so it expands to the remote home
|
|
@@ -309,6 +312,7 @@ module Net
|
|
|
309
312
|
# * :preserve - the atime and mtime of the file should be preserved.
|
|
310
313
|
# * :verbose - the process should result in verbose output on the server
|
|
311
314
|
# end (useful for debugging).
|
|
315
|
+
# * :limit - the bandwidth limit in Kbit/s (see #upload).
|
|
312
316
|
# * :quote - how +remote+ is quoted for the remote shell (see #upload).
|
|
313
317
|
#
|
|
314
318
|
# This method will return immediately, returning the Net::SSH::Connection::Channel
|
|
@@ -343,7 +347,7 @@ module Net
|
|
|
343
347
|
|
|
344
348
|
# Constructs the scp command line needed to initiate and SCP session
|
|
345
349
|
# for the given +mode+ (:upload or :download) and with the given options
|
|
346
|
-
# (:verbose, :recursive, :preserve). Returns the command-line as a
|
|
350
|
+
# (:verbose, :recursive, :preserve, :limit). Returns the command-line as a
|
|
347
351
|
# string, ready to execute.
|
|
348
352
|
def scp_command(mode, options)
|
|
349
353
|
command = +"scp "
|
|
@@ -351,6 +355,11 @@ module Net
|
|
|
351
355
|
command << " -v" if options[:verbose]
|
|
352
356
|
command << " -r" if options[:recursive]
|
|
353
357
|
command << " -p" if options[:preserve]
|
|
358
|
+
limit = options[:limit]
|
|
359
|
+
unless limit.nil?
|
|
360
|
+
raise ArgumentError, ":limit must be a positive Integer" unless limit.is_a?(Integer) && limit > 0
|
|
361
|
+
command << " -l #{limit}"
|
|
362
|
+
end
|
|
354
363
|
command
|
|
355
364
|
end
|
|
356
365
|
|
|
@@ -381,8 +390,10 @@ module Net
|
|
|
381
390
|
|
|
382
391
|
channel.on_close do
|
|
383
392
|
begin
|
|
393
|
+
next if channel[:aborted]
|
|
394
|
+
|
|
384
395
|
# The close can be dispatched before on_process has consumed data that arrived with it.
|
|
385
|
-
|
|
396
|
+
process_state(channel)
|
|
386
397
|
# If we got an exit-status and it is not 0, something went wrong
|
|
387
398
|
if !channel[:exit].nil? && channel[:exit] != 0
|
|
388
399
|
raise Net::SCP::Error, 'SCP did not finish successfully ' \
|
|
@@ -395,14 +406,13 @@ module Net
|
|
|
395
406
|
raise Net::SCP::Error, message
|
|
396
407
|
end
|
|
397
408
|
ensure
|
|
398
|
-
|
|
399
|
-
io.close if io && io != channel[:local] && !io.closed?
|
|
409
|
+
close_owned_io(channel)
|
|
400
410
|
end
|
|
401
411
|
end
|
|
402
412
|
channel.on_data { |ch2, data| channel[:buffer].append(data) }
|
|
403
413
|
channel.on_extended_data { |ch2, type, data| debug { data.chomp } }
|
|
404
414
|
channel.on_request("exit-status") { |ch2, data| channel[:exit] = data.read_long }
|
|
405
|
-
channel.on_process {
|
|
415
|
+
channel.on_process { process_state(channel) unless channel[:aborted] }
|
|
406
416
|
else
|
|
407
417
|
channel.close
|
|
408
418
|
raise Net::SCP::Error, "could not exec scp on the remote host"
|
|
@@ -411,6 +421,25 @@ module Net
|
|
|
411
421
|
end
|
|
412
422
|
end
|
|
413
423
|
|
|
424
|
+
# Runs the action for the current state. If it raises, the transfer is
|
|
425
|
+
# aborted and the channel closed, so the error surfaces once and the
|
|
426
|
+
# session stays usable.
|
|
427
|
+
def process_state(channel)
|
|
428
|
+
send("#{channel[:state]}_state", channel)
|
|
429
|
+
rescue Exception
|
|
430
|
+
channel[:aborted] = true
|
|
431
|
+
close_owned_io(channel)
|
|
432
|
+
channel.close
|
|
433
|
+
raise
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
# Closes the IO opened by the library; an IO passed in by the caller is
|
|
437
|
+
# left open.
|
|
438
|
+
def close_owned_io(channel)
|
|
439
|
+
io = channel[:io]
|
|
440
|
+
io.close if io && io != channel[:local] && !io.closed?
|
|
441
|
+
end
|
|
442
|
+
|
|
414
443
|
# Causes the state machine to enter the "await response" state, where
|
|
415
444
|
# things just pause until the server replies with a 0 (see
|
|
416
445
|
# #await_response_state), at which point the state machine will pick up
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: net-scp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.1
|
|
4
|
+
version: 4.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jamis Buck
|
|
@@ -32,7 +32,7 @@ cert_chain:
|
|
|
32
32
|
vNiMFH5yLu/tlav4xh+HlYscWVdFQIvd7f/Uxa+Vip1Pi16wmhnrE15z/vDX921v
|
|
33
33
|
hukBRIoCEAuUgNVBh+L/C8aETzbf/77WU3Si/w==
|
|
34
34
|
-----END CERTIFICATE-----
|
|
35
|
-
date: 2026-
|
|
35
|
+
date: 2026-11-02 00:00:00.000000000 Z
|
|
36
36
|
dependencies:
|
|
37
37
|
- !ruby/object:Gem::Dependency
|
|
38
38
|
name: net-ssh
|
|
@@ -91,20 +91,9 @@ extra_rdoc_files:
|
|
|
91
91
|
- LICENSE.txt
|
|
92
92
|
- README.md
|
|
93
93
|
files:
|
|
94
|
-
- ".github/pull_request_template.md"
|
|
95
|
-
- ".github/workflows/changelog.yml"
|
|
96
|
-
- ".github/workflows/ci.yml"
|
|
97
|
-
- ".gitignore"
|
|
98
94
|
- CHANGES.txt
|
|
99
|
-
- CONTRIBUTING.md
|
|
100
|
-
- Gemfile
|
|
101
95
|
- LICENSE.txt
|
|
102
|
-
- Manifest
|
|
103
96
|
- README.md
|
|
104
|
-
- Rakefile
|
|
105
|
-
- SECURITY.md
|
|
106
|
-
- changelog.d/README.md
|
|
107
|
-
- gemfiles/legacy.gemfile
|
|
108
97
|
- lib/net/scp.rb
|
|
109
98
|
- lib/net/scp/download.rb
|
|
110
99
|
- lib/net/scp/errors.rb
|
|
@@ -112,9 +101,6 @@ files:
|
|
|
112
101
|
- lib/net/scp/version.rb
|
|
113
102
|
- lib/uri/open-scp.rb
|
|
114
103
|
- lib/uri/scp.rb
|
|
115
|
-
- net-scp-public_cert.pem
|
|
116
|
-
- net-scp.gemspec
|
|
117
|
-
- setup.rb
|
|
118
104
|
homepage: https://github.com/net-ssh/net-scp
|
|
119
105
|
licenses:
|
|
120
106
|
- MIT
|
|
@@ -128,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
128
114
|
requirements:
|
|
129
115
|
- - ">="
|
|
130
116
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '2.
|
|
117
|
+
version: '2.6'
|
|
132
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
119
|
requirements:
|
|
134
120
|
- - ">="
|
metadata.gz.sig
CHANGED
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!-- After opening the PR, add a changelog.d/<PR number>.<type>.txt fragment (none, change, security, breaking or breaking-security) instead of editing CHANGES.txt; see CONTRIBUTING.md#changelog. -->
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
name: Changelog
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
types: [opened, synchronize, reopened, labeled, unlabeled]
|
|
6
|
-
|
|
7
|
-
permissions:
|
|
8
|
-
contents: read
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
changelog:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v4
|
|
15
|
-
with:
|
|
16
|
-
# HEAD is the PR merged into the base branch; HEAD^1 is the base it was merged into.
|
|
17
|
-
fetch-depth: 2
|
|
18
|
-
- uses: net-ssh/changelogd@v1
|
data/.github/workflows/ci.yml
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on:
|
|
3
|
-
pull_request:
|
|
4
|
-
push: { branches: master }
|
|
5
|
-
permissions:
|
|
6
|
-
contents: read
|
|
7
|
-
jobs:
|
|
8
|
-
test:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
strategy:
|
|
11
|
-
fail-fast: false
|
|
12
|
-
matrix:
|
|
13
|
-
ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4', '4.0', 'ruby-head']
|
|
14
|
-
continue-on-error: ${{ matrix.ruby-version == 'ruby-head' }}
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v3
|
|
17
|
-
- name: Set up Ruby ${{ matrix.ruby-version }}
|
|
18
|
-
uses: ruby/setup-ruby@v1
|
|
19
|
-
with:
|
|
20
|
-
ruby-version: ${{ matrix.ruby-version }}
|
|
21
|
-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
22
|
-
- name: Run Tests
|
|
23
|
-
run: bundle exec rake test
|
|
24
|
-
env:
|
|
25
|
-
RUBYOPT: "--enable=frozen_string_literal"
|
|
26
|
-
test-legacy:
|
|
27
|
-
runs-on: ubuntu-latest
|
|
28
|
-
strategy:
|
|
29
|
-
fail-fast: false
|
|
30
|
-
matrix:
|
|
31
|
-
ruby-version: ['2.3', '2.4', '2.5']
|
|
32
|
-
steps:
|
|
33
|
-
- uses: actions/checkout@v3
|
|
34
|
-
# Plain docker run rather than container: the ruby:2.3/2.4 images' glibc is too old for the actions' Node.
|
|
35
|
-
# Not rake test: the Rakefile loads changelogd, which these Rubies can't install.
|
|
36
|
-
# No frozen_string_literal: net-ssh 6 mutates string literals.
|
|
37
|
-
- name: Run Tests
|
|
38
|
-
run: >-
|
|
39
|
-
docker run --rm -v "$PWD:/w" -w /w -e BUNDLE_GEMFILE=gemfiles/legacy.gemfile ruby:${{ matrix.ruby-version }}
|
|
40
|
-
sh -c 'bundle install --jobs 4 && bundle exec ruby -Ilib -Itest -e "Dir.glob(\"./test/test_*.rb\").each { |f| require f }"'
|
data/.gitignore
DELETED
data/CONTRIBUTING.md
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Contributing to net-scp
|
|
2
|
-
|
|
3
|
-
Run the tests with `bundle exec rake test`.
|
|
4
|
-
|
|
5
|
-
## Changelog
|
|
6
|
-
|
|
7
|
-
Don't edit `CHANGES.txt`. Instead, add a fragment file to `changelog.d/` in your PR; the release's version bump (`rake vbump:*`) moves all fragments into a new `=== <version>` section at the top of `CHANGES.txt` and deletes them.
|
|
8
|
-
|
|
9
|
-
A fragment is named `<number>.<type>.txt`, where `<number>` is the PR number (so open the PR first, then add the fragment), and contains a single UTF-8 paragraph: the entry as it should read in `CHANGES.txt`, without the bullet or prefix. Lines are joined, so it can be wrapped. If it doesn't end with a reference list such as `[#95, #101]` or `[GHSA-xxxx-xxxx-xxxx]`, ` [#<number>]` is appended.
|
|
10
|
-
|
|
11
|
-
| Type | Written as | Use for |
|
|
12
|
-
| ------------------- | ------------------------------ | ------------------------------------------------------------ |
|
|
13
|
-
| `breaking-security` | `* BREAKING: Security: <text>` | an incompatible change made for security |
|
|
14
|
-
| `breaking` | `* BREAKING: <text>` | an incompatible change |
|
|
15
|
-
| `security` | `* Security: <text>` | a security fix or hardening |
|
|
16
|
-
| `change` | `* <text>` | any other user-visible fix or feature |
|
|
17
|
-
| `none` | nothing | PRs with no user-visible change (tests, CI, docs, refactors) |
|
|
18
|
-
|
|
19
|
-
Examples:
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
rake "changelog:new[102,change,Fixed uploading files with spaces in their names]"
|
|
23
|
-
# changelog.d/102.change.txt -> * Fixed uploading files with spaces in their names [#102]
|
|
24
|
-
|
|
25
|
-
echo 'Refuse downloads that write outside the target directory [GHSA-xxxx-xxxx-xxxx]' > changelog.d/103.security.txt
|
|
26
|
-
touch changelog.d/104.none.txt
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
For several entries from one PR add a suffix: `102.change.txt`, `102.change.2.txt` (`changelog:new` picks the next free one).
|
|
30
|
-
|
|
31
|
-
`rake changelog:check` validates the fragments and `rake changelog:preview` prints the section the next release would add. CI fails a PR that edits `CHANGES.txt` or doesn't add or modify a `changelog.d/<PR number>.<type>.txt` fragment, unless it only touches `changelog.d/` or a maintainer adds the `skip-changelog` label; Dependabot PRs are skipped.
|
|
32
|
-
|
|
33
|
-
The full rules, including how a release orders the entries, are in the [changelogd README](https://github.com/net-ssh/changelogd#readme).
|
data/Gemfile
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
# Specify your gem's dependencies in mygem.gemspec
|
|
4
|
-
gemspec
|
|
5
|
-
|
|
6
|
-
gem "net-ssh", ">= 7.3.1"
|
|
7
|
-
gem "logger" # no longer a default gem in Ruby 4.0+
|
|
8
|
-
|
|
9
|
-
# TODO: add to gemspec
|
|
10
|
-
gem "bundler", ">= 1.11"
|
|
11
|
-
gem "rake", ">= 12.0"
|
|
12
|
-
gem "rdoc"
|
|
13
|
-
|
|
14
|
-
# git: rather than github:, which Bundler 1.x (the publish workflow uses 1.17.3) expands to an unsupported git:// URL.
|
|
15
|
-
gem "changelogd", git: "https://github.com/net-ssh/changelogd.git", tag: "v1", group: :development
|
|
16
|
-
|
|
17
|
-
gem 'byebug', group: %i[development test] if !Gem.win_platform? && RUBY_ENGINE == "ruby"
|
|
18
|
-
|
|
19
|
-
if ENV["CI"]
|
|
20
|
-
gem 'codecov', require: false, group: :test
|
|
21
|
-
gem 'simplecov', require: false, group: :test
|
|
22
|
-
end
|
data/Manifest
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
CHANGELOG.rdoc
|
|
2
|
-
lib/net/scp/download.rb
|
|
3
|
-
lib/net/scp/errors.rb
|
|
4
|
-
lib/net/scp/upload.rb
|
|
5
|
-
lib/net/scp/version.rb
|
|
6
|
-
lib/net/scp.rb
|
|
7
|
-
lib/uri/open-scp.rb
|
|
8
|
-
lib/uri/scp.rb
|
|
9
|
-
Rakefile
|
|
10
|
-
README.md
|
|
11
|
-
setup.rb
|
|
12
|
-
test/common.rb
|
|
13
|
-
test/test_all.rb
|
|
14
|
-
test/test_download.rb
|
|
15
|
-
test/test_scp.rb
|
|
16
|
-
test/test_upload.rb
|
|
17
|
-
Manifest
|
data/Rakefile
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
require "rubygems"
|
|
2
|
-
require "rake"
|
|
3
|
-
require "rake/clean"
|
|
4
|
-
begin
|
|
5
|
-
require "rdoc/task"
|
|
6
|
-
rescue LoadError
|
|
7
|
-
end
|
|
8
|
-
require "bundler/gem_tasks"
|
|
9
|
-
|
|
10
|
-
desc "When releasing make sure NET_SSH_BUILDGEM_SIGNED is set"
|
|
11
|
-
task :check_NET_SSH_BUILDGEM_SIGNED do
|
|
12
|
-
raise "NET_SSH_BUILDGEM_SIGNED should be set to release" unless ENV['NET_SSH_BUILDGEM_SIGNED']
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
Rake::Task[:release].enhance [:check_NET_SSH_BUILDGEM_SIGNED]
|
|
16
|
-
Rake::Task[:release].prerequisites.unshift(:check_NET_SSH_BUILDGEM_SIGNED)
|
|
17
|
-
|
|
18
|
-
task default: ["build"]
|
|
19
|
-
CLEAN.include [ 'pkg', 'rdoc' ]
|
|
20
|
-
name = "net-scp"
|
|
21
|
-
|
|
22
|
-
require_relative "lib/net/scp/version"
|
|
23
|
-
version = Net::SCP::Version::CURRENT
|
|
24
|
-
|
|
25
|
-
begin
|
|
26
|
-
require "changelogd/rake"
|
|
27
|
-
rescue LoadError
|
|
28
|
-
# A git gem isn't on the load path under plain `rake`, as the release workflow runs it; bundler/setup could clash with the running rake.
|
|
29
|
-
require "bundler"
|
|
30
|
-
$LOAD_PATH.unshift(*Bundler.definition.specs["changelogd"].flat_map(&:full_require_paths))
|
|
31
|
-
require "changelogd/rake"
|
|
32
|
-
end
|
|
33
|
-
Changelogd::RakeTasks.new(version_file: "lib/net/scp/version.rb")
|
|
34
|
-
|
|
35
|
-
namespace :cert do
|
|
36
|
-
desc "Update public cert from private - only run if public is expired"
|
|
37
|
-
task :update_public_when_expired do
|
|
38
|
-
require 'openssl'
|
|
39
|
-
require 'time'
|
|
40
|
-
raw = File.read "net-scp-public_cert.pem"
|
|
41
|
-
certificate = OpenSSL::X509::Certificate.new raw
|
|
42
|
-
raise Exception, "Not yet expired: #{certificate.not_after}" unless certificate.not_after < Time.now
|
|
43
|
-
sh "gem cert --build netssh@solutious.com --days 365*5 --private-key /mnt/gem/net-ssh-private_key.pem"
|
|
44
|
-
sh "mv gem-public_cert.pem net-scp-public_cert.pem"
|
|
45
|
-
sh "gem cert --add net-scp-public_cert.pem"
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
if false
|
|
50
|
-
begin
|
|
51
|
-
require "jeweler"
|
|
52
|
-
Jeweler::Tasks.new do |s|
|
|
53
|
-
s.version = version
|
|
54
|
-
s.name = name
|
|
55
|
-
s.summary = "A pure Ruby implementation of the SCP client protocol"
|
|
56
|
-
s.description = s.summary
|
|
57
|
-
s.email = "net-ssh@solutious.com"
|
|
58
|
-
s.homepage = "https://github.com/net-ssh/net-scp"
|
|
59
|
-
s.authors = ["Jamis Buck", "Delano Mandelbaum"]
|
|
60
|
-
|
|
61
|
-
s.add_dependency 'net-ssh', ">=2.6.5"
|
|
62
|
-
|
|
63
|
-
s.add_development_dependency 'test-unit'
|
|
64
|
-
s.add_development_dependency 'mocha'
|
|
65
|
-
|
|
66
|
-
s.license = "MIT"
|
|
67
|
-
|
|
68
|
-
s.signing_key = File.join('/mnt/gem/', 'gem-private_key.pem')
|
|
69
|
-
s.cert_chain = ['gem-public_cert.pem']
|
|
70
|
-
end
|
|
71
|
-
Jeweler::GemcutterTasks.new
|
|
72
|
-
rescue LoadError
|
|
73
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
require 'rake/testtask'
|
|
78
|
-
Rake::TestTask.new do |t|
|
|
79
|
-
t.libs = ["lib", "test"]
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
extra_files = %w[LICENSE.txt THANKS.txt CHANGES.txt ]
|
|
83
|
-
if defined?(RDoc::Task)
|
|
84
|
-
RDoc::Task.new do |rdoc|
|
|
85
|
-
rdoc.rdoc_dir = "rdoc"
|
|
86
|
-
rdoc.title = "#{name} #{version}"
|
|
87
|
-
rdoc.generator = 'hanna' # gem install hanna-nouveau
|
|
88
|
-
rdoc.main = 'README.md'
|
|
89
|
-
rdoc.rdoc_files.include("README*")
|
|
90
|
-
rdoc.rdoc_files.include("bin/*.rb")
|
|
91
|
-
rdoc.rdoc_files.include("lib/**/*.rb")
|
|
92
|
-
extra_files.each { |file|
|
|
93
|
-
rdoc.rdoc_files.include(file) if File.exist?(file)
|
|
94
|
-
}
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def change_version(&block)
|
|
99
|
-
Rake::Task["changelog:check"].invoke
|
|
100
|
-
version_file = 'lib/net/scp/version.rb'
|
|
101
|
-
require_relative version_file
|
|
102
|
-
pre = Net::SCP::Version::PRE
|
|
103
|
-
tiny = Net::SCP::Version::TINY
|
|
104
|
-
result = block[pre: pre, tiny: Net::SCP::Version::TINY]
|
|
105
|
-
raise ArgumentError, "Version change logic should always return a pre" unless result.key?(:pre)
|
|
106
|
-
|
|
107
|
-
new_pre = result[:pre]
|
|
108
|
-
new_tiny = result[:tiny] || tiny
|
|
109
|
-
found = { pre: false, tiny: false }
|
|
110
|
-
File.open("#{version_file}.new", "w") do |f|
|
|
111
|
-
File.readlines(version_file).each do |line|
|
|
112
|
-
match =
|
|
113
|
-
if pre.nil?
|
|
114
|
-
/^(\s+PRE\s+=\s+)nil(\s*)$/.match(line)
|
|
115
|
-
else
|
|
116
|
-
/^(\s+PRE\s+=\s+")#{pre}("\s*)$/.match(line)
|
|
117
|
-
end
|
|
118
|
-
if match
|
|
119
|
-
prefix = match[1]
|
|
120
|
-
postfix = match[2]
|
|
121
|
-
prefix.delete_suffix!('"')
|
|
122
|
-
postfix.delete_prefix!('"')
|
|
123
|
-
new_line = "#{prefix}#{new_pre.inspect}#{postfix}"
|
|
124
|
-
puts "Changing:\n - #{line} + #{new_line}"
|
|
125
|
-
line = new_line
|
|
126
|
-
found[:pre] = true
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
if new_tiny != tiny
|
|
130
|
-
match = /^(\s+TINY\s+=\s+)#{tiny}(\s*)$/.match(line)
|
|
131
|
-
if match
|
|
132
|
-
prefix = match[1]
|
|
133
|
-
postfix = match[2]
|
|
134
|
-
new_line = "#{prefix}#{new_tiny}#{postfix}"
|
|
135
|
-
puts "Changing:\n - #{line} + #{new_line}"
|
|
136
|
-
line = new_line
|
|
137
|
-
found[:tiny] = true
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
f.write(line)
|
|
142
|
-
end
|
|
143
|
-
raise ArgumentError, "Cound not find line: PRE = \"#{pre}\" in #{version_file}" unless found[:pre]
|
|
144
|
-
raise ArgumentError, "Cound not find line: TINY = \"#{tiny}\" in #{version_file}" unless found[:tiny] || new_tiny == tiny
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
FileUtils.mv version_file, "#{version_file}.old"
|
|
148
|
-
FileUtils.mv "#{version_file}.new", version_file
|
|
149
|
-
Rake::Task["changelog:release"].invoke
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
namespace :vbump do
|
|
153
|
-
desc "Final release"
|
|
154
|
-
task :final do
|
|
155
|
-
change_version do |pre:, tiny:|
|
|
156
|
-
_ = tiny
|
|
157
|
-
if pre.nil?
|
|
158
|
-
{ tiny: tiny + 1, pre: nil }
|
|
159
|
-
else
|
|
160
|
-
raise ArgumentError, "Unexpected pre: #{pre}" if pre.nil?
|
|
161
|
-
|
|
162
|
-
{ pre: nil }
|
|
163
|
-
end
|
|
164
|
-
end
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
desc "Increment prerelease"
|
|
168
|
-
task :pre, [:type] do |_t, args|
|
|
169
|
-
change_version do |pre:, tiny:|
|
|
170
|
-
puts " PRE => #{pre.inspect}"
|
|
171
|
-
match = /^([a-z]+)(\d+)/.match(pre)
|
|
172
|
-
raise ArgumentError, "Unexpected pre: #{pre}" if match.nil? && args[:type].nil?
|
|
173
|
-
|
|
174
|
-
if match.nil? || (!args[:type].nil? && args[:type] != match[1])
|
|
175
|
-
if pre.nil?
|
|
176
|
-
{ pre: "#{args[:type]}1", tiny: tiny + 1 }
|
|
177
|
-
else
|
|
178
|
-
{ pre: "#{args[:type]}1" }
|
|
179
|
-
end
|
|
180
|
-
else
|
|
181
|
-
{ pre: "#{match[1]}#{match[2].to_i + 1}" }
|
|
182
|
-
end
|
|
183
|
-
end
|
|
184
|
-
end
|
|
185
|
-
end
|
data/SECURITY.md
DELETED
data/changelog.d/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Changelog fragments: one `<PR number>.<type>.txt` file per user-visible change, assembled into `CHANGES.txt` when the version is bumped. See [CONTRIBUTING.md](../CONTRIBUTING.md#changelog).
|
data/gemfiles/legacy.gemfile
DELETED
data/net-scp-public_cert.pem
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
|
2
|
-
MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZuZXRz
|
|
3
|
-
c2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZFgNj
|
|
4
|
-
b20wHhcNMjYwNTE2MTYyMDUzWhcNMjcwNTE2MTYyMDUzWjBBMQ8wDQYDVQQDDAZu
|
|
5
|
-
ZXRzc2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZ
|
|
6
|
-
FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGJ4TbZ9H+qZ08
|
|
7
|
-
pQfJhPJTHaDCyQvCsKTFrL5O9z3tllQ7B/zksMMM+qFBpNYu9HCcg4yBATacE/PB
|
|
8
|
-
qVVyUrpr6lbH/XwoN5ljXm+bdCfmnjZvTCL2FTE6o+bcnaF0IsJyC0Q2B1fbWdXN
|
|
9
|
-
6Off1ZWoUk6We2BIM1bn6QJLxBpGyYhvOPXsYoqSuzDf2SJDDsWFZ8kV5ON13Ohm
|
|
10
|
-
JbBzn0oD8HF8FuYOewwsC0C1q4w7E5GtvHcQ5juweS7+RKsyDcVcVrLuNzoGRttS
|
|
11
|
-
KP4yMn+TzaXijyjRg7gECfJr3TGASaA4bQsILFGG5dAWcwO4OMrZedR7SHj/o0Kf
|
|
12
|
-
3gL7P0axAgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
|
|
13
|
-
BBQF8qLA7Z4zg0SJGtUbv3eoQ8tjIzAfBgNVHREEGDAWgRRuZXRzc2hAc29sdXRp
|
|
14
|
-
b3VzLmNvbTAfBgNVHRIEGDAWgRRuZXRzc2hAc29sdXRpb3VzLmNvbTANBgkqhkiG
|
|
15
|
-
9w0BAQsFAAOCAQEAVx/yCCX0ZPQ8TFeZe1T+OBEn3Co/AfjAmCdhstf1TF+Jziyx
|
|
16
|
-
dFJ8m8mF4596gru87Mi8mvu+WbPsLlFMOf5LDUkAsgnlvJ+zqNL7jPjGmsh0KOHJ
|
|
17
|
-
0dzPYnTeGcfyrp1AXNN3Z2jWlEInrnqvo376vOmejjTtmDVVlhPjITHQqLSXzRaQ
|
|
18
|
-
e3M8fbJ+nupobti6jpXCYvH86KtpaxF66mwaynfdjzxQAVycV/ilKtL+sHH8zxlg
|
|
19
|
-
vNiMFH5yLu/tlav4xh+HlYscWVdFQIvd7f/Uxa+Vip1Pi16wmhnrE15z/vDX921v
|
|
20
|
-
hukBRIoCEAuUgNVBh+L/C8aETzbf/77WU3Si/w==
|
|
21
|
-
-----END CERTIFICATE-----
|
data/net-scp.gemspec
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
require_relative 'lib/net/scp/version'
|
|
3
|
-
|
|
4
|
-
Gem::Specification.new do |spec|
|
|
5
|
-
spec.name = "net-scp"
|
|
6
|
-
spec.version = Net::SCP::Version::STRING
|
|
7
|
-
spec.authors = ["Jamis Buck", "Delano Mandelbaum", "Mikl\u{f3}s Fazekas"]
|
|
8
|
-
spec.email = ["net-ssh@solutious.com"]
|
|
9
|
-
|
|
10
|
-
if ENV['NET_SSH_BUILDGEM_SIGNED']
|
|
11
|
-
spec.cert_chain = ["net-scp-public_cert.pem"]
|
|
12
|
-
spec.signing_key = "/mnt/gem/net-ssh-private_key.pem"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
spec.summary = %q{A pure Ruby implementation of the SCP client protocol.}
|
|
16
|
-
spec.description = %q{A pure Ruby implementation of the SCP client protocol}
|
|
17
|
-
spec.homepage = "https://github.com/net-ssh/net-scp"
|
|
18
|
-
spec.license = "MIT"
|
|
19
|
-
spec.required_rubygems_version = Gem::Requirement.new(">= 0") if spec.respond_to? :required_rubygems_version=
|
|
20
|
-
spec.required_ruby_version = ">= 2.3"
|
|
21
|
-
spec.metadata = {
|
|
22
|
-
"changelog_uri" => "https://github.com/net-ssh/net-scp/blob/master/CHANGES.txt"
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
spec.extra_rdoc_files = [
|
|
26
|
-
"LICENSE.txt",
|
|
27
|
-
"README.md"
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
31
|
-
spec.require_paths = ["lib"]
|
|
32
|
-
|
|
33
|
-
if spec.respond_to? :specification_version then
|
|
34
|
-
spec.specification_version = 3
|
|
35
|
-
|
|
36
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
37
|
-
spec.add_runtime_dependency(%q<net-ssh>, [">= 2.6.5", "< 9.0.0"])
|
|
38
|
-
spec.add_development_dependency(%q<test-unit>, [">= 0"])
|
|
39
|
-
spec.add_development_dependency(%q<mocha>, [">= 0"])
|
|
40
|
-
else
|
|
41
|
-
spec.add_dependency(%q<net-ssh>, [">= 2.6.5", "< 9.0.0"])
|
|
42
|
-
spec.add_dependency(%q<test-unit>, [">= 0"])
|
|
43
|
-
spec.add_dependency(%q<mocha>, [">= 0"])
|
|
44
|
-
end
|
|
45
|
-
else
|
|
46
|
-
spec.add_dependency(%q<net-ssh>, [">= 2.6.5", "< 9.0.0"])
|
|
47
|
-
spec.add_dependency(%q<test-unit>, [">= 0"])
|
|
48
|
-
spec.add_dependency(%q<mocha>, [">= 0"])
|
|
49
|
-
end
|
|
50
|
-
end
|