dandy 0.12.1 → 0.12.2
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 +5 -5
- data/README.md +4 -3
- data/lib/dandy/generators/cli.rb +5 -2
- data/lib/dandy/generators/templates/actions/common/close_db_session.rb +12 -0
- data/lib/dandy/generators/templates/actions/common/handle_errors_jet_set.rb +20 -0
- data/lib/dandy/generators/templates/app/app.jet_set.routes +7 -0
- data/lib/dandy/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b3801fd28080c3bdea511c614591b6b15c3d33066724ba8692941b9d77a56957
|
4
|
+
data.tar.gz: 226894d6c2cdfedaa9fda4677e3b9ac607e57de240045d7879a1f1f93312a78a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86a58f84405999d88351c799c2475fdce2d8835ced1c2ae07a046d5f3491f3b7dc73f69073abdb97fb48f59934769fcd681c7a7ee4d6a10856305fed46cf3b75
|
7
|
+
data.tar.gz: e8b2e3ec269c757881ae9d42af8944ed9979d8b95713aed9b33cdf34357bb32018e423989eb59a07b119c66acf56af67f85a08560c55d04600c8af9d8fc56782
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Dandy is a minimalistic web API framework. Its main idea is to implement an approach
|
4
4
|
from Clean Architecture principles - "web is just a delivery mechanism".
|
5
|
-
Dandy is build on top of IoC container Hypo and forces to use dependency injection
|
5
|
+
Dandy is build on top of IoC container [Hypo](https://github.com/cylon-v/hypo) and forces to use dependency injection
|
6
6
|
approach everywhere.
|
7
7
|
|
8
8
|
## Basic Concepts
|
@@ -109,13 +109,14 @@ or just
|
|
109
109
|
$ rackup -p 8000 config.ru
|
110
110
|
```
|
111
111
|
|
112
|
-
4.
|
112
|
+
4. Run curl command `curl http://localhost:9292 -H "Accept: application/json"` and you'll see:
|
113
113
|
|
114
114
|
```json
|
115
115
|
{"message": "Welcome to dandy-app!"}
|
116
116
|
```
|
117
|
+
Please take attention - HTTP header "Accept: application/json" is a mandatory.
|
117
118
|
|
118
|
-
5. Investigate example application code, it
|
119
|
+
5. Investigate example application code, it explains most of Dandy aspects.
|
119
120
|
6. For more details visit our [Wiki](https://github.com/cylon-v/dandy/wiki).
|
120
121
|
|
121
122
|
## Development
|
data/lib/dandy/generators/cli.rb
CHANGED
@@ -19,16 +19,19 @@ module Dandy
|
|
19
19
|
copy_file 'templates/Gemfile_jet_set', "#{name}/Gemfile"
|
20
20
|
copy_file 'templates/db/mapping.rb', "#{name}/db/mapping.rb"
|
21
21
|
copy_file 'templates/actions/common/open_db_session.rb', "#{name}/app/actions/common/open_db_session.rb"
|
22
|
+
copy_file 'templates/actions/common/close_db_session.rb', "#{name}/app/actions/common/close_db_session.rb"
|
23
|
+
copy_file 'templates/actions/common/handle_errors_jet_set.rb', "#{name}/app/actions/common/handle_errors.rb"
|
24
|
+
copy_file 'templates/app/app.jet_set.routes', "#{name}/app/app.routes"
|
22
25
|
else
|
23
26
|
copy_file 'templates/app/app.rb', "#{name}/app/app.rb"
|
24
27
|
copy_file 'templates/Gemfile', "#{name}/Gemfile"
|
28
|
+
copy_file 'templates/actions/common/handle_errors.rb', "#{name}/app/actions/common/handle_errors.rb"
|
29
|
+
copy_file 'templates/app/app.routes', "#{name}/app/app.routes"
|
25
30
|
end
|
26
31
|
|
27
|
-
copy_file 'templates/app/app.routes', "#{name}/app/app.routes"
|
28
32
|
copy_file 'templates/dandy.yml', "#{name}/dandy.yml"
|
29
33
|
copy_file 'templates/config.ru', "#{name}/config.ru"
|
30
34
|
copy_file 'templates/views/show_welcome.json.jbuilder', "#{name}/app/views/show_welcome.json.jbuilder"
|
31
|
-
copy_file 'templates/actions/common/handle_errors.rb', "#{name}/app/actions/common/handle_errors.rb"
|
32
35
|
template 'templates/actions/welcome.tt', "#{name}/app/actions/welcome.rb", {app_name: name}
|
33
36
|
|
34
37
|
if options[:jet_set]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class HandleErrors < Dandy::HandleErrors
|
2
|
+
def initialize(container, dandy_error, sequel)
|
3
|
+
super(container, dandy_error)
|
4
|
+
|
5
|
+
@sequel = sequel
|
6
|
+
end
|
7
|
+
|
8
|
+
def call
|
9
|
+
@sequel.disconnect
|
10
|
+
|
11
|
+
# implement your own error handling logic here.
|
12
|
+
# by default let's print the error to standard output
|
13
|
+
puts @dandy_error.message
|
14
|
+
puts @dandy_error.backtrace
|
15
|
+
|
16
|
+
# use preferred HTTP status code for different cases
|
17
|
+
# i.e. set_http_status(403) for authorization issue
|
18
|
+
set_http_status(500)
|
19
|
+
end
|
20
|
+
end
|
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.12.
|
4
|
+
version: 0.12.2
|
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-
|
11
|
+
date: 2018-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hypo
|
@@ -239,9 +239,12 @@ files:
|
|
239
239
|
- lib/dandy/generators/templates/.gitignore
|
240
240
|
- lib/dandy/generators/templates/Gemfile
|
241
241
|
- lib/dandy/generators/templates/Gemfile_jet_set
|
242
|
+
- lib/dandy/generators/templates/actions/common/close_db_session.rb
|
242
243
|
- lib/dandy/generators/templates/actions/common/handle_errors.rb
|
244
|
+
- lib/dandy/generators/templates/actions/common/handle_errors_jet_set.rb
|
243
245
|
- lib/dandy/generators/templates/actions/common/open_db_session.rb
|
244
246
|
- lib/dandy/generators/templates/actions/welcome.tt
|
247
|
+
- lib/dandy/generators/templates/app/app.jet_set.routes
|
245
248
|
- lib/dandy/generators/templates/app/app.rb
|
246
249
|
- lib/dandy/generators/templates/app/app.routes
|
247
250
|
- lib/dandy/generators/templates/app/app_jet_set.rb
|
@@ -315,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
315
318
|
version: '0'
|
316
319
|
requirements: []
|
317
320
|
rubyforge_project:
|
318
|
-
rubygems_version: 2.
|
321
|
+
rubygems_version: 2.7.4
|
319
322
|
signing_key:
|
320
323
|
specification_version: 4
|
321
324
|
summary: Dandy is a minimalistic web API framework.
|