described_routes 0.3.3 → 0.3.4
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/History.txt +8 -1
- data/Manifest.txt +31 -0
- data/README.rdoc +6 -2
- data/Rakefile +13 -11
- data/lib/described_routes/rake_task_methods.rb +38 -0
- data/lib/described_routes.rb +1 -1
- data/lib/tasks/described_routes.rb +12 -22
- data/test_rails_app/Rakefile +12 -0
- data/test_rails_app/app/controllers/application_controller.rb +10 -0
- data/test_rails_app/app/helpers/application_helper.rb +3 -0
- data/test_rails_app/config/boot.rb +110 -0
- data/test_rails_app/config/environment.rb +41 -0
- data/test_rails_app/config/environments/development.rb +17 -0
- data/test_rails_app/config/environments/production.rb +28 -0
- data/test_rails_app/config/environments/test.rb +28 -0
- data/test_rails_app/config/initializers/described_routes.rb +1 -0
- data/test_rails_app/config/initializers/new_rails_defaults.rb +19 -0
- data/test_rails_app/config/initializers/session_store.rb +15 -0
- data/test_rails_app/config/routes.rb +28 -0
- data/test_rails_app/log/development.log +0 -0
- data/test_rails_app/log/production.log +0 -0
- data/test_rails_app/log/server.log +0 -0
- data/test_rails_app/log/test.log +0 -0
- data/test_rails_app/script/server +3 -0
- data/test_rails_app/test/fixtures/build_time/described_routes.json +1 -0
- data/test_rails_app/test/fixtures/build_time/described_routes.text +27 -0
- data/test_rails_app/test/fixtures/build_time/described_routes.xml +309 -0
- data/test_rails_app/test/fixtures/build_time/described_routes.yaml +243 -0
- data/test_rails_app/test/fixtures/build_time/described_routes.yaml_short +72 -0
- data/test_rails_app/test/fixtures/run_time/described_routes.json +1 -0
- data/test_rails_app/test/fixtures/run_time/described_routes.text +27 -0
- data/test_rails_app/test/fixtures/run_time/described_routes.xml +336 -0
- data/test_rails_app/test/fixtures/run_time/described_routes.yaml +270 -0
- data/test_rails_app/test/fixtures/run_time/described_routes.yaml_short +99 -0
- data/test_rails_app/test/integration/described_routes_run_time_test.rb +37 -0
- data/test_rails_app/test/integration/rake_tasks_test.rb +29 -0
- data/test_rails_app/test/test_helper.rb +2 -0
- metadata +34 -3
data/History.txt
CHANGED
@@ -1,6 +1,13 @@
|
|
1
|
+
== 0.3.4 2009-05-06
|
2
|
+
|
3
|
+
* Please comment on roadmap at http://positiveincline.com/?p=213 !
|
4
|
+
* 2 minor enhancements:
|
5
|
+
* optional BASE parameter: rake described_routes:<format> BASE=http://...
|
6
|
+
* added test_rails_app subproject, included in main project's tests
|
7
|
+
|
1
8
|
== 0.3.3 2009-05-05
|
2
9
|
|
3
|
-
* Please comment on roadmap at http://positiveincline.com/?p=213
|
10
|
+
* Please comment on roadmap at http://positiveincline.com/?p=213 !
|
4
11
|
* 1 minor fix:
|
5
12
|
* fix controller for YAML output
|
6
13
|
|
data/Manifest.txt
CHANGED
@@ -7,6 +7,7 @@ Rakefile
|
|
7
7
|
lib/described_routes.rb
|
8
8
|
lib/described_routes/rails_controller.rb
|
9
9
|
lib/described_routes/rails_routes.rb
|
10
|
+
lib/described_routes/rake_task_methods.rb
|
10
11
|
lib/described_routes/resource_template.rb
|
11
12
|
lib/tasks/described_routes.rb
|
12
13
|
script/console
|
@@ -16,3 +17,33 @@ test/fixtures/described_routes_test.json
|
|
16
17
|
test/test_described_routes.rb
|
17
18
|
test/test_helper.rb
|
18
19
|
test/test_resource_template.rb
|
20
|
+
test_rails_app/Rakefile
|
21
|
+
test_rails_app/app/controllers/application_controller.rb
|
22
|
+
test_rails_app/app/helpers/application_helper.rb
|
23
|
+
test_rails_app/config/boot.rb
|
24
|
+
test_rails_app/config/environment.rb
|
25
|
+
test_rails_app/config/environments/development.rb
|
26
|
+
test_rails_app/config/environments/production.rb
|
27
|
+
test_rails_app/config/environments/test.rb
|
28
|
+
test_rails_app/config/initializers/described_routes.rb
|
29
|
+
test_rails_app/config/initializers/new_rails_defaults.rb
|
30
|
+
test_rails_app/config/initializers/session_store.rb
|
31
|
+
test_rails_app/config/routes.rb
|
32
|
+
test_rails_app/log/development.log
|
33
|
+
test_rails_app/log/production.log
|
34
|
+
test_rails_app/log/server.log
|
35
|
+
test_rails_app/log/test.log
|
36
|
+
test_rails_app/script/server
|
37
|
+
test_rails_app/test/fixtures/build_time/described_routes.json
|
38
|
+
test_rails_app/test/fixtures/build_time/described_routes.text
|
39
|
+
test_rails_app/test/fixtures/build_time/described_routes.xml
|
40
|
+
test_rails_app/test/fixtures/build_time/described_routes.yaml
|
41
|
+
test_rails_app/test/fixtures/build_time/described_routes.yaml_short
|
42
|
+
test_rails_app/test/fixtures/run_time/described_routes.json
|
43
|
+
test_rails_app/test/fixtures/run_time/described_routes.text
|
44
|
+
test_rails_app/test/fixtures/run_time/described_routes.xml
|
45
|
+
test_rails_app/test/fixtures/run_time/described_routes.yaml
|
46
|
+
test_rails_app/test/fixtures/run_time/described_routes.yaml_short
|
47
|
+
test_rails_app/test/integration/described_routes_run_time_test.rb
|
48
|
+
test_rails_app/test/integration/rake_tasks_test.rb
|
49
|
+
test_rails_app/test/test_helper.rb
|
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= described_routes README
|
2
2
|
|
3
|
-
|
3
|
+
Note to reader: Please comment on the roadmap at http://positiveincline.com/?p=213
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
@@ -55,6 +55,10 @@ The text output looks like this:
|
|
55
55
|
edit edit_user_profile GET /users/{user_id}/profile/edit{-prefix|.|format}
|
56
56
|
new new_user_profile GET /users/{user_id}/profile/new{-prefix|.|format}
|
57
57
|
|
58
|
+
You can specify the base URL of your application by appending the following
|
59
|
+
parameter "BASE=http://..." to the rake command line. The output will then
|
60
|
+
include full URI templates.
|
61
|
+
|
58
62
|
The JSON, XML and YAML formats (of which the YAML is the most readable) are designed for program consumption.
|
59
63
|
|
60
64
|
=== Run time
|
@@ -105,7 +109,7 @@ Example:
|
|
105
109
|
|
106
110
|
=== Natural structure
|
107
111
|
|
108
|
-
The YAML and JSON representations appear as simple array and hash structures
|
112
|
+
The YAML and JSON representations appear as simple array and hash structures. Each resource is represented by a hash of attributes (one of which may be a list of child resources); the top level structure is an array of the resources that don't have parents.
|
109
113
|
|
110
114
|
Attributes:
|
111
115
|
|
data/Rakefile
CHANGED
@@ -2,14 +2,6 @@
|
|
2
2
|
$:.push File.dirname(__FILE__) + '/lib'
|
3
3
|
require 'described_routes'
|
4
4
|
|
5
|
-
# undefined method `empty?' for nil:NilClass
|
6
|
-
# /Library/Ruby/Site/1.8/rubygems/specification.rb:886:in `validate'
|
7
|
-
class NilClass
|
8
|
-
def empty?
|
9
|
-
true
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
5
|
# Generate all the Rake tasks
|
14
6
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
15
7
|
$hoe = Hoe.new('described_routes', DescribedRoutes::VERSION) do |p|
|
@@ -17,7 +9,7 @@ $hoe = Hoe.new('described_routes', DescribedRoutes::VERSION) do |p|
|
|
17
9
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
18
10
|
p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
19
11
|
p.rubyforge_name = 'describedroutes'
|
20
|
-
p.url = 'http://positiveincline.com/?
|
12
|
+
p.url = 'http://positiveincline.com/?p=213'
|
21
13
|
# p.extra_deps = [
|
22
14
|
# ['activesupport','>= 2.0.2'],
|
23
15
|
# ]
|
@@ -34,5 +26,15 @@ end
|
|
34
26
|
require 'newgem/tasks' # load /tasks/*.rake
|
35
27
|
Dir['tasks/**/*.rake'].each { |t| load t }
|
36
28
|
|
37
|
-
#
|
38
|
-
#
|
29
|
+
#
|
30
|
+
# These add to existing tasks and execute in the ./test_rails_app/ subproject
|
31
|
+
#
|
32
|
+
|
33
|
+
task :test do
|
34
|
+
rubyopt = "-I#{File.dirname(__FILE__) + '/lib'} #{ENV['RUBYOPT']}"
|
35
|
+
Dir.chdir("test_rails_app"){ sh "RUBYOPT=\"#{rubyopt}\" rake test:integration" }
|
36
|
+
end
|
37
|
+
|
38
|
+
task :clean do
|
39
|
+
Dir.chdir("test_rails_app"){ sh "rake log:clear tmp:clear" }
|
40
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'described_routes/rails_routes'
|
2
|
+
|
3
|
+
module DescribedRoutes
|
4
|
+
module RakeTaskMethods
|
5
|
+
# Describe resource structure in JSON format
|
6
|
+
def self.json
|
7
|
+
DescribedRoutes::ResourceTemplate.to_json(
|
8
|
+
DescribedRoutes::RailsRoutes.get_resource_templates(ENV['BASE']))
|
9
|
+
end
|
10
|
+
|
11
|
+
# "Describe resource structure in YAML format
|
12
|
+
def self.yaml
|
13
|
+
DescribedRoutes::ResourceTemplate.to_yaml(
|
14
|
+
DescribedRoutes::RailsRoutes.get_resource_templates(ENV['BASE']))
|
15
|
+
end
|
16
|
+
|
17
|
+
# Describe resource structure in YAML format (basic structure only)
|
18
|
+
def self.yaml_short
|
19
|
+
DescribedRoutes::ResourceTemplate.to_yaml(
|
20
|
+
DescribedRoutes::RailsRoutes.get_resource_templates(ENV['BASE'])).grep(
|
21
|
+
/(name|rel|path_template|uri_template|resources):|^---/).join
|
22
|
+
end
|
23
|
+
|
24
|
+
# Describe resource structure in XML format
|
25
|
+
def self.xml
|
26
|
+
DescribedRoutes::ResourceTemplate.to_xml(
|
27
|
+
Builder::XmlMarkup.new(:indent => 2),
|
28
|
+
DescribedRoutes::RailsRoutes.get_resource_templates(ENV['BASE'])
|
29
|
+
).target!
|
30
|
+
end
|
31
|
+
|
32
|
+
# Describe resource structure in text format
|
33
|
+
def self.text
|
34
|
+
DescribedRoutes::ResourceTemplate.to_text(
|
35
|
+
DescribedRoutes::RailsRoutes.get_resource_templates(ENV['BASE']))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/described_routes.rb
CHANGED
@@ -1,43 +1,33 @@
|
|
1
1
|
require 'tasks/rails'
|
2
|
-
require 'described_routes/
|
2
|
+
require 'described_routes/rake_task_methods'
|
3
3
|
|
4
4
|
namespace :described_routes do
|
5
|
-
desc
|
6
|
-
desc "Describe resource structure in JSON format"
|
7
|
-
|
5
|
+
desc 'Describe resource structure in JSON format (optional: add "BASE=http://...")'
|
8
6
|
task :json => :environment do
|
9
|
-
puts DescribedRoutes::
|
10
|
-
DescribedRoutes::RailsRoutes.get_resource_templates)
|
7
|
+
puts DescribedRoutes::RakeTaskMethods.json
|
11
8
|
end
|
12
9
|
|
13
|
-
desc
|
10
|
+
desc 'Describe resource structure in YAML format (optional: add "BASE=http://...")'
|
14
11
|
task :yaml => :environment do
|
15
|
-
puts DescribedRoutes::
|
16
|
-
DescribedRoutes::RailsRoutes.get_resource_templates)
|
12
|
+
puts DescribedRoutes::RakeTaskMethods.yaml
|
17
13
|
end
|
18
14
|
|
19
|
-
desc
|
15
|
+
desc 'Describe resource structure in YAML format (basic structure only) (optional: add "BASE=http://...")'
|
20
16
|
task :yaml_short => :environment do
|
21
|
-
puts DescribedRoutes::
|
22
|
-
DescribedRoutes::RailsRoutes.get_resource_templates).grep(
|
23
|
-
/(name|rel|path_template|uri_template|resources):|^---/)
|
17
|
+
puts DescribedRoutes::RakeTaskMethods.yaml_short
|
24
18
|
end
|
25
19
|
|
26
|
-
desc
|
20
|
+
desc 'Describe resource structure in XML format (optional: add "BASE=http://...")'
|
27
21
|
task :xml => :environment do
|
28
|
-
puts DescribedRoutes::
|
29
|
-
Builder::XmlMarkup.new(:indent => 2),
|
30
|
-
DescribedRoutes::RailsRoutes.get_resource_templates
|
31
|
-
).target!
|
22
|
+
puts DescribedRoutes::RakeTaskMethods.xml
|
32
23
|
end
|
33
24
|
|
34
|
-
desc
|
25
|
+
desc 'Describe resource structure in text format (optional: add "BASE=http://...")'
|
35
26
|
task :text => :environment do
|
36
|
-
puts DescribedRoutes::
|
37
|
-
DescribedRoutes::RailsRoutes.get_resource_templates)
|
27
|
+
puts DescribedRoutes::RakeTaskMethods.text
|
38
28
|
end
|
39
29
|
|
40
|
-
# unsupported
|
30
|
+
# unsupported
|
41
31
|
task :ruby => :environment do
|
42
32
|
puts DescribedRoutes::ResourceTemplate.to_parsed(
|
43
33
|
DescribedRoutes::RailsRoutes.get_resource_templates).inspect
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
require 'rake/rdoctask'
|
9
|
+
|
10
|
+
require 'tasks/rails'
|
11
|
+
|
12
|
+
require 'tasks/described_routes'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Filters added to this controller apply to all controllers in the application.
|
2
|
+
# Likewise, all the methods added will be available for all controllers.
|
3
|
+
|
4
|
+
class ApplicationController < ActionController::Base
|
5
|
+
helper :all # include all helpers, all the time
|
6
|
+
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
7
|
+
|
8
|
+
# Scrub sensitive parameters from your log
|
9
|
+
# filter_parameter_logging :password
|
10
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# Don't change this file!
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
+
|
4
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
class << self
|
8
|
+
def boot!
|
9
|
+
unless booted?
|
10
|
+
preinitialize
|
11
|
+
pick_boot.run
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def booted?
|
16
|
+
defined? Rails::Initializer
|
17
|
+
end
|
18
|
+
|
19
|
+
def pick_boot
|
20
|
+
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
+
end
|
22
|
+
|
23
|
+
def vendor_rails?
|
24
|
+
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
+
end
|
26
|
+
|
27
|
+
def preinitialize
|
28
|
+
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def preinitializer_path
|
32
|
+
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Boot
|
37
|
+
def run
|
38
|
+
load_initializer
|
39
|
+
Rails::Initializer.run(:set_load_path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class VendorBoot < Boot
|
44
|
+
def load_initializer
|
45
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
+
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
+
Rails::GemDependency.add_frozen_gem_path
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class GemBoot < Boot
|
52
|
+
def load_initializer
|
53
|
+
self.class.load_rubygems
|
54
|
+
load_rails_gem
|
55
|
+
require 'initializer'
|
56
|
+
end
|
57
|
+
|
58
|
+
def load_rails_gem
|
59
|
+
if version = self.class.gem_version
|
60
|
+
gem 'rails', version
|
61
|
+
else
|
62
|
+
gem 'rails'
|
63
|
+
end
|
64
|
+
rescue Gem::LoadError => load_error
|
65
|
+
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
66
|
+
exit 1
|
67
|
+
end
|
68
|
+
|
69
|
+
class << self
|
70
|
+
def rubygems_version
|
71
|
+
Gem::RubyGemsVersion rescue nil
|
72
|
+
end
|
73
|
+
|
74
|
+
def gem_version
|
75
|
+
if defined? RAILS_GEM_VERSION
|
76
|
+
RAILS_GEM_VERSION
|
77
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
78
|
+
ENV['RAILS_GEM_VERSION']
|
79
|
+
else
|
80
|
+
parse_gem_version(read_environment_rb)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def load_rubygems
|
85
|
+
require 'rubygems'
|
86
|
+
min_version = '1.3.1'
|
87
|
+
unless rubygems_version >= min_version
|
88
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
89
|
+
exit 1
|
90
|
+
end
|
91
|
+
|
92
|
+
rescue LoadError
|
93
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
94
|
+
exit 1
|
95
|
+
end
|
96
|
+
|
97
|
+
def parse_gem_version(text)
|
98
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
def read_environment_rb
|
103
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# All that for this:
|
110
|
+
Rails.boot!
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file
|
2
|
+
|
3
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
4
|
+
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
|
5
|
+
|
6
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
7
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
8
|
+
|
9
|
+
Rails::Initializer.run do |config|
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Add additional load paths for your own custom dirs
|
15
|
+
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
16
|
+
|
17
|
+
# Specify gems that this application depends on and have them installed with rake gems:install
|
18
|
+
# config.gem "bj"
|
19
|
+
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
20
|
+
# config.gem "sqlite3-ruby", :lib => "sqlite3"
|
21
|
+
# config.gem "aws-s3", :lib => "aws/s3"
|
22
|
+
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
24
|
+
# :all can be used as a placeholder for all plugins not explicitly named
|
25
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
26
|
+
|
27
|
+
# Skip frameworks you're not going to use. To use Rails without a database,
|
28
|
+
# you must remove the Active Record framework.
|
29
|
+
config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
30
|
+
|
31
|
+
# Activate observers that should always be running
|
32
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
33
|
+
|
34
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
35
|
+
# Run "rake -D time" for a list of tasks for finding time zone names.
|
36
|
+
config.time_zone = 'UTC'
|
37
|
+
|
38
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
39
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
|
40
|
+
# config.i18n.default_locale = :de
|
41
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# In the development environment your application's code is reloaded on
|
4
|
+
# every request. This slows down response time but is perfect for development
|
5
|
+
# since you don't have to restart the webserver when you make code changes.
|
6
|
+
config.cache_classes = false
|
7
|
+
|
8
|
+
# Log error messages when you accidentally call methods on nil.
|
9
|
+
config.whiny_nils = true
|
10
|
+
|
11
|
+
# Show full error reports and disable caching
|
12
|
+
config.action_controller.consider_all_requests_local = true
|
13
|
+
config.action_view.debug_rjs = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The production environment is meant for finished, "live" apps.
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Full error reports are disabled and caching is turned on
|
8
|
+
config.action_controller.consider_all_requests_local = false
|
9
|
+
config.action_controller.perform_caching = true
|
10
|
+
config.action_view.cache_template_loading = true
|
11
|
+
|
12
|
+
# See everything in the log (default is :info)
|
13
|
+
# config.log_level = :debug
|
14
|
+
|
15
|
+
# Use a different logger for distributed setups
|
16
|
+
# config.logger = SyslogLogger.new
|
17
|
+
|
18
|
+
# Use a different cache store in production
|
19
|
+
# config.cache_store = :mem_cache_store
|
20
|
+
|
21
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
22
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
23
|
+
|
24
|
+
# Disable delivery errors, bad email addresses will be ignored
|
25
|
+
# config.action_mailer.raise_delivery_errors = false
|
26
|
+
|
27
|
+
# Enable threaded mode
|
28
|
+
# config.threadsafe!
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
config.action_view.cache_template_loading = true
|
16
|
+
|
17
|
+
# Disable request forgery protection in test environment
|
18
|
+
config.action_controller.allow_forgery_protection = false
|
19
|
+
|
20
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
21
|
+
# The :test delivery method accumulates sent emails in the
|
22
|
+
# ActionMailer::Base.deliveries array.
|
23
|
+
config.action_mailer.delivery_method = :test
|
24
|
+
|
25
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
26
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
27
|
+
# like if you have constraints or database-specific column types
|
28
|
+
# config.active_record.schema_format = :sql
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'described_routes/rails_controller'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# These settings change the behavior of Rails 2 apps and will be defaults
|
4
|
+
# for Rails 3. You can remove this initializer when Rails 3 is released.
|
5
|
+
|
6
|
+
if defined?(ActiveRecord)
|
7
|
+
# Include Active Record class name as root for JSON serialized output.
|
8
|
+
ActiveRecord::Base.include_root_in_json = true
|
9
|
+
|
10
|
+
# Store the full class name (including module namespace) in STI type column.
|
11
|
+
ActiveRecord::Base.store_full_sti_class = true
|
12
|
+
end
|
13
|
+
|
14
|
+
# Use ISO 8601 format for JSON serialized times and dates.
|
15
|
+
ActiveSupport.use_standard_json_time_format = true
|
16
|
+
|
17
|
+
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
|
18
|
+
# if you're including raw json in an HTML page.
|
19
|
+
ActiveSupport.escape_html_entities_in_json = false
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying cookie session data integrity.
|
4
|
+
# If you change this key, all old sessions will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
ActionController::Base.session = {
|
8
|
+
:key => '_testapp_session',
|
9
|
+
:secret => 'dad28f64c968d96b22e305e25488eea6046369e9eb88987ed49877a9fce693f4972691a2fa8b5baad1aa043e95438d3e31ab708486a800399b72e56f2c4428f6'
|
10
|
+
}
|
11
|
+
|
12
|
+
# Use the database for sessions instead of the cookie-based default,
|
13
|
+
# which shouldn't be used to store highly confidential information
|
14
|
+
# (create the session table with "rake db:sessions:create")
|
15
|
+
# ActionController::Base.session_store = :active_record_store
|
@@ -0,0 +1,28 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
|
3
|
+
#
|
4
|
+
# some sample routes taken from the comments in the original boilerplate
|
5
|
+
#
|
6
|
+
|
7
|
+
map.resources :users do |users|
|
8
|
+
users.resources :articles, :collection => {:recent => :get}
|
9
|
+
users.resource :profile
|
10
|
+
end
|
11
|
+
|
12
|
+
map.resources :pages, :member => {:summary => :get, :toggle_visibility => :post}
|
13
|
+
|
14
|
+
map.namespace :admin do |admin|
|
15
|
+
admin.resources :products
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# described_routes will use this as the base URI if present, otherwise
|
20
|
+
# it returns only relative paths
|
21
|
+
#
|
22
|
+
map.root :controller => "welcome"
|
23
|
+
|
24
|
+
#
|
25
|
+
# described_routes at runtime
|
26
|
+
#
|
27
|
+
map.resources :described_routes, :controller => "described_routes/rails"
|
28
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"name":"root","path_template":"\/"},{"name":"admin_products","resource_templates":[{"name":"new_admin_product","options":["GET"],"path_template":"\/admin\/products\/new{-prefix|.|format}","rel":"new_admin_product","optional_params":["format"]},{"name":"admin_product","resource_templates":[{"name":"edit_admin_product","options":["GET"],"path_template":"\/admin\/products\/{product_id}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["product_id"]}],"options":["GET","PUT","DELETE"],"path_template":"\/admin\/products\/{product_id}{-prefix|.|format}","optional_params":["format"],"params":["product_id"]}],"options":["GET","POST"],"path_template":"\/admin\/products{-prefix|.|format}","optional_params":["format"]},{"name":"described_routes","resource_templates":[{"name":"new_described_route","options":["GET"],"path_template":"\/described_routes\/new{-prefix|.|format}","rel":"new_described_route","optional_params":["format"]},{"name":"described_route","resource_templates":[{"name":"edit_described_route","options":["GET"],"path_template":"\/described_routes\/{route_name}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["route_name"]}],"options":["GET","PUT","DELETE"],"path_template":"\/described_routes\/{route_name}{-prefix|.|format}","optional_params":["format"],"params":["route_name"]}],"options":["GET","POST"],"path_template":"\/described_routes{-prefix|.|format}","optional_params":["format"]},{"name":"pages","resource_templates":[{"name":"new_page","options":["GET"],"path_template":"\/pages\/new{-prefix|.|format}","rel":"new_page","optional_params":["format"]},{"name":"page","resource_templates":[{"name":"edit_page","options":["GET"],"path_template":"\/pages\/{page_id}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["page_id"]},{"name":"summary_page","options":["GET"],"path_template":"\/pages\/{page_id}\/summary{-prefix|.|format}","rel":"summary","optional_params":["format"],"params":["page_id"]},{"name":"toggle_visibility_page","options":["POST"],"path_template":"\/pages\/{page_id}\/toggle_visibility{-prefix|.|format}","rel":"toggle_visibility","optional_params":["format"],"params":["page_id"]}],"options":["GET","PUT","DELETE"],"path_template":"\/pages\/{page_id}{-prefix|.|format}","optional_params":["format"],"params":["page_id"]}],"options":["GET","POST"],"path_template":"\/pages{-prefix|.|format}","optional_params":["format"]},{"name":"users","resource_templates":[{"name":"new_user","options":["GET"],"path_template":"\/users\/new{-prefix|.|format}","rel":"new_user","optional_params":["format"]},{"name":"user","resource_templates":[{"name":"edit_user","options":["GET"],"path_template":"\/users\/{user_id}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id"]},{"name":"user_articles","resource_templates":[{"name":"new_user_article","options":["GET"],"path_template":"\/users\/{user_id}\/articles\/new{-prefix|.|format}","rel":"new_user_article","optional_params":["format"],"params":["user_id"]},{"name":"recent_user_articles","options":["GET"],"path_template":"\/users\/{user_id}\/articles\/recent{-prefix|.|format}","rel":"recent","optional_params":["format"],"params":["user_id"]},{"name":"user_article","resource_templates":[{"name":"edit_user_article","options":["GET"],"path_template":"\/users\/{user_id}\/articles\/{article_id}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id","article_id"]}],"options":["GET","PUT","DELETE"],"path_template":"\/users\/{user_id}\/articles\/{article_id}{-prefix|.|format}","optional_params":["format"],"params":["user_id","article_id"]}],"options":["GET","POST"],"path_template":"\/users\/{user_id}\/articles{-prefix|.|format}","rel":"articles","optional_params":["format"],"params":["user_id"]},{"name":"user_profile","resource_templates":[{"name":"edit_user_profile","options":["GET"],"path_template":"\/users\/{user_id}\/profile\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id"]},{"name":"new_user_profile","options":["GET"],"path_template":"\/users\/{user_id}\/profile\/new{-prefix|.|format}","rel":"new","optional_params":["format"],"params":["user_id"]}],"options":["GET","PUT","DELETE","POST"],"path_template":"\/users\/{user_id}\/profile{-prefix|.|format}","rel":"profile","optional_params":["format"],"params":["user_id"]}],"options":["GET","PUT","DELETE"],"path_template":"\/users\/{user_id}{-prefix|.|format}","optional_params":["format"],"params":["user_id"]}],"options":["GET","POST"],"path_template":"\/users{-prefix|.|format}","optional_params":["format"]}]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
root root /
|
2
|
+
admin_products admin_products GET, POST /admin/products{-prefix|.|format}
|
3
|
+
new_admin_product new_admin_product GET /admin/products/new{-prefix|.|format}
|
4
|
+
{product_id} admin_product GET, PUT, DELETE /admin/products/{product_id}{-prefix|.|format}
|
5
|
+
edit edit_admin_product GET /admin/products/{product_id}/edit{-prefix|.|format}
|
6
|
+
described_routes described_routes GET, POST /described_routes{-prefix|.|format}
|
7
|
+
new_described_route new_described_route GET /described_routes/new{-prefix|.|format}
|
8
|
+
{route_name} described_route GET, PUT, DELETE /described_routes/{route_name}{-prefix|.|format}
|
9
|
+
edit edit_described_route GET /described_routes/{route_name}/edit{-prefix|.|format}
|
10
|
+
pages pages GET, POST /pages{-prefix|.|format}
|
11
|
+
new_page new_page GET /pages/new{-prefix|.|format}
|
12
|
+
{page_id} page GET, PUT, DELETE /pages/{page_id}{-prefix|.|format}
|
13
|
+
edit edit_page GET /pages/{page_id}/edit{-prefix|.|format}
|
14
|
+
summary summary_page GET /pages/{page_id}/summary{-prefix|.|format}
|
15
|
+
toggle_visibility toggle_visibility_page POST /pages/{page_id}/toggle_visibility{-prefix|.|format}
|
16
|
+
users users GET, POST /users{-prefix|.|format}
|
17
|
+
new_user new_user GET /users/new{-prefix|.|format}
|
18
|
+
{user_id} user GET, PUT, DELETE /users/{user_id}{-prefix|.|format}
|
19
|
+
edit edit_user GET /users/{user_id}/edit{-prefix|.|format}
|
20
|
+
articles user_articles GET, POST /users/{user_id}/articles{-prefix|.|format}
|
21
|
+
new_user_article new_user_article GET /users/{user_id}/articles/new{-prefix|.|format}
|
22
|
+
recent recent_user_articles GET /users/{user_id}/articles/recent{-prefix|.|format}
|
23
|
+
{article_id} user_article GET, PUT, DELETE /users/{user_id}/articles/{article_id}{-prefix|.|format}
|
24
|
+
edit edit_user_article GET /users/{user_id}/articles/{article_id}/edit{-prefix|.|format}
|
25
|
+
profile user_profile GET, PUT, DELETE, POST /users/{user_id}/profile{-prefix|.|format}
|
26
|
+
edit edit_user_profile GET /users/{user_id}/profile/edit{-prefix|.|format}
|
27
|
+
new new_user_profile GET /users/{user_id}/profile/new{-prefix|.|format}
|