dandy 0.12.1 → 0.12.2

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
- SHA1:
3
- metadata.gz: f5fd46a75db6411e264b87e934aff42dd34b2b7e
4
- data.tar.gz: 681b74058c62074c072f59fab34c98ad21ac3e35
2
+ SHA256:
3
+ metadata.gz: b3801fd28080c3bdea511c614591b6b15c3d33066724ba8692941b9d77a56957
4
+ data.tar.gz: 226894d6c2cdfedaa9fda4677e3b9ac607e57de240045d7879a1f1f93312a78a
5
5
  SHA512:
6
- metadata.gz: a9fc7ea134531646040be3368dcb0745e8bd8d19d4495bd38a0963728f8268c5d46f687f4bc7e0a76c0d55900f80d4ee07dbbbbb211cdce717a7aa809087fb85
7
- data.tar.gz: 5a2b123dd6e34b828450a519ebb2cbe2bb98b52aa960bb1933956433fdc60d7db6b3166d2db9004ae60ccd4ddb604184e91f6581de7273c7c9ba7b8be0fdb730
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. Using a browser, go to http://localhost:8000 and you'll see:
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 will explain most of Dandy aspects.
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
@@ -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,12 @@
1
+ require 'sequel'
2
+ require 'jet_set'
3
+
4
+ class CloseDbSession
5
+ def initialize(sequel)
6
+ @sequel = sequel
7
+ end
8
+
9
+ def call
10
+ @sequel.disconnect
11
+ end
12
+ end
@@ -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
@@ -0,0 +1,7 @@
1
+ :receive
2
+ .->
3
+ :before -> common/open_db_session
4
+ :after -> common/close_db_session
5
+
6
+ GET -> message@welcome -> :respond <- show_welcome
7
+ :catch -> common/handle_errors
data/lib/dandy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dandy
2
- VERSION = '0.12.1'.freeze
2
+ VERSION = '0.12.2'.freeze
3
3
  end
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.1
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-05-25 00:00:00.000000000 Z
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.6.12
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.