rascal 0.3.0 → 0.3.1

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: 410f63a35a3389098195b39badbc4e1c36f6ac9f534f8741ca92489b0bfbd083
4
- data.tar.gz: 38c474e407a4217c8750de66eabbb123a6214c4f921308ea64fb7d17831b1095
3
+ metadata.gz: 572abe30bc6bf324db027831465e8727645f9a3baa86099f17b183990dadc112
4
+ data.tar.gz: a3f022201df4025e5f967db4482bf25b9cfc8c20b99518ce905671415610ca90
5
5
  SHA512:
6
- metadata.gz: da2100bea61c066b3c7c3eb72b7b321c69cb39f697de0c04cdc81ece950e10d2d60ddab0b6c7b74de6fa8e7f3ea3b767be9a74bf909dde7794fc3560c6664586
7
- data.tar.gz: 404cf6adc8d6977f1946cb1e8ecbe60647c38b9683a0f411cad51731d3ff8d45d8c44556c907088d0a2aac1f3be16727751025bc80710692999534d2b9d32bbe
6
+ metadata.gz: bb8692dd074d0ed5f6b266df552652dafcc79e89a7cbfbf17c4c624caf7d0a8fb96760d0feb8f4aabd384bb3ae5b809c99539faba3cb36f1ef13a1ff3f259542
7
+ data.tar.gz: 07e7e1980a7b275c274448c4bd4961bd5a3a33a310c65453ab604ab27f7c9d1103e3d470d693066298b596c87dd43024dc2ac41b1d0a86fd5995055f8f0d6ede
@@ -4,6 +4,11 @@ All notable changes to this project will be documented here.
4
4
 
5
5
  Rascal follows semantic versioning. This has little consequence pre 1.0, so expect breaking changes.
6
6
 
7
+ ## 0.3.1 (2020-10-01)
8
+
9
+ - Pass env variables to service containers.
10
+
11
+
7
12
  ## 0.3.0 (2020-09-23)
8
13
 
9
14
  - Mount /repo into all service volumes
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rascal (0.3.0)
4
+ rascal (0.3.1)
5
5
  thor (~> 0.20.3)
6
6
 
7
7
  GEM
@@ -40,12 +40,13 @@ module Rascal
40
40
  !!id
41
41
  end
42
42
 
43
- def start(network: nil, network_alias: nil, volumes: [])
43
+ def start(network: nil, network_alias: nil, volumes: [], env: {})
44
44
  say "Starting container for #{@name}"
45
45
  create(network: network, network_alias: network_alias, volumes: volumes) unless exists?
46
46
  Docker.interface.run(
47
47
  'container',
48
48
  'start',
49
+ *env_args(env),
49
50
  id,
50
51
  )
51
52
  end
@@ -75,7 +76,7 @@ module Rascal
75
76
  '--tty',
76
77
  *(['-w', working_dir] if working_dir),
77
78
  *(volumes.flat_map { |v| ['-v', v.to_param] }),
78
- *(env.flat_map { |key, value| ['-e', "#{key}=#{value}"] }),
79
+ *env_args(env),
79
80
  *(['--network', network.id] if network),
80
81
  @image,
81
82
  *command,
@@ -148,6 +149,10 @@ module Rascal
148
149
  id,
149
150
  )
150
151
  end
152
+
153
+ def env_args(env)
154
+ env.flat_map { |key, value| ['-e', "#{key}=#{value}"] }
155
+ end
151
156
  end
152
157
  end
153
158
  end
@@ -69,15 +69,16 @@ module Rascal
69
69
  name = config.get('name', key)
70
70
  full_name = "#{@base_name}-#{name}"
71
71
  shared_volumes = [build_repo_volume(docker_repo_dir), build_builds_volume(full_name)]
72
+ env_variables = (config.get('variables', {}))
72
73
  Environment.new(full_name,
73
74
  name: name,
74
75
  image: config.get('image'),
75
- env_variables: (config.get('variables', {})),
76
76
  volumes: [
77
77
  *shared_volumes,
78
78
  *build_volumes(full_name, config.get('volumes', {}))
79
79
  ],
80
- services: build_services(full_name, config.get('services', []), volumes: shared_volumes),
80
+ env_variables: env_variables,
81
+ services: build_services(full_name, config.get('services', []), volumes: shared_volumes, env_variables: env_variables),
81
82
  before_shell: config.get('before_shell', []),
82
83
  after_shell: config.get('after_shell', []),
83
84
  working_dir: docker_repo_dir,
@@ -110,13 +111,14 @@ module Rascal
110
111
  end
111
112
  end
112
113
 
113
- def build_services(name, services, volumes: [])
114
+ def build_services(name, services, volumes: [], env_variables: {})
114
115
  services.collect do |service_config|
115
116
  service_alias = service_config['alias']
116
117
  Service.new("#{name}_#{service_alias}",
117
118
  alias_name: service_config['alias'],
118
119
  image: service_config['name'],
119
120
  volumes: volumes,
121
+ env_variables: env_variables,
120
122
  )
121
123
  end
122
124
  end
@@ -1,12 +1,13 @@
1
1
  module Rascal
2
2
  class Service
3
- attr_reader :name, :container, :alias
3
+ attr_reader :name, :container, :alias, :env_variables
4
4
 
5
- def initialize(name, image:, alias_name:, volumes: [])
5
+ def initialize(name, env_variables: {}, image:, alias_name:, volumes: [])
6
6
  @name = name
7
7
  @container = Docker::Container.new(name, image)
8
8
  @alias = alias_name
9
9
  @volumes = volumes
10
+ @env_variables = env_variables
10
11
  end
11
12
 
12
13
  def download_missing
@@ -15,7 +16,7 @@ module Rascal
15
16
 
16
17
  def start_if_stopped(network: nil)
17
18
  unless @container.running?
18
- @container.start(network: network, network_alias: @alias, volumes: @volumes)
19
+ @container.start(network: network, network_alias: @alias, volumes: @volumes, env: @env_variables)
19
20
  end
20
21
  end
21
22
 
@@ -1,3 +1,3 @@
1
1
  module Rascal
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rascal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-23 00:00:00.000000000 Z
11
+ date: 2020-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor