rack-app 0.2.0 → 0.2.1
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 +4 -4
- data/README.md +60 -13
- data/VERSION +1 -1
- data/rack-app.gemspec +2 -2
- metadata +5 -8
- data/example/config.ru +0 -24
- data/example/mounted_controller.rb +0 -11
- data/example/ping.sh +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b73d73652c1d94613ff5b3e740f363668e2116b3
|
4
|
+
data.tar.gz: 2e985c4fb97b52082d67effbf9484ed2a2386441
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9718d82bb50144e069b250df27e1c95cabb52de0c19f44f0004e250c4e7f0743a57f547e04e20c19ca1d96775eda1c7d90a243b7a9ac9df5fbbf3ce9e156f144
|
7
|
+
data.tar.gz: 27c7666a0be7acb52d1118ae6ea389695af048997df091c236c4894e8d221130a900753298fe79308b100d2ccc2bbf63e41e4d018e6711a9e39c1e5c841e107e
|
data/README.md
CHANGED
@@ -1,13 +1,19 @@
|
|
1
|
-
# Rack::
|
1
|
+
# Rack::APP
|
2
2
|
|
3
|
-
|
3
|
+
Your next favourite rack based micro framework that is totally addition free!
|
4
|
+
Have a cup of awesomeness with your to performance designed framework!
|
4
5
|
|
5
6
|
The idea behind is simple.
|
6
|
-
|
7
|
+
Keep the dependencies and everything as little as possible,
|
8
|
+
while able to write pure rack apps,
|
7
9
|
that will do nothing more than what you defined.
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
+
If you want see fancy magic, you are in a bad place buddy!
|
12
|
+
This includes that it do not have such core extensions like activesupport that monkey patch the whole world.
|
13
|
+
|
14
|
+
Routing can handle large amount of endpoints so if you that crazy to use more than 10k endpoint,
|
15
|
+
you still dont have to worry about response speed.
|
16
|
+
|
11
17
|
## Installation
|
12
18
|
|
13
19
|
Add this line to your application's Gemfile:
|
@@ -31,8 +37,12 @@ config.ru
|
|
31
37
|
|
32
38
|
require 'rack/app'
|
33
39
|
|
40
|
+
require_relative 'lib/bootstrap'
|
41
|
+
|
34
42
|
class YourAwesomeApp < Rack::APP
|
35
43
|
|
44
|
+
mount AwesomeController
|
45
|
+
|
36
46
|
get '/hello' do
|
37
47
|
'Hello World!'
|
38
48
|
end
|
@@ -40,27 +50,64 @@ class YourAwesomeApp < Rack::APP
|
|
40
50
|
get '/nope' do
|
41
51
|
request.env
|
42
52
|
response.write 'some response body'
|
43
|
-
|
44
53
|
end
|
45
54
|
|
46
|
-
post '/
|
55
|
+
post '/lol_post_fail' do
|
47
56
|
status 500
|
48
57
|
'LOL'
|
49
58
|
end
|
50
|
-
|
59
|
+
|
60
|
+
get '/users/:user_id' do
|
61
|
+
params['user_id']
|
62
|
+
end
|
63
|
+
|
64
|
+
post '/some/endpoint/for/the/rabbit/:queue_name' do
|
65
|
+
mq_request # helper are the class instance method
|
66
|
+
end
|
67
|
+
|
68
|
+
def mq_request
|
69
|
+
q = BUNNY_CONN_CHANNEL.queue(params['queue_name'])
|
70
|
+
BUNNY_CONN_CHANNEL.default_exchange.publish(request.body.read, :routing_key => q.name)
|
71
|
+
end
|
72
|
+
|
51
73
|
end
|
52
74
|
|
53
75
|
run YourAwesomeApp
|
54
76
|
```
|
55
77
|
|
78
|
+
you can access Rack::Request with the request method and
|
79
|
+
Rack::Response as response method.
|
80
|
+
|
81
|
+
By default if you dont write anything to the response 'body' the endpoint block logic return will be used
|
82
|
+
|
83
|
+
## Example Apps To start with
|
84
|
+
|
85
|
+
* [Basic](https://github.com/adamluzsi/rack-app.rb-examples/tree/master/basic)
|
86
|
+
* bare bone simple example app
|
87
|
+
|
88
|
+
* [Escher Authorized Api](https://github.com/adamluzsi/rack-app.rb-examples/tree/master/escher_authorized)
|
89
|
+
* complex authorization for corporal level api use
|
90
|
+
|
56
91
|
## TODO
|
57
92
|
|
58
|
-
* benchmark for rails, padrino, sinatra, grape etc to prove awesomeness
|
93
|
+
* benchmark for rails, padrino, sinatra, grape etc to prove awesomeness in term of speed
|
59
94
|
* more verbose readme
|
60
95
|
* drink less coffee
|
61
|
-
|
62
|
-
|
63
|
-
|
96
|
+
|
97
|
+
## Roadmap
|
98
|
+
|
99
|
+
### 0.3.0
|
100
|
+
|
101
|
+
* add TESTING module for rspec helpers that allow easy to test controllers
|
102
|
+
|
103
|
+
### 0.4.0
|
104
|
+
|
105
|
+
* serializer block/method for class shared serialization logic
|
106
|
+
|
107
|
+
### 0.5.0
|
108
|
+
|
109
|
+
* content_type syntax sugar on class level
|
110
|
+
* response_headers syntax sugar for request processing
|
64
111
|
|
65
112
|
## Development
|
66
113
|
|
@@ -70,5 +117,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
70
117
|
|
71
118
|
## Contributing
|
72
119
|
|
73
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
120
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/adamluzsi/rack-app.rb This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
74
121
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/rack-app.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ["Adam Luzsi"]
|
11
11
|
spec.email = ["adamluzsi@gmail.com"]
|
12
12
|
|
13
|
-
spec.summary = %q{
|
14
|
-
spec.description = %q{
|
13
|
+
spec.summary = %q{Your next favourite, performance designed micro framework!}
|
14
|
+
spec.description = %q{Your next favourite rack based micro framework that is totally addition free! Have a cup of awesomeness with your to performance designed framework!}
|
15
15
|
spec.homepage = "https://github.com/adamluzsi/rack-app.rb"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,8 +66,8 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
70
|
-
|
69
|
+
description: Your next favourite rack based micro framework that is totally addition
|
70
|
+
free! Have a cup of awesomeness with your to performance designed framework!
|
71
71
|
email:
|
72
72
|
- adamluzsi@gmail.com
|
73
73
|
executables: []
|
@@ -83,9 +83,6 @@ files:
|
|
83
83
|
- Rakefile
|
84
84
|
- VERSION
|
85
85
|
- bin/setup
|
86
|
-
- example/config.ru
|
87
|
-
- example/mounted_controller.rb
|
88
|
-
- example/ping.sh
|
89
86
|
- lib/rack/app.rb
|
90
87
|
- lib/rack/app/class_methods.rb
|
91
88
|
- lib/rack/app/endpoint.rb
|
@@ -121,5 +118,5 @@ rubyforge_project:
|
|
121
118
|
rubygems_version: 2.2.2
|
122
119
|
signing_key:
|
123
120
|
specification_version: 4
|
124
|
-
summary:
|
121
|
+
summary: Your next favourite, performance designed micro framework!
|
125
122
|
test_files: []
|
data/example/config.ru
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),'..','lib'))
|
2
|
-
require 'rack/app'
|
3
|
-
|
4
|
-
require_relative 'mounted_controller'
|
5
|
-
|
6
|
-
class YourAwesomeApp < Rack::APP
|
7
|
-
|
8
|
-
mount MountedController
|
9
|
-
|
10
|
-
get '/hello' do
|
11
|
-
'Hello World!'
|
12
|
-
end
|
13
|
-
|
14
|
-
get '/nope' do
|
15
|
-
response.write 'nope nope nope...'
|
16
|
-
end
|
17
|
-
|
18
|
-
get '/users/:user_id' do
|
19
|
-
params['user_id']
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
run YourAwesomeApp
|