sct 1.0.0 → 1.0.6
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 +4 -4
- data/cluster/lib/cluster/commands_generator.rb +0 -9
- data/cluster/lib/cluster/runner.rb +2 -5
- data/sct/lib/sct/cli_tools_distributor.rb +8 -8
- data/sct/lib/sct/commands/dev.rb +36 -10
- data/{shell/lib/shell/runner.rb → sct/lib/sct/commands/shell.rb} +7 -5
- data/sct/lib/sct/commands_generator.rb +8 -2
- data/sct/lib/sct/tools.rb +3 -6
- data/sct/lib/sct/version.rb +1 -1
- metadata +3 -7
- data/shell/lib/shell.rb +0 -2
- data/shell/lib/shell/commands_generator.rb +0 -14
- data/shell/lib/shell/module.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fc131f8bc317386225d5f4fc54e8a3949b890ed962478c76e4d0cf61a6c24c7
|
4
|
+
data.tar.gz: 8b5b694782cb53883193fcb79192b016e0a53085e492fa3ddd2222348186df16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d05370cc4b9c87de1d7dcdd2895003b8ef3c3d80175e1f5280ce28e66ab2d004387db2f949fbefd867627481171b64392763203105907567220936e49e794561
|
7
|
+
data.tar.gz: a6f5276d96f817ee6ef80b6323f6a184eb72a389a0fd99c2ed6595c9583ebbc67114f575bc19e2deaab8bed0f4293d9d48c2b9e26e977abfb847af80e606d859
|
@@ -63,15 +63,6 @@ module Cluster
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
command :pull do |c|
|
67
|
-
c.syntax = 'sct cluster pull'
|
68
|
-
c.description = 'pull new image versions'
|
69
|
-
|
70
|
-
c.action do |args, options|
|
71
|
-
Cluster::Runner.new.pull
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
66
|
command :status do |c|
|
76
67
|
c.syntax = 'sct cluster status'
|
77
68
|
c.description = 'see the status of your cluster'
|
@@ -24,6 +24,8 @@ module Cluster
|
|
24
24
|
run_dc "build #{options.pull ? "--pull" : ""}"
|
25
25
|
end
|
26
26
|
|
27
|
+
run "docker container prune -f"
|
28
|
+
|
27
29
|
run_dc "up --detach"
|
28
30
|
|
29
31
|
if options.pull or options.build
|
@@ -50,11 +52,6 @@ module Cluster
|
|
50
52
|
start args, options
|
51
53
|
end
|
52
54
|
|
53
|
-
def pull
|
54
|
-
run_dc "pull"
|
55
|
-
run "docker image prune -f"
|
56
|
-
end
|
57
|
-
|
58
55
|
def status
|
59
56
|
run_dc "ps"
|
60
57
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Sct
|
2
2
|
class CLIToolsDistributor
|
3
|
-
class << self
|
3
|
+
class << self
|
4
4
|
def take_off
|
5
5
|
require 'sct'
|
6
6
|
|
@@ -8,18 +8,18 @@ module Sct
|
|
8
8
|
|
9
9
|
if tool_name && Sct::TOOLS.include?(tool_name.to_sym)
|
10
10
|
# Triggering a specific tool
|
11
|
-
|
11
|
+
|
12
12
|
require tool_name
|
13
13
|
begin
|
14
14
|
# First, remove the tool's name from the arguments
|
15
15
|
# Since it will be parsed by the `commander` at a later point
|
16
16
|
# and it must not contain the binary name
|
17
17
|
ARGV.shift
|
18
|
-
|
18
|
+
|
19
19
|
# Import the CommandsGenerator class, which is used to parse
|
20
20
|
# the user input
|
21
21
|
require File.join(tool_name, "commands_generator")
|
22
|
-
|
22
|
+
|
23
23
|
# Call the tool's CommandsGenerator class and let it do its thing
|
24
24
|
commands_generator = Object.const_get(tool_name.sct_module)::CommandsGenerator
|
25
25
|
rescue LoadError
|
@@ -28,15 +28,15 @@ module Sct
|
|
28
28
|
# When we launch this feature, this should never be the case
|
29
29
|
abort("#{tool_name} can't be called via `sct #{tool_name}`, run '#{tool_name}' directly instead".red)
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
# Some of the tools might use other actions so need to load all
|
33
33
|
# actions before we start the tool generator here in the future
|
34
34
|
Sct.load_actions
|
35
|
-
|
35
|
+
|
36
36
|
# trigger start on tool
|
37
37
|
commands_generator.start
|
38
38
|
|
39
|
-
else
|
39
|
+
else
|
40
40
|
require "sct/commands_generator"
|
41
41
|
Sct::CommandsGenerator.start
|
42
42
|
end
|
@@ -47,4 +47,4 @@ module Sct
|
|
47
47
|
|
48
48
|
end
|
49
49
|
end
|
50
|
-
end
|
50
|
+
end
|
data/sct/lib/sct/commands/dev.rb
CHANGED
@@ -3,24 +3,34 @@ require 'yaml'
|
|
3
3
|
module Sct
|
4
4
|
class DevCommand
|
5
5
|
|
6
|
+
@@file = "docker-compose.dev.yml"
|
7
|
+
|
6
8
|
def error message
|
7
9
|
UI.error message
|
8
10
|
exit 1
|
9
11
|
end
|
10
12
|
|
11
|
-
def
|
12
|
-
|
13
|
+
def dc command, env = {}
|
14
|
+
system env, "docker-compose -f ~/development/spend-cloud/docker-compose.yml #{command}"
|
15
|
+
end
|
13
16
|
|
14
|
-
|
15
|
-
|
17
|
+
def dc_dev command, env = {}
|
18
|
+
system env, "docker-compose -f #{@@file} #{command}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def manifest
|
22
|
+
if !File.exist? @@file
|
23
|
+
error "Could not find file '#{@@file}'."
|
16
24
|
end
|
17
25
|
|
18
|
-
|
26
|
+
YAML.load File.read @@file
|
27
|
+
end
|
19
28
|
|
29
|
+
def execute args, options
|
20
30
|
services = manifest["services"].to_a
|
21
31
|
|
22
32
|
if services.length != 1
|
23
|
-
error "Currently sct only supports a single service declaration in '#{file}'. Contact the infra guild if you consider this a limitation."
|
33
|
+
error "Currently sct only supports a single service declaration in '#{@@file}'. Contact the infra guild if you consider this a limitation."
|
24
34
|
end
|
25
35
|
|
26
36
|
service, service_spec = services.first
|
@@ -28,15 +38,31 @@ module Sct
|
|
28
38
|
container = service_spec["container_name"]
|
29
39
|
command = service_spec["command"] || ""
|
30
40
|
|
41
|
+
env = {
|
42
|
+
"PUID" => `id -u`.chomp,
|
43
|
+
"PGID" => `id -g`.chomp,
|
44
|
+
"HOST_MACHINE_IP" => (options.wsl_debugger ? `hostname -I | awk '{print $1}'` : `powershell.exe -c '(Test-Connection -ComputerName $env:computername -count 1).ipv4address.IPAddressToString' | dos2unix`).chomp,
|
45
|
+
"IDE_DEBUG_KEY" => "PHPSTORM",
|
46
|
+
"IDE_DEBUG_SERVER" => "docker",
|
47
|
+
}
|
48
|
+
|
49
|
+
if options.pull
|
50
|
+
return unless dc_dev "pull"
|
51
|
+
end
|
52
|
+
|
31
53
|
if options.build
|
32
|
-
return unless
|
54
|
+
return unless dc_dev "build #{options.pull ? "--pull" : ""}", env
|
55
|
+
end
|
56
|
+
|
57
|
+
if options.pull or options.build
|
58
|
+
system "docker image prune -f"
|
33
59
|
end
|
34
60
|
|
35
|
-
return unless
|
61
|
+
return unless dc "rm --stop --force #{service}"
|
36
62
|
|
37
|
-
|
63
|
+
dc_dev "run --rm --service-ports --name #{container} #{service} #{command}", env
|
38
64
|
|
39
|
-
|
65
|
+
dc "up --detach #{service}"
|
40
66
|
end
|
41
67
|
|
42
68
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
|
-
module
|
4
|
-
class
|
3
|
+
module Sct
|
4
|
+
class ShellCommand
|
5
5
|
|
6
6
|
def error message
|
7
7
|
UI.error message
|
8
8
|
exit 1
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
command =
|
11
|
+
def execute args, options
|
12
|
+
command = args.empty? ? "sh" : args.join(" ")
|
13
13
|
|
14
14
|
file = "docker-compose.dev.yml"
|
15
15
|
|
@@ -41,7 +41,9 @@ module Shell
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
user = options.root ? "root:root" : "$(id -u):$(id -g)"
|
45
|
+
|
46
|
+
system "docker exec -it --user #{user} #{container} #{command}"
|
45
47
|
end
|
46
48
|
|
47
49
|
end
|
@@ -35,13 +35,19 @@ module Sct
|
|
35
35
|
command :'shell' do |c|
|
36
36
|
c.syntax = 'sct shell'
|
37
37
|
c.description = 'run commands from the shell using docker containers'
|
38
|
+
c.option '--root', 'run as root user in the container'
|
39
|
+
|
40
|
+
c.action do |args, options|
|
41
|
+
Sct::ShellCommand.new.execute args, options
|
42
|
+
end
|
38
43
|
end
|
39
44
|
|
40
45
|
command :'dev' do |c|
|
41
46
|
c.syntax = 'sct dev'
|
42
47
|
c.description = 'start development container in the current directory'
|
43
|
-
c.option '--build', '(re)build
|
44
|
-
c.option '--pull', 'pull latest
|
48
|
+
c.option '--build', '(re)build images before starting'
|
49
|
+
c.option '--pull', 'pull latest images before starting'
|
50
|
+
c.option '--wsl-debugger', 'use if running the PHP debugger from WSL'
|
45
51
|
|
46
52
|
c.action do |args, options|
|
47
53
|
Sct::DevCommand.new.execute args, options
|
data/sct/lib/sct/tools.rb
CHANGED
data/sct/lib/sct/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reshad Farid
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- sct/lib/sct/command.rb
|
209
209
|
- sct/lib/sct/commands/dev.rb
|
210
210
|
- sct/lib/sct/commands/mysqlproxy.rb
|
211
|
+
- sct/lib/sct/commands/shell.rb
|
211
212
|
- sct/lib/sct/commands_generator.rb
|
212
213
|
- sct/lib/sct/tools.rb
|
213
214
|
- sct/lib/sct/version.rb
|
@@ -223,10 +224,6 @@ files:
|
|
223
224
|
- sct_core/lib/sct_core/ui/interface.rb
|
224
225
|
- sct_core/lib/sct_core/ui/ui.rb
|
225
226
|
- sct_core/lib/sct_core/update_checker/update_checker.rb
|
226
|
-
- shell/lib/shell.rb
|
227
|
-
- shell/lib/shell/commands_generator.rb
|
228
|
-
- shell/lib/shell/module.rb
|
229
|
-
- shell/lib/shell/runner.rb
|
230
227
|
homepage: https://gitlab.com/proactive-software/packages/sct
|
231
228
|
licenses:
|
232
229
|
- MIT
|
@@ -240,7 +237,6 @@ require_paths:
|
|
240
237
|
- cluster/lib
|
241
238
|
- sct/lib
|
242
239
|
- sct_core/lib
|
243
|
-
- shell/lib
|
244
240
|
required_ruby_version: !ruby/object:Gem::Requirement
|
245
241
|
requirements:
|
246
242
|
- - ">="
|
data/shell/lib/shell.rb
DELETED