wd_sinatra 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md
CHANGED
@@ -19,6 +19,7 @@ module WDSinatra
|
|
19
19
|
load_middleware
|
20
20
|
set_sinatra_routes
|
21
21
|
set_sinatra_settings
|
22
|
+
load_hooks
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
@@ -30,7 +31,7 @@ module WDSinatra
|
|
30
31
|
set_loadpath
|
31
32
|
load_environment
|
32
33
|
load_lib_dependencies
|
33
|
-
|
34
|
+
load_app_file
|
34
35
|
load_models
|
35
36
|
load_apis
|
36
37
|
@booted = true
|
@@ -84,11 +85,10 @@ module WDSinatra
|
|
84
85
|
require 'weasel_diesel'
|
85
86
|
require 'sinatra'
|
86
87
|
require 'wd_sinatra/sinatra_ext'
|
87
|
-
# TODO: hook to custom app dependencies
|
88
88
|
end
|
89
89
|
|
90
|
-
def
|
91
|
-
require File.join(root_path, '
|
90
|
+
def load_app_file
|
91
|
+
require File.join(root_path, 'lib', 'app')
|
92
92
|
end
|
93
93
|
|
94
94
|
def load_models
|
@@ -116,5 +116,12 @@ module WDSinatra
|
|
116
116
|
require File.join(root_path, 'config', 'sinatra_config')
|
117
117
|
end
|
118
118
|
|
119
|
+
def load_hooks
|
120
|
+
hooks_file = File.join(root_path, 'lib', 'hooks.rb')
|
121
|
+
if File.exist?(hooks_file)
|
122
|
+
require 'hooks'
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
119
126
|
end
|
120
127
|
end
|
@@ -4,9 +4,11 @@ require 'rack'
|
|
4
4
|
require 'rack/test'
|
5
5
|
require 'json'
|
6
6
|
require 'weasel_diesel'
|
7
|
+
require 'wd_sinatra/app_loader'
|
7
8
|
require 'json_response_verification'
|
8
9
|
|
9
10
|
WeaselDiesel.send(:include, JSONResponseVerification)
|
11
|
+
ENV['DONT_PRINT_ROUTES'] = 'true'
|
10
12
|
|
11
13
|
class Requester
|
12
14
|
include ::Rack::Test::Methods
|
@@ -19,12 +21,26 @@ end
|
|
19
21
|
module TestApi
|
20
22
|
module_function
|
21
23
|
|
22
|
-
URL_PLACEHOLDER
|
23
|
-
|
24
|
-
|
24
|
+
URL_PLACEHOLDER = /\/*(:[a-z A-Z _]+)\/*/
|
25
|
+
|
26
|
+
# Sets the X header name to make auth'd requests.
|
27
|
+
def auth_request_x_header=(val)
|
28
|
+
@auth_request_x_header = val
|
29
|
+
end
|
30
|
+
|
31
|
+
# getter for the auth X header
|
32
|
+
def auth_request_x_header
|
33
|
+
@auth_request_x_header
|
25
34
|
end
|
26
|
-
|
27
|
-
|
35
|
+
|
36
|
+
# Sets the X header name for mobile auth'd requests
|
37
|
+
def mobile_request_x_header=(val)
|
38
|
+
@mobile_request_x_header = val
|
39
|
+
end
|
40
|
+
|
41
|
+
# getter for the mobile X header
|
42
|
+
def mobile_request_x_header
|
43
|
+
@mobile_request_x_header
|
28
44
|
end
|
29
45
|
|
30
46
|
def request(verb, uri, params={}, headers=nil)
|
@@ -121,16 +137,15 @@ module TestApi
|
|
121
137
|
@json_response.rest_response if @json_response
|
122
138
|
end
|
123
139
|
|
140
|
+
# Define this method in your test helpers
|
124
141
|
def valid_internal_api_headers(headers)
|
125
|
-
|
126
|
-
custom_headers.merge!(headers) if headers
|
127
|
-
custom_headers
|
142
|
+
raise 'NotImplemented, You need to implement this method yourself'
|
128
143
|
end
|
129
144
|
|
145
|
+
# Define this method in your test helpers
|
146
|
+
|
130
147
|
def mobile_headers(headers)
|
131
|
-
|
132
|
-
custom_headers.merge!(headers) if headers
|
133
|
-
custom_headers
|
148
|
+
raise 'NotImplemented, You need to implement this method yourself'
|
134
149
|
end
|
135
150
|
|
136
151
|
end
|
data/lib/wd_sinatra/version.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wd_sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Aimonetti
|
@@ -15,7 +15,8 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-05-
|
18
|
+
date: 2012-05-09 00:00:00 +02:00
|
19
|
+
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: weasel_diesel
|
@@ -74,14 +75,14 @@ files:
|
|
74
75
|
- templates/api/hello_world.rb
|
75
76
|
- templates/bin/console
|
76
77
|
- templates/config.ru
|
77
|
-
- templates/config/app.rb
|
78
78
|
- templates/config/environments/default.rb
|
79
79
|
- templates/config/environments/production.rb
|
80
80
|
- templates/config/environments/test.rb
|
81
|
-
- templates/config/hooks.rb
|
82
81
|
- templates/config/middleware.rb
|
83
82
|
- templates/config/sinatra_config.rb
|
83
|
+
- templates/lib/app.rb
|
84
84
|
- templates/lib/body_parser.rb
|
85
|
+
- templates/lib/hooks.rb
|
85
86
|
- templates/lib/tasks/doc.rake
|
86
87
|
- templates/lib/tasks/doc_generator/bootstrap/.gitignore
|
87
88
|
- templates/lib/tasks/doc_generator/bootstrap/LICENSE
|
@@ -140,6 +141,7 @@ files:
|
|
140
141
|
- templates/lib/tasks/doc_generator/template.erb
|
141
142
|
- templates/public/favicon.ico
|
142
143
|
- wd-sinatra.gemspec
|
144
|
+
has_rdoc: true
|
143
145
|
homepage: https://github.com/mattetti/wd_sinatra
|
144
146
|
licenses: []
|
145
147
|
|
@@ -169,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
171
|
requirements: []
|
170
172
|
|
171
173
|
rubyforge_project:
|
172
|
-
rubygems_version: 1.
|
174
|
+
rubygems_version: 1.5.3
|
173
175
|
signing_key:
|
174
176
|
specification_version: 3
|
175
177
|
summary: Weasel-Diesel Sinatra app gem, allowing you to generate/update sinatra apps using the Weasel Diesel DSL
|