dry-web-roda 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '0880eb4f59f005cab77a367955ccfa1714645e9b'
4
- data.tar.gz: e1f524aed2cbf74a1a1b5d0675ff1a3bda13f39b
3
+ metadata.gz: 14c4010b4a8637565d8a63e3de52212d35d5a377
4
+ data.tar.gz: 66b7c5de8cec7e1145a972f881b573941e517839
5
5
  SHA512:
6
- metadata.gz: 881d050b55fd571e21fe98e2817dc612432ffd9acb6c672e5fe4c760b6485f481cfb6bc5e74f4bdd8feb474d63d5bc45d4e62a1679d21a77684b69df8b2d48f7
7
- data.tar.gz: 8a990f3f980914fff124e834a41b50e9ed4f9d4482ff3087a823faa5bbd24d2062b4a94d16e2827128715b0a5ce1e0185e6b80753e8b361bb0494e2c7b99aa64
6
+ metadata.gz: ef4e0e2d6f8828e0fb4048f33596ae3b9cc359812389a9636cf6bb20260ba076d48c27b08060c41c83f9a961096c951725dc77fac3ddee3fe4589928e7e2c8ef
7
+ data.tar.gz: 98f8defcdaf3ac8fc3dac89de3196c1822672014ad88ac4f03c99cdc66b063f6c8391642b8067f621f2978100879907d5320d05c39ac0454a8fb28550833c69d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # 0.7.4 - 2017-07-25
2
+
3
+ ### Added
4
+
5
+ - Added db:create and db:drop take tasks, to create and drop the application database (GustavoCaso)
6
+
7
+ ## Changed
8
+
9
+ - Use Postgres environment variables to provide connection info to `pg_dump` command in db:structure:dump rake task (timriley)
10
+ - Remove error handling block from generated sub-app application classes, since an error handling block is already provided in the top-level umbrella application class (timriley)
11
+
12
+ ### Fixed
13
+
14
+ - Prevent duplicate log entries in generated umbrella architecture projects (timriley)
15
+
1
16
  # 0.7.3 - 2017-07-10
2
17
 
3
18
  ### Fixed
@@ -7,7 +22,7 @@
7
22
  ### Changed
8
23
 
9
24
  - In generated project, require `pry-byebug` instead of `byebug` alone (alejandrobabio)
10
- - In generated project's `web_spec_helper.rb`, use updated `save_path` setting for Capybara (alejandrobabio )
25
+ - In generated project's `web_spec_helper.rb`, use updated `save_path` setting for Capybara (alejandrobabio)
11
26
 
12
27
  # 0.7.2 - 2017-07-03
13
28
 
@@ -15,12 +15,34 @@ def db
15
15
  <%= config[:camel_cased_app_name] %>::Container["persistence.db"]
16
16
  end
17
17
 
18
+ def settings
19
+ <%= config[:camel_cased_app_name] %>::Container["settings"]
20
+ end
21
+
22
+ def database_uri
23
+ require "uri"
24
+ URI.parse(settings.database_url)
25
+ end
26
+
27
+ def postgres_env_vars(uri)
28
+ {}.tap do |vars|
29
+ vars["PGHOST"] = uri.host
30
+ vars["PGPORT"] = uri.port if uri.port
31
+ vars["PGUSER"] = uri.user if uri.user
32
+ vars["PGPASSWORD"] = uri.password if uri.password
33
+ end
34
+ end
35
+
18
36
  namespace :db do
19
37
  task :setup do
20
38
  <%= config[:camel_cased_app_name] %>::Container.boot :rom
21
39
  end
22
40
 
23
- desc "Prints current schema version"
41
+ task :settings do
42
+ <%= config[:camel_cased_app_name] %>::Container.boot :settings
43
+ end
44
+
45
+ desc "Print current database schema version"
24
46
  task version: :setup do
25
47
  version =
26
48
  if db.tables.include?(:schema_migrations)
@@ -32,7 +54,29 @@ namespace :db do
32
54
  puts "Current schema version: #{version}"
33
55
  end
34
56
 
35
- desc "Perform migration up to latest migration available"
57
+ desc "Create database"
58
+ task create: :settings do
59
+ if system("which createdb", out: File::NULL)
60
+ uri = database_uri
61
+ system(postgres_env_vars(uri), "createdb #{Shellwords.escape(uri.path[1..-1])}")
62
+ else
63
+ puts "You must have Postgres installed to create a database"
64
+ exit 1
65
+ end
66
+ end
67
+
68
+ desc "Drop database"
69
+ task drop: :settings do
70
+ if system("which dropdb", out: File::NULL)
71
+ uri = database_uri
72
+ system(postgres_env_vars(uri), "dropdb #{Shellwords.escape(uri.path[1..-1])}")
73
+ else
74
+ puts "You must have Postgres installed to drop a database"
75
+ exit 1
76
+ end
77
+ end
78
+
79
+ desc "Migrate database up to latest migration available"
36
80
  task :migrate do
37
81
  # Enhance the migration task provided by ROM
38
82
 
@@ -47,7 +91,10 @@ namespace :db do
47
91
  desc "Dump database structure to db/structure.sql"
48
92
  task :dump do
49
93
  if system("which pg_dump", out: File::NULL)
50
- system(%(pg_dump -s -x -O #{Shellwords.escape(db.url)} > db/structure.sql))
94
+ uri = database_uri
95
+ system(postgres_env_vars(uri), "pg_dump -s -x -O #{Shellwords.escape(uri.path[1..-1])}", out: "db/structure.sql")
96
+ else
97
+ puts "You must have pg_dump installed to dump the database structure"
51
98
  end
52
99
  end
53
100
  end
@@ -24,11 +24,6 @@ module <%= config[:camel_cased_app_name] %>
24
24
  end
25
25
  end
26
26
 
27
- error do |e|
28
- self.class[:rack_monitor].instrument(:error, exception: e)
29
- raise e
30
- end
31
-
32
27
  load_routes!
33
28
  end
34
29
  end
@@ -6,8 +6,6 @@ module <%= config[:camel_cased_app_name] %>
6
6
  require root.join("system/<%= config[:underscored_umbrella_name] %>/container")
7
7
  import core: <%= config[:camel_cased_umbrella_name] %>::Container
8
8
 
9
- register :rack_monitor, <%= config[:camel_cased_umbrella_name] %>::Container[:rack_monitor]
10
-
11
9
  configure do |config|
12
10
  config.root = Pathname(__FILE__).join("../..").realpath.dirname.freeze
13
11
  config.logger = <%= config[:camel_cased_umbrella_name] %>::Container[:logger]
@@ -1,7 +1,7 @@
1
1
  module Dry
2
2
  module Web
3
3
  module Roda
4
- VERSION = "0.7.3".freeze
4
+ VERSION = "0.7.4".freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-web-roda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-10 00:00:00.000000000 Z
11
+ date: 2017-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable