docker-cli 0.1.2 → 0.2.0

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: 273888f0efbab78c681cbba082b6bf402b8c546abf8a732d71827f238bfa51df
4
- data.tar.gz: cc1cd3009140b977b4ffd7bbfa74920542ae2217f5d50b18eb5519310b06a9ea
3
+ metadata.gz: c3b534e3b0aa4cba19d8cce7c543f9af128e3186e3315cd2fc9efd4c44610e7e
4
+ data.tar.gz: 00ac6d7b9919d13b08d1dbf9fd460491abb35810f57bd032d1e18c41f1ab0b9e
5
5
  SHA512:
6
- metadata.gz: e0a459e9c1fa225a93f53f957c558d537e2e3a1558f88cb04b95e1a723bf726e2cc3745fe27e6210a64179883624ab6ec5984ed55f55bd9b7ce9a69ee6832343
7
- data.tar.gz: f37f25934d5584d271cbc6d529aab26a42d869c0911d670b7736aa8f144acecbd82cd6c548f3ec3de229c60c15e06eb9984d29c2f311a8f21a98b029931b4422
6
+ metadata.gz: 5f33fcfe8272f889b4d7c79921b562d969e0318ac76b0660085026ff09a784eabfa1b8cdff5929cffaa2bb771906ad8ca74d9d2996ffb9077bd0433563108249
7
+ data.tar.gz: 6342a7d84dc8bd713eac66c09823b41395adb9e1a4e82bad1c5f14c54f5c51762c77d0653c2a1bee9539dd526a6847b3d98613afc137188d99896cd31420f40b
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,33 +1,59 @@
1
- PATH
2
- remote: .
3
- specs:
4
- docker-cli (0.1.2)
5
- ptools
6
- teLogger
7
- toolrack
8
- tty-command
9
- tty-prompt
10
-
11
- GEM
12
- remote: https://rubygems.org/
1
+ GIT
2
+ remote: devops_assist
3
+ revision: 7d0ed10bc1964532be810c347447ec9ee4a61fca
4
+ branch: master
13
5
  specs:
14
- devops_assist (0.3.11)
6
+ devops_assist (0.3.3)
15
7
  git_cli
16
- git_cli_prompt (~> 0.3.3)
8
+ git_cli_prompt
17
9
  gvcs
18
10
  teLogger
19
11
  toolrack
20
12
  tty-prompt
21
- diff-lcs (1.5.0)
13
+
14
+ GIT
15
+ remote: git_cli
16
+ revision: 05d83d28f37f4023920b6bf91d975b818d0f13fe
17
+ branch: master
18
+ specs:
22
19
  git_cli (0.11.2)
23
20
  gvcs
24
21
  ptools (~> 1.4.0)
25
22
  teLogger
26
23
  toolrack
27
- git_cli_prompt (0.3.4)
24
+
25
+ GIT
26
+ remote: git_cli_prompt
27
+ revision: b9734eab851922936515f717093b1e2429a24d8a
28
+ branch: master
29
+ specs:
30
+ git_cli_prompt (0.3.1)
28
31
  teLogger
29
32
  toolrack
30
33
  tty-prompt
34
+
35
+ PATH
36
+ remote: .
37
+ specs:
38
+ docker-cli (0.2.0)
39
+ ptools
40
+ teLogger
41
+ tty-command
42
+ tty-prompt
43
+
44
+ GIT
45
+ remote: toolrack
46
+ revision: be0bda340f7f6047e5ceace77b5d0a928bbcdecf
47
+ branch: master
48
+ specs:
49
+ toolrack (0.20.1)
50
+ base58
51
+
52
+ GEM
53
+ remote: https://rubygems.org/
54
+ specs:
55
+ base58 (0.2.3)
56
+ diff-lcs (1.5.0)
31
57
  gvcs (0.1.1)
32
58
  pastel (0.8.0)
33
59
  tty-color (~> 0.5)
@@ -42,12 +68,11 @@ GEM
42
68
  rspec-expectations (3.12.2)
43
69
  diff-lcs (>= 1.2.0, < 2.0)
44
70
  rspec-support (~> 3.12.0)
45
- rspec-mocks (3.12.5)
71
+ rspec-mocks (3.12.4)
46
72
  diff-lcs (>= 1.2.0, < 2.0)
47
73
  rspec-support (~> 3.12.0)
48
74
  rspec-support (3.12.0)
49
75
  teLogger (0.2.2)
50
- toolrack (0.21.0)
51
76
  tty-color (0.6.0)
52
77
  tty-command (0.10.1)
53
78
  pastel (~> 0.8)
@@ -63,14 +88,16 @@ GEM
63
88
  wisper (2.0.1)
64
89
 
65
90
  PLATFORMS
