rumination 0.6.0 → 0.6.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/lib/rumination/deploy/base.rb +35 -2
- data/lib/rumination/railtie.rb +3 -0
- data/lib/rumination/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 152e08702548edd933148c86a34021b38d4c7773
|
4
|
+
data.tar.gz: 6ad821b539978f4e9b89a9206e90e884bd778681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 183a13215da86e46804064a502b0a1d1eb0210bfb267c43b40a0a5ab4f7d1fcc16d9261084cf157b1d6484e153dd921cb6b200fb323a307c5445eee4fc43aed7
|
7
|
+
data.tar.gz: 9c34059e25892d85dbc5dbf398104dcd412689cc5fa72e2e308effb921a674badab4e7880ac6c5ecbf6fcdf17896bf2586155746ede147d81f568d2915375801
|
@@ -11,6 +11,7 @@ module Rumination
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def call
|
14
|
+
load_application_config_if_exists
|
14
15
|
load_target_config
|
15
16
|
DockerCompose.build.down.up
|
16
17
|
yield if block_given?
|
@@ -22,11 +23,20 @@ module Rumination
|
|
22
23
|
def on_fresh_containers
|
23
24
|
puts "Bootstrapping '#{target}'"
|
24
25
|
raise BootstrappedAlready if bootstrapped?
|
26
|
+
write_env_file
|
25
27
|
initialize_database
|
26
28
|
end
|
27
29
|
|
30
|
+
def load_application_config_if_exists
|
31
|
+
load application_config_path if File.exists?(application_config_path)
|
32
|
+
end
|
33
|
+
|
34
|
+
def application_config_path
|
35
|
+
"./config/deploy/application.rb"
|
36
|
+
end
|
37
|
+
|
28
38
|
def load_target_config
|
29
|
-
load
|
39
|
+
load target_config_path
|
30
40
|
ENV["VIRTUAL_HOST"] = Deploy.config.virtual_host
|
31
41
|
ENV["COMPOSE_FILE"] = Deploy.config.compose_file if Deploy.config.compose_file
|
32
42
|
setup_docker_machine_env if Deploy.config.docker_machine
|
@@ -34,13 +44,32 @@ module Rumination
|
|
34
44
|
raise UnknownTarget, e.message
|
35
45
|
end
|
36
46
|
|
47
|
+
def target_config_path
|
48
|
+
"./config/deploy/targets/#{target}.rb"
|
49
|
+
end
|
50
|
+
|
51
|
+
def password_vars
|
52
|
+
config.generate_passwords || Array(config.generate_password)
|
53
|
+
end
|
54
|
+
|
37
55
|
def setup_docker_machine_env
|
38
56
|
dm_env_str = `docker-machine env #{Deploy.config.docker_machine}`
|
39
57
|
ENV.update Dotenv::Parser.call(dm_env_str)
|
40
58
|
end
|
41
59
|
|
60
|
+
def write_env_file
|
61
|
+
password_vars.each do |var|
|
62
|
+
container(:backend)
|
63
|
+
.run(%Q[echo "#{var}=#{generate_password}" >> #{env_file_path}])
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def generate_password
|
68
|
+
Generate.password
|
69
|
+
end
|
70
|
+
|
42
71
|
def bootstrapped?
|
43
|
-
|
72
|
+
container(:backend).has_file?(env_file_path)
|
44
73
|
end
|
45
74
|
|
46
75
|
def initialize_database
|
@@ -48,6 +77,10 @@ module Rumination
|
|
48
77
|
raise DatabaseInitError unless $? == 0
|
49
78
|
end
|
50
79
|
|
80
|
+
def env_file_path
|
81
|
+
"/opt/app/env"
|
82
|
+
end
|
83
|
+
|
51
84
|
def container(name)
|
52
85
|
DockerCompose::Container.new(name)
|
53
86
|
end
|
data/lib/rumination/railtie.rb
CHANGED
data/lib/rumination/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rumination
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Baguinski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|