dandy 0.7.4 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dandy/config.rb +3 -1
- data/lib/dandy/generators/templates/actions/common/handle_errors.rb +3 -0
- data/lib/dandy/generators/templates/app/app.routes +1 -1
- data/lib/dandy/generators/templates/config.ru +1 -1
- data/lib/dandy/request.rb +7 -2
- data/lib/dandy/routing/syntax_grammar.tt +1 -1
- data/lib/dandy/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: 638225663a3c7bb092445c17472c8ea044a83a56
|
4
|
+
data.tar.gz: 447b928898b071c070a4ecdc08c6a940b65cdef2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d117ca4ae73aeb227f93c53fbb77239d0b41f662891fb0ad7d0f9c3ebee77149b0244bfab012700d2a7127423e64cfa258fadf6ecbcce3817f006b074b8c4e06
|
7
|
+
data.tar.gz: c962ed1ef887d8ef5f481ade14964e106ae7b22705839f68e0a6a14982cb80009cfe9e72c951096c6372746b11a1f045abf7bcaf6eb90c792b4b6b8600ea0a61
|
data/lib/dandy/config.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'erb'
|
2
3
|
require 'dandy/extensions/hash'
|
3
4
|
|
4
5
|
module Dandy
|
5
6
|
class Config
|
6
7
|
def initialize(config_file_path)
|
7
8
|
path = File.join(Dir.pwd, config_file_path)
|
8
|
-
|
9
|
+
yaml = ERB.new(File.read(path)).result
|
10
|
+
@params = YAML.load(yaml).deep_symbolize_keys!
|
9
11
|
end
|
10
12
|
|
11
13
|
def [](key)
|
data/lib/dandy/request.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'json'
|
1
2
|
require 'dandy/chain_factory'
|
2
3
|
require 'dandy/view_factory'
|
3
4
|
|
@@ -30,9 +31,13 @@ module Dandy
|
|
30
31
|
register_params(data, :dandy_data)
|
31
32
|
|
32
33
|
chain = @chain_factory.create(match)
|
33
|
-
|
34
|
+
chain_result = chain.execute
|
34
35
|
|
35
|
-
|
36
|
+
if match.route.view
|
37
|
+
body = @view_factory.create(match.route.view, content_type)
|
38
|
+
else
|
39
|
+
body = chain_result.is_a?(String) ? chain_result : JSON.generate(chain_result)
|
40
|
+
end
|
36
41
|
|
37
42
|
status = @container.resolve(:dandy_status)
|
38
43
|
result = [status, { 'Content-Type' => content_type }, [body]]
|
data/lib/dandy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dandy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Kalinkin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hypo
|