sct 1.0.4 → 1.0.9
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/sct/lib/sct/cli_tools_distributor.rb +8 -8
- data/sct/lib/sct/commands/databasepull.rb +37 -0
- data/sct/lib/sct/commands/dev.rb +15 -1
- data/{shell/lib/shell/runner.rb → sct/lib/sct/commands/shell.rb} +7 -5
- data/sct/lib/sct/commands_generator.rb +18 -0
- data/sct/lib/sct/tools.rb +3 -6
- data/sct/lib/sct/version.rb +1 -1
- data/sct_core/lib/sct_core/helper.rb +4 -0
- metadata +19 -8
- 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: a4e19d771e32524e38a9d685d161bdf57a17a71569536ce5af8fd51462b52960
|
4
|
+
data.tar.gz: 610520f2b59b575ccc858c80af79cd1b40b470c403c849e34415559461e9b4ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd68fb3fd3e6c5ba9c4a91232cb83427697631385367eefff7a5477fd99e10f8c524f9d7ea4327c56d7ab31a93fca09e4ee610aad3b099ce14d26f7ab4777e76
|
7
|
+
data.tar.gz: 2ab0d6e33f702ec64050126b05ee818e607ceae6b806a5ee91938295cf7e8e69824e3e3dacf41688e4f538041e67aaacfecd7c7708d168be3ce5311ef527e75b
|
@@ -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
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Sct
|
2
|
+
class DatabasePullCommand
|
3
|
+
def error message
|
4
|
+
UI.error message
|
5
|
+
exit 1
|
6
|
+
end
|
7
|
+
|
8
|
+
def execute args, options
|
9
|
+
branch = ENV['CI_BRANCH']
|
10
|
+
if not branch or branch == ""
|
11
|
+
branch = 'master'
|
12
|
+
end
|
13
|
+
|
14
|
+
# We need to set this locally, so that we don't save this at the repository
|
15
|
+
pipeline_endpoint = ENV['CI_MERGE_REQUEST_PIPELINE']
|
16
|
+
if not pipeline_endpoint
|
17
|
+
error "Pipeline endpoint not set"
|
18
|
+
end
|
19
|
+
|
20
|
+
# We need to set this locally, so that we don't save this at the repository
|
21
|
+
private_token = ENV['CI_PRIVATE_TOKEN']
|
22
|
+
if not private_token
|
23
|
+
error "Private token not set"
|
24
|
+
end
|
25
|
+
|
26
|
+
if options.proactive_frame
|
27
|
+
UI.important("Requesting to pull database for proactive frame")
|
28
|
+
process_request = `curl -X POST -F token=#{private_token} -F ref=master -F variables[DB_PULL_FRAME]=true -F variables[REMOTE_BRANCH_NAME]=#{branch} #{pipeline_endpoint}`
|
29
|
+
end
|
30
|
+
|
31
|
+
if options.proactive_config
|
32
|
+
UI.important("Requesting to pull database for proactive config")
|
33
|
+
process_request = `curl -X POST -F token=#{private_token} -F ref=master -F variables[DB_PULL_CONFIG]=true -F variables[REMOTE_BRANCH_NAME]=#{branch} #{pipeline_endpoint}`
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/sct/lib/sct/commands/dev.rb
CHANGED
@@ -38,7 +38,21 @@ module Sct
|
|
38
38
|
container = service_spec["container_name"]
|
39
39
|
command = service_spec["command"] || ""
|
40
40
|
|
41
|
-
|
41
|
+
if Sct::Helper.is_windows?
|
42
|
+
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
|
43
|
+
elsif Sct::Helper.is_mac_os?
|
44
|
+
host_machine_IP = `ipconfig getifaddr $(route get 8.8.8.8 | awk '/interface: / {print $2; }')`.chomp
|
45
|
+
else
|
46
|
+
host_machine_IP = `hostname -I | awk '{print $1}'`.chomp
|
47
|
+
end
|
48
|
+
|
49
|
+
env = {
|
50
|
+
"PUID" => `id -u`.chomp,
|
51
|
+
"PGID" => `id -g`.chomp,
|
52
|
+
"HOST_MACHINE_IP" => host_machine_IP,
|
53
|
+
"IDE_DEBUG_KEY" => "PHPSTORM",
|
54
|
+
"IDE_DEBUG_SERVER" => "docker",
|
55
|
+
}
|
42
56
|
|
43
57
|
if options.pull
|
44
58
|
return unless dc_dev "pull"
|
@@ -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,6 +35,11 @@ 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|
|
@@ -42,12 +47,25 @@ module Sct
|
|
42
47
|
c.description = 'start development container in the current directory'
|
43
48
|
c.option '--build', '(re)build images before starting'
|
44
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
|
48
54
|
end
|
49
55
|
end
|
50
56
|
|
57
|
+
command :'database-pull' do |c|
|
58
|
+
c.syntax = 'sct database pull'
|
59
|
+
c.description = 'pull database changes for proactive frame and proactive config'
|
60
|
+
c.option '--proactive-frame', 'pull the database changes from proactive-frame'
|
61
|
+
c.option '--proactive-config', 'pull the database changes from proactive-config'
|
62
|
+
|
63
|
+
c.action do |args, options|
|
64
|
+
UI.important("Trying to pull database")
|
65
|
+
Sct::DatabasePullCommand.new.execute args, options
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
51
69
|
run!
|
52
70
|
end
|
53
71
|
end
|
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.9
|
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-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored
|
@@ -100,6 +100,20 @@ dependencies:
|
|
100
100
|
- - "<"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: 3.0.0
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: gitlab
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 4.17.0
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 4.17.0
|
103
117
|
- !ruby/object:Gem::Dependency
|
104
118
|
name: tty-screen
|
105
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,8 +220,10 @@ files:
|
|
206
220
|
- sct/lib/sct/.DS_Store
|
207
221
|
- sct/lib/sct/cli_tools_distributor.rb
|
208
222
|
- sct/lib/sct/command.rb
|
223
|
+
- sct/lib/sct/commands/databasepull.rb
|
209
224
|
- sct/lib/sct/commands/dev.rb
|
210
225
|
- sct/lib/sct/commands/mysqlproxy.rb
|
226
|
+
- sct/lib/sct/commands/shell.rb
|
211
227
|
- sct/lib/sct/commands_generator.rb
|
212
228
|
- sct/lib/sct/tools.rb
|
213
229
|
- sct/lib/sct/version.rb
|
@@ -223,10 +239,6 @@ files:
|
|
223
239
|
- sct_core/lib/sct_core/ui/interface.rb
|
224
240
|
- sct_core/lib/sct_core/ui/ui.rb
|
225
241
|
- 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
242
|
homepage: https://gitlab.com/proactive-software/packages/sct
|
231
243
|
licenses:
|
232
244
|
- MIT
|
@@ -238,7 +250,6 @@ post_install_message:
|
|
238
250
|
rdoc_options: []
|
239
251
|
require_paths:
|
240
252
|
- cluster/lib
|
241
|
-
- shell/lib
|
242
253
|
- sct/lib
|
243
254
|
- sct_core/lib
|
244
255
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -252,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
252
263
|
- !ruby/object:Gem::Version
|
253
264
|
version: '0'
|
254
265
|
requirements: []
|
255
|
-
rubygems_version: 3.
|
266
|
+
rubygems_version: 3.1.2
|
256
267
|
signing_key:
|
257
268
|
specification_version: 4
|
258
269
|
summary: Spend Cloud Tool.
|
data/shell/lib/shell.rb
DELETED