rumination 0.7.2 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f325774e91ad159086866c8010c446d6fbfb0fc
4
- data.tar.gz: 33f015937b823de3e20fff0387c27cfe56a19133
3
+ metadata.gz: dee4296b401b146bdaae7886f80b167e100e396f
4
+ data.tar.gz: e8d229aab1b52cded67329d7f4497b4767a6eab6
5
5
  SHA512:
6
- metadata.gz: d1d52842fb9ddd24612a8d379884e3b9d016f6bd6a2e2fccccb3e3855c22af6c18e926367b1e8881e464b63702c7bde44bb99359b1d0479d5d37e851b1c50372
7
- data.tar.gz: 5a115792541d136597d743e5292cee53e8fe98e21f58ecd331b59bf4f13c5866985c50793a14aea0ffcbf5798adf8086590f27d612da0ccb27627123d4eacd6d
6
+ metadata.gz: 271227420d7b2ce828ec9b78ec745db3fd83c05bf12ed5c99b3761dfb11a9c8c17392e374f9113c14bcb6a08d25c14b3e8003a30d0ee2017b76de74ea715e9d2
7
+ data.tar.gz: a69c2f6ead15b24188505433bee50a726036684cd68232b432a24e1d1e8fd1978dd2ba2b517d1e276d8524d54fdfa7b804c177e1aa0675377eed023bf61d3416
@@ -21,6 +21,7 @@ module Rumination
21
21
  end
22
22
 
23
23
  def call
24
+ setup_outside_env
24
25
  DockerCompose.build.down("--remove-orphans").up
25
26
  yield if block_given?
26
27
  container(:backend).exec("rake deploy:unload[#{target}]")
@@ -29,8 +30,17 @@ module Rumination
29
30
  raise DeployError unless $? == 0
30
31
  end
31
32
 
32
- def env
33
+ def load_target_config
33
34
  load target_config_path
35
+ rescue LoadError => e
36
+ raise UnknownTarget, e.message
37
+ end
38
+
39
+ def setup_outside_env
40
+ ENV.update env
41
+ end
42
+
43
+ def env
34
44
  env = docker_machine_env
35
45
  env["VIRTUAL_HOST"] = config.virtual_host
36
46
  if config.letsencrypt_email.present?
@@ -70,12 +80,6 @@ module Rumination
70
80
  "./config/deploy/application.rb"
71
81
  end
72
82
 
73
- def load_target_config
74
- ENV.update env
75
- rescue LoadError => e
76
- raise UnknownTarget, e.message
77
- end
78
-
79
83
  def target_config_path
80
84
  (config.target_config_path || "./config/deploy/targets/%s.rb") % target
81
85
  end
@@ -0,0 +1,20 @@
1
+ namespace :db do
2
+ include Rumination::Pg::Commands
3
+
4
+ task :create_dump => :pg_environment do
5
+ create_dump dump_path, "-O"
6
+ end
7
+
8
+ task :load_dump => :pg_environment do
9
+ load_dump dump_path
10
+ end
11
+
12
+ task :pg_environment => :environment do
13
+ db_config = Rails.configuration.database_configuration[Rails.env]
14
+ ENV["PGHOST"] = db_config["host"].to_s if db_config["host"]
15
+ ENV["PGPORT"] = db_config["port"].to_s if db_config["port"]
16
+ ENV["PGPASSWORD"] = db_config["password"].to_s if db_config["password"]
17
+ ENV["PGUSER"] = db_config["username"].to_s if db_config["username"]
18
+ ENV["PGDATABASE"] = db_config["database"].to_s if db_config["database"]
19
+ end
20
+ end
@@ -0,0 +1,13 @@
1
+ namespace :db do
2
+ def dump_path
3
+ "db/postgres_dumps/seeds.sql.gz"
4
+ end
5
+
6
+ namespace :setup do
7
+ if File.exists?(dump_path)
8
+ task :maybe_load_dump => [:create, :load_dump, :migrate, :seed]
9
+ else
10
+ task :maybe_load_dump => :setup
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Rumination
2
- VERSION = "0.7.2"
2
+ VERSION = "0.8.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rumination
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Baguinski
@@ -138,6 +138,8 @@ files:
138
138
  - lib/rumination/pg/commands.rb
139
139
  - lib/rumination/pg/restore.rb
140
140
  - lib/rumination/railtie.rb
141
+ - lib/rumination/tasks/db/dump.rake
142
+ - lib/rumination/tasks/db/setup.rake
141
143
  - lib/rumination/tasks/deploy.rake
142
144
  - lib/rumination/tasks/deploy/bootstrap.rake
143
145
  - lib/rumination/tasks/deploy/env.rake