66
- ruby
67
- x86_64-linux
91
+ x86_64-darwin-21
68
92
 
69
93
  DEPENDENCIES
70
- devops_assist
94
+ devops_assist!
71
95
  docker-cli!
96
+ git_cli!
97
+ git_cli_prompt!
72
98
  rake (~> 13.0)
73
99
  rspec (~> 3.0)
100
+ toolrack!
74
101
 
75
102
  BUNDLED WITH
76
- 2.2.28
103
+ 2.4.6
data/docker-cli.gemspec CHANGED
@@ -30,7 +30,7 @@ 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'
33
+ #spec.add_dependency 'toolrack'
34
34
  spec.add_dependency 'teLogger'
35
35
 
36
36
  spec.add_dependency 'ptools'
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.add_dependency 'tty-command'
39
39
  spec.add_dependency 'tty-prompt'
40
40
 
41
- spec.add_development_dependency 'devops_assist'
41
+ #spec.add_development_dependency 'devops_assist'
42
42
 
43
43
  # Uncomment to register a new dependency of your gem
44
44
  # spec.add_dependency "example-gem", "~> 1.0"
@@ -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,6 +43,30 @@ 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 <<EOL
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
+ EOL
62
+ `
63
+ when "Terminal"
64
+ `osascript -e \
65
+ 'tell application "Terminal"
66
+ activate
67
+ do script "#{@command_buffer.join(" ")}"
68
+ end tell'
69
+ `
44
70
  else
45
71
  raise Error, "Unfinished supporting terminal : #{terminal}"
46
72
  end
@@ -70,10 +96,17 @@ module Docker
70
96
 
71
97
  private
72
98
  def detect_terminal
73
- possible = [ "gnome-terminal","konsole","cmd.exe", "tilix", "terminator" ]
74
99
  avail = []
75
- possible.each do |app|
76
- avail << app if not File.which(app).nil?
100
+ if TR::RTUtils.on_linux?
101
+ possible = [ "gnome-terminal","konsole","cmd.exe", "tilix", "terminator" ]
102
+ possible.each do |app|
103
+ avail << app if not File.which(app).nil?
104
+ end
105
+ elsif TR::RTUtils.on_windows?
106
+ avail << "cmd.exe"
107
+ elsif TR::RTUtils.on_mac?
108
+ avail << "Terminal"
109
+ avail << "iTerm2"
77
110
  end
78
111
  avail
79
112
  end
@@ -93,14 +93,9 @@ module Docker
93
93
  cmd = []
94
94
  cmd << Cli.docker_exe
95
95
  cmd << "ps"
96
- # return all info instead of only the container ID
97
- #cmd << "-a"
98
96
  cmd << "-aq"
99
97
  cmd << "-f"
100
- # From little testing seems the command by default already support regex formatting
101
- # So can use the regex marker to get exact match
102
- # e.g. if want exact match, pass in ^#{name}\z
103
- cmd << "name=\"#{name}\""
98
+ cmd << "name=#{name}"
104
99
 
105
100
  logger.debug "Find from all container: #{cmd.join(" ")}"
106
101
  Command.new(cmd)
@@ -260,10 +255,6 @@ module Docker
260
255
  @logger
261
256
  end
262
257
 
263
- def parse_container_list(out, &block)
264
-
265
- end
266
-
267
258
  end
268
259
  end
269
260
  end
@@ -1,4 +1,5 @@
1
1
 
2
+ require 'toolrack'
2
3
 
3
4
  module Docker
4
5
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Docker
4
4
  module Cli
5
- VERSION = "0.1.2"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
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,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-04 00:00:00.000000000 Z
11
+ date: 2023-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: toolrack
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: teLogger
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +66,6 @@ dependencies:
80
66
  - - ">="
81
67
  - !ruby/object:Gem::Version
82
68
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: devops_assist
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
69
  description: ''
98
70
  email:
99
71
  - cameronian0@protonmail.com
@@ -116,10 +88,11 @@ files:
116
88
  - lib/docker/cli/command_factory.rb
117
89
  - lib/docker/cli/command_result.rb
118
90
  - lib/docker/cli/version.rb
91
+ - ruby-iterm2.sh
119
92
  homepage: ''
120
93
  licenses: []
121
94
  metadata: {}
122
- post_install_message:
95
+ post_install_message:
123
96
  rdoc_options: []
124
97
  require_paths:
125
98
  - lib
@@ -134,8 +107,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
107
  - !ruby/object:Gem::Version
135
108
  version: '0'
136
109
  requirements: []
137
- rubygems_version: 3.4.10
138
- signing_key:
110
+ rubygems_version: 3.4.6
111
+ signing_key:
139
112
  specification_version: 4
140
113
  summary: ''
141
114
  test_files: []