bats 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bats.rb +5 -22
- metadata +3 -3
data/lib/bats.rb
CHANGED
@@ -5,7 +5,7 @@ end
|
|
5
5
|
class Bats
|
6
6
|
extend Wizarding
|
7
7
|
|
8
|
-
traits :routes
|
8
|
+
traits :routes, :root
|
9
9
|
|
10
10
|
def self.inherited c
|
11
11
|
c.traits *traits.keys
|
@@ -27,24 +27,10 @@ class Bats
|
|
27
27
|
statusCode( i ).headers( :Location => l )
|
28
28
|
end
|
29
29
|
|
30
|
-
def self.
|
31
|
-
|
32
|
-
def statusCode i
|
33
|
-
::HTTPResponse.const_get( "Status#{i}" )
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.statusCode i
|
37
|
-
::HTTPResponse.const_get( "Status#{i}" )
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.pubDir
|
41
|
-
File.expand_path( '../../public', __FILE__ )
|
42
|
-
end
|
43
|
-
|
44
|
-
def pubDir
|
45
|
-
File.expand_path( '../../public', __FILE__ )
|
46
|
-
end
|
30
|
+
def self.statusCode i; ::HTTPResponse.const_get( "Status#{i}" ); end
|
31
|
+
def statusCode i; ::HTTPResponse.const_get( "Status#{i}" ); end
|
47
32
|
|
33
|
+
def self.call env; new.call( env ); end
|
48
34
|
def call env
|
49
35
|
method = env[ 'REQUEST_METHOD' ].downcase.to_sym
|
50
36
|
path = env[ 'PATH_INFO' ]
|
@@ -69,9 +55,6 @@ class Bats
|
|
69
55
|
end
|
70
56
|
end
|
71
57
|
end
|
72
|
-
if !route && path =~ /\./ then
|
73
|
-
route = ::Rack::File.new( pubDir ) if File.exist?( "#{pubDir}/#{path}" )
|
74
|
-
end
|
75
58
|
route ||= statusCode( 404 )
|
76
59
|
args = ( matches ) ? [ env, *matches ] : [ env ]
|
77
60
|
begin
|
@@ -84,4 +67,4 @@ class Bats
|
|
84
67
|
route.call( env )
|
85
68
|
end
|
86
69
|
end
|
87
|
-
end
|
70
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hans Oksendahl
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-15 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -39,7 +39,7 @@ files:
|
|
39
39
|
- lib/bats/modules/metaid.rb
|
40
40
|
- README
|
41
41
|
has_rdoc: true
|
42
|
-
homepage: http://hansoksendahl.com/
|
42
|
+
homepage: http://hansoksendahl.com/bats
|
43
43
|
licenses: []
|
44
44
|
|
45
45
|
post_install_message:
|