has_many_polymorphs 2.10 → 2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +2 -0
  3. data/Manifest +191 -56
  4. data/TODO +1 -0
  5. data/examples/hmph.rb +69 -0
  6. data/generators/commenting/commenting_generator.rb +94 -0
  7. data/generators/commenting/templates/comment.rb +33 -0
  8. data/generators/commenting/templates/comment_test.rb +12 -0
  9. data/generators/commenting/templates/commenting.rb +13 -0
  10. data/generators/commenting/templates/commenting_extensions.rb +30 -0
  11. data/generators/commenting/templates/commenting_test.rb +30 -0
  12. data/generators/commenting/templates/commentings.yml +23 -0
  13. data/generators/commenting/templates/comments.yml +13 -0
  14. data/generators/commenting/templates/migration.rb +28 -0
  15. data/generators/tagging/templates/tagging_extensions.rb +4 -8
  16. data/has_many_polymorphs.gemspec +19 -12
  17. data/lib/has_many_polymorphs.rb +3 -4
  18. data/lib/has_many_polymorphs/autoload.rb +4 -4
  19. data/lib/has_many_polymorphs/class_methods.rb +8 -8
  20. data/lib/has_many_polymorphs/debugging_tools.rb +2 -0
  21. data/lib/has_many_polymorphs/dependencies.rb +9 -4
  22. data/lib/has_many_polymorphs/support_methods.rb +3 -1
  23. data/test/fixtures/{aquatic/fish.yml → fish.yml} +0 -0
  24. data/test/fixtures/{aquatic/little_whale_pupils.yml → little_whale_pupils.yml} +0 -0
  25. data/test/fixtures/{aquatic/whales.yml → whales.yml} +0 -0
  26. data/test/integration/app/README +182 -0
  27. data/test/integration/app/Rakefile +19 -0
  28. data/test/integration/app/app/controllers/addresses_controller.rb +85 -0
  29. data/test/integration/app/app/controllers/application.rb +7 -0
  30. data/test/integration/app/app/controllers/sellers_controller.rb +85 -0
  31. data/test/integration/app/app/controllers/states_controller.rb +85 -0
  32. data/test/integration/app/app/controllers/users_controller.rb +85 -0
  33. data/test/integration/app/app/helpers/addresses_helper.rb +2 -0
  34. data/test/integration/app/app/helpers/application_helper.rb +3 -0
  35. data/test/integration/app/app/helpers/sellers_helper.rb +28 -0
  36. data/test/integration/app/app/helpers/states_helper.rb +2 -0
  37. data/test/integration/app/app/helpers/users_helper.rb +2 -0
  38. data/test/integration/app/app/models/address.rb +4 -0
  39. data/test/integration/app/app/models/citation.rb +3 -0
  40. data/test/integration/app/app/models/citations_item.rb +4 -0
  41. data/test/integration/app/app/models/seller.rb +4 -0
  42. data/test/integration/app/app/models/state.rb +3 -0
  43. data/test/integration/app/app/models/user.rb +4 -0
  44. data/test/integration/app/app/views/addresses/edit.html.erb +12 -0
  45. data/test/integration/app/app/views/addresses/index.html.erb +18 -0
  46. data/test/integration/app/app/views/addresses/new.html.erb +11 -0
  47. data/test/integration/app/app/views/addresses/show.html.erb +3 -0
  48. data/test/integration/app/app/views/layouts/addresses.html.erb +17 -0
  49. data/test/integration/app/app/views/layouts/sellers.html.erb +17 -0
  50. data/test/integration/app/app/views/layouts/states.html.erb +17 -0
  51. data/test/integration/app/app/views/layouts/users.html.erb +17 -0
  52. data/test/integration/app/app/views/sellers/edit.html.erb +12 -0
  53. data/test/integration/app/app/views/sellers/index.html.erb +20 -0
  54. data/test/integration/app/app/views/sellers/new.html.erb +11 -0
  55. data/test/integration/app/app/views/sellers/show.html.erb +3 -0
  56. data/test/integration/app/app/views/states/edit.html.erb +12 -0
  57. data/test/integration/app/app/views/states/index.html.erb +19 -0
  58. data/test/integration/app/app/views/states/new.html.erb +11 -0
  59. data/test/integration/app/app/views/states/show.html.erb +3 -0
  60. data/test/integration/app/app/views/users/edit.html.erb +12 -0
  61. data/test/integration/app/app/views/users/index.html.erb +22 -0
  62. data/test/integration/app/app/views/users/new.html.erb +11 -0
  63. data/test/integration/app/app/views/users/show.html.erb +3 -0
  64. data/test/integration/app/config/boot.rb +45 -0
  65. data/test/integration/app/config/database.yml +21 -0
  66. data/test/integration/app/config/environment.rb +13 -0
  67. data/test/integration/app/config/environments/development.rb +7 -0
  68. data/test/integration/app/config/environments/production.rb +18 -0
  69. data/test/integration/app/config/environments/test.rb +19 -0
  70. data/test/integration/app/config/locomotive.yml +6 -0
  71. data/test/integration/app/config/routes.rb +33 -0
  72. data/test/integration/app/config/ultrasphinx/default.base +56 -0
  73. data/test/integration/app/config/ultrasphinx/development.conf.canonical +155 -0
  74. data/test/integration/app/db/migrate/001_create_users.rb +16 -0
  75. data/test/integration/app/db/migrate/002_create_sellers.rb +14 -0
  76. data/test/integration/app/db/migrate/003_create_addresses.rb +19 -0
  77. data/test/integration/app/db/migrate/004_create_states.rb +12 -0
  78. data/test/integration/app/db/migrate/005_add_capitalization_to_seller.rb +9 -0
  79. data/test/integration/app/db/migrate/006_add_deleted_to_user.rb +9 -0
  80. data/test/integration/app/db/migrate/007_add_lat_and_long_to_address.rb +11 -0
  81. data/test/integration/app/db/migrate/008_create_citations.rb +12 -0
  82. data/test/integration/app/db/migrate/009_create_citations_items.rb +14 -0
  83. data/test/integration/app/db/schema.rb +144 -0
  84. data/test/integration/app/doc/README_FOR_APP +2 -0
  85. data/test/integration/app/generated_models/aquatic_fish.rb +109 -0
  86. data/test/integration/app/generated_models/aquatic_pupils_whale.rb +13 -0
  87. data/test/integration/app/generated_models/aquatic_whale.rb +42 -0
  88. data/test/integration/app/generated_models/beautiful_fight_relationship.rb +25 -0
  89. data/test/integration/app/generated_models/citation.rb +40 -0
  90. data/test/integration/app/generated_models/citations_item.rb +12 -0
  91. data/test/integration/app/generated_models/dog.rb +183 -0
  92. data/test/integration/app/generated_models/eaters_foodstuff.rb +13 -0
  93. data/test/integration/app/generated_models/frog.rb +78 -0
  94. data/test/integration/app/generated_models/kitten.rb +161 -0
  95. data/test/integration/app/generated_models/parentship.rb +14 -0
  96. data/test/integration/app/generated_models/person.rb +53 -0
  97. data/test/integration/app/generated_models/petfood.rb +125 -0
  98. data/test/integration/app/generated_models/polymorph_test_some_model.rb +25 -0
  99. data/test/integration/app/generated_models/seller.rb +30 -0
  100. data/test/integration/app/generated_models/tabby.rb +26 -0
  101. data/test/integration/app/generated_models/user.rb +34 -0
  102. data/test/integration/app/generated_models/wild_boar.rb +87 -0
  103. data/test/integration/app/generators/commenting_generator_test.rb +83 -0
  104. data/test/integration/app/public/404.html +30 -0
  105. data/test/integration/app/public/500.html +30 -0
  106. data/test/integration/app/public/dispatch.cgi +10 -0
  107. data/test/integration/app/public/dispatch.fcgi +24 -0
  108. data/test/integration/app/public/dispatch.rb +10 -0
  109. data/test/integration/app/public/favicon.ico +0 -0
  110. data/test/integration/app/public/images/rails.png +0 -0
  111. data/test/integration/app/public/index.html +277 -0
  112. data/test/integration/app/public/javascripts/application.js +2 -0
  113. data/test/integration/app/public/javascripts/controls.js +833 -0
  114. data/test/integration/app/public/javascripts/dragdrop.js +942 -0
  115. data/test/integration/app/public/javascripts/effects.js +1088 -0
  116. data/test/integration/app/public/javascripts/prototype.js +2515 -0
  117. data/test/integration/app/public/robots.txt +1 -0
  118. data/test/integration/app/public/stylesheets/scaffold.css +74 -0
  119. data/test/integration/app/script/about +3 -0
  120. data/test/integration/app/script/breakpointer +3 -0
  121. data/test/integration/app/script/console +3 -0
  122. data/test/integration/app/script/destroy +3 -0
  123. data/test/integration/app/script/generate +3 -0
  124. data/test/integration/app/script/performance/benchmarker +3 -0
  125. data/test/integration/app/script/performance/profiler +3 -0
  126. data/test/integration/app/script/plugin +3 -0
  127. data/test/integration/app/script/process/inspector +3 -0
  128. data/test/integration/app/script/process/reaper +3 -0
  129. data/test/integration/app/script/process/spawner +3 -0
  130. data/test/integration/app/script/runner +3 -0
  131. data/test/integration/app/script/server +3 -0
  132. data/test/integration/app/test/fixtures/addresses.yml +13 -0
  133. data/test/integration/app/test/fixtures/citations.yml +9 -0
  134. data/test/integration/app/test/fixtures/citations_items.yml +9 -0
  135. data/test/integration/app/test/fixtures/sellers.yml +10 -0
  136. data/test/integration/app/test/fixtures/states.yml +216 -0
  137. data/test/integration/app/test/fixtures/users.yml +11 -0
  138. data/test/integration/app/test/functional/addresses_controller_test.rb +57 -0
  139. data/test/integration/app/test/functional/sellers_controller_test.rb +57 -0
  140. data/test/integration/app/test/functional/states_controller_test.rb +57 -0
  141. data/test/integration/app/test/functional/users_controller_test.rb +57 -0
  142. data/test/integration/app/test/test_helper.rb +28 -0
  143. data/test/integration/app/test/unit/address_test.rb +10 -0
  144. data/test/integration/app/test/unit/citation_test.rb +10 -0
  145. data/test/integration/app/test/unit/citations_item_test.rb +10 -0
  146. data/test/integration/app/test/unit/seller_test.rb +10 -0
  147. data/test/integration/app/test/unit/state_test.rb +10 -0
  148. data/test/integration/app/test/unit/user_test.rb +10 -0
  149. data/test/models/aquatic/fish.rb +2 -1
  150. data/test/models/aquatic/whale.rb +2 -0
  151. data/test/setup.rb +10 -0
  152. data/test/test_all.rb +16 -0
  153. data/test/test_helper.rb +16 -12
  154. data/test/unit/polymorph_test.rb +35 -34
  155. metadata +239 -98
  156. metadata.gz.sig +0 -0
