radiant 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of radiant might be problematic. Click here for more details.
- data/CHANGELOG +61 -7
- data/CONTRIBUTORS +15 -0
- data/app/controllers/admin/export_controller.rb +1 -1
- data/app/controllers/admin/page_controller.rb +1 -0
- data/app/controllers/admin/user_controller.rb +2 -1
- data/app/controllers/application.rb +7 -8
- data/app/helpers/admin/node_helper.rb +84 -0
- data/app/helpers/admin/page_helper.rb +1 -19
- data/app/helpers/application_helper.rb +15 -9
- data/app/models/file_not_found_page.rb +2 -2
- data/app/models/page.rb +22 -18
- data/app/models/page_context.rb +9 -0
- data/app/models/radiant/config.rb +4 -2
- data/app/models/response_cache.rb +18 -12
- data/app/models/standard_tags.rb +111 -50
- data/app/views/admin/extension/index.rhtml +2 -2
- data/app/views/admin/layout/edit.rhtml +2 -2
- data/app/views/admin/layout/remove.rhtml +2 -2
- data/app/views/admin/page/_node.rhtml +4 -26
- data/app/views/admin/page/_part.rhtml +9 -14
- data/app/views/admin/page/edit.rhtml +38 -121
- data/app/views/admin/page/index.rhtml +2 -6
- data/app/views/admin/page/remove.rhtml +2 -2
- data/app/views/admin/snippet/edit.rhtml +3 -3
- data/app/views/admin/snippet/index.rhtml +2 -2
- data/app/views/admin/snippet/remove.rhtml +2 -2
- data/app/views/admin/user/edit.rhtml +4 -4
- data/app/views/admin/user/preferences.rhtml +2 -2
- data/app/views/admin/welcome/login.rhtml +1 -1
- data/config/environment.rb +79 -78
- data/db/schema.rb +2 -0
- data/lib/local_time.rb +12 -0
- data/lib/plugins/extension_patches/lib/fixture_loading_extension.rb +1 -1
- data/lib/plugins/extension_patches/lib/mailer_view_paths_extension.rb +3 -3
- data/lib/radiant.rb +1 -1
- data/lib/radiant/extension.rb +9 -3
- data/lib/radiant/extension_loader.rb +2 -2
- data/lib/tasks/extensions.rake +23 -8
- data/public/javascripts/admin.js +89 -0
- data/public/javascripts/controls.js +486 -354
- data/public/javascripts/dragdrop.js +90 -58
- data/public/javascripts/effects.js +398 -364
- data/public/javascripts/pngfix.js +37 -37
- data/public/javascripts/prototype.js +2764 -1095
- data/public/javascripts/ruledtable.js +10 -25
- data/public/javascripts/sitemap.js +74 -112
- data/public/javascripts/string.js +1 -7
- data/public/javascripts/tabcontrol.js +71 -86
- data/public/javascripts/tag_reference_search.js +19 -26
- data/public/stylesheets/admin/main.css +11 -5
- data/test/fixtures/extensions/01_basic/lib/new_module.rb +2 -0
- data/test/fixtures/page_parts.yml +16 -1
- data/test/fixtures/pages.yml +47 -84
- data/test/functional/extension_initialization_test.rb +11 -0
- data/test/helpers/login_test_helper.rb +12 -1
- data/test/helpers/page_test_helper.rb +6 -0
- data/test/helpers/render_test_helper.rb +11 -8
- data/test/test_helper.rb +1 -12
- data/test/unit/file_not_found_page_test.rb +5 -1
- data/test/unit/local_time_test.rb +45 -0
- data/test/unit/page_context_test.rb +32 -1
- data/test/unit/page_test.rb +45 -11
- data/test/unit/radiant/config_test.rb +1 -1
- data/test/unit/response_cache_test.rb +27 -2
- data/test/unit/standard_tags_test.rb +60 -15
- data/vendor/extensions/archive/README +29 -0
- data/vendor/extensions/archive/Rakefile +25 -0
- data/{app → vendor/extensions/archive/app}/models/archive_day_index_page.rb +0 -0
- data/{app → vendor/extensions/archive/app}/models/archive_finder.rb +8 -6
- data/{app → vendor/extensions/archive/app}/models/archive_month_index_page.rb +0 -0
- data/{app → vendor/extensions/archive/app}/models/archive_page.rb +0 -0
- data/{app → vendor/extensions/archive/app}/models/archive_year_index_page.rb +0 -0
- data/vendor/extensions/archive/archive_extension.rb +19 -0
- data/{lib → vendor/extensions/archive/lib}/archive_index_tags_and_methods.rb +0 -0
- data/vendor/extensions/archive/lib/tasks/archive_extension_tasks.rake +28 -0
- data/vendor/extensions/archive/test/fixtures/pages.yml +397 -0
- data/vendor/extensions/archive/test/functional/archive_extension_test.rb +16 -0
- data/{test → vendor/extensions/archive/test}/helpers/archive_index_test_helper.rb +0 -0
- data/vendor/extensions/archive/test/test_helper.rb +19 -0
- data/{test → vendor/extensions/archive/test}/unit/archive_day_index_page_test.rb +0 -0
- data/{test → vendor/extensions/archive/test}/unit/archive_month_index_page_test.rb +0 -0
- data/{test → vendor/extensions/archive/test}/unit/archive_page_test.rb +7 -1
- data/{test → vendor/extensions/archive/test}/unit/archive_year_index_page_test.rb +0 -0
- data/vendor/rails/actionmailer/CHANGELOG +10 -0
- data/vendor/rails/actionmailer/Rakefile +1 -1
- data/vendor/rails/actionmailer/lib/action_mailer/version.rb +1 -1
- data/vendor/rails/actionpack/CHANGELOG +51 -2
- data/vendor/rails/actionpack/Rakefile +1 -1
- data/vendor/rails/actionpack/lib/action_controller/assertions/dom_assertions.rb +2 -2
- data/vendor/rails/actionpack/lib/action_controller/assertions/model_assertions.rb +1 -1
- data/vendor/rails/actionpack/lib/action_controller/assertions/response_assertions.rb +3 -0
- data/vendor/rails/actionpack/lib/action_controller/assertions/routing_assertions.rb +1 -0
- data/vendor/rails/actionpack/lib/action_controller/assertions/selector_assertions.rb +2 -0
- data/vendor/rails/actionpack/lib/action_controller/base.rb +7 -1
- data/vendor/rails/actionpack/lib/action_controller/caching.rb +39 -38
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/pstore_performance_fix.rb +30 -0
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb +1 -1
- data/vendor/rails/actionpack/lib/action_controller/cgi_process.rb +13 -4
- data/vendor/rails/actionpack/lib/action_controller/cookies.rb +5 -3
- data/vendor/rails/actionpack/lib/action_controller/filters.rb +176 -77
- data/vendor/rails/actionpack/lib/action_controller/integration.rb +31 -21
- data/vendor/rails/actionpack/lib/action_controller/macros/in_place_editing.rb +1 -1
- data/vendor/rails/actionpack/lib/action_controller/pagination.rb +7 -1
- data/vendor/rails/actionpack/lib/action_controller/resources.rb +117 -32
- data/vendor/rails/actionpack/lib/action_controller/routing.rb +56 -23
- data/vendor/rails/actionpack/lib/action_controller/test_process.rb +5 -2
- data/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb +4 -1
- data/vendor/rails/actionpack/lib/action_controller/verification.rb +1 -0
- data/vendor/rails/actionpack/lib/action_pack/version.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/base.rb +25 -19
- data/vendor/rails/actionpack/lib/action_view/compiled_templates.rb +2 -2
- data/vendor/rails/actionpack/lib/action_view/helpers/active_record_helper.rb +18 -18
- data/vendor/rails/actionpack/lib/action_view/helpers/debug_helper.rb +10 -0
- data/vendor/rails/actionpack/lib/action_view/helpers/deprecated_helper.rb +3 -0
- data/vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb +33 -17
- data/vendor/rails/actionpack/test/activerecord/pagination_test.rb +9 -0
- data/vendor/rails/actionpack/test/controller/action_pack_assertions_test.rb +13 -0
- data/vendor/rails/actionpack/test/controller/addresses_render_test.rb +4 -1
- data/vendor/rails/actionpack/test/controller/base_test.rb +1 -1
- data/vendor/rails/actionpack/test/controller/caching_test.rb +3 -2
- data/vendor/rails/actionpack/test/controller/cookie_test.rb +11 -0
- data/vendor/rails/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb +18 -0
- data/vendor/rails/actionpack/test/controller/filter_params_test.rb +1 -0
- data/vendor/rails/actionpack/test/controller/filters_test.rb +149 -26
- data/vendor/rails/actionpack/test/controller/integration_test.rb +93 -8
- data/vendor/rails/actionpack/test/controller/resources_test.rb +215 -36
- data/vendor/rails/actionpack/test/controller/routing_test.rb +2 -2
- data/vendor/rails/actionpack/test/controller/test_test.rb +16 -0
- data/vendor/rails/actionpack/test/controller/url_rewriter_test.rb +66 -10
- data/vendor/rails/actionpack/test/controller/verification_test.rb +15 -0
- data/vendor/rails/actionpack/test/fixtures/test/hello_world.rxml +2 -1
- data/vendor/rails/actionpack/test/template/asset_tag_helper_test.rb +5 -0
- data/vendor/rails/actionpack/test/template/compiled_templates_test.rb +29 -17
- data/vendor/rails/actionpack/test/template/javascript_helper_test.rb +4 -4
- data/vendor/rails/actionpack/test/template/number_helper_test.rb +1 -1
- data/vendor/rails/actionpack/test/template/prototype_helper_test.rb +13 -13
- data/vendor/rails/actionwebservice/CHANGELOG +14 -0
- data/vendor/rails/actionwebservice/Rakefile +2 -2
- data/vendor/rails/actionwebservice/lib/action_web_service/version.rb +1 -1
- data/vendor/rails/activerecord/CHANGELOG +34 -0
- data/vendor/rails/activerecord/Rakefile +1 -1
- data/vendor/rails/activerecord/lib/active_record/acts/list.rb +14 -2
- data/vendor/rails/activerecord/lib/active_record/acts/tree.rb +7 -0
- data/vendor/rails/activerecord/lib/active_record/associations.rb +29 -14
- data/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb +5 -1
- data/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb +2 -2
- data/vendor/rails/activerecord/lib/active_record/associations/has_many_through_association.rb +10 -0
- data/vendor/rails/activerecord/lib/active_record/base.rb +12 -3
- data/vendor/rails/activerecord/lib/active_record/calculations.rb +2 -2
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +1 -1
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb +1 -0
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +2 -2
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb +54 -38
- data/vendor/rails/activerecord/lib/active_record/deprecated_finders.rb +3 -3
- data/vendor/rails/activerecord/lib/active_record/fixtures.rb +1 -1
- data/vendor/rails/activerecord/lib/active_record/timestamp.rb +0 -9
- data/vendor/rails/activerecord/lib/active_record/version.rb +1 -1
- data/vendor/rails/activerecord/test/associations/eager_test.rb +13 -0
- data/vendor/rails/activerecord/test/associations/join_model_test.rb +10 -1
- data/vendor/rails/activerecord/test/associations_test.rb +36 -3
- data/vendor/rails/activerecord/test/base_test.rb +17 -4
- data/vendor/rails/activerecord/test/defaults_test.rb +15 -0
- data/vendor/rails/activerecord/test/fixtures/author.rb +1 -0
- data/vendor/rails/activerecord/test/fixtures/binaries.yml +437 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/schema.rb +13 -0
- data/vendor/rails/activerecord/test/fixtures/developer.rb +10 -0
- data/vendor/rails/activerecord/test/fixtures_test.rb +9 -5
- data/vendor/rails/activerecord/test/migration_test.rb +9 -10
- data/vendor/rails/activerecord/test/mixin_test.rb +47 -0
- data/vendor/rails/activerecord/test/validations_test.rb +2 -2
- data/vendor/rails/activesupport/CHANGELOG +16 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/blank.rb +9 -3
- data/vendor/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb +48 -3
- data/vendor/rails/activesupport/lib/active_support/core_ext/module/introspection.rb +14 -0
- data/vendor/rails/activesupport/lib/active_support/dependencies.rb +3 -3
- data/vendor/rails/activesupport/lib/active_support/json/encoders/core.rb +5 -3
- data/vendor/rails/activesupport/lib/active_support/multibyte/chars.rb +6 -6
- data/vendor/rails/activesupport/lib/active_support/version.rb +1 -1
- data/vendor/rails/activesupport/test/core_ext/hash_ext_test.rb +37 -0
- data/vendor/rails/activesupport/test/core_ext/module_test.rb +8 -0
- data/vendor/rails/activesupport/test/dependencies_test.rb +11 -0
- data/vendor/rails/activesupport/test/{json.rb → json_test.rb} +15 -5
- data/vendor/rails/railties/CHANGELOG +25 -1
- data/vendor/rails/railties/README +32 -3
- data/vendor/rails/railties/Rakefile +5 -5
- data/vendor/rails/railties/environments/boot.rb +12 -18
- data/vendor/rails/railties/environments/environment.rb +15 -15
- data/vendor/rails/railties/lib/dispatcher.rb +1 -2
- data/vendor/rails/railties/lib/initializer.rb +33 -9
- data/vendor/rails/railties/lib/rails/version.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/scaffold_resource_generator.rb +1 -0
- data/vendor/rails/railties/lib/railties_path.rb +1 -1
- data/vendor/rails/railties/lib/tasks/framework.rake +4 -4
- data/vendor/rails/railties/lib/tasks/routes.rake +17 -0
- data/vendor/rails/release.rb +2 -2
- metadata +1877 -1848
@@ -470,3 +470,40 @@ class HashToXmlTest < Test::Unit::TestCase
|
|
470
470
|
end
|
471
471
|
end
|
472
472
|
end
|
473
|
+
|
474
|
+
class QueryTest < Test::Unit::TestCase
|
475
|
+
def test_simple_conversion
|
476
|
+
assert_query_equal 'a=10', :a => 10
|
477
|
+
end
|
478
|
+
|
479
|
+
def test_cgi_escaping
|
480
|
+
assert_query_equal 'a%3Ab=c+d', 'a:b' => 'c d'
|
481
|
+
end
|
482
|
+
|
483
|
+
def test_nil_parameter_value
|
484
|
+
empty = Object.new
|
485
|
+
def empty.to_param; nil end
|
486
|
+
assert_query_equal 'a=', 'a' => empty
|
487
|
+
end
|
488
|
+
|
489
|
+
def test_nested_conversion
|
490
|
+
assert_query_equal 'person%5Bname%5D=Nicholas&person%5Blogin%5D=seckar',
|
491
|
+
:person => {:name => 'Nicholas', :login => 'seckar'}
|
492
|
+
end
|
493
|
+
|
494
|
+
def test_multiple_nested
|
495
|
+
assert_query_equal 'account%5Bperson%5D%5Bid%5D=20&person%5Bid%5D=10',
|
496
|
+
:person => {:id => 10}, :account => {:person => {:id => 20}}
|
497
|
+
end
|
498
|
+
|
499
|
+
def test_array_values
|
500
|
+
assert_query_equal 'person%5Bid%5D%5B%5D=10&person%5Bid%5D%5B%5D=20',
|
501
|
+
:person => {:id => [10, 20]}
|
502
|
+
end
|
503
|
+
|
504
|
+
private
|
505
|
+
def assert_query_equal(expected, actual, message = nil)
|
506
|
+
assert_equal expected.split('&').sort, actual.to_query.split('&').sort
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
@@ -1,10 +1,14 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../abstract_unit'
|
2
2
|
|
3
3
|
module One
|
4
|
+
Constant1 = "Hello World"
|
5
|
+
Constant2 = "What's up?"
|
4
6
|
end
|
5
7
|
|
6
8
|
class Ab
|
7
9
|
include One
|
10
|
+
Constant1 = "Hello World" # Will have different object id than One::Constant1
|
11
|
+
Constant3 = "Goodbye World"
|
8
12
|
end
|
9
13
|
|
10
14
|
module Xy
|
@@ -91,6 +95,10 @@ class ModuleTest < Test::Unit::TestCase
|
|
91
95
|
assert_equal [Yz::Zy, Yz, Object], Yz::Zy::Cd.parents
|
92
96
|
assert_equal [Yz, Object], Yz::Zy.parents
|
93
97
|
end
|
98
|
+
|
99
|
+
def test_local_constants
|
100
|
+
assert_equal %w(Constant1 Constant3), Ab.local_constants.sort
|
101
|
+
end
|
94
102
|
|
95
103
|
def test_as_load_path
|
96
104
|
assert_equal 'yz/zy', Yz::Zy.as_load_path
|
@@ -9,6 +9,10 @@ module ModuleWithMissing
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
+
module ModuleWithConstant
|
13
|
+
InheritedConstant = "Hello"
|
14
|
+
end
|
15
|
+
|
12
16
|
class DependenciesTest < Test::Unit::TestCase
|
13
17
|
def teardown
|
14
18
|
Dependencies.clear
|
@@ -574,6 +578,13 @@ class DependenciesTest < Test::Unit::TestCase
|
|
574
578
|
Object.send :remove_const, :M rescue nil
|
575
579
|
end
|
576
580
|
|
581
|
+
def test_new_constants_in_with_inherited_constants
|
582
|
+
m = Dependencies.new_constants_in(:Object) do
|
583
|
+
Object.send :include, ModuleWithConstant
|
584
|
+
end
|
585
|
+
assert_equal [], m
|
586
|
+
end
|
587
|
+
|
577
588
|
def test_file_with_multiple_constants_and_require_dependency
|
578
589
|
with_loading 'autoloading_fixtures' do
|
579
590
|
assert ! defined?(MultipleConstantFile)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/abstract_unit'
|
2
2
|
|
3
|
-
class
|
3
|
+
class JsonFoo
|
4
4
|
def initialize(a, b)
|
5
5
|
@a, @b = a, b
|
6
6
|
end
|
@@ -14,7 +14,7 @@ class TestJSONEmitters < Test::Unit::TestCase
|
|
14
14
|
[ 2.5, %(2.5) ]]
|
15
15
|
|
16
16
|
StringTests = [[ 'this is the string', %("this is the string") ],
|
17
|
-
[ 'a "string" with quotes', %("a \\"string\\" with quotes") ]]
|
17
|
+
[ 'a "string" with quotes<script>', %("a \\"string\\" with quotes\\074script\\076") ]]
|
18
18
|
|
19
19
|
ArrayTests = [[ ['a', 'b', 'c'], %([\"a\", \"b\", \"c\"]) ],
|
20
20
|
[ [1, 'a', :b, nil, false], %([1, \"a\", \"b\", null, false]) ]]
|
@@ -23,7 +23,7 @@ class TestJSONEmitters < Test::Unit::TestCase
|
|
23
23
|
[ :this, %("this") ],
|
24
24
|
[ :"a b", %("a b") ]]
|
25
25
|
|
26
|
-
ObjectTests = [[
|
26
|
+
ObjectTests = [[ JsonFoo.new(1, 2), %({\"a\": 1, \"b\": 2}) ]]
|
27
27
|
|
28
28
|
VariableTests = [[ ActiveSupport::JSON::Variable.new('foo'), 'foo'],
|
29
29
|
[ ActiveSupport::JSON::Variable.new('alert("foo")'), 'alert("foo")']]
|
@@ -71,8 +71,18 @@ class TestJSONEmitters < Test::Unit::TestCase
|
|
71
71
|
|
72
72
|
def test_unquote_hash_key_identifiers
|
73
73
|
values = {0 => 0, 1 => 1, :_ => :_, "$" => "$", "a" => "a", :A => :A, :A0 => :A0, "A0B" => "A0B"}
|
74
|
-
|
75
|
-
|
74
|
+
|
75
|
+
assert_equal %({"a": "a"}), {"a"=>"a"}.to_json
|
76
|
+
assert_equal %({0: 0}), { 0 => 0 }.to_json
|
77
|
+
assert_equal %({"_": "_"}), {:_ =>:_ }.to_json
|
78
|
+
assert_equal %({"$": "$"}), {"$"=>"$"}.to_json
|
79
|
+
|
80
|
+
unquote(true) do
|
81
|
+
assert_equal %({a: "a"}), {"a"=>"a"}.to_json
|
82
|
+
assert_equal %({0: 0}), { 0 => 0 }.to_json
|
83
|
+
assert_equal %({_: "_"}), {:_ =>:_ }.to_json
|
84
|
+
assert_equal %({$: "$"}), {"$"=>"$"}.to_json
|
85
|
+
end
|
76
86
|
end
|
77
87
|
|
78
88
|
protected
|
@@ -1,6 +1,30 @@
|
|
1
|
+
*1.2.5* (October 12th, 2007)
|
2
|
+
|
3
|
+
* Correct RAILS_GEM_VERSION regexp. Use =version gem requirement instead of ~>version so you don't get surprised by a beta gem in production. This change means upgrading to 1.2.5 will require a boot.rb upgrade. [Jeremy Kemper]
|
4
|
+
|
5
|
+
* Move custom inflections example so available before route generation. #6829 [dcmanges, Nate, piotrb]
|
6
|
+
|
7
|
+
|
8
|
+
*1.2.4* (October 4th, 2007)
|
9
|
+
|
10
|
+
* Add a new rake task to aid debugging of named routes.
|
11
|
+
|
12
|
+
rake routes
|
13
|
+
|
14
|
+
* use Gem.find_name instead of search when freezing gems. Prevent false positives for other gems with rails in the name. Closes #8729 [wselman]
|
15
|
+
|
16
|
+
* Fix syntax error in dispatcher than wrecked failsafe responses. #8625 [mtitorenko]
|
17
|
+
|
18
|
+
* Add Active Resource to rails:freeze:edge and drop Action Web Service. #8205 [underbluewaters, Jeremy Kemper]
|
19
|
+
|
20
|
+
* Give generate scaffold a more descriptive database message. Closes #7316 [jeremymcanally]
|
21
|
+
|
22
|
+
* Canonicalize RAILS_ROOT by using File.expand_path on Windows, which doesn't have to worry about symlinks, and Pathname#realpath elsewhere, which respects symlinks in relative paths but is incompatible with Windows. #6755 [Jeremy Kemper, trevor]
|
23
|
+
|
24
|
+
|
1
25
|
*1.2.3* (March 12th, 2007)
|
2
26
|
|
3
|
-
* Ruby 1.8.6 compatibility
|
27
|
+
* Ruby 1.8.6 compatibility fixes. Upgrade rake dependency to 0.7.2.
|
4
28
|
|
5
29
|
* Windows: include MinGW in RUBY_PLATFORM check. #2982 [okkez000@gmail.com, Kaspar Schiess]
|
6
30
|
|
@@ -64,9 +64,38 @@ please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI
|
|
64
64
|
|
65
65
|
== Debugging Rails
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
68
|
+
will help you debug it and get it back on the rails.
|
69
|
+
|
70
|
+
First area to check is the application log files. Have "tail -f" commands running
|
71
|
+
on the server.log and development.log. Rails will automatically display debugging
|
72
|
+
and runtime information to these files. Debugging info will also be shown in the
|
73
|
+
browser on requests from 127.0.0.1.
|
74
|
+
|
75
|
+
You can also log your own messages directly into the log file from your code using
|
76
|
+
the Ruby logger class from inside your controllers. Example:
|
77
|
+
|
78
|
+
class WeblogController < ActionController::Base
|
79
|
+
def destroy
|
80
|
+
@weblog = Weblog.find(params[:id])
|
81
|
+
@weblog.destroy
|
82
|
+
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
The result will be a message in your log file along the lines of:
|
87
|
+
|
88
|
+
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
|
89
|
+
|
90
|
+
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
91
|
+
|
92
|
+
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
|
93
|
+
|
94
|
+
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
|
95
|
+
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
96
|
+
|
97
|
+
These two online (and free) books will bring you up to speed on the Ruby language
|
98
|
+
and also on programming in general.
|
70
99
|
|
71
100
|
|
72
101
|
== Breakpoints
|
@@ -288,11 +288,11 @@ spec = Gem::Specification.new do |s|
|
|
288
288
|
EOF
|
289
289
|
|
290
290
|
s.add_dependency('rake', '>= 0.7.2')
|
291
|
-
s.add_dependency('activesupport', '= 1.4.
|
292
|
-
s.add_dependency('activerecord', '= 1.15.
|
293
|
-
s.add_dependency('actionpack', '= 1.13.
|
294
|
-
s.add_dependency('actionmailer', '= 1.3.
|
295
|
-
s.add_dependency('actionwebservice', '= 1.2.
|
291
|
+
s.add_dependency('activesupport', '= 1.4.4' + PKG_BUILD)
|
292
|
+
s.add_dependency('activerecord', '= 1.15.5' + PKG_BUILD)
|
293
|
+
s.add_dependency('actionpack', '= 1.13.5' + PKG_BUILD)
|
294
|
+
s.add_dependency('actionmailer', '= 1.3.5' + PKG_BUILD)
|
295
|
+
s.add_dependency('actionwebservice', '= 1.2.5' + PKG_BUILD)
|
296
296
|
|
297
297
|
s.rdoc_options << '--exclude' << '.'
|
298
298
|
s.has_rdoc = false
|
@@ -1,15 +1,6 @@
|
|
1
1
|
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
|
2
2
|
|
3
|
-
unless defined?(RAILS_ROOT)
|
4
|
-
root_path = File.join(File.dirname(__FILE__), '..')
|
5
|
-
|
6
|
-
unless RUBY_PLATFORM =~ /(:?mswin|mingw)/
|
7
|
-
require 'pathname'
|
8
|
-
root_path = Pathname.new(root_path).cleanpath(true).to_s
|
9
|
-
end
|
10
|
-
|
11
|
-
RAILS_ROOT = root_path
|
12
|
-
end
|
3
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
13
4
|
|
14
5
|
unless defined?(Rails::Initializer)
|
15
6
|
if File.directory?("#{RAILS_ROOT}/vendor/rails")
|
@@ -17,20 +8,23 @@ unless defined?(Rails::Initializer)
|
|
17
8
|
else
|
18
9
|
require 'rubygems'
|
19
10
|
|
20
|
-
|
21
|
-
|
22
|
-
|
11
|
+
rails_gem_version =
|
12
|
+
if defined? RAILS_GEM_VERSION
|
13
|
+
RAILS_GEM_VERSION
|
14
|
+
else
|
15
|
+
File.read("#{File.dirname(__FILE__)}/environment.rb") =~ /^[^#]*RAILS_GEM_VERSION\s+=\s+'([\d.]+)'/
|
16
|
+
$1
|
17
|
+
end
|
23
18
|
|
24
|
-
if
|
25
|
-
|
26
|
-
rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last
|
19
|
+
if rails_gem_version
|
20
|
+
rails_gem = Gem.cache.search('rails', "=#{rails_gem_version}.0").sort_by { |g| g.version.version }.last
|
27
21
|
|
28
22
|
if rails_gem
|
29
23
|
gem "rails", "=#{rails_gem.version.version}"
|
30
24
|
require rails_gem.full_gem_path + '/lib/initializer'
|
31
25
|
else
|
32
|
-
STDERR.puts %(Cannot find gem for Rails
|
33
|
-
Install the missing gem with 'gem install -v=#{
|
26
|
+
STDERR.puts %(Cannot find gem for Rails =#{rails_gem_version}.0:
|
27
|
+
Install the missing gem with 'gem install -v=#{rails_gem_version} rails', or
|
34
28
|
change environment.rb to define RAILS_GEM_VERSION with your desired version.
|
35
29
|
)
|
36
30
|
exit 1
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Be sure to restart your web server when you modify this file.
|
2
2
|
|
3
|
-
# Uncomment below to force Rails into production mode when
|
3
|
+
# Uncomment below to force Rails into production mode when
|
4
4
|
# you don't control web/app server and can't set it the proper way
|
5
5
|
# ENV['RAILS_ENV'] ||= 'production'
|
6
6
|
|
@@ -12,7 +12,7 @@ require File.join(File.dirname(__FILE__), 'boot')
|
|
12
12
|
|
13
13
|
Rails::Initializer.run do |config|
|
14
14
|
# Settings in config/environments/* take precedence over those specified here
|
15
|
-
|
15
|
+
|
16
16
|
# Skip frameworks you're not going to use (only works if using vendor/rails)
|
17
17
|
# config.frameworks -= [ :action_web_service, :action_mailer ]
|
18
18
|
|
@@ -22,7 +22,7 @@ Rails::Initializer.run do |config|
|
|
22
22
|
# Add additional load paths for your own custom dirs
|
23
23
|
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
24
24
|
|
25
|
-
# Force all environments to use the same logger level
|
25
|
+
# Force all environments to use the same logger level
|
26
26
|
# (by default production uses :info, the others :debug)
|
27
27
|
# config.log_level = :debug
|
28
28
|
|
@@ -31,7 +31,7 @@ Rails::Initializer.run do |config|
|
|
31
31
|
# config.action_controller.session_store = :active_record_store
|
32
32
|
|
33
33
|
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
34
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
34
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
35
35
|
# like if you have constraints or database-specific column types
|
36
36
|
# config.active_record.schema_format = :sql
|
37
37
|
|
@@ -40,21 +40,21 @@ Rails::Initializer.run do |config|
|
|
40
40
|
|
41
41
|
# Make Active Record use UTC-base instead of local time
|
42
42
|
# config.active_record.default_timezone = :utc
|
43
|
-
|
43
|
+
|
44
|
+
# Add new inflection rules using the following format
|
45
|
+
# (all these examples are active by default):
|
46
|
+
# Inflector.inflections do |inflect|
|
47
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
48
|
+
# inflect.singular /^(ox)en/i, '\1'
|
49
|
+
# inflect.irregular 'person', 'people'
|
50
|
+
# inflect.uncountable %w( fish sheep )
|
51
|
+
# end
|
52
|
+
|
44
53
|
# See Rails::Configuration for more options
|
45
54
|
end
|
46
55
|
|
47
|
-
# Add new inflection rules using the following format
|
48
|
-
# (all these examples are active by default):
|
49
|
-
# Inflector.inflections do |inflect|
|
50
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
51
|
-
# inflect.singular /^(ox)en/i, '\1'
|
52
|
-
# inflect.irregular 'person', 'people'
|
53
|
-
# inflect.uncountable %w( fish sheep )
|
54
|
-
# end
|
55
|
-
|
56
56
|
# Add new mime types for use in respond_to blocks:
|
57
57
|
# Mime::Type.register "text/richtext", :rtf
|
58
58
|
# Mime::Type.register "application/x-mobile", :mobile
|
59
59
|
|
60
|
-
# Include your application configuration below
|
60
|
+
# Include your application configuration below
|
@@ -42,8 +42,7 @@ class Dispatcher
|
|
42
42
|
end
|
43
43
|
rescue Exception => exception # errors from CGI dispatch
|
44
44
|
failsafe_response(output, '500 Internal Server Error', exception) do
|
45
|
-
controller ||= ApplicationController rescue
|
46
|
-
controller ||= ActionController::Base
|
45
|
+
controller ||= (ApplicationController rescue ActionController::Base)
|
47
46
|
controller.process_with_exception(request, response, exception).out(output)
|
48
47
|
end
|
49
48
|
ensure
|
@@ -1,7 +1,11 @@
|
|
1
1
|
require 'logger'
|
2
2
|
require 'set'
|
3
|
-
require
|
4
|
-
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
6
|
+
require 'railties_path'
|
7
|
+
require 'rails/version'
|
8
|
+
|
5
9
|
|
6
10
|
RAILS_ENV = (ENV['RAILS_ENV'] || 'development').dup unless defined?(RAILS_ENV)
|
7
11
|
|
@@ -191,7 +195,7 @@ module Rails
|
|
191
195
|
raise(LoadError, "Cannot find the plugin '#{name}'!") if path.nil?
|
192
196
|
load_plugin path
|
193
197
|
end
|
194
|
-
end
|
198
|
+
end
|
195
199
|
$LOAD_PATH.uniq!
|
196
200
|
end
|
197
201
|
|
@@ -201,7 +205,9 @@ module Rails
|
|
201
205
|
silence_warnings do
|
202
206
|
config = configuration
|
203
207
|
constants = self.class.constants
|
208
|
+
|
204
209
|
eval(IO.read(configuration.environment_path), binding, configuration.environment_path)
|
210
|
+
|
205
211
|
(self.class.constants - constants).each do |const|
|
206
212
|
Object.const_set(const, self.class.const_get(const))
|
207
213
|
end
|
@@ -307,10 +313,10 @@ module Rails
|
|
307
313
|
|
308
314
|
def initialize_temporary_directories
|
309
315
|
if configuration.frameworks.include?(:action_controller)
|
310
|
-
session_path = "#{
|
316
|
+
session_path = "#{configuration.root_path}/tmp/sessions/"
|
311
317
|
ActionController::Base.session_options[:tmpdir] = File.exist?(session_path) ? session_path : Dir::tmpdir
|
312
318
|
|
313
|
-
cache_path = "#{
|
319
|
+
cache_path = "#{configuration.root_path}/tmp/cache/"
|
314
320
|
if File.exist?(cache_path)
|
315
321
|
ActionController::Base.fragment_cache_store = :file_store, cache_path
|
316
322
|
end
|
@@ -414,6 +420,9 @@ module Rails
|
|
414
420
|
# config = Rails::Configuration.new
|
415
421
|
# Rails::Initializer.run(:process, config)
|
416
422
|
class Configuration
|
423
|
+
# The application's base directory.
|
424
|
+
attr_reader :root_path
|
425
|
+
|
417
426
|
# A stub for setting options on ActionController::Base
|
418
427
|
attr_accessor :action_controller
|
419
428
|
|
@@ -497,6 +506,8 @@ module Rails
|
|
497
506
|
# Create a new Configuration instance, initialized with the default
|
498
507
|
# values.
|
499
508
|
def initialize
|
509
|
+
set_root_path!
|
510
|
+
|
500
511
|
self.frameworks = default_frameworks
|
501
512
|
self.load_paths = default_load_paths
|
502
513
|
self.load_once_paths = default_load_once_paths
|
@@ -516,6 +527,23 @@ module Rails
|
|
516
527
|
end
|
517
528
|
end
|
518
529
|
|
530
|
+
# Set the root_path to RAILS_ROOT and canonicalize it.
|
531
|
+
def set_root_path!
|
532
|
+
raise 'RAILS_ROOT is not set' unless defined?(::RAILS_ROOT)
|
533
|
+
raise 'RAILS_ROOT is not a directory' unless File.directory?(::RAILS_ROOT)
|
534
|
+
|
535
|
+
@root_path =
|
536
|
+
# Pathname is incompatible with Windows, but Windows doesn't have
|
537
|
+
# real symlinks so File.expand_path is safe.
|
538
|
+
if RUBY_PLATFORM =~ /(:?mswin|mingw)/
|
539
|
+
File.expand_path(::RAILS_ROOT)
|
540
|
+
|
541
|
+
# Otherwise use Pathname#realpath which respects symlinks.
|
542
|
+
else
|
543
|
+
Pathname.new(::RAILS_ROOT).realpath.to_s
|
544
|
+
end
|
545
|
+
end
|
546
|
+
|
519
547
|
# Loads and returns the contents of the #database_configuration_file. The
|
520
548
|
# contents of the file are processed via ERB before being sent through
|
521
549
|
# YAML::load.
|
@@ -575,10 +603,6 @@ module Rails
|
|
575
603
|
end
|
576
604
|
|
577
605
|
private
|
578
|
-
def root_path
|
579
|
-
::RAILS_ROOT
|
580
|
-
end
|
581
|
-
|
582
606
|
def framework_root_path
|
583
607
|
defined?(::RAILS_FRAMEWORK_ROOT) ? ::RAILS_FRAMEWORK_ROOT : "#{root_path}/vendor/rails"
|
584
608
|
end
|