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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fe4dfb1cb7b66f72ab2775c4949a86a487bbbd0
4
- data.tar.gz: 8c9b28a63244d8911eec1066b262ada854293743
3
+ metadata.gz: 152e08702548edd933148c86a34021b38d4c7773
4
+ data.tar.gz: 6ad821b539978f4e9b89a9206e90e884bd778681
5
5
  SHA512:
6
- metadata.gz: 17b905220d6888d4a15f319c74616214bdbe417081510ed117f093f9035e1fd609798f1092df86485809778f2f85a02067f5bc2a8fd4d91aefd19fdf2c7e2c4b
7
- data.tar.gz: 52f8ad78f39d8604a44b8c161c03a318152da4bf4ed9963b2753332cb70c92f1fa592ffed8e0d8c896a4b5d003efa4a1922fbe6f11ddf6c785ce6b287350ab1b
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 "./config/deploy/targets/#{target}.rb"
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
- false
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
@@ -8,5 +8,8 @@ module Rumination
8
8
  load path
9
9
  end
10
10
  end
11
+ initializer "rumination.load_app_env" do
12
+ Dotenv.load("/opt/app/env") if File.exists?("/opt/app/env")
13
+ end
11
14
  end
12
15
  end
@@ -1,3 +1,3 @@
1
1
  module Rumination
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
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.0
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-22 00:00:00.000000000 Z
11
+ date: 2017-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler