wd_sinatra 0.3.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/CHANGELOG.md +6 -0
- data/lib/wd_sinatra/sinatra_ext.rb +11 -6
- data/lib/wd_sinatra/version.rb +1 -1
- data/templates/Rakefile +9 -0
- data/templates/bin/console +2 -0
- metadata +64 -41
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Weasel Diesel Sinatra Changelog
|
2
2
|
|
3
|
+
## 1.0.0
|
4
|
+
* It's time for WD to graduate, it's been behaving well in production
|
5
|
+
for a while and no major problems were reported. A new rake task was
|
6
|
+
added in the default Rakefile to print the routes. But besides that,
|
7
|
+
this version didn't add anything major to 0.3.2
|
8
|
+
|
3
9
|
## 0.3.2
|
4
10
|
* Removed `post_dispatch_hook` since it doesn't work well with `halt`
|
5
11
|
and file responses. Use Sinatra's `after` filter instead.
|
@@ -89,23 +89,28 @@ class WeaselDiesel
|
|
89
89
|
|
90
90
|
end # of RequestHandler
|
91
91
|
|
92
|
-
|
92
|
+
|
93
|
+
# Creates a new handler per request to dispatch
|
94
|
+
# by cloning the alpha handler
|
95
|
+
def handler
|
96
|
+
@alpha_handler.clone
|
97
|
+
end
|
93
98
|
|
94
99
|
def implementation(&block)
|
95
100
|
if block_given?
|
96
|
-
@
|
97
|
-
@
|
101
|
+
@alpha_handler = RequestHandler.new(self, &block)
|
102
|
+
@alpha_handler.define_singleton_method(:service_dispatch, block)
|
98
103
|
end
|
99
|
-
@
|
104
|
+
@alpha_handler
|
100
105
|
end
|
101
106
|
|
102
107
|
def load_sinatra_route
|
103
108
|
service = self
|
104
109
|
upcase_verb = service.verb.to_s.upcase
|
105
110
|
unless ENV['DONT_PRINT_ROUTES']
|
106
|
-
LOGGER.info "Available endpoint: #{self.http_verb.upcase} /#{self.url}"
|
111
|
+
LOGGER.info "Available endpoint: #{self.http_verb.upcase} /#{self.url}"
|
107
112
|
end
|
108
|
-
raise "DSL is missing the implementation block" unless
|
113
|
+
raise "DSL is missing the implementation block" unless ['SKIP_SERVICE_CHECK'] || self.handler
|
109
114
|
|
110
115
|
# Define the route directly to save some object allocations on the critical path
|
111
116
|
# Note that we are using a private API to define the route and that unlike sinatra usual DSL
|
data/lib/wd_sinatra/version.rb
CHANGED
data/templates/Rakefile
CHANGED
@@ -26,6 +26,15 @@ task :environment do
|
|
26
26
|
WDSinatra::AppLoader.server(root)
|
27
27
|
end
|
28
28
|
|
29
|
+
desc "Prints the available routes set by the application"
|
30
|
+
task :routes do
|
31
|
+
WDSinatra::AppLoader.console(root)
|
32
|
+
print "Available routes: \n"
|
33
|
+
WSList.all.each do |service|
|
34
|
+
print "#{service.http_verb.upcase}\t/#{service.url}\n"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
29
38
|
WDSinatra::AppLoader.set_loadpath(root)
|
30
39
|
Dir.glob("lib/tasks/**/*.rake").each do |task_file|
|
31
40
|
load task_file
|
data/templates/bin/console
CHANGED
metadata
CHANGED
@@ -1,47 +1,60 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: wd_sinatra
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Matt Aimonetti
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-10-18 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: weasel_diesel
|
16
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
24
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
22
32
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
26
35
|
name: thor
|
27
|
-
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
38
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
33
46
|
type: :runtime
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
apps using the Weasel Diesel DSL
|
38
|
-
email:
|
47
|
+
version_requirements: *id002
|
48
|
+
description: Weasel-Diesel Sinatra app gem, allowing you to generate/update sinatra apps using the Weasel Diesel DSL
|
49
|
+
email:
|
39
50
|
- mattaimonetti@gmail.com
|
40
|
-
executables:
|
51
|
+
executables:
|
41
52
|
- wd_sinatra
|
42
53
|
extensions: []
|
54
|
+
|
43
55
|
extra_rdoc_files: []
|
44
|
-
|
56
|
+
|
57
|
+
files:
|
45
58
|
- .gitignore
|
46
59
|
- CHANGELOG.md
|
47
60
|
- Gemfile
|
@@ -134,27 +147,37 @@ files:
|
|
134
147
|
- wd-sinatra.gemspec
|
135
148
|
homepage: https://github.com/mattetti/wd-sinatra
|
136
149
|
licenses: []
|
150
|
+
|
137
151
|
post_install_message:
|
138
152
|
rdoc_options: []
|
139
|
-
|
153
|
+
|
154
|
+
require_paths:
|
140
155
|
- lib
|
141
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
142
157
|
none: false
|
143
|
-
requirements:
|
144
|
-
- -
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
|
147
|
-
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
hash: 3
|
162
|
+
segments:
|
163
|
+
- 0
|
164
|
+
version: "0"
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
166
|
none: false
|
149
|
-
requirements:
|
150
|
-
- -
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
hash: 3
|
171
|
+
segments:
|
172
|
+
- 0
|
173
|
+
version: "0"
|
153
174
|
requirements: []
|
175
|
+
|
154
176
|
rubyforge_project:
|
155
|
-
rubygems_version: 1.8.
|
177
|
+
rubygems_version: 1.8.24
|
156
178
|
signing_key:
|
157
179
|
specification_version: 3
|
158
|
-
summary: Weasel-Diesel Sinatra app gem, allowing you to generate/update sinatra apps
|
159
|
-
using the Weasel Diesel DSL
|
180
|
+
summary: Weasel-Diesel Sinatra app gem, allowing you to generate/update sinatra apps using the Weasel Diesel DSL
|
160
181
|
test_files: []
|
182
|
+
|
183
|
+
has_rdoc:
|