sct 1.4.0 → 1.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa71b183edc2b021f2c3399d5ca7dffe713e3b7b1a26ceada2e49bb224ae50b8
4
- data.tar.gz: 32f4f9e7d27f5f9a77fdb34138150c5b336c21504695dfa174448e5fd6152f88
3
+ metadata.gz: 12ac7ca75a6616f5e4bb671a8bcd02e10ce44b896336f5ff730f17a49e625489
4
+ data.tar.gz: 4549975fd4d799e06fb65de205baee7479bf104e298b21f6a6e53a4fdfadc46c
5
5
  SHA512:
6
- metadata.gz: 77cdf1a0d171c64d0e90e54e218a4bb904bfba9d806f4f0b56f8bae7b2f8494c88e74d5496890f188acf3058835ea149154582077af5174977809e75f152bab8
7
- data.tar.gz: d3b0dcccad17ecd873a9f2288b66c81d82f0e8786e94365b7aa7790a970a794146a9701e9dc510c50dfbf28d6fb03f4fdc50d748b003584d72d4be06676cad41
6
+ metadata.gz: 2e355b398d7d49d5e12ce7212254db901cee4fe0b5452518f9b8c4d02d3acb51b33ca5bd5c12aaae4bec22d9417eb4e312973fb7ba1a00f55573b4a6ac71bd59
7
+ data.tar.gz: c0d05d3519ee4af245ecb7586537a2a0480d8fec08b241ce66203195b833677c05806774286ce152133143bff35e81bd769952a807081caed13ef50e76da1e64
@@ -18,7 +18,7 @@ module Cluster
18
18
 
19
19
  command :start do |c|
20
20
  c.syntax = "sct cluster start"
21
- c.description = "start the cluster"
21
+ c.description = "(re)start the cluster"
22
22
  c.option '--build', '(re)build images before starting'
23
23
  c.option '--pull', 'pull latest images before starting'
24
24
 
@@ -36,15 +36,6 @@ module Cluster
36
36
  end
37
37
  end
38
38
 
39
- command :restart do |c|
40
- c.syntax = "sct cluster restart"
41
- c.description = "restart the cluster"
42
-
43
- c.action do |args, options|
44
- Cluster::Runner.new.restart
45
- end
46
- end
47
-
48
39
  command :delete do |c|
49
40
  c.syntax = "sct cluster delete"
50
41
  c.description = "delete the cluster"
@@ -1,6 +1,8 @@
1
1
  module Cluster
2
2
  class Runner
3
3
 
4
+ @@dc = system("docker compose version", out: "/dev/null", err: "/dev/null") ? "docker compose" : "docker-compose"
5
+
4
6
  def run command, options = {}
5
7
  begin
6
8
  if !system command, options
@@ -11,27 +13,22 @@ module Cluster
11
13
  end
12
14
  end
13
15
 
14
- def dc_system
15
- return executer = system("which docker-compose") ? 'docker-compose' : 'docker compose'
16
- end
17
-
18
- def run_dc command, options = {}
19
- run "#{dc_system} -f ~/development/spend-cloud/docker-compose.yml #{command}", options
16
+ def dc command, options = {}
17
+ run "#{@@dc} -f ~/development/spend-cloud/docker-compose.yml #{command}", options
20
18
  end
21
19
 
22
20
  def start args, options
23
- print "DC_SYSTEM: #{dc_system}"
24
21
  if options.pull
25
- run_dc "pull"
22
+ dc "pull"
26
23
  end
27
24
 
28
25
  if options.build
29
- run_dc "build #{options.pull ? "--pull" : ""}"
26
+ dc "build #{options.pull ? "--pull" : ""}"
30
27
  end
31
28
 
32
29
  run "docker container prune -f"
33
30
 
34
- run_dc "up --detach --remove-orphans --force-recreate --always-recreate-deps"
31
+ dc "up --detach --remove-orphans --force-recreate --always-recreate-deps"
35
32
 
36
33
  if options.pull or options.build
