docker-cli 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.release_history.yml +4 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +17 -17
- data/docker-cli.gemspec +6 -6
- data/lib/docker/cli/command.rb +39 -5
- data/lib/docker/cli/command_factory.rb +7 -9
- data/lib/docker/cli/command_result.rb +1 -0
- data/lib/docker/cli/version.rb +1 -1
- data/ruby-iterm2.sh +46 -0
- metadata +31 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70e675b039f436ae267c09f5ff766d6c6fe80781b3502f01c1684614c994735e
|
4
|
+
data.tar.gz: 1e01b0315a9507886da689d63f6f061b4e0455f650b210d4cdce603c8086c036
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 617a1e09957069d7d53876c179f30b22c91efa792d28bec7306913832db9a7369318076ded4328e36c5095437f3984b008bffde276b22a2789110514340e4215
|
7
|
+
data.tar.gz: 36be5d9e521662e5da112e495004290935ab2883d62ca7a8dfd8cffc8be3dc269148df1697c935d0d8e70b7f7b879f2b23c6c2d0176678bc170936bcc05acabc
|
data/.release_history.yml
CHANGED
data/Gemfile
CHANGED
@@ -8,3 +8,10 @@ gemspec
|
|
8
8
|
gem "rake", "~> 13.0"
|
9
9
|
|
10
10
|
gem "rspec", "~> 3.0"
|
11
|
+
|
12
|
+
#gem 'toolrack', git: 'toolrack', branch: 'master'
|
13
|
+
#
|
14
|
+
#gem 'git_cli', git: "git_cli", branch: "master"
|
15
|
+
#gem 'git_cli_prompt', git: "git_cli_prompt", branch: 'master'
|
16
|
+
#gem 'devops_assist', git: "devops_assist", branch: "master"
|
17
|
+
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
docker-cli (0.1
|
5
|
-
ptools
|
6
|
-
teLogger
|
7
|
-
toolrack
|
8
|
-
tty-command
|
9
|
-
tty-prompt
|
4
|
+
docker-cli (0.2.1)
|
5
|
+
ptools (~> 1.4.3)
|
6
|
+
teLogger (~> 0.2.2)
|
7
|
+
toolrack (~> 0.20.1)
|
8
|
+
tty-command (~> 0.10.1)
|
9
|
+
tty-prompt (~> 0.23.1)
|
10
10
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
14
|
base58 (0.2.3)
|
15
|
-
devops_assist (0.3.
|
15
|
+
devops_assist (0.3.3)
|
16
16
|
git_cli
|
17
17
|
git_cli_prompt
|
18
18
|
gvcs
|
@@ -20,7 +20,7 @@ GEM
|
|
20
20
|
toolrack
|
21
21
|
tty-prompt
|
22
22
|
diff-lcs (1.5.0)
|
23
|
-
git_cli (0.
|
23
|
+
git_cli (0.11.2)
|
24
24
|
gvcs
|
25
25
|
ptools (~> 1.4.0)
|
26
26
|
teLogger
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
teLogger
|
30
30
|
toolrack
|
31
31
|
tty-prompt
|
32
|
-
gvcs (0.1.
|
32
|
+
gvcs (0.1.1)
|
33
33
|
pastel (0.8.0)
|
34
34
|
tty-color (~> 0.5)
|
35
35
|
ptools (1.4.3)
|
@@ -38,17 +38,17 @@ GEM
|
|
38
38
|
rspec-core (~> 3.12.0)
|
39
39
|
rspec-expectations (~> 3.12.0)
|
40
40
|
rspec-mocks (~> 3.12.0)
|
41
|
-
rspec-core (3.12.
|
41
|
+
rspec-core (3.12.1)
|
42
42
|
rspec-support (~> 3.12.0)
|
43
|
-
rspec-expectations (3.12.
|
43
|
+
rspec-expectations (3.12.2)
|
44
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
45
45
|
rspec-support (~> 3.12.0)
|
46
|
-
rspec-mocks (3.12.
|
46
|
+
rspec-mocks (3.12.4)
|
47
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
48
|
rspec-support (~> 3.12.0)
|
49
49
|
rspec-support (3.12.0)
|
50
|
-
teLogger (0.2.
|
51
|
-
toolrack (0.
|
50
|
+
teLogger (0.2.2)
|
51
|
+
toolrack (0.20.1)
|
52
52
|
base58
|
53
53
|
tty-color (0.6.0)
|
54
54
|
tty-command (0.10.1)
|
@@ -65,13 +65,13 @@ GEM
|
|
65
65
|
wisper (2.0.1)
|
66
66
|
|
67
67
|
PLATFORMS
|
68
|
-
x86_64-
|
68
|
+
x86_64-darwin-21
|
69
69
|
|
70
70
|
DEPENDENCIES
|
71
|
-
devops_assist
|
71
|
+
devops_assist (~> 0.3.3)
|
72
72
|
docker-cli!
|
73
73
|
rake (~> 13.0)
|
74
74
|
rspec (~> 3.0)
|
75
75
|
|
76
76
|
BUNDLED WITH
|
77
|
-
2.
|
77
|
+
2.4.6
|
data/docker-cli.gemspec
CHANGED
@@ -30,15 +30,15 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
|
-
spec.add_dependency 'toolrack'
|
34
|
-
spec.add_dependency 'teLogger'
|
33
|
+
spec.add_dependency 'toolrack', "~> 0.20.1"
|
34
|
+
spec.add_dependency 'teLogger', "~> 0.2.2"
|
35
35
|
|
36
|
-
spec.add_dependency 'ptools'
|
36
|
+
spec.add_dependency 'ptools', "~> 1.4.3"
|
37
37
|
|
38
|
-
spec.add_dependency 'tty-command'
|
39
|
-
spec.add_dependency 'tty-prompt'
|
38
|
+
spec.add_dependency 'tty-command', "~> 0.10.1"
|
39
|
+
spec.add_dependency 'tty-prompt', "~> 0.23.1"
|
40
40
|
|
41
|
-
spec.add_development_dependency 'devops_assist'
|
41
|
+
spec.add_development_dependency 'devops_assist', "~> 0.3.3"
|
42
42
|
|
43
43
|
# Uncomment to register a new dependency of your gem
|
44
44
|
# spec.add_dependency "example-gem", "~> 1.0"
|
data/lib/docker/cli/command.rb
CHANGED
@@ -3,6 +3,8 @@ require 'tty/command'
|
|
3
3
|
require 'tty/prompt'
|
4
4
|
require 'ptools'
|
5
5
|
|
6
|
+
require 'toolrack'
|
7
|
+
|
6
8
|
require_relative 'command_result'
|
7
9
|
|
8
10
|
module Docker
|
@@ -41,15 +43,40 @@ module Docker
|
|
41
43
|
`#{terminal} -x "#{@command_buffer.join(" ")}"`
|
42
44
|
when "gnome-terminal"
|
43
45
|
`#{terminal} -- bash -c "#{@command_buffer.join(" ")}; exec bash"`
|
46
|
+
when "iTerm2"
|
47
|
+
`osascript -e \
|
48
|
+
'tell application "iTerm"
|
49
|
+
activate
|
50
|
+
|
51
|
+
create window with default profile
|
52
|
+
delay 0.5
|
53
|
+
|
54
|
+
set currentWindow to current window
|
55
|
+
|
56
|
+
tell current session of currentWindow
|
57
|
+
write text "#{@command_buffer.join(" ")}"
|
58
|
+
end tell
|
59
|
+
|
60
|
+
end tell'
|
61
|
+
`
|
62
|
+
when "Terminal"
|
63
|
+
`osascript -e \
|
64
|
+
'tell application "Terminal"
|
65
|
+
activate
|
66
|
+
do script "#{@command_buffer.join(" ")}"
|
67
|
+
end tell'
|
68
|
+
`
|
44
69
|
else
|
45
70
|
raise Error, "Unfinished supporting terminal : #{terminal}"
|
46
71
|
end
|
72
|
+
|
73
|
+
pmt.puts "\n Prompt running inside the Docker shall be opened in a new window\n\n"
|
47
74
|
end
|
48
75
|
|
49
76
|
else
|
50
77
|
@outStream = []
|
51
78
|
@errStream = []
|
52
|
-
|
79
|
+
result = @runner.run!(@command_buffer.join(" ")) do |out, err|
|
53
80
|
if block
|
54
81
|
block.call(:outstream, out)
|
55
82
|
block.call(:errstream, err)
|
@@ -59,7 +86,7 @@ module Docker
|
|
59
86
|
end
|
60
87
|
end
|
61
88
|
|
62
|
-
CommandResult.new(
|
89
|
+
CommandResult.new(result, @outStream, @errStream)
|
63
90
|
#{ outStream: @outStream, errStream: @errStream, result: @result }
|
64
91
|
end
|
65
92
|
end
|
@@ -70,10 +97,17 @@ module Docker
|
|
70
97
|
|
71
98
|
private
|
72
99
|
def detect_terminal
|
73
|
-
possible = [ "gnome-terminal","konsole","cmd.exe", "tilix", "terminator" ]
|
74
100
|
avail = []
|
75
|
-
|
76
|
-
|
101
|
+
if TR::RTUtils.on_linux?
|
102
|
+
possible = [ "gnome-terminal","konsole","tilix", "terminator" ]
|
103
|
+
possible.each do |app|
|
104
|
+
avail << app if not File.which(app).nil?
|
105
|
+
end
|
106
|
+
elsif TR::RTUtils.on_windows?
|
107
|
+
avail << "cmd.exe"
|
108
|
+
elsif TR::RTUtils.on_mac?
|
109
|
+
avail << "Terminal"
|
110
|
+
avail << "iTerm2"
|
77
111
|
end
|
78
112
|
avail
|
79
113
|
end
|
@@ -192,15 +192,13 @@ module Docker
|
|
192
192
|
|
193
193
|
isTty = false
|
194
194
|
isInteractive = false
|
195
|
-
if
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
isInteractive = true
|
203
|
-
end
|
195
|
+
if not_empty?(opts[:tty]) and opts[:tty] == true
|
196
|
+
cmd << "-t"
|
197
|
+
isTty = true
|
198
|
+
end
|
199
|
+
if not_empty?(opts[:interactive]) and opts[:interactive] == true
|
200
|
+
cmd << "-i"
|
201
|
+
isInteractive = true
|
204
202
|
end
|
205
203
|
|
206
204
|
cmd << container
|
data/lib/docker/cli/version.rb
CHANGED
data/ruby-iterm2.sh
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
PATH_AND_FILE=$1
|
3
|
+
|
4
|
+
THE_PATH="${PATH_AND_FILE%/*}"
|
5
|
+
FILENAME="${PATH_AND_FILE##*/}"
|
6
|
+
echo "Script called"
|
7
|
+
echo "PATH_AND_FILE=$PATH_AND_FILE"
|
8
|
+
echo "THE_PATH=$THE_PATH"
|
9
|
+
echo "FILENAME=$FILENAME"
|
10
|
+
|
11
|
+
osascript <<EOF
|
12
|
+
|
13
|
+
tell application "iTerm"
|
14
|
+
activate
|
15
|
+
|
16
|
+
# Check to see if we have an open window. If not, open one.
|
17
|
+
if (count windows) is 0 then # no window is open.
|
18
|
+
create window with default profile
|
19
|
+
delay 0.5
|
20
|
+
end if
|
21
|
+
|
22
|
+
set currentWindow to current window # get a reference to current window
|
23
|
+
|
24
|
+
# We have an open window.
|
25
|
+
tell current session of currentWindow
|
26
|
+
if (is processing) or (name is not "bash") then # the current session is busy
|
27
|
+
tell currentWindow
|
28
|
+
create tab with default profile #- create a new tab
|
29
|
+
delay 0.5
|
30
|
+
end tell
|
31
|
+
end if
|
32
|
+
end tell
|
33
|
+
|
34
|
+
tell current session of currentWindow
|
35
|
+
# make sure we're in the right directory
|
36
|
+
write text "cd '$THE_PATH'"
|
37
|
+
delay 0.5
|
38
|
+
|
39
|
+
# run the script
|
40
|
+
set script_string to "$2" & " " & quoted form of "$FILENAME"
|
41
|
+
write text script_string
|
42
|
+
|
43
|
+
end tell
|
44
|
+
|
45
|
+
end tell
|
46
|
+
EOF
|
metadata
CHANGED
@@ -1,99 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toolrack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.20.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.20.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: teLogger
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.2.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.2.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: ptools
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.4.3
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.4.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: tty-command
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.10.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.10.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: tty-prompt
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.23.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 0.23.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: devops_assist
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.3.3
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 0.3.3
|
97
97
|
description: ''
|
98
98
|
email:
|
99
99
|
- cameronian0@protonmail.com
|
@@ -116,10 +116,11 @@ files:
|
|
116
116
|
- lib/docker/cli/command_factory.rb
|
117
117
|
- lib/docker/cli/command_result.rb
|
118
118
|
- lib/docker/cli/version.rb
|
119
|
+
- ruby-iterm2.sh
|
119
120
|
homepage: ''
|
120
121
|
licenses: []
|
121
122
|
metadata: {}
|
122
|
-
post_install_message:
|
123
|
+
post_install_message:
|
123
124
|
rdoc_options: []
|
124
125
|
require_paths:
|
125
126
|
- lib
|
@@ -134,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
135
|
- !ruby/object:Gem::Version
|
135
136
|
version: '0'
|
136
137
|
requirements: []
|
137
|
-
rubygems_version: 3.
|
138
|
-
signing_key:
|
138
|
+
rubygems_version: 3.4.6
|
139
|
+
signing_key:
|
139
140
|
specification_version: 4
|
140
141
|
summary: ''
|
141
142
|
test_files: []
|