sinatra-routes 0.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.
- data/README.md +40 -0
- data/example/routes/users.rb +29 -0
- data/example/server.rb +15 -0
- data/lib/sinatra/routes.rb +15 -0
- data/rakefile.rb +16 -0
- metadata +84 -0
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
sinatra-routes
|
2
|
+
==============
|
3
|
+
|
4
|
+
sinatra-routes - a Sinatra exentsion for routing. It helps you to place routes in separate files, grouped by their goal.
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
gem install sinatra-routes
|
10
|
+
|
11
|
+
Usage example
|
12
|
+
-------------
|
13
|
+
# server.rb
|
14
|
+
|
15
|
+
require 'rubygems'
|
16
|
+
require 'sinatra/base'
|
17
|
+
require 'sinatra/routes'
|
18
|
+
|
19
|
+
Server < Sinatra::Base
|
20
|
+
register Sinatra::Routes
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'routes/users.rb'
|
24
|
+
|
25
|
+
Server.run!
|
26
|
+
|
27
|
+
Now you cal place your routes in separate file.
|
28
|
+
|
29
|
+
# routes/users.rb
|
30
|
+
|
31
|
+
routes do
|
32
|
+
get '/users' do
|
33
|
+
# render '/users'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Author
|
38
|
+
======
|
39
|
+
|
40
|
+
Dmitry Maksimov <dmtmax@gmail.com>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
routes do
|
2
|
+
get '/users' do
|
3
|
+
'GET /users'
|
4
|
+
end
|
5
|
+
|
6
|
+
get '/users/:id' do
|
7
|
+
'GET /users/:id'
|
8
|
+
end
|
9
|
+
|
10
|
+
get '/users/new' do
|
11
|
+
'GET /users/new'
|
12
|
+
end
|
13
|
+
|
14
|
+
post '/users' do
|
15
|
+
'POST /users'
|
16
|
+
end
|
17
|
+
|
18
|
+
get '/users/:id/edit' do
|
19
|
+
'GET /users/:id/edit'
|
20
|
+
end
|
21
|
+
|
22
|
+
put '/users/:id' do
|
23
|
+
'PUT /users/:id'
|
24
|
+
end
|
25
|
+
|
26
|
+
delete '/users/:id' do
|
27
|
+
'DELETE /users/:id'
|
28
|
+
end
|
29
|
+
end
|
data/example/server.rb
ADDED
data/rakefile.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
Jeweler::Tasks.new do |gemspec|
|
4
|
+
gemspec.name = "sinatra-routes"
|
5
|
+
gemspec.version = "0.1"
|
6
|
+
gemspec.summary = "Sinatra extension for routing"
|
7
|
+
gemspec.description = "Sinatra extension that helps organize routes in separate files"
|
8
|
+
gemspec.email = "dmtmax@gmail.com"
|
9
|
+
gemspec.homepage = "http://github.com/kolo/sinatra-routes"
|
10
|
+
gemspec.authors = ["Dmitry Maksimov"]
|
11
|
+
gemspec.files = FileList["README.md", "rakefile.rb", "example/**/*", "lib/**/*"]
|
12
|
+
gemspec.add_dependency "sinatra", ">= 1.0"
|
13
|
+
end
|
14
|
+
rescue LoadError
|
15
|
+
puts "Jeweler is not available. Install it with: gem install jeweler"
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sinatra-routes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: "0.1"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Dmitry Maksimov
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-08-18 00:00:00 +04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: sinatra
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 15
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 0
|
32
|
+
version: "1.0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
description: Sinatra extension that helps organize routes in separate files
|
36
|
+
email: dmtmax@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README.md
|
43
|
+
files:
|
44
|
+
- README.md
|
45
|
+
- example/routes/users.rb
|
46
|
+
- example/server.rb
|
47
|
+
- lib/sinatra/routes.rb
|
48
|
+
- rakefile.rb
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: http://github.com/kolo/sinatra-routes
|
51
|
+
licenses: []
|
52
|
+
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options:
|
55
|
+
- --charset=UTF-8
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
requirements: []
|
77
|
+
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 1.3.7
|
80
|
+
signing_key:
|
81
|
+
specification_version: 3
|
82
|
+
summary: Sinatra extension for routing
|
83
|
+
test_files: []
|
84
|
+
|