sct 1.0.0 → 1.0.1

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: 8be150a1d5ddc9339df696d2f7db5d6056dfdba0fbb48884e57cfacc700b79ea
4
- data.tar.gz: d6fc67a9a3af7c51bf542353f476ec59b60f1c40e7387da64910c4287be857c7
3
+ metadata.gz: 6c949eeff7191cb2699ed0ed1ba26559d7a47ca5111e154204b4e1da42356069
4
+ data.tar.gz: 7c021037a4e3fc764d011e7d2e76024344a6a2b3e05672de4bc5dc0cad985042
5
5
  SHA512:
6
- metadata.gz: e5046d7b3acb18f4cce8b17b7a8d32586758dfda47ba696b7e0f36192fd5b51d132fe2a770768410728279c08b70ebfeb263a79b82bad5531d889b3fe0b733cc
7
- data.tar.gz: 3502a15df6d47b547af6dc7a15cd175a23f45700c6771ccf66055542d2df2d21baadb7c26c03c0736d469ead3108c5b09f968adc318c1d572fa036fea047f454
6
+ metadata.gz: 9022840b61e7414056aef611325122d8c4e1c1dce4c370f99d2b67d5ddda35b9e395444ffc6b7d79b01d530d40117cfc08159148b276263d9b8958cce488e8c5
7
+ data.tar.gz: d5f967cd37ad3447f3566051894195b08ecda28773a95a9bdecc7f61bbb59efc339d6541c826b1f5a0efd6e06bc3519e1d1cce32c096b784ca1ad4518f71e0c3
@@ -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'
@@ -50,11 +50,6 @@ module Cluster
50
50
  start args, options
51
51
  end
52
52
 
53
- def pull
54
- run_dc "pull"
55
- run "docker image prune -f"
56
- end
57
-
58
53
  def status
59
54
  run_dc "ps"
60
55
  end
@@ -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 execute args, options
12
- file = "docker-compose.dev.yml"
13
+ def dc command
14
+ system "docker-compose -f ~/development/spend-cloud/docker-compose.yml #{command}"
15
+ end
13
16
 
14
- if !File.exist? file
15
- error "Could not find file '#{file}'."
17
+ def local_dc command
18
+ system "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
- manifest = YAML.load File.read file
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,23 @@ module Sct
28
38
  container = service_spec["container_name"]
29
39
  command = service_spec["command"] || ""
30
40
 
41
+ if options.pull
42
+ return unless local_dc "pull"
43
+ end
44
+
31
45
  if options.build
32
- return unless system "docker-compose -f #{file} build #{options.pull ? "--pull" : ""}"
46
+ return unless local_dc "build --build-arg PUID=$(id -u) --build-arg PGID=$(id -g) #{options.pull ? "--pull" : ""}"
47
+ end
48
+
49
+ if options.pull or options.build
50
+ system "docker image prune -f"
33
51
  end
34
52
 
35
- return unless system "docker-compose -f ~/development/spend-cloud/docker-compose.yml rm --stop --force #{service}"
53
+ return unless dc "rm --stop --force #{service}"
36
54
 
37
- system "docker-compose -f #{file} run --rm --service-ports --name #{container} #{service} #{command}"
55
+ local_dc "run --rm --service-ports --name #{container} #{service} #{command}"
38
56
 
39
- system "docker-compose -f ~/development/spend-cloud/docker-compose.yml up --detach #{service}"
57
+ dc "up --detach #{service}"
40
58
  end
41
59
 
42
60
  end
@@ -40,8 +40,8 @@ module Sct
40
40
  command :'dev' do |c|
41
41
  c.syntax = 'sct dev'
42
42
  c.description = 'start development container in the current directory'
43
- c.option '--build', '(re)build image from Dockerfile before starting'
44
- c.option '--pull', 'pull latest base image from Dockerfile before (re)building. only used in combination with --build flag'
43
+ c.option '--build', '(re)build images before starting'
44
+ c.option '--pull', 'pull latest images before starting'
45
45
 
46
46
  c.action do |args, options|
47
47
  Sct::DevCommand.new.execute args, options
@@ -1,3 +1,3 @@
1
1
  module Sct
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -41,7 +41,7 @@ module Shell
41
41
  end
42
42
  end
43
43
 
44
- system "docker exec -it #{container} #{command}"
44
+ system "docker exec -it --user $(id -u):$(id -g) #{container} #{command}"
45
45
  end
46
46
 
47
47
  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.0
4
+ version: 1.0.1
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-01-14 00:00:00.000000000 Z
11
+ date: 2021-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -237,10 +237,10 @@ metadata:
237
237
  post_install_message:
238
238
  rdoc_options: []
239
239
  require_paths:
240
+ - shell/lib
240
241
  - cluster/lib
241
242
  - sct/lib
242
243
  - sct_core/lib
243
- - shell/lib
244
244
  required_ruby_version: !ruby/object:Gem::Requirement
245
245
  requirements:
246
246
  - - ">="