sshkit-sudo-next 0.2.0 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eaf0ceec3960adf1b245082ce6c353db05abf9e5a8941ed267454eb0a6b9683f
4
- data.tar.gz: 64d65fd50dc8624827c2479c898f4c4a294bbb26814c204c613dfe5fb5d2d9cf
3
+ metadata.gz: fa2b9bfd304eb63502003564ba3dd7e5f0c8bf113eaed7cb1333d50daff10af7
4
+ data.tar.gz: f1ea910c20e0c19eccd3a948ba4951ca7af6ad84a41aa90931a80c12a50fccd8
5
5
  SHA512:
6
- metadata.gz: 061ddb73088198fd52acabba6a3db5d66ee7d965f8d34eaf1aef29af62e45bc41ef41a10565dca26cf85d132112da400534c22c507764f0dd315626190f6cf5f
7
- data.tar.gz: a09448741593b69288b0f32cb1428eafd25e009063f651f8759f8614eb31b1ddd3b0267aa21a5cdd4a119bac250e75e5a28b463ec584fd44944faecf4b16056f
6
+ metadata.gz: fc1b4037bc29776399e780dc7f04f830571ae70435ee995cc7f081adf3b01e9d953702817fa00edc4d2574243732f96a87723863ce4750881e1d63bd57517afe
7
+ data.tar.gz: 617afadec49af0f29fa9e95e1531766bbc061054d42b2917005a1bb3c562355820b7edc237baab48ed461dd01b3ee07e71a7e83aecdcd95cce241b4242179fa3
data/README.md CHANGED
@@ -2,9 +2,4 @@
2
2
 
3
3
  Fork of the [SSHKit::Sudo](https://github.com/kentaroi/sshkit-sudo.git) project, with significant cleanups and some improvements.
4
4
 
5
- As the original project, this gem allows:
6
-
7
- - sudo commands with password support;
8
- - perform all the tasks of a given session (eg. a whole deploy) as a specified user.
9
-
10
- We're in the process of preparing and releasing thorough documentation (estimated time: beginning of May/2021).
5
+ This gem provides sudo password handling for SSHKit: when a remote command emits a `[sudo] password for <user>:` prompt, the configured password is sent automatically, so commands invoking `sudo` (whether via `as :root do … end` blocks or by literally including `sudo` in the command) don't require interactive password entry.
@@ -69,27 +69,21 @@ module SSHKit
69
69
 
70
70
  env = (@env || {})
71
71
 
72
- user = @user || self.class.config.owner
73
-
74
- # As general Linux practice, switching user is not enough - some variables need to be updated
75
- # as well.
76
- # For an explanation, see https://saveriomiroddi.github.io/Chef-properly-run-a-resource-as-alternate-user.
77
- #
78
- user_home = user == 'root' ? '/root' : "/home/#{user}"
79
- env = env.merge(user: user, home: user_home)
80
-
81
- # Sshkit::Command#user runs commands in a non-login shell, so that variables are not inherited.
82
- # We can workaround this by setting them in the env, which is `export`ed, however, only the
83
- # specified ones are. Since `RAILS_ENV` is common, we pass it.
84
- #
85
- env = env.merge(rails_env: fetch(:rails_env))
72
+ if @user
73
+ # As general Linux practice, switching user is not enough - some variables need to be updated
74
+ # as well.
75
+ # For an explanation, see https://saveriomiroddi.github.io/Chef-properly-run-a-resource-as-alternate-user.
76
+ #
77
+ user_home = @user == 'root' ? '/root' : "/home/#{@user}"
78
+ env = env.merge(user: @user, home: user_home, rails_env: fetch(:rails_env))
79
+ end
86
80
 
87
81
  SSHKit::Command.new(*args, options.merge(
88
82
  {
89
83
  in: pwd_path,
90
84
  env: env,
91
85
  host: @host,
92
- user: user,
86
+ user: @user,
93
87
  group: @group,
94
88
  }
95
89
  ))
@@ -1,5 +1,5 @@
1
1
  module SSHKit
2
2
  module Sudo
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -6,6 +6,7 @@ require 'sshkit/sudo/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "sshkit-sudo-next"
8
8
  spec.version = SSHKit::Sudo::VERSION
9
+ spec.date = "2026-04-27"
9
10
  spec.authors = ["Saverio Miroddi"]
10
11
  spec.email = ["saverio.pub2@gmail.com"]
11
12
  spec.summary = %q{SSHKit extension, for sudo operation with password input.}
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sshkit-sudo-next
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saverio Miroddi
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-04-22 00:00:00.000000000 Z
10
+ date: 2026-04-27 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: sshkit
@@ -74,7 +73,6 @@ homepage: ''
74
73
  licenses:
75
74
  - MIT
76
75
  metadata: {}
77
- post_install_message:
78
76
  rdoc_options: []
79
77
  require_paths:
80
78
  - lib
@@ -89,8 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
87
  - !ruby/object:Gem::Version
90
88
  version: '0'
91
89
  requirements: []
92
- rubygems_version: 3.1.4
93
- signing_key:
90
+ rubygems_version: 4.0.8
94
91
  specification_version: 4
95
92
  summary: SSHKit extension, for sudo operation with password input.
96
93
  test_files: []