37
34
  system "docker image prune -f"
@@ -41,15 +38,11 @@ module Cluster
41
38
  end
42
39
 
43
40
  def stop
44
- run_dc "down --remove-orphans"
45
- end
46
-
47
- def restart
48
- run_dc "restart"
41
+ dc "down --remove-orphans"
49
42
  end
50
43
 
51
44
  def delete
52
- run_dc "down --remove-orphans -v"
45
+ dc "down --remove-orphans -v"
53
46
  end
54
47
 
55
48
  def reset args, options
@@ -58,7 +51,7 @@ module Cluster
58
51
  end
59
52
 
60
53
  def status
61
- run_dc "ps"
54
+ dc "ps"
62
55
  end
63
56
 
64
57
  def logs args, options
@@ -68,7 +61,7 @@ module Cluster
68
61
  command << " --timestamps" if options.t or options.timestamps
69
62
  command << " --tail #{options.tail}" if options.tail
70
63
 
71
- run_dc "#{command} #{args.join " "}"
64
+ dc "#{command} #{args.join " "}"
72
65
  end
73
66
 
74
67
  end
@@ -105,17 +105,8 @@ module Henk
105
105
  end
106
106
  end
107
107
 
108
- command :"list-dumps" do |c|
109
- c.syntax = 'sct henk list-dumps'
110
- c.description = 'List the customer dumps currently available for import.'
111
-
112
- c.action do |args, options|
113
- Henk::Runner.new.list_dumps args, options
114
- end
115
- end
116
-
117
108
  command :"import" do |c|
118
- c.syntax = 'sct henk import'
109
+ c.syntax = 'sct henk import [<URL>]'
119
110
  c.description = 'Import a customer dump from GCP.'
120
111
 
121
112
  c.action do |args, options|
@@ -123,7 +114,8 @@ module Henk
123
114
  when 0
124
115
  puts "Loading available customer dumps...".blue
125
116
 
126
- available_dumps = `sct henk list-dumps`.lines chomp: true
117
+ available_dumps = `gsutil ls gs://henk-db-dumps/`.lines chomp: true
118
+
127
119
  begin
128
120
  dump_url = choose do |menu|
129
121
  menu.prompt = "Please choose a dump to import:"
@@ -133,8 +125,8 @@ module Henk
133
125
  end
134
126
  end
135
127
  rescue Interrupt
136
- print "\nStopping import"
137
- exit
128
+ # user pressed Ctrl+C, return in order to exit gracefully
129
+ return
138
130
  end
139
131
  when 1
140
132
  dump_url = args.first
@@ -172,10 +172,6 @@ module Henk
172
172
  return options_str
173
173
  end
174
174
 
175
- def list_dumps args, options
176
- run "gsutil ls gs://henk-db-dumps/"
177
- end
178
-
179
175
  def import args, options, dump_url
180
176
  puts "Going to import #{dump_url}".blue
181
177
 
@@ -3,6 +3,8 @@ require 'yaml'
3
3
  module Sct
4
4
  class DevCommand
5
5
 
6
+ @@dc = system("docker compose version", out: "/dev/null", err: "/dev/null") ? "docker compose" : "docker-compose"
7
+
6
8
  @@file = "docker-compose.dev.yml"
7
9
 
8
10
  def error message
@@ -10,17 +12,12 @@ module Sct
10
12
  exit 1
11
13
  end
12
14
 
13
- def dc_system
14
- return executer = system("which docker-compose") ? 'docker-compose' : 'docker compose'
15
- end
16
-
17
15
  def dc command, env = {}
18
- system env, "#{dc_system} -f ~/development/spend-cloud/docker-compose.yml #{command}"
16
+ system env, "#{@@dc} -f ~/development/spend-cloud/docker-compose.yml #{command}"
19
17
  end
20
18
 
21
19
  def dc_dev command, env = {}
22
-
23
- system env, "#{dc_system} -f #{@@file} #{command}"
20
+ system env, "#{@@dc} -f #{@@file} #{command}"
24
21
  end
