orchestration 0.3.0 → 0.3.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 +4 -4
- data/README.md +1 -8
- data/lib/orchestration/file_helpers.rb +10 -5
- data/lib/orchestration/install_generator.rb +5 -5
- data/lib/orchestration/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 377c0f68de78347f2db6d0cd5caee441f1db097b
|
4
|
+
data.tar.gz: 1e2e41b54ed59837308772e32d008b1f58842857
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af1a3883b1b8ac1eb72fcf91bb080b7ce54d6585315bd96ab69cfcf3e5209d6a57e2c82c8976570a2e857501702a8388e8ca0df92a8729a9df4cf095aa57a184
|
7
|
+
data.tar.gz: 6c8d67d40c4066440ff1070b58140ad04e972d79785017bb291fece26a35ec1cf31dc7b649be067d468c52928cf6a5300ce55f2a4c467508914ab7ad0230e37a
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Containers are automatically created for the following dependencies:
|
|
18
18
|
Add this line to your application's Gemfile:
|
19
19
|
|
20
20
|
```ruby
|
21
|
-
gem 'orchestration', '~> 0.3.
|
21
|
+
gem 'orchestration', '~> 0.3.1'
|
22
22
|
```
|
23
23
|
|
24
24
|
And then build your bundle:
|
@@ -88,13 +88,6 @@ To start services:
|
|
88
88
|
$ make start
|
89
89
|
```
|
90
90
|
|
91
|
-
This will launch any dependencies your project needs (e.g. _MySQL_, _MongoDB_, etc.).
|
92
|
-
|
93
|
-
To wait for all services to be ready:
|
94
|
-
```bash
|
95
|
-
$ make wait
|
96
|
-
```
|
97
|
-
|
98
91
|
It is recommended that you create a `test` command in your `Makefile` which will launch all dependencies and wait for them to be ready before running all tests. For example:
|
99
92
|
|
100
93
|
```Makefile
|
@@ -34,31 +34,31 @@ module Orchestration
|
|
34
34
|
update_file(dest, template(template_name))
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
37
|
+
def create_file(path, content, options = {})
|
38
38
|
relpath = relative_path(path)
|
39
39
|
overwrite = options.fetch(:overwrite, true)
|
40
40
|
present = File.exist?(path)
|
41
41
|
return @terminal.write(:skip, relpath) if present && !overwrite
|
42
42
|
|
43
|
-
|
43
|
+
write_file(path, content)
|
44
44
|
@terminal.write(:create, relative_path(path))
|
45
45
|
end
|
46
46
|
|
47
47
|
def update_file(path, content)
|
48
48
|
present = File.exist?(path)
|
49
|
-
return
|
49
|
+
return create_file(path, content) unless present
|
50
50
|
|
51
51
|
previous_content = File.read(path) if present
|
52
|
-
File.write(path, content)
|
53
52
|
if present && previous_content == content
|
54
53
|
return @terminal.write(:skip, relative_path(path))
|
55
54
|
end
|
56
55
|
|
56
|
+
File.write(path, content)
|
57
57
|
@terminal.write(:update, relative_path(path))
|
58
58
|
end
|
59
59
|
|
60
60
|
def append_file(path, content, echo: true)
|
61
|
-
return
|
61
|
+
return create_file(path, content) unless File.exist?(path)
|
62
62
|
|
63
63
|
File.write(path, content, File.size(path), mode: 'a')
|
64
64
|
@terminal.write(:update, relative_path(path)) if echo
|
@@ -95,5 +95,10 @@ module Orchestration
|
|
95
95
|
def read_template(template)
|
96
96
|
File.read(templates_path.join("#{template}.erb"))
|
97
97
|
end
|
98
|
+
|
99
|
+
def write_file(path, content)
|
100
|
+
FileUtils.mkdir_p(File.dirname(path))
|
101
|
+
File.write(path, content)
|
102
|
+
end
|
98
103
|
end
|
99
104
|
end
|
@@ -29,7 +29,7 @@ module Orchestration
|
|
29
29
|
environment = { env: @env, wait_commands: wait_commands }
|
30
30
|
content = template('Makefile', environment)
|
31
31
|
path = @env.orchestration_root.join('Makefile')
|
32
|
-
path.exist? ? update_file(path, content) :
|
32
|
+
path.exist? ? update_file(path, content) : create_file(path, content)
|
33
33
|
inject_if_missing(
|
34
34
|
@env.root.join('Makefile'),
|
35
35
|
'include orchestration/Makefile'
|
@@ -38,7 +38,7 @@ module Orchestration
|
|
38
38
|
|
39
39
|
def dockerfile
|
40
40
|
content = template('Dockerfile', ruby_version: RUBY_VERSION)
|
41
|
-
|
41
|
+
create_file(
|
42
42
|
orchestration_dir.join('Dockerfile'),
|
43
43
|
content,
|
44
44
|
overwrite: false
|
@@ -48,7 +48,7 @@ module Orchestration
|
|
48
48
|
def entrypoint
|
49
49
|
content = template('entrypoint.sh')
|
50
50
|
path = orchestration_dir.join('entrypoint.sh')
|
51
|
-
|
51
|
+
create_file(path, content, overwrite: false)
|
52
52
|
FileUtils.chmod('a+x', path)
|
53
53
|
end
|
54
54
|
|
@@ -66,13 +66,13 @@ module Orchestration
|
|
66
66
|
return if File.exist?(path)
|
67
67
|
|
68
68
|
docker_compose = DockerCompose::Services.new(@env, service_configurations)
|
69
|
-
|
69
|
+
create_file(path, docker_compose.structure.to_yaml)
|
70
70
|
end
|
71
71
|
|
72
72
|
def unicorn
|
73
73
|
content = template('unicorn.rb')
|
74
74
|
path = @env.root.join('config', 'unicorn.rb')
|
75
|
-
|
75
|
+
create_file(path, content, overwrite: false)
|
76
76
|
end
|
77
77
|
|
78
78
|
def yaml_bash
|