described_routes 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +54 -33
  2. data/lib/described_routes.rb +1 -1
  3. metadata +3 -3
data/README.rdoc CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == DESCRIPTION:
4
4
 
5
- Outputs hierarchical, framework-neutral descriptions of Rails routes in JSON, YAML and XML formats for potential consumption by client applications (e.g. those based on path-to[http://github.com/asplake/path-to/tree]).
5
+ Outputs hierarchical, framework-neutral descriptions of Rails routes in JSON, YAML, XML and plain text formats for potential consumption by client applications (e.g. those based on path-to[http://github.com/asplake/path-to/tree]).
6
6
 
7
7
  == SYNOPSIS:
8
8
 
@@ -19,37 +19,41 @@ Then:
19
19
  rake described_routes:xml # Describe resource structure in XML format
20
20
  rake described_routes:yaml # Describe resource structure in YAML format
21
21
  rake described_routes:yaml_short # Describe resource structure in YAML format (basic structure only)
22
-
23
- For a flavour, try the short form:
24
-
25
- $ rake described_routes:yaml_short
26
- - name: users
27
- path_template: /users{-prefix|.|format}
28
- resources:
29
- - name: user
30
- path_template: /users/{user_id}{-prefix|.|format}
31
- resources:
32
- - name: user_articles
33
- rel: articles
34
- path_template: /users/{user_id}/articles{-prefix|.|format}
35
- resources:
36
- - name: user_article
37
- path_template: /users/{user_id}/articles/{article_id}{-prefix|.|format}
38
- resources:
39
- - name: edit_user_article
40
- path_template: /users/{user_id}/articles/{article_id}/edit{-prefix|.|format}
41
- rel: edit
42
- - name: new_user_article
43
- path_template: /users/{user_id}/articles/new{-prefix|.|format}
44
- rel: new
45
- - name: recent_user_articles
46
- path_template: /users/{user_id}/articles/recent{-prefix|.|format}
47
- rel: recent
48
- - name: edit_user
49
- path_template: /users/{user_id}/edit{-prefix|.|format}
50
- rel: edit
51
-
52
- The above YAML is an abbreviated form that shows only name, rel, path_template for each resource in the hierarchy. The full form includes parameter lists (both mandatory and optional) and options (i.e. HTTP methods).
22
+ rake described_routes:text # Describe resource structure in text (comparable to "rake routes")
23
+
24
+ The text output looks like this:
25
+
26
+ $ rake described_routes:text
27
+ (in /Users/asplake/railsapps/testapp)
28
+ root root /
29
+ admin_products admin_products GET, POST /admin/products{-prefix|.|format}
30
+ new_admin_product new_admin_product GET /admin/products/new{-prefix|.|format}
31
+ {product_id} admin_product GET, PUT, DELETE /admin/products/{product_id}{-prefix|.|format}
32
+ edit edit_admin_product GET /admin/products/{product_id}/edit{-prefix|.|format}
33
+ described_routes described_routes GET, POST /described_routes{-prefix|.|format}
34
+ new_described_route new_described_route GET /described_routes/new{-prefix|.|format}
35
+ {route_name} described_route GET, PUT, DELETE /described_routes/{route_name}{-prefix|.|format}
36
+ edit edit_described_route GET /described_routes/{route_name}/edit{-prefix|.|format}
37
+ pages pages GET, POST /pages{-prefix|.|format}
38
+ new_page new_page GET /pages/new{-prefix|.|format}
39
+ {page_id} page GET, PUT, DELETE /pages/{page_id}{-prefix|.|format}
40
+ edit edit_page GET /pages/{page_id}/edit{-prefix|.|format}
41
+ summary summary_page GET /pages/{page_id}/summary{-prefix|.|format}
42
+ toggle_visibility toggle_visibility_page POST /pages/{page_id}/toggle_visibility{-prefix|.|format}
43
+ users users GET, POST /users{-prefix|.|format}
44
+ new_user new_user GET /users/new{-prefix|.|format}
45
+ {user_id} user GET, PUT, DELETE /users/{user_id}{-prefix|.|format}
46
+ edit edit_user GET /users/{user_id}/edit{-prefix|.|format}
47
+ articles user_articles GET, POST /users/{user_id}/articles{-prefix|.|format}
48
+ new_user_article new_user_article GET /users/{user_id}/articles/new{-prefix|.|format}
49
+ recent recent_user_articles GET /users/{user_id}/articles/recent{-prefix|.|format}
50
+ {article_id} user_article GET, PUT, DELETE /users/{user_id}/articles/{article_id}{-prefix|.|format}
51
+ edit edit_user_article GET /users/{user_id}/articles/{article_id}/edit{-prefix|.|format}
52
+ profile user_profile GET, PUT, DELETE, POST /users/{user_id}/profile{-prefix|.|format}
53
+ edit edit_user_profile GET /users/{user_id}/profile/edit{-prefix|.|format}
54
+ new new_user_profile GET /users/{user_id}/profile/new{-prefix|.|format}
55
+
56
+ The JSON, XML and YAML formats (of which the YAML is the most readable) are designed for program consumption.
53
57
 
54
58
  === Run time
55
59
 
@@ -76,7 +80,24 @@ and for the named route "users" (say):
76
80
  * .../described_routes/users.yaml?short=true
77
81
 
78
82
  If the application has a route named "root", run-time-generated data will include uri_template attributes based on root_url in addition to the path_template attributes supported at build time.
79
-
83
+
84
+ Example:
85
+
86
+ $ curl http://localhost:3000/described_routes.txt | head
87
+ % Total % Received % Xferd Average Speed Time Time Time Current
88
+ Dload Upload Total Spent Left Speed
89
+ 100 3536 100 3536 0 0 226k 0 --:--:-- --:--:-- --:--:-- 3453k
90
+ root root http://localhost:3000/
91
+ admin_products admin_products GET, POST http://localhost:3000/admin/products{-prefix|.|format}
92
+ new_admin_product new_admin_product GET http://localhost:3000/admin/products/new{-prefix|.|format}
93
+ {product_id} admin_product GET, PUT, DELETE http://localhost:3000/admin/products/{product_id}{-prefix|.|format}
94
+ edit edit_admin_product GET http://localhost:3000/admin/products/{product_id}/edit{-prefix|.|format}
95
+ described_routes described_routes GET, POST http://localhost:3000/described_routes{-prefix|.|format}
96
+ new_described_route new_described_route GET http://localhost:3000/described_routes/new{-prefix|.|format}
97
+ {route_name} described_route GET, PUT, DELETE http://localhost:3000/described_routes/{route_name}{-prefix|.|format}
98
+ edit edit_described_route GET http://localhost:3000/described_routes/{route_name}/edit{-prefix|.|format}
99
+ pages pages GET, POST http://localhost:3000/pages{-prefix|.|format}
100
+
80
101
  == DATA STRUCTURES and FORMATS
81
102
 
82
103
  === Natural structure
@@ -2,5 +2,5 @@ require 'described_routes/resource_template'
2
2
 
3
3
  module DescribedRoutes
4
4
  # rubygem version
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: described_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Burrows
@@ -32,7 +32,7 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.8.0
34
34
  version:
35
- description: Outputs hierarchical, framework-neutral descriptions of Rails routes in JSON, YAML and XML formats for potential consumption by client applications (e.g. those based on path-to[http://github.com/asplake/path-to/tree]).
35
+ description: Outputs hierarchical, framework-neutral descriptions of Rails routes in JSON, YAML, XML and plain text formats for potential consumption by client applications (e.g. those based on path-to[http://github.com/asplake/path-to/tree]).
36
36
  email:
37
37
  - mjb@asplake.co.uk
38
38
  executables: []
@@ -91,7 +91,7 @@ rubyforge_project: describedroutes
91
91
  rubygems_version: 1.3.2
92
92
  signing_key:
93
93
  specification_version: 3
94
- summary: Outputs hierarchical, framework-neutral descriptions of Rails routes in JSON, YAML and XML formats for potential consumption by client applications (e.g
94
+ summary: Outputs hierarchical, framework-neutral descriptions of Rails routes in JSON, YAML, XML and plain text formats for potential consumption by client applications (e.g
95
95
  test_files:
96
96
  - test/test_described_routes.rb
97
97
  - test/test_helper.rb