25
22
 
26
23
  def manifest
@@ -32,9 +29,6 @@ module Sct
32
29
  end
33
30
 
34
31
  def execute args, options
35
-
36
- UI.message('Trying to start development environment')
37
-
38
32
  services = manifest["services"].to_a
39
33
 
40
34
  if Sct::Helper.is_windows?
@@ -17,28 +17,21 @@ module Sct
17
17
 
18
18
  global_option('--verbose') { $verbose = true }
19
19
 
20
- command :'mysql-proxy' do |c|
21
- c.syntax = 'sct mysql-proxy'
22
- c.description = 'setup google mysql proxy'
23
-
24
- c.action do |args, options|
25
- UI.important("Trying to setup mysql proxy")
26
- Sct::MysqlproxyCommand.new.execute args, options
27
- end
28
- end
29
-
30
20
  command :'cluster' do |c|
31
21
  c.syntax = 'sct cluster'
32
22
  c.description = 'make changes to the cluster'
33
23
  end
34
24
 
35
- command :'shell' do |c|
36
- c.syntax = 'sct shell'
37
- c.description = 'run commands from the shell using docker containers'
38
- c.option '--root', 'run as root user in the container'
25
+ command :'database-pull' do |c|
26
+ c.syntax = 'sct database pull'
27
+ c.description = 'pull database changes for proactive frame and proactive config'
28
+ c.option '--all', 'pull the database changes for all repositories'
29
+ c.option '--proactive-frame', 'pull the database changes from proactive-frame'
30
+ c.option '--proactive-config', 'pull the database changes from proactive-config'
39
31
 
40
32
  c.action do |args, options|
41
- Sct::ShellCommand.new.execute args, options
33
+ UI.important("Trying to pull database")
34
+ Sct::DatabasePullCommand.new.execute args, options
42
35
  end
43
36
  end
44
37
 
@@ -54,16 +47,28 @@ module Sct
54
47
  end
55
48
  end
56
49
 
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'
50
+ command :'henk' do |c|
51
+ c.syntax = 'sct henk'
52
+ c.description = 'manage clients on your cluster'
53
+ end
54
+
55
+ command :'mysql-proxy' do |c|
56
+ c.syntax = 'sct mysql-proxy'
57
+ c.description = 'setup google mysql proxy'
63
58
 
64
59
  c.action do |args, options|
65
- UI.important("Trying to pull database")
66
- Sct::DatabasePullCommand.new.execute args, options
60
+ UI.important("Trying to setup mysql proxy")
61
+ Sct::MysqlproxyCommand.new.execute args, options
62
+ end
63
+ end
64
+
65
+ command :'shell' do |c|
66
+ c.syntax = 'sct shell'
67
+ c.description = 'run commands from the shell using docker containers'
68
+ c.option '--root', 'run as root user in the container'
69
+
70
+ c.action do |args, options|
71
+ Sct::ShellCommand.new.execute args, options
67
72
  end
68
73
  end
69
74
 
@@ -1,3 +1,3 @@
1
1
  module Sct
2
- VERSION = "1.4.0"
2
+ VERSION = "1.5.0"
3
3
  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.4.0
4
+ version: 1.5.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: 2022-09-09 00:00:00.000000000 Z
11
+ date: 2022-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -253,10 +253,10 @@ metadata:
253
253
  post_install_message:
254
254
  rdoc_options: []
255
255
  require_paths:
256
- - cluster/lib
257
- - henk/lib
258
256
  - sct/lib
257
+ - henk/lib
259
258
  - sct_core/lib
259
+ - cluster/lib
260
260
  required_ruby_version: !ruby/object:Gem::Requirement
261
261
  requirements:
262
262
  - - ">="
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  - !ruby/object:Gem::Version
269
269
  version: '0'
270
270
  requirements: []
271
- rubygems_version: 3.1.2
271
+ rubygems_version: 3.0.3.1
272
272
  signing_key:
273
273
  specification_version: 4
274
274
  summary: Spend Cloud Tool.