@@ -0,0 +1,30 @@
1
+
2
+ class Seller
3
+
4
+ belongs_to ,
5
+ use
6
+ # called from line 57
7
+
8
+ has_many :citations_items,
9
+ :extend => [],
10
+ :dependent => :destroy,
11
+ :conditions => nil,
12
+ :as => :item,
13
+ :class_name => "CitationsItem",
14
+ :order => nil
15
+ # called from line 57
16
+
17
+ has_many :citations,
18
+ :source => :citation,
19
+ :extend => [],
20
+ :foreign_key => "citation_id",
21
+ :limit => nil,
22
+ :through => :citations_items,
23
+ :group => nil,
24
+ :conditions => nil,
25
+ :offset => nil,
26
+ :class_name => "Citation",
27
+ :order => nil
28
+ # called from line 57
29
+
30
+ end
@@ -0,0 +1,26 @@
1
+
2
+ class Tabby
3
+
4
+ has_many :eaters_foodstuffs,
5
+ :extend => [Petfood::PetfoodEaterPolymorphicJoinAssociationExtension0],
6
+ :dependent => :destroy,
7
+ :conditions => "NULL IS NULL OR NULL != 'Snausages'",
8
+ :as => :eater,
9
+ :class_name => "EatersFoodstuff",
10
+ :order => "NULL DESC"
11
+ # called from line 57
12
+
13
+ has_many :foodstuffs_of_eaters,
14
+ :source => :foodstuff,
15
+ :extend => [Petfood::PetfoodEaterPolymorphicParentAssociationExtension0],
16
+ :foreign_key => "foodstuff_id",
17
+ :limit => nil,
18
+ :through => :eaters_foodstuffs,
19
+ :group => nil,
20
+ :conditions => "petfoods.name IS NULL OR petfoods.name != 'Snausages'",
21
+ :offset => nil,
22
+ :class_name => "Petfood",
23
+ :order => "petfoods.the_petfood_primary_key DESC"
24
+ # called from line 57
25
+
26
+ end
@@ -0,0 +1,34 @@
1
+
2
+ class User
3
+
4
+ has_one ,
5
+ selle
6
+ # called from line 57
7
+
8
+ has_one ,
9
+ addres
10
+ # called from line 57
11
+
12
+ has_many :citations_items,
13
+ :extend => [],
14
+ :dependent => :destroy,
15
+ :conditions => nil,
16
+ :as => :item,
17
+ :class_name => "CitationsItem",
18
+ :order => nil
19
+ # called from line 57
20
+
21
+ has_many :citations,
22
+ :source => :citation,
23
+ :extend => [],
24
+ :foreign_key => "citation_id",
25
+ :limit => nil,
26
+ :through => :citations_items,
27
+ :group => nil,
28
+ :conditions => nil,
29
+ :offset => nil,
30
+ :class_name => "Citation",
31
+ :order => nil
32
+ # called from line 57
33
+
34
+ end
@@ -0,0 +1,87 @@
1
+
2
+ class WildBoar
3
+
4
+ has_many_polymorphs :enemies,
5
+ :singular_reverse_association_id => :protector,
6
+ :extend => [ExtensionModule, #<Proc:0x00000000@/Users/eweaver/Desktop/projects/fauna/has_many_polymorphs/trunk/test/models/beautiful_fight_relationship.rb:14>],
7
+ :foreign_key => "protector_id",
8
+ :is_double => true,
9
+ :from => [:dogs,
10
+ :kittens,
11
+ :frogs],
12
+ :through => :beautiful_fight_relationships,
13
+ :foreign_type_key => "protector_type",
14
+ :join_extend => [#<Proc:0x03be672c@/Users/eweaver/Desktop/projects/fauna/has_many_polymorphs/trunk/test/models/beautiful_fight_relationship.rb:20>],
15
+ :conflicts => [:dogs,
16
+ :kittens],
17
+ :as => :protector
18
+ # called from line 57
19
+
20
+ has_many :beautiful_fight_relationships_as_protector,
21
+ :extend => [WildBoar::WildBoarEnemyPolymorphicJoinAssociationExtension0],
22
+ :dependent => :destroy,
23
+ :foreign_key => "protector_id",
24
+ :conditions => "protector_type = 'WildBoar'",
25
+ :as => :protector,
26
+ :class_name => "BeautifulFightRelationship"
27
+ # called from line 57
28
+
29
+ has_many :frogs,
30
+ :source => :enemy,
31
+ :extend => [WildBoar::WildBoarFrogPolymorphicChildAssociationExtension, ExtensionModule, WildBoar::WildBoarEnemyPolymorphicAssociationExtension0],
32
+ :limit => nil,
33
+ :through => :beautiful_fight_relationships_as_protector,
34
+ :group => nil,
35
+ :conditions => nil,
36
+ :source_type => "Frog",
37
+ :class_name => "Frog",
38
+ :order => nil
39
+ # called from line 57
40
+
41
+ has_many :kittens,
42
+ :source => :enemy,
43
+ :extend => [WildBoar::WildBoarKittenPolymorphicChildAssociationExtension, ExtensionModule, WildBoar::WildBoarEnemyPolymorphicAssociationExtension0],
44
+ :limit => nil,
45
+ :through => :beautiful_fight_relationships_as_protector,
46
+ :group => nil,
47
+ :conditions => nil,
48
+ :source_type => "Cat",
49
+ :class_name => "Kitten",
50
+ :order => nil
51
+ # called from line 57
52
+
53
+ has_many :dogs,
54
+ :source => :enemy,
55
+ :extend => [WildBoar::WildBoarDogPolymorphicChildAssociationExtension, ExtensionModule, WildBoar::WildBoarEnemyPolymorphicAssociationExtension0],
56
+ :limit => nil,
57
+ :through => :beautiful_fight_relationships_as_protector,
58
+ :group => nil,
59
+ :conditions => nil,
60
+ :source_type => "Dog",
61
+ :class_name => "Dog",
62
+ :order => nil
63
+ # called from line 57
64
+
65
+ has_many :eaters_foodstuffs,
66
+ :extend => [Petfood::PetfoodEaterPolymorphicJoinAssociationExtension0],
67
+ :dependent => :destroy,
68
+ :conditions => "NULL IS NULL OR NULL != 'Snausages'",
69
+ :as => :eater,
70
+ :class_name => "EatersFoodstuff",
71
+ :order => "NULL DESC"
72
+ # called from line 57
73
+
74
+ has_many :foodstuffs_of_eaters,
75
+ :source => :foodstuff,
76
+ :extend => [Petfood::PetfoodEaterPolymorphicParentAssociationExtension0],
77
+ :foreign_key => "foodstuff_id",
78
+ :limit => nil,
79
+ :through => :eaters_foodstuffs,
80
+ :group => nil,
81
+ :conditions => "petfoods.name IS NULL OR petfoods.name != 'Snausages'",
82
+ :offset => nil,
83
+ :class_name => "Petfood",
84
+ :order => "petfoods.the_petfood_primary_key DESC"
85
+ # called from line 57
86
+
87
+ end
@@ -0,0 +1,83 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ require 'fileutils'
3
+
4
+ class CommentingGeneratorTest < Test::Unit::TestCase
5
+
6
+ def test_ensure_comments_dont_exist
7
+ # make sure the comments are already defined
8
+ assert_equal false, Object.send(:const_defined?, :Comment)
9
+ assert_equal false, Object.send(:const_defined?, :Commenting)
10
+ end
11
+
12
+ def test_ensure_files_exist_after_generator_runs
13
+ run_generator
14
+
15
+ # make sure the files are there
16
+ for generated_file in generated_files do
17
+ assert File.exists?(File.expand_path(generated_file))
18
+ end
19
+ end
20
+
21
+ def test_classes_exist_with_associations
22
+ run_generator
23
+ assert_nothing_raised { Commenting }
24
+ assert_nothing_raised { Comment }
25
+ citation = Citation.find(:first)
26
+ assert !citation.nil?
27
+ assert citation.respond_to?(:comments)
28
+ user = User.find(:first)
29
+ assert !user.nil?
30
+ assert user.respond_to?(:comments)
31
+ end
32
+
33
+ def teardown
34
+ Object.send(:remove_const, :Comment) if Object.send(:const_defined?, :Comment)
35
+ Object.send(:remove_const, :Commenting) if Object.send(:const_defined?, :Commenting)
36
+ remove_all_generated_files
37
+ remove_require_for_commenting_extensions
38
+ end
39
+
40
+ def generated_files
41
+ generated_files = [File.join(File.dirname(__FILE__), '..', '..', 'app', 'models', 'comment.rb')]
42
+ generated_files << File.join(File.dirname(__FILE__), '..', '..', 'app', 'models', 'commenting.rb')
43
+ generated_files << File.join(File.dirname(__FILE__), '..', '..', 'test', 'unit', 'commenting_test.rb')
44
+ generated_files << File.join(File.dirname(__FILE__), '..', '..', 'test', 'unit', 'comment_test.rb')
45
+ generated_files << File.join(File.dirname(__FILE__), '..', '..', 'lib', 'commenting_extensions.rb')
46
+ generated_files << File.join(File.dirname(__FILE__), '..', '..', 'test', 'fixtures', 'comments.yml')
47
+ generated_files << File.join(File.dirname(__FILE__), '..', '..', 'test', 'fixtures', 'commentings.yml')
48
+ end
49
+
50
+ def remove_all_generated_files
51
+ for generated_file in generated_files do
52
+ if File.exists?(generated_file)
53
+ assert FileUtils.rm(generated_file)
54
+ end
55
+ end
56
+ end
57
+
58
+ def run_migrate
59
+ `rake db:migrate RAILS_ENV=test`
60
+ end
61
+
62
+ def run_generator
63
+ command = File.join(File.dirname(__FILE__), '..', '..', 'script', 'generate')
64
+ `#{command} commenting Citation User`
65
+ run_migrate
66
+ end
67
+
68
+ def remove_require_for_commenting_extensions
69
+ environment = File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment.rb')
70
+ new_environment = ''
71
+ if File.exists?(environment)
72
+ if (open(environment) { |file| file.grep(/Rails/).any? })
73
+ IO.readlines(environment).each do |line|
74
+ new_environment += line unless line.match(/commenting_extensions/i)
75
+ end
76
+ File.open(environment, "w+") do |f|
77
+ f.pos = 0
78
+ f.print new_environment
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
+ <title>The page you were looking for doesn't exist (404)</title>
9
+ <style type="text/css">
10
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
+ div.dialog {
12
+ width: 25em;
13
+ padding: 0 4em;
14
+ margin: 4em auto 0 auto;
15
+ border: 1px solid #ccc;
16
+ border-right-color: #999;
17
+ border-bottom-color: #999;
18
+ }
19
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <!-- This file lives in public/404.html -->
25
+ <div class="dialog">
26
+ <h1>The page you were looking for doesn't exist.</h1>
27
+ <p>You may have mistyped the address or the page may have moved.</p>
28
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
+ <title>We're sorry, but something went wrong</title>
9
+ <style type="text/css">
10
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
+ div.dialog {
12
+ width: 25em;
13
+ padding: 0 4em;
14
+ margin: 4em auto 0 auto;
15
+ border: 1px solid #ccc;
16
+ border-right-color: #999;
17
+ border-bottom-color: #999;
18
+ }
19
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <!-- This file lives in public/500.html -->
25
+ <div class="dialog">
26
+ <h1>We're sorry, but something went wrong.</h1>
27
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
28
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,10 @@
1
+ #!/usr/local/bin/ruby
2
+
3
+ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
4
+
5
+ # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
6
+ # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
7
+ require "dispatcher"
8
+
9
+ ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
10
+ Dispatcher.dispatch
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # You may specify the path to the FastCGI crash log (a log of unhandled
4
+ # exceptions which forced the FastCGI instance to exit, great for debugging)
5
+ # and the number of requests to process before running garbage collection.
6
+ #
7
+ # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
8
+ # and the GC period is nil (turned off). A reasonable number of requests
9
+ # could range from 10-100 depending on the memory footprint of your app.
10
+ #
11
+ # Example:
12
+ # # Default log path, normal GC behavior.
13
+ # RailsFCGIHandler.process!
14
+ #
15
+ # # Default log path, 50 requests between GC.
16
+ # RailsFCGIHandler.process! nil, 50
17
+ #
18
+ # # Custom log path, normal GC behavior.
19
+ # RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
20
+ #
21
+ require File.dirname(__FILE__) + "/../config/environment"
22
+ require 'fcgi_handler'
23
+
24
+ RailsFCGIHandler.process!
@@ -0,0 +1,10 @@
1
+ #!/usr/local/bin/ruby
2
+
3
+ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
4
+
5
+ # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
6
+ # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
7
+ require "dispatcher"
8
+
9
+ ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
10
+ Dispatcher.dispatch
@@ -0,0 +1,277 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
+ <title>Ruby on Rails: Welcome aboard</title>
7
+ <style type="text/css" media="screen">
8
+ body {
9
+ margin: 0;
10
+ margin-bottom: 25px;
11
+ padding: 0;
12
+ background-color: #f0f0f0;
13
+ font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
14
+ font-size: 13px;
15
+ color: #333;
16
+ }
17
+
18
+ h1 {
19
+ font-size: 28px;
20
+ color: #000;
21
+ }
22
+
23
+ a {color: #03c}
24
+ a:hover {
25
+ background-color: #03c;
26
+ color: white;
27
+ text-decoration: none;
28
+ }
29
+
30
+
31
+ #page {
32
+ background-color: #f0f0f0;
33
+ width: 750px;
34
+ margin: 0;
35
+ margin-left: auto;
36
+ margin-right: auto;
37
+ }
38
+
39
+ #content {
40
+ float: left;
41
+ background-color: white;
42
+ border: 3px solid #aaa;
43
+ border-top: none;
44
+ padding: 25px;
45
+ width: 500px;
46
+ }
47
+
48
+ #sidebar {
49
+ float: right;
50
+ width: 175px;
51
+ }
52
+
53
+ #footer {
54
+ clear: both;
55
+ }
56
+
57
+
58
+ #header, #about, #getting-started {
59
+ padding-left: 75px;
60
+ padding-right: 30px;
61
+ }
62
+
63
+
64
+ #header {
65
+ background-image: url("images/rails.png");
66
+ background-repeat: no-repeat;
67
+ background-position: top left;
68
+ height: 64px;
69
+ }
70
+ #header h1, #header h2 {margin: 0}
71
+ #header h2 {
72
+ color: #888;
73
+ font-weight: normal;
74
+ font-size: 16px;
75
+ }
76
+
77
+
78
+ #about h3 {
79
+ margin: 0;
80
+ margin-bottom: 10px;
81
+ font-size: 14px;
82
+ }
83
+
84
+ #about-content {
85
+ background-color: #ffd;
86
+ border: 1px solid #fc0;
87
+ margin-left: -11px;
88
+ }
89
+ #about-content table {
90
+ margin-top: 10px;
91
+ margin-bottom: 10px;
92
+ font-size: 11px;
93
+ border-collapse: collapse;
94
+ }
95
+ #about-content td {
96
+ padding: 10px;
97
+ padding-top: 3px;
98
+ padding-bottom: 3px;
99
+ }
100
+ #about-content td.name {color: #555}
101
+ #about-content td.value {color: #000}
102
+
103
+ #about-content.failure {
104
+ background-color: #fcc;
105
+ border: 1px solid #f00;
106
+ }
107
+ #about-content.failure p {
108
+ margin: 0;
109
+ padding: 10px;
110
+ }
111
+
112
+
113
+ #getting-started {
114
+ border-top: 1px solid #ccc;
115
+ margin-top: 25px;
116
+ padding-top: 15px;
117
+ }
118
+ #getting-started h1 {
119
+ margin: 0;
120
+ font-size: 20px;
121
+ }
122
+ #getting-started h2 {
123
+ margin: 0;
124
+ font-size: 14px;
125
+ font-weight: normal;
126
+ color: #333;
127
+ margin-bottom: 25px;
128
+ }
129
+ #getting-started ol {
130
+ margin-left: 0;
131
+ padding-left: 0;
132
+ }
133
+ #getting-started li {
134
+ font-size: 18px;
135
+ color: #888;
136
+ margin-bottom: 25px;
137
+ }
138
+ #getting-started li h2 {
139
+ margin: 0;
140
+ font-weight: normal;
141
+ font-size: 18px;
142
+ color: #333;
143
+ }
144
+ #getting-started li p {
145
+ color: #555;
146
+ font-size: 13px;
147
+ }
148
+
149
+
150
+ #search {
151
+ margin: 0;
152
+ padding-top: 10px;
153
+ padding-bottom: 10px;
154
+ font-size: 11px;
155
+ }
156
+ #search input {
157
+ font-size: 11px;
158
+ margin: 2px;
159
+ }
160
+ #search-text {width: 170px}
161
+
162
+
163
+ #sidebar ul {
164
+ margin-left: 0;
165
+ padding-left: 0;
166
+ }
167
+ #sidebar ul h3 {
168
+ margin-top: 25px;
169
+ font-size: 16px;
170
+ padding-bottom: 10px;
171
+ border-bottom: 1px solid #ccc;
172
+ }
173
+ #sidebar li {
174
+ list-style-type: none;
175
+ }
176
+ #sidebar ul.links li {
177
+ margin-bottom: 5px;
178
+ }
179
+
180
+ </style>
181
+ <script type="text/javascript" src="javascripts/prototype.js"></script>
182
+ <script type="text/javascript" src="javascripts/effects.js"></script>
183
+ <script type="text/javascript">
184
+ function about() {
185
+ if (Element.empty('about-content')) {
186
+ new Ajax.Updater('about-content', 'rails/info/properties', {
187
+ method: 'get',
188
+ onFailure: function() {Element.classNames('about-content').add('failure')},
189
+ onComplete: function() {new Effect.BlindDown('about-content', {duration: 0.25})}
190
+ });
191
+ } else {
192
+ new Effect[Element.visible('about-content') ?
193
+ 'BlindUp' : 'BlindDown']('about-content', {duration: 0.25});
194
+ }
195
+ }
196
+
197
+ window.onload = function() {
198
+ $('search-text').value = '';
199
+ $('search').onsubmit = function() {
200
+ $('search-text').value = 'site:rubyonrails.org ' + $F('search-text');
201
+ }
202
+ }
203
+ </script>
204
+ </head>
205
+ <body>
206
+ <div id="page">
207
+ <div id="sidebar">
208
+ <ul id="sidebar-items">
209
+ <li>
210
+ <form id="search" action="http://www.google.com/search" method="get">
211
+ <input type="hidden" name="hl" value="en" />
212
+ <input type="text" id="search-text" name="q" value="site:rubyonrails.org " />
213
+ <input type="submit" value="Search" /> the Rails site
214
+ </form>
215
+ </li>
216
+
217
+ <li>
218
+ <h3>Join the community</h3>
219
+ <ul class="links">
220
+ <li><a href="http://www.rubyonrails.org/">Ruby on Rails</a></li>
221
+ <li><a href="http://weblog.rubyonrails.org/">Official weblog</a></li>
222
+ <li><a href="http://lists.rubyonrails.org/">Mailing lists</a></li>
223
+ <li><a href="http://wiki.rubyonrails.org/rails/pages/IRC">IRC channel</a></li>
224
+ <li><a href="http://wiki.rubyonrails.org/">Wiki</a></li>
225
+ <li><a href="http://dev.rubyonrails.org/">Bug tracker</a></li>
226
+ </ul>
227
+ </li>
228
+
229
+ <li>
230
+ <h3>Browse the documentation</h3>
231
+ <ul class="links">
232
+ <li><a href="http://api.rubyonrails.org/">Rails API</a></li>
233
+ <li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
234
+ <li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
235
+ </ul>
236
+ </li>
237
+ </ul>
238
+ </div>
239
+
240
+ <div id="content">
241
+ <div id="header">
242
+ <h1>Welcome aboard</h1>
243
+ <h2>You&rsquo;re riding the Rails!</h2>
244
+ </div>
245
+
246
+ <div id="about">
247
+ <h3><a href="rails/info/properties" onclick="about(); return false">About your application&rsquo;s environment</a></h3>
248
+ <div id="about-content" style="display: none"></div>
249
+ </div>
250
+
251
+ <div id="getting-started">
252
+ <h1>Getting started</h1>
253
+ <h2>Here&rsquo;s how to get rolling:</h2>
254
+
255
+ <ol>
256
+ <li>
257
+ <h2>Create your databases and edit <tt>config/database.yml</tt></h2>
258
+ <p>Rails needs to know your login and password.</p>
259
+ </li>
260
+
261
+ <li>
262
+ <h2>Use <tt>script/generate</tt> to create your models and controllers</h2>
263
+ <p>To see all available options, run it without parameters.</p>
264
+ </li>
265
+
266
+ <li>
267
+ <h2>Set up a default route and remove or rename this file</h2>
268
+ <p>Routes are setup in config/routes.rb.</p>
269
+ </li>
270
+ </ol>
271
+ </div>
272
+ </div>
273
+
274
+ <div id="footer">&nbsp;</div>
275
+ </div>
276
+ </body>
277
+ </html>