sct 1.0.5 → 1.1.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: 14d8446d9ad177cfe1423a229687670d9731830389539014fda62491d09ca054
4
- data.tar.gz: fa3083af252bb67c0b776d270a69b29605e6ce33e06cfe8b6625998ab0cff29a
3
+ metadata.gz: 8fad01fe00c948d248dae7390285021760ae28ad592411a3cbc18ffdef650cd8
4
+ data.tar.gz: 1ba8d43b23ade6f4316767b8759c91bf98f2dac1327cb9903a2c8fa66b2f7a5e
5
5
  SHA512:
6
- metadata.gz: d62a9c18d78ce4a821d32cb0848c4bbc2dc88e1ca526f7600c1bb8b7945a36522f157e94a365036cc68e7549ae76f90368d2c54a1335b43d2cc2233c4c354d54
7
- data.tar.gz: 98381741d7493183b420c176843062d005b8f6620d0a67ce0739d53da77ae2bf11c73c60817b2a0965dfd41a338a249446ec482ee27ba465f8b92708cb768db8
6
+ metadata.gz: 88c67f14fb87bc1ca891527e46b78b7552fb5021832347fdff73e4af0a8066e6b25cd17344b295ba2588af7265682a79248b245d6d2f0b1fe93fa5e9d5b4050c
7
+ data.tar.gz: 392db33f0c88bdc2f36025b24a85614865bcf54d99f22970b8da874bf8abf1f956ec194ab5dc3d2659ee708fc5d34940d59689d6f2e0e9bf433139c3262dd5d0
@@ -0,0 +1,50 @@
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.all
27
+ UI.important("Requesting to pull database changes for proactive frame and proactive config")
28
+ process_request = `curl -X POST -F token=#{private_token} -F ref=master -F variables[DB_PULL_FRAME]=true -F variables[DB_PULL_CONFIG]=true -F variables[REMOTE_BRANCH_NAME]=#{branch} #{pipeline_endpoint}`
29
+ else
30
+ db_pull_frame = ""
31
+ if options.proactive_frame
32
+ UI.important("Requesting to pull database for proactive frame")
33
+ db_pull_frame = "-F variables[DB_PULL_FRAME]=true"
34
+ end
35
+
36
+ db_pull_config = ""
37
+ if options.proactive_config
38
+ UI.important("Requesting to pull database for proactive config")
39
+ db_pull_config = "-F variables[DB_PULL_CONFIG]=true"
40
+ end
41
+
42
+ if db_pull_frame != "" or db_pull_config != ""
43
+ process_request = `curl -X POST -F token=#{private_token} -F ref=master #{db_pull_frame} #{db_pull_config} -F variables[REMOTE_BRANCH_NAME]=#{branch} #{pipeline_endpoint}`
44
+ else
45
+ error "Missing options. Use --help to see the available options"
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -38,7 +38,21 @@ module Sct
38
38
  container = service_spec["container_name"]
39
39
  command = service_spec["command"] || ""
40
40
 
41
- env = { "PUID" => `id -u`.chomp, "PGID" => `id -g`.chomp }
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"
@@ -47,12 +47,26 @@ module Sct
47
47
  c.description = 'start development container in the current directory'
48
48
  c.option '--build', '(re)build images before starting'
49
49
  c.option '--pull', 'pull latest images before starting'
50
+ c.option '--wsl-debugger', 'use if running the PHP debugger from WSL'
50
51
 
51
52
  c.action do |args, options|
52
53
  Sct::DevCommand.new.execute args, options
53
54
  end
54
55
  end
55
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 '--all', 'pull the database changes for all repositories'
61
+ c.option '--proactive-frame', 'pull the database changes from proactive-frame'
62
+ c.option '--proactive-config', 'pull the database changes from proactive-config'
63
+
64
+ c.action do |args, options|
65
+ UI.important("Trying to pull database")
66
+ Sct::DatabasePullCommand.new.execute args, options
67
+ end
68
+ end
69
+
56
70
  run!
57
71
  end
58
72
  end
@@ -1,3 +1,3 @@
1
1
  module Sct
2
- VERSION = "1.0.5"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -66,6 +66,10 @@ module SctCore
66
66
  return !ENV["SUDO_USER"].nil? && !ENV["SUDO_USER"].empty?
67
67
  end
68
68
 
69
+ def self.is_mac_os?
70
+ return self.operating_system == MAC_OS
71
+ end
72
+
69
73
  def self.is_windows?
70
74
  return self.operating_system == WINDOWS
71
75
  end
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.5
4
+ version: 1.1.0
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-04-06 00:00:00.000000000 Z
11
+ date: 2021-06-30 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,6 +220,7 @@ 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
211
226
  - sct/lib/sct/commands/shell.rb
@@ -248,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
263
  - !ruby/object:Gem::Version
249
264
  version: '0'
250
265
  requirements: []
251
- rubygems_version: 3.0.8
266
+ rubygems_version: 3.1.2
252
267
  signing_key:
253
268
  specification_version: 4
254
269
  summary: Spend Cloud Tool.