dev-kit 0.1.0 → 0.1.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
  SHA1:
3
- metadata.gz: 9f29c2743d231ff3c8b7485ed1f98e50e6246bad
4
- data.tar.gz: '0389cdeaabb2b1b3a649f2abc9431e769a44dd94'
3
+ metadata.gz: e8a7ad1bb620a4ef9c24d1b23a3b51959c3206c0
4
+ data.tar.gz: 0b0957c437ebd354b68506516338871d13c327ed
5
5
  SHA512:
6
- metadata.gz: 49126e8a61f5ade5609d21e6dd1d7721ab4c36436b5dcd9749718c4d2652eef2500abc4aa6a2e6eaa0b092347aa41dd2dcc868c65f2fd3e47d29aeab7dca7661
7
- data.tar.gz: 6c612d9fe65a830bd1775ee4fe9eea768f6a7d9d586227e41572c2de434121aa646da6ec1fd8025ed64d082244898ec683d7cef60bd05e2334512a709479a8c8
6
+ metadata.gz: 53b11d8a08980d86e1c20b93807d8984774097be9edef84d800323330b7e3a5a54f9c6490b62a96b2422a425f8da0e2e5106fe3b734741cd57f4fe7bf9b5434e
7
+ data.tar.gz: be57303043e80cefeed7b73f48832ca79aed4434cebdf05d7776a75d3955bac589a32b64d667c3211678af78ebff61bfdd4bd528973125b8b6fd3f1a692805ed
data/dev.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  up:
2
- - homebrew:
3
2
  - ruby: 2.3.3
4
3
  - bundler
5
4
 
@@ -6,8 +6,8 @@ require 'English'
6
6
  module Dev
7
7
  module Kit
8
8
  module System
9
+ SUDO_PROMPT = Dev::UI.fmt("{{info:(sudo)}} Password: ")
9
10
  class << self
10
- SUDO_PROMPT = Dev::UI.fmt("{{info:(sudo)}} Password: ")
11
11
 
12
12
  # Ask for sudo access with a message explaning the need for it
13
13
  # Will make subsequent commands capable of running with sudo for a period of time
@@ -35,6 +35,7 @@ module Dev
35
35
  # - `*a`: A splat of arguments evaluated as a command. (e.g. `'rm', folder` is equivalent to `rm #{folder}`)
36
36
  # - `sudo`: If truthy, run this command with sudo. If String, pass to `sudo_reason`
37
37
  # - `env`: process environment with which to execute this command
38
+ # - `**kwargs`: additional arguments to pass to Open3.capture2
38
39
  #
39
40
  # #### Returns
40
41
  # - `output`: output (STDOUT) of the command execution
@@ -43,8 +44,8 @@ module Dev
43
44
  # #### Usage
44
45
  # `out, stat = Dev::Kit::System.capture2('ls', 'a_folder')`
45
46
  #
46
- def capture2(*a, sudo: false, env: ENV)
47
- delegate_open3(*a, sudo: sudo, env: env, method: :capture2)
47
+ def capture2(*a, sudo: false, env: ENV, **kwargs)
48
+ delegate_open3(*a, sudo: sudo, env: env, method: :capture2, **kwargs)
48
49
  end
49
50
 
50
51
  # Execute a command in the user's environment
@@ -55,6 +56,7 @@ module Dev
55
56
  # - `*a`: A splat of arguments evaluated as a command. (e.g. `'rm', folder` is equivalent to `rm #{folder}`)
56
57
  # - `sudo`: If truthy, run this command with sudo. If String, pass to `sudo_reason`
57
58
  # - `env`: process environment with which to execute this command
59
+ # - `**kwargs`: additional arguments to pass to Open3.capture2e
58
60
  #
59
61
  # #### Returns
60
62
  # - `output`: output (STDOUT merged with STDERR) of the command execution
@@ -63,8 +65,8 @@ module Dev
63
65
  # #### Usage
64
66
  # `out_and_err, stat = Dev::Kit::System.capture2e('ls', 'a_folder')`
65
67
  #
66
- def capture2e(*a, sudo: false, env: ENV)
67
- delegate_open3(*a, sudo: sudo, env: env, method: :capture2e)
68
+ def capture2e(*a, sudo: false, env: ENV, **kwargs)
69
+ delegate_open3(*a, sudo: sudo, env: env, method: :capture2e, **kwargs)
68
70
  end
69
71
 
70
72
  # Execute a command in the user's environment
@@ -75,6 +77,7 @@ module Dev
75
77
  # - `*a`: A splat of arguments evaluated as a command. (e.g. `'rm', folder` is equivalent to `rm #{folder}`)
76
78
  # - `sudo`: If truthy, run this command with sudo. If String, pass to `sudo_reason`
77
79
  # - `env`: process environment with which to execute this command
80
+ # - `**kwargs`: additional arguments to pass to Open3.capture3
78
81
  #
79
82
  # #### Returns
80
83
  # - `output`: STDOUT of the command execution
@@ -84,8 +87,8 @@ module Dev
84
87
  # #### Usage
85
88
  # `out, err, stat = Dev::Kit::System.capture3('ls', 'a_folder')`
86
89
  #
87
- def capture3(*a, sudo: false, env: ENV)
88
- delegate_open3(*a, sudo: sudo, env: env, method: :capture3)
90
+ def capture3(*a, sudo: false, env: ENV, **kwargs)
91
+ delegate_open3(*a, sudo: sudo, env: env, method: :capture3, **kwargs)
89
92
  end
90
93
 
91
94
  # Execute a command in the user's environment
@@ -142,14 +145,14 @@ module Dev
142
145
  private
143
146
 
144
147
  def apply_sudo(*a, sudo)
145
- a.unshift('sudo', '-S', '-p', SUDO_PROMPT) if sudo
148
+ a.unshift('sudo', '-S', '-p', SUDO_PROMPT, '--') if sudo
146
149
  sudo_reason(sudo) if sudo.is_a?(String)
147
150
  a
148
151
  end
149
152
 
150
- def delegate_open3(*a, sudo: raise, env: raise, method: raise)
153
+ def delegate_open3(*a, sudo: raise, env: raise, method: raise, **kwargs)
151
154
  a = apply_sudo(*a, sudo)
152
- Open3.send(method, env, *resolve_path(a, env))
155
+ Open3.send(method, env, *resolve_path(a, env), **kwargs)
153
156
  rescue Errno::EINTR
154
157
  raise(Errno::EINTR, "command interrupted: #{a.join(' ')}")
155
158
  end
@@ -1,5 +1,5 @@
1
1
  module Dev
2
2
  module Kit
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burke Libbey
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-06-21 00:00:00.000000000 Z
12
+ date: 2017-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dev-ui
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 2.6.10
112
+ rubygems_version: 2.6.14
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Terminal UI framework extensions