rascal 0.2.1 → 0.3.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 +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/lib/rascal/docker/container.rb +4 -3
- data/lib/rascal/environment.rb +3 -2
- data/lib/rascal/environments_definition/gitlab.rb +6 -4
- data/lib/rascal/service.rb +3 -2
- data/lib/rascal/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 410f63a35a3389098195b39badbc4e1c36f6ac9f534f8741ca92489b0bfbd083
|
4
|
+
data.tar.gz: 38c474e407a4217c8750de66eabbb123a6214c4f921308ea64fb7d17831b1095
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da2100bea61c066b3c7c3eb72b7b321c69cb39f697de0c04cdc81ece950e10d2d60ddab0b6c7b74de6fa8e7f3ea3b767be9a74bf909dde7794fc3560c6664586
|
7
|
+
data.tar.gz: 404cf6adc8d6977f1946cb1e8ecbe60647c38b9683a0f411cad51731d3ff8d45d8c44556c907088d0a2aac1f3be16727751025bc80710692999534d2b9d32bbe
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ 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.0 (2020-09-23)
|
8
|
+
|
9
|
+
- Mount /repo into all service volumes
|
10
|
+
|
7
11
|
|
8
12
|
## 0.2.1 (2019-04-10)
|
9
13
|
|
data/Gemfile.lock
CHANGED
@@ -40,9 +40,9 @@ module Rascal
|
|
40
40
|
!!id
|
41
41
|
end
|
42
42
|
|
43
|
-
def start(network: nil, network_alias: nil)
|
43
|
+
def start(network: nil, network_alias: nil, volumes: [])
|
44
44
|
say "Starting container for #{@name}"
|
45
|
-
create(network: network, network_alias: network_alias) unless exists?
|
45
|
+
create(network: network, network_alias: network_alias, volumes: volumes) unless exists?
|
46
46
|
Docker.interface.run(
|
47
47
|
'container',
|
48
48
|
'start',
|
@@ -50,11 +50,12 @@ module Rascal
|
|
50
50
|
)
|
51
51
|
end
|
52
52
|
|
53
|
-
def create(network: nil, network_alias: nil)
|
53
|
+
def create(network: nil, network_alias: nil, volumes: [])
|
54
54
|
@id = Docker.interface.run(
|
55
55
|
'container',
|
56
56
|
'create',
|
57
57
|
'--name', @prefixed_name,
|
58
|
+
*(volumes.flat_map { |v| ['-v', v.to_param] }),
|
58
59
|
*(['--network', network.id] if network),
|
59
60
|
*(['--network-alias', network_alias] if network_alias),
|
60
61
|
@image,
|
data/lib/rascal/environment.rb
CHANGED
@@ -2,7 +2,7 @@ module Rascal
|
|
2
2
|
class Environment
|
3
3
|
attr_reader :name, :network, :container, :env_variables, :services, :volumes, :working_dir, :before_shell
|
4
4
|
|
5
|
-
def initialize(full_name, name:, image:, env_variables: {}, services: [], volumes: [], before_shell: [], working_dir: nil)
|
5
|
+
def initialize(full_name, name:, image:, env_variables: {}, services: [], volumes: [], before_shell: [], after_shell: [], working_dir: nil)
|
6
6
|
@name = name
|
7
7
|
@network = Docker::Network.new(full_name)
|
8
8
|
@container = Docker::Container.new(full_name, image)
|
@@ -11,12 +11,13 @@ module Rascal
|
|
11
11
|
@volumes = volumes
|
12
12
|
@working_dir = working_dir
|
13
13
|
@before_shell = before_shell
|
14
|
+
@after_shell = after_shell
|
14
15
|
end
|
15
16
|
|
16
17
|
def run_shell
|
17
18
|
download_missing
|
18
19
|
start_services
|
19
|
-
command = [*@before_shell, 'bash'].join(';')
|
20
|
+
command = [*@before_shell, 'bash', *@after_shell].join(';')
|
20
21
|
@container.run_and_attach('bash', '-c', command,
|
21
22
|
env: @env_variables,
|
22
23
|
network: @network,
|
@@ -68,17 +68,18 @@ module Rascal
|
|
68
68
|
unless key.start_with?('.') || config.get('hide', false)
|
69
69
|
name = config.get('name', key)
|
70
70
|
full_name = "#{@base_name}-#{name}"
|
71
|
+
shared_volumes = [build_repo_volume(docker_repo_dir), build_builds_volume(full_name)]
|
71
72
|
Environment.new(full_name,
|
72
73
|
name: name,
|
73
74
|
image: config.get('image'),
|
74
75
|
env_variables: (config.get('variables', {})),
|
75
|
-
services: build_services(full_name, config.get('services', [])),
|
76
76
|
volumes: [
|
77
|
-
|
78
|
-
build_builds_volume(full_name),
|
77
|
+
*shared_volumes,
|
79
78
|
*build_volumes(full_name, config.get('volumes', {}))
|
80
79
|
],
|
80
|
+
services: build_services(full_name, config.get('services', []), volumes: shared_volumes),
|
81
81
|
before_shell: config.get('before_shell', []),
|
82
|
+
after_shell: config.get('after_shell', []),
|
82
83
|
working_dir: docker_repo_dir,
|
83
84
|
)
|
84
85
|
end
|
@@ -109,12 +110,13 @@ module Rascal
|
|
109
110
|
end
|
110
111
|
end
|
111
112
|
|
112
|
-
def build_services(name, services)
|
113
|
+
def build_services(name, services, volumes: [])
|
113
114
|
services.collect do |service_config|
|
114
115
|
service_alias = service_config['alias']
|
115
116
|
Service.new("#{name}_#{service_alias}",
|
116
117
|
alias_name: service_config['alias'],
|
117
118
|
image: service_config['name'],
|
119
|
+
volumes: volumes,
|
118
120
|
)
|
119
121
|
end
|
120
122
|
end
|
data/lib/rascal/service.rb
CHANGED
@@ -2,10 +2,11 @@ module Rascal
|
|
2
2
|
class Service
|
3
3
|
attr_reader :name, :container, :alias
|
4
4
|
|
5
|
-
def initialize(name, image:, alias_name:)
|
5
|
+
def initialize(name, image:, alias_name:, volumes: [])
|
6
6
|
@name = name
|
7
7
|
@container = Docker::Container.new(name, image)
|
8
8
|
@alias = alias_name
|
9
|
+
@volumes = volumes
|
9
10
|
end
|
10
11
|
|
11
12
|
def download_missing
|
@@ -14,7 +15,7 @@ module Rascal
|
|
14
15
|
|
15
16
|
def start_if_stopped(network: nil)
|
16
17
|
unless @container.running?
|
17
|
-
@container.start(network: network, network_alias: @alias)
|
18
|
+
@container.start(network: network, network_alias: @alias, volumes: @volumes)
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
data/lib/rascal/version.rb
CHANGED
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Kraze
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
|
-
rubygems_version: 3.
|
94
|
+
rubygems_version: 3.1.4
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: Spin up CI environments locally.
|