sshkit 1.19.0 → 1.19.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b4191d45c0d732071e82c9a8eeead452366f901fd483eb016dbd97761da10d1
4
- data.tar.gz: 49209aa289eb35cc906bb88fa187aa43079d3c3a0e9ed42582cbc74bb967d54f
3
+ metadata.gz: 1b8cc968102708cd224132592b522e059c57c29a68b7c0feced32ef905fb6f1e
4
+ data.tar.gz: d5a2ad7b2a09ba796ad5def0a211e793e7e27334fdf2296cc557fc92e9e92597
5
5
  SHA512:
6
- metadata.gz: aa67fe84e2eda52dae94814f6c81d66a0f965e8fbffadc4238c9cc63b800ab3c24a424b0382d8d1a1431f5ecb095dda017fe076277fe165f8771d1e21d6f4d82
7
- data.tar.gz: f404f7933c620ab7737c5062c45a7b536dd62f26034894588dffb132b9e027a32516c0bf5a43215d7bdf468c4ae3102d99957d7a1ef728bf2e3e7db9c1ee3dd0
6
+ metadata.gz: 67f29e165c1d9612f157323a638a04054688a50c0bb302620756c3590a854929fcbac166b3f9f7671f32c21de2a22c5ca2e3ba7c3edb35c8918f7fc4ddc38d1d
7
+ data.tar.gz: 70c0ada0ed66f2b92032f7fc9adda13f3a2bb1d31207733072772817a795f7342de7b88acee6dc154c52a14c4aaaef051c4922118a87669c433320606ea2e0e6
@@ -7,6 +7,10 @@ appear at the top.
7
7
 
8
8
  * Your contribution here!
9
9
 
10
+ ## [1.19.1][] (2019-07-02)
11
+
12
+ * [#465](https://github.com/capistrano/sshkit/pull/456): Fix a regression in 1.19.0 that prevented `~` from being used in Capistrano paths, e.g. `:deploy_to`, etc. - [@grosser](https://github.com/grosser)
13
+
10
14
  ## [1.19.0][] (2019-06-30)
11
15
 
12
16
  * [#455](https://github.com/capistrano/sshkit/pull/455): Ensure UUID of commands are stable in logging - [@lazyatom](https://github.com/lazyatom)
@@ -764,7 +768,8 @@ version `0.0.5`.
764
768
 
765
769
  First release.
766
770
 
767
- [Unreleased]: https://github.com/capistrano/sshkit/compare/v1.19.0...HEAD
771
+ [Unreleased]: https://github.com/capistrano/sshkit/compare/v1.19.1...HEAD
772
+ [1.19.1]: https://github.com/capistrano/sshkit/compare/v1.19.0...v1.19.1
768
773
  [1.19.0]: https://github.com/capistrano/sshkit/compare/v1.18.2...v1.19.0
769
774
  [1.18.2]: https://github.com/capistrano/sshkit/compare/v1.18.1...v1.18.2
770
775
  [1.18.1]: https://github.com/capistrano/sshkit/compare/v1.18.0...v1.18.1
@@ -82,9 +82,10 @@ module SSHKit
82
82
 
83
83
  def within(directory, &_block)
84
84
  (@pwd ||= []).push directory.to_s
85
+ escaped = Command.shellescape_except_tilde(pwd_path)
85
86
  execute <<-EOTEST, verbosity: Logger::DEBUG
86
- if test ! -d #{File.join(@pwd).shellescape}
87
- then echo "Directory does not exist '#{File.join(@pwd).shellescape}'" 1>&2
87
+ if test ! -d #{escaped}
88
+ then echo "Directory does not exist '#{escaped}'" 1>&2
88
89
  false
89
90
  fi
90
91
  EOTEST
@@ -143,7 +143,7 @@ module SSHKit
143
143
 
144
144
  def within(&_block)
145
145
  return yield unless options[:in]
146
- "cd #{options[:in].shellescape} && #{yield}"
146
+ "cd #{self.class.shellescape_except_tilde(options[:in])} && #{yield}"
147
147
  end
148
148
 
149
149
  def environment_hash
@@ -219,6 +219,11 @@ module SSHKit
219
219
  end
220
220
  end
221
221
 
222
+ # allow using home directory but escape everything else like spaces etc
223
+ def self.shellescape_except_tilde(file)
224
+ file.shellescape.gsub("\\~", "~")
225
+ end
226
+
222
227
  private
223
228
 
224
229
  def default_options
@@ -1,3 +1,3 @@
1
1
  module SSHKit
2
- VERSION = "1.19.0".freeze
2
+ VERSION = "1.19.1".freeze
3
3
  end
@@ -99,6 +99,18 @@ module SSHKit
99
99
  assert_equal '/usr/bin/env cat file', backend.executed_command.to_command
100
100
  end
101
101
 
102
+ def test_within_home
103
+ backend = ExampleBackend.new do
104
+ within '~/foo' do
105
+ execute :cat, 'file', :strip => false
106
+ end
107
+ end
108
+
109
+ backend.run
110
+
111
+ assert_equal 'cd ~/foo && /usr/bin/env cat file', backend.executed_command.to_command
112
+ end
113
+
102
114
  def test_background_logs_deprecation_warnings
103
115
  deprecation_out = ''
104
116
  SSHKit.config.deprecation_output = deprecation_out
@@ -84,6 +84,11 @@ module SSHKit
84
84
  assert_equal "cd /opt/sites && /usr/bin/env ls -l", c.to_command
85
85
  end
86
86
 
87
+ def test_working_in_home_directory
88
+ c = Command.new(:ls, '-l', in: "~/sites")
89
+ assert_equal "cd ~/sites && /usr/bin/env ls -l", c.to_command
90
+ end
91
+
87
92
  def test_working_in_a_given_weird_directory
88
93
  c = Command.new(:ls, '-l', in: "/opt/sites and stuff")
89
94
  assert_equal "cd /opt/sites\\ and\\ stuff && /usr/bin/env ls -l", c.to_command
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sshkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.0
4
+ version: 1.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Hambley
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-07-01 00:00:00.000000000 Z
12
+ date: 2019-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh