rack-app 0.2.3 → 0.3.0

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: 37182cf1fad78cd5fefd4871741f80af13d4d0b6
4
- data.tar.gz: ce6ff1f1fbcfa8b76b5ab24811a237d465c50410
3
+ metadata.gz: 08805ebc1c3be6338441b4ca870489333fdee27a
4
+ data.tar.gz: 0fc3f607f9bbc02ed4fe4392b49968e23612015e
5
5
  SHA512:
6
- metadata.gz: 9f15e93028a0a4d2ed5a871a36cd04327b6d61df33a8911c18df6610249af83eaeb35182b9b33fd60b687557bb9f280ef27616dad9b0c766b43d1fa07567be3b
7
- data.tar.gz: 22f72023935cb1ee13bb05434bc96696e90d339483d3c8a3683eec6864d66bfe50c8937d01ec73351224ba6838bad17e98f6cb1650aac96689dc30806c0d4a53
6
+ metadata.gz: eaa0c3dc517544bc6dee91ae97a3208a39172da520c4368c399f222e928947252ed7c87a9e9dec637d7352bc6abd616a44304331c6622419c77316f84b68d1d8
7
+ data.tar.gz: ae56428e27d1ad9e30ebb9e21b215cd440d3b0cde6bb97ef8a0ddcb92a2b4b15f6390ce631bee218de7efd426af76b6330f5755301fc93669e166d266be1f35a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-app (0.2.3)
4
+ rack-app (0.3.0)
5
5
  rack
6
6
 
7
7
  GEM
data/LICENSE CHANGED
@@ -589,7 +589,7 @@ later version.
589
589
  15. Disclaimer of Warranty.
590
590
 
591
591
  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
- APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
592
+ AppLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
593
  HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
594
  OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
595
  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@@ -599,7 +599,7 @@ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
599
 
600
600
  16. Limitation of Liability.
601
601
 
602
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
602
+ IN NO EVENT UNLESS REQUIRED BY AppLICABLE LAW OR AGREED TO IN WRITING
603
603
  WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
604
  THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
605
  GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Rack::APP
1
+ # Rack::App
2
2
 
3
3
  Your next favourite rack based micro framework that is totally addition free!
4
4
  Have a cup of awesomeness with your performance designed framework!
@@ -39,7 +39,7 @@ require 'rack/app'
39
39
 
40
40
  require_relative 'lib/bootstrap'
41
41
 
42
- class YourAwesomeApp < Rack::APP
42
+ class YourAwesomeApp < Rack::App
43
43
 
44
44
  mount AwesomeController
45
45
 
@@ -93,7 +93,7 @@ By default if you dont write anything to the response 'body' the endpoint block
93
93
  * Dump duration with zero if or routing: 6.0e-06 s
94
94
  * no routing
95
95
  * return only a static array with static values
96
- * Rack::APP duration with routing lookup: 7.0e-05 s
96
+ * Rack::App duration with routing lookup: 7.0e-05 s
97
97
  * with routing
98
98
  * with value parsing and reponse object building
99
99
  * Grape::API duration with routing lookup: 0.180764 s
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.3.0
@@ -1,7 +1,7 @@
1
1
  require 'rack'
2
2
  require 'rack/request'
3
3
  require 'rack/response'
4
- class Rack::APP
4
+ class Rack::App
5
5
 
6
6
  require 'rack/app/version'
7
7
 
@@ -12,14 +12,14 @@ class Rack::APP
12
12
  require 'rack/app/runner'
13
13
 
14
14
  require 'rack/app/class_methods'
15
- extend Rack::APP::ClassMethods
15
+ extend Rack::App::ClassMethods
16
16
 
17
17
  require 'rack/app/request_helpers'
18
18
 
19
- include Rack::APP::RequestHelpers
19
+ include Rack::App::RequestHelpers
20
20
 
21
21
  def self.call(request_env)
22
- Rack::APP::Runner.response_for(self,request_env)
22
+ Rack::App::Runner.response_for(self,request_env)
23
23
  end
24
24
 
25
25
  attr_reader :request, :response
@@ -1,4 +1,4 @@
1
- module Rack::APP::ClassMethods
1
+ module Rack::App::ClassMethods
2
2
 
3
3
  def description(*description_texts)
4
4
  @last_description = description_texts.join("\n")
@@ -33,12 +33,12 @@ module Rack::APP::ClassMethods
33
33
  end
34
34
 
35
35
  def router
36
- @static_router ||= Rack::APP::Router.new
36
+ @static_router ||= Rack::App::Router.new
37
37
  end
38
38
 
39
39
  def add_route(request_method, request_path, &block)
40
40
 
41
- endpoint = Rack::APP::Endpoint.new(
41
+ endpoint = Rack::App::Endpoint.new(
42
42
  self,
43
43
  {
44
44
  request_method: request_method,
@@ -57,8 +57,8 @@ module Rack::APP::ClassMethods
57
57
 
58
58
  def mount(api_class)
59
59
 
60
- unless api_class.is_a?(Class) and api_class <= Rack::APP
61
- raise(ArgumentError, 'Invalid class given for mount, must be a Rack::APP')
60
+ unless api_class.is_a?(Class) and api_class <= Rack::App
61
+ raise(ArgumentError, 'Invalid class given for mount, must be a Rack::App')
62
62
  end
63
63
 
64
64
  router.merge!(api_class.router)
@@ -1,4 +1,4 @@
1
- class Rack::APP::Endpoint
1
+ class Rack::App::Endpoint
2
2
 
3
3
  def initialize(api_class, properties={}, &logic_block)
4
4
  @properties = properties
@@ -1,5 +1,5 @@
1
- api_class = Class.new(Rack::APP)
2
- Rack::APP::Endpoint::NOT_FOUND = Rack::APP::Endpoint.new(api_class) do
1
+ api_class = Class.new(Rack::App)
2
+ Rack::App::Endpoint::NOT_FOUND = Rack::App::Endpoint.new(api_class) do
3
3
  response.status= 404
4
4
  response.write '404 Not Found'
5
5
  response.finish
@@ -1,11 +1,10 @@
1
1
  require 'cgi'
2
- class Rack::APP::RequestHelpers::Params
2
+ class Rack::App::RequestHelpers::Params
3
3
 
4
- def initialize(request_env, path_params_matcher={})
4
+ def initialize(request_env, options = {})
5
5
  @request_env = request_env
6
6
 
7
- @path_params_matcher = path_params_matcher
8
-
7
+ @path_params_matcher = options[:path_params_matcher] || {}
9
8
  end
10
9
 
11
10
  def to_hash
@@ -32,7 +31,7 @@ class Rack::APP::RequestHelpers::Params
32
31
  path_params = {}
33
32
  if @path_params_matcher.is_a?(Hash) and not @path_params_matcher.empty?
34
33
 
35
- request_path_parts = Rack::APP::Utils.normalize_path(@request_env['REQUEST_PATH']).split('/')
34
+ request_path_parts = Rack::App::Utils.normalize_path(@request_env['REQUEST_PATH']).split('/')
36
35
 
37
36
  path_params = request_path_parts.each.with_index.reduce({}) do |params_col, (path_part, index)|
38
37
  if @path_params_matcher[index]
@@ -1,9 +1,9 @@
1
- module Rack::APP::RequestHelpers
1
+ module Rack::App::RequestHelpers
2
2
 
3
3
  require 'rack/app/request_helper/params'
4
4
 
5
5
  def params
6
- @__request_params__ ||= Rack::APP::RequestHelpers::Params.new(request.env).to_hash
6
+ @__request_params__ ||= Rack::App::RequestHelpers::Params.new(request.env,@options).to_hash
7
7
  end
8
8
 
9
9
  def status(new_status=nil)
@@ -1,10 +1,10 @@
1
- class Rack::APP::Router
1
+ class Rack::App::Router
2
2
 
3
3
  require 'rack/app/router/static'
4
4
  require 'rack/app/router/dynamic'
5
5
 
6
6
  def add_endpoint(request_method, request_path, endpoint)
7
- if defined_path_is_dynamic?(Rack::APP::Utils.normalize_path(request_path))
7
+ if defined_path_is_dynamic?(Rack::App::Utils.normalize_path(request_path))
8
8
  @dynamic_router.add_endpoint(request_method, request_path, endpoint)
9
9
  else
10
10
  @static_router.add_endpoint(request_method, request_path, endpoint)
@@ -14,7 +14,7 @@ class Rack::APP::Router
14
14
  def fetch_endpoint(request_method, request_path)
15
15
  @static_router.fetch_endpoint(request_method, request_path) or
16
16
  @dynamic_router.fetch_endpoint(request_method, request_path) or
17
- Rack::APP::Endpoint::NOT_FOUND
17
+ Rack::App::Endpoint::NOT_FOUND
18
18
  end
19
19
 
20
20
  def merge!(router)
@@ -27,8 +27,8 @@ class Rack::APP::Router
27
27
  protected
28
28
 
29
29
  def initialize
30
- @static_router = Rack::APP::Router::Static.new
31
- @dynamic_router = Rack::APP::Router::Dynamic.new
30
+ @static_router = Rack::App::Router::Static.new
31
+ @dynamic_router = Rack::App::Router::Dynamic.new
32
32
  end
33
33
 
34
34
  def defined_path_is_dynamic?(path_str)
@@ -1,9 +1,9 @@
1
- class Rack::APP::Router::Dynamic
1
+ class Rack::App::Router::Dynamic
2
2
 
3
- ANY = 'Rack::APP::Router::Dynamic::ANY'.freeze
3
+ ANY = 'Rack::App::Router::Dynamic::ANY'.freeze
4
4
 
5
5
  def add_endpoint(request_method, request_path, endpoint)
6
- request_path = Rack::APP::Utils.normalize_path(request_path)
6
+ request_path = Rack::App::Utils.normalize_path(request_path)
7
7
 
8
8
  current_cluster = main_cluster(request_method)
9
9
  path_params = {}
@@ -27,7 +27,7 @@ class Rack::APP::Router::Dynamic
27
27
  end
28
28
 
29
29
  def fetch_endpoint(request_method, request_path)
30
- normalized_request_path = Rack::APP::Utils.normalize_path(request_path)
30
+ normalized_request_path = Rack::App::Utils.normalize_path(request_path)
31
31
 
32
32
  current_cluster = main_cluster(request_method)
33
33
  normalized_request_path.split('/').each do |path_part|
@@ -1,7 +1,7 @@
1
- class Rack::APP::Router::Static
1
+ class Rack::App::Router::Static
2
2
 
3
3
  def add_endpoint(request_method, request_path, endpoint)
4
- @endpoints[[request_method.to_s.upcase, Rack::APP::Utils.normalize_path(request_path)]]= endpoint
4
+ @endpoints[[request_method.to_s.upcase, Rack::App::Utils.normalize_path(request_path)]]= endpoint
5
5
  end
6
6
 
7
7
  def fetch_endpoint(request_method, request_path)
@@ -1,4 +1,4 @@
1
- module Rack::APP::Runner
1
+ module Rack::App::Runner
2
2
  extend self
3
3
 
4
4
  def response_for(api_class, request_env)
@@ -1,4 +1,4 @@
1
- module Rack::APP::Utils
1
+ module Rack::App::Utils
2
2
  extend self
3
3
 
4
4
  # Normalizes URI path.
@@ -1,3 +1,3 @@
1
1
  Rack ||= Module.new
2
- Rack::APP ||= Class.new
3
- Rack::APP::VERSION = File.read(File.join(File.dirname(__FILE__), '..', '..', '..', 'VERSION')).strip
2
+ Rack::App ||= Class.new
3
+ Rack::App::VERSION = File.read(File.join(File.dirname(__FILE__), '..', '..', '..', 'VERSION')).strip
@@ -6,7 +6,7 @@ require 'rack/app/version'
6
6
  Gem::Specification.new do |spec|
7
7
 
8
8
  spec.name = "rack-app"
9
- spec.version = Rack::APP::VERSION
9
+ spec.version = Rack::App::VERSION
10
10
  spec.authors = ["Adam Luzsi"]
11
11
  spec.email = ["adamluzsi@gmail.com"]
12
12
 
@@ -2,8 +2,8 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'rack/app'
3
3
  require 'securerandom'
4
4
 
5
- static_router = Rack::APP::Router::Static.new
6
- dynamic_router = Rack::APP::Router::Dynamic.new
5
+ static_router = Rack::App::Router::Static.new
6
+ dynamic_router = Rack::App::Router::Dynamic.new
7
7
 
8
8
  classic_router = []
9
9
 
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.3
4
+ version: 0.3.0
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-08 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.2.2
121
+ rubygems_version: 2.4.8
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Your next favourite, performance designed micro framework!