rails 2.2.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails might be problematic. Click here for more details.

Files changed (336) hide show
  1. data/bin/rails +8 -18
  2. metadata +118 -452
  3. data/CHANGELOG +0 -2071
  4. data/MIT-LICENSE +0 -20
  5. data/README +0 -256
  6. data/Rakefile +0 -411
  7. data/bin/about +0 -4
  8. data/bin/console +0 -3
  9. data/bin/dbconsole +0 -3
  10. data/bin/destroy +0 -3
  11. data/bin/generate +0 -3
  12. data/bin/performance/benchmarker +0 -3
  13. data/bin/performance/profiler +0 -3
  14. data/bin/performance/request +0 -3
  15. data/bin/plugin +0 -3
  16. data/bin/process/inspector +0 -3
  17. data/bin/process/reaper +0 -3
  18. data/bin/process/spawner +0 -3
  19. data/bin/runner +0 -3
  20. data/bin/server +0 -3
  21. data/builtin/rails_info/rails/info.rb +0 -125
  22. data/builtin/rails_info/rails/info_controller.rb +0 -9
  23. data/builtin/rails_info/rails/info_helper.rb +0 -2
  24. data/builtin/rails_info/rails_info_controller.rb +0 -2
  25. data/config.ru +0 -17
  26. data/configs/apache.conf +0 -40
  27. data/configs/databases/frontbase.yml +0 -28
  28. data/configs/databases/ibm_db.yml +0 -62
  29. data/configs/databases/mysql.yml +0 -57
  30. data/configs/databases/oracle.yml +0 -39
  31. data/configs/databases/postgresql.yml +0 -51
  32. data/configs/databases/sqlite2.yml +0 -19
  33. data/configs/databases/sqlite3.yml +0 -22
  34. data/configs/empty.log +0 -0
  35. data/configs/initializers/inflections.rb +0 -10
  36. data/configs/initializers/mime_types.rb +0 -5
  37. data/configs/initializers/new_rails_defaults.rb +0 -17
  38. data/configs/lighttpd.conf +0 -54
  39. data/configs/locales/en.yml +0 -5
  40. data/configs/routes.rb +0 -43
  41. data/dispatches/dispatch.fcgi +0 -24
  42. data/dispatches/dispatch.rb +0 -10
  43. data/dispatches/gateway.cgi +0 -97
  44. data/doc/README_FOR_APP +0 -5
  45. data/doc/guides/html/2_2_release_notes.html +0 -1185
  46. data/doc/guides/html/actioncontroller_basics.html +0 -1270
  47. data/doc/guides/html/activerecord_validations_callbacks.html +0 -749
  48. data/doc/guides/html/association_basics.html +0 -2585
  49. data/doc/guides/html/authors.html +0 -240
  50. data/doc/guides/html/benchmarking_and_profiling.html +0 -1018
  51. data/doc/guides/html/caching_with_rails.html +0 -583
  52. data/doc/guides/html/command_line.html +0 -434
  53. data/doc/guides/html/configuring.html +0 -438
  54. data/doc/guides/html/creating_plugins.html +0 -1594
  55. data/doc/guides/html/debugging_rails_applications.html +0 -1175
  56. data/doc/guides/html/finders.html +0 -1090
  57. data/doc/guides/html/form_helpers.html +0 -638
  58. data/doc/guides/html/getting_started_with_rails.html +0 -2066
  59. data/doc/guides/html/index.html +0 -349
  60. data/doc/guides/html/layouts_and_rendering.html +0 -1406
  61. data/doc/guides/html/migrations.html +0 -921
  62. data/doc/guides/html/routing_outside_in.html +0 -2213
  63. data/doc/guides/html/security.html +0 -1346
  64. data/doc/guides/html/testing_rails_applications.html +0 -1859
  65. data/doc/guides/source/2_2_release_notes.txt +0 -435
  66. data/doc/guides/source/actioncontroller_basics/changelog.txt +0 -5
  67. data/doc/guides/source/actioncontroller_basics/cookies.txt +0 -34
  68. data/doc/guides/source/actioncontroller_basics/csrf.txt +0 -32
  69. data/doc/guides/source/actioncontroller_basics/filters.txt +0 -119
  70. data/doc/guides/source/actioncontroller_basics/http_auth.txt +0 -24
  71. data/doc/guides/source/actioncontroller_basics/index.txt +0 -40
  72. data/doc/guides/source/actioncontroller_basics/introduction.txt +0 -9
  73. data/doc/guides/source/actioncontroller_basics/methods.txt +0 -39
  74. data/doc/guides/source/actioncontroller_basics/parameter_filtering.txt +0 -14
  75. data/doc/guides/source/actioncontroller_basics/params.txt +0 -93
  76. data/doc/guides/source/actioncontroller_basics/request_response_objects.txt +0 -43
  77. data/doc/guides/source/actioncontroller_basics/rescue.txt +0 -67
  78. data/doc/guides/source/actioncontroller_basics/session.txt +0 -187
  79. data/doc/guides/source/actioncontroller_basics/streaming.txt +0 -91
  80. data/doc/guides/source/actioncontroller_basics/verification.txt +0 -40
  81. data/doc/guides/source/active_record_basics.txt +0 -181
  82. data/doc/guides/source/activerecord_validations_callbacks.txt +0 -404
  83. data/doc/guides/source/association_basics.txt +0 -1840
  84. data/doc/guides/source/authors.txt +0 -39
  85. data/doc/guides/source/benchmarking_and_profiling/appendix.txt +0 -95
  86. data/doc/guides/source/benchmarking_and_profiling/digging_deeper.txt +0 -105
  87. data/doc/guides/source/benchmarking_and_profiling/edge_rails_features.txt +0 -185
  88. data/doc/guides/source/benchmarking_and_profiling/gameplan.txt +0 -27
  89. data/doc/guides/source/benchmarking_and_profiling/index.txt +0 -242
  90. data/doc/guides/source/benchmarking_and_profiling/rubyprof.txt +0 -179
  91. data/doc/guides/source/benchmarking_and_profiling/statistics.txt +0 -57
  92. data/doc/guides/source/caching_with_rails.txt +0 -367
  93. data/doc/guides/source/command_line.txt +0 -147
  94. data/doc/guides/source/configuring.txt +0 -225
  95. data/doc/guides/source/creating_plugins/acts_as_yaffle.txt +0 -191
  96. data/doc/guides/source/creating_plugins/appendix.txt +0 -46
  97. data/doc/guides/source/creating_plugins/controllers.txt +0 -59
  98. data/doc/guides/source/creating_plugins/core_ext.txt +0 -123
  99. data/doc/guides/source/creating_plugins/custom_route.txt +0 -69
  100. data/doc/guides/source/creating_plugins/gem.txt +0 -1
  101. data/doc/guides/source/creating_plugins/generator_method.txt +0 -89
  102. data/doc/guides/source/creating_plugins/helpers.txt +0 -51
  103. data/doc/guides/source/creating_plugins/index.txt +0 -52
  104. data/doc/guides/source/creating_plugins/migration_generator.txt +0 -156
  105. data/doc/guides/source/creating_plugins/models.txt +0 -76
  106. data/doc/guides/source/creating_plugins/odds_and_ends.txt +0 -69
  107. data/doc/guides/source/creating_plugins/test_setup.txt +0 -230
  108. data/doc/guides/source/debugging_rails_applications.txt +0 -733
  109. data/doc/guides/source/finders.txt +0 -668
  110. data/doc/guides/source/form_helpers.txt +0 -345
  111. data/doc/guides/source/getting_started_with_rails.txt +0 -1256
  112. data/doc/guides/source/images/belongs_to.png +0 -0
  113. data/doc/guides/source/images/bullet.gif +0 -0
  114. data/doc/guides/source/images/csrf.png +0 -0
  115. data/doc/guides/source/images/habtm.png +0 -0
  116. data/doc/guides/source/images/has_many.png +0 -0
  117. data/doc/guides/source/images/has_many_through.png +0 -0
  118. data/doc/guides/source/images/has_one.png +0 -0
  119. data/doc/guides/source/images/has_one_through.png +0 -0
  120. data/doc/guides/source/images/header_backdrop.png +0 -0
  121. data/doc/guides/source/images/icons/README +0 -5
  122. data/doc/guides/source/images/icons/callouts/1.png +0 -0
  123. data/doc/guides/source/images/icons/callouts/10.png +0 -0
  124. data/doc/guides/source/images/icons/callouts/11.png +0 -0
  125. data/doc/guides/source/images/icons/callouts/12.png +0 -0
  126. data/doc/guides/source/images/icons/callouts/13.png +0 -0
  127. data/doc/guides/source/images/icons/callouts/14.png +0 -0
  128. data/doc/guides/source/images/icons/callouts/15.png +0 -0
  129. data/doc/guides/source/images/icons/callouts/2.png +0 -0
  130. data/doc/guides/source/images/icons/callouts/3.png +0 -0
  131. data/doc/guides/source/images/icons/callouts/4.png +0 -0
  132. data/doc/guides/source/images/icons/callouts/5.png +0 -0
  133. data/doc/guides/source/images/icons/callouts/6.png +0 -0
  134. data/doc/guides/source/images/icons/callouts/7.png +0 -0
  135. data/doc/guides/source/images/icons/callouts/8.png +0 -0
  136. data/doc/guides/source/images/icons/callouts/9.png +0 -0
  137. data/doc/guides/source/images/icons/caution.png +0 -0
  138. data/doc/guides/source/images/icons/example.png +0 -0
  139. data/doc/guides/source/images/icons/home.png +0 -0
  140. data/doc/guides/source/images/icons/important.png +0 -0
  141. data/doc/guides/source/images/icons/next.png +0 -0
  142. data/doc/guides/source/images/icons/note.png +0 -0
  143. data/doc/guides/source/images/icons/prev.png +0 -0
  144. data/doc/guides/source/images/icons/tip.png +0 -0
  145. data/doc/guides/source/images/icons/up.png +0 -0
  146. data/doc/guides/source/images/icons/warning.png +0 -0
  147. data/doc/guides/source/images/polymorphic.png +0 -0
  148. data/doc/guides/source/images/rails_logo_remix.gif +0 -0
  149. data/doc/guides/source/images/ruby_on_rails_by_mike_rundle2.gif +0 -0
  150. data/doc/guides/source/images/session_fixation.png +0 -0
  151. data/doc/guides/source/index.txt +0 -118
  152. data/doc/guides/source/layouts_and_rendering.txt +0 -982
  153. data/doc/guides/source/migrations/anatomy_of_a_migration.txt +0 -85
  154. data/doc/guides/source/migrations/changelog.txt +0 -5
  155. data/doc/guides/source/migrations/creating_a_migration.txt +0 -109
  156. data/doc/guides/source/migrations/foreign_keys.txt +0 -8
  157. data/doc/guides/source/migrations/index.txt +0 -22
  158. data/doc/guides/source/migrations/rakeing_around.txt +0 -111
  159. data/doc/guides/source/migrations/scheming.txt +0 -47
  160. data/doc/guides/source/migrations/using_models_in_migrations.txt +0 -46
  161. data/doc/guides/source/migrations/writing_a_migration.txt +0 -159
  162. data/doc/guides/source/routing_outside_in.txt +0 -986
  163. data/doc/guides/source/security.txt +0 -984
  164. data/doc/guides/source/stylesheets/base.css +0 -358
  165. data/doc/guides/source/stylesheets/forms.css +0 -35
  166. data/doc/guides/source/stylesheets/more.css +0 -82
  167. data/doc/guides/source/templates/guides.html.erb +0 -97
  168. data/doc/guides/source/templates/inline.css +0 -165
  169. data/doc/guides/source/testing_rails_applications.txt +0 -995
  170. data/environments/boot.rb +0 -109
  171. data/environments/development.rb +0 -17
  172. data/environments/environment.rb +0 -75
  173. data/environments/production.rb +0 -24
  174. data/environments/test.rb +0 -22
  175. data/fresh_rakefile +0 -10
  176. data/helpers/application.rb +0 -15
  177. data/helpers/application_helper.rb +0 -3
  178. data/helpers/performance_test.rb +0 -9
  179. data/helpers/test_helper.rb +0 -38
  180. data/html/404.html +0 -30
  181. data/html/422.html +0 -30
  182. data/html/500.html +0 -33
  183. data/html/favicon.ico +0 -0
  184. data/html/images/rails.png +0 -0
  185. data/html/index.html +0 -274
  186. data/html/javascripts/application.js +0 -2
  187. data/html/javascripts/controls.js +0 -963
  188. data/html/javascripts/dragdrop.js +0 -973
  189. data/html/javascripts/effects.js +0 -1128
  190. data/html/javascripts/prototype.js +0 -4320
  191. data/html/robots.txt +0 -5
  192. data/lib/code_statistics.rb +0 -107
  193. data/lib/commands.rb +0 -17
  194. data/lib/commands/about.rb +0 -3
  195. data/lib/commands/console.rb +0 -45
  196. data/lib/commands/dbconsole.rb +0 -67
  197. data/lib/commands/destroy.rb +0 -6
  198. data/lib/commands/generate.rb +0 -6
  199. data/lib/commands/ncgi/listener +0 -86
  200. data/lib/commands/ncgi/tracker +0 -69
  201. data/lib/commands/performance/benchmarker.rb +0 -24
  202. data/lib/commands/performance/profiler.rb +0 -50
  203. data/lib/commands/performance/request.rb +0 -6
  204. data/lib/commands/plugin.rb +0 -967
  205. data/lib/commands/process/inspector.rb +0 -68
  206. data/lib/commands/process/reaper.rb +0 -149
  207. data/lib/commands/process/spawner.rb +0 -219
  208. data/lib/commands/process/spinner.rb +0 -57
  209. data/lib/commands/runner.rb +0 -48
  210. data/lib/commands/server.rb +0 -49
  211. data/lib/commands/servers/base.rb +0 -31
  212. data/lib/commands/servers/lighttpd.rb +0 -94
  213. data/lib/commands/servers/mongrel.rb +0 -69
  214. data/lib/commands/servers/new_mongrel.rb +0 -16
  215. data/lib/commands/servers/thin.rb +0 -25
  216. data/lib/commands/servers/webrick.rb +0 -66
  217. data/lib/commands/update.rb +0 -4
  218. data/lib/console_app.rb +0 -30
  219. data/lib/console_sandbox.rb +0 -6
  220. data/lib/console_with_helpers.rb +0 -26
  221. data/lib/dispatcher.rb +0 -24
  222. data/lib/fcgi_handler.rb +0 -237
  223. data/lib/initializer.rb +0 -1038
  224. data/lib/performance_test_help.rb +0 -5
  225. data/lib/rails/gem_builder.rb +0 -21
  226. data/lib/rails/gem_dependency.rb +0 -251
  227. data/lib/rails/mongrel_server/commands.rb +0 -342
  228. data/lib/rails/mongrel_server/handler.rb +0 -55
  229. data/lib/rails/plugin.rb +0 -124
  230. data/lib/rails/plugin/loader.rb +0 -152
  231. data/lib/rails/plugin/locator.rb +0 -100
  232. data/lib/rails/rack.rb +0 -6
  233. data/lib/rails/rack/logger.rb +0 -28
  234. data/lib/rails/rack/static.rb +0 -35
  235. data/lib/rails/vendor_gem_source_index.rb +0 -140
  236. data/lib/rails/version.rb +0 -9
  237. data/lib/rails_generator.rb +0 -43
  238. data/lib/rails_generator/base.rb +0 -263
  239. data/lib/rails_generator/commands.rb +0 -616
  240. data/lib/rails_generator/generated_attribute.rb +0 -46
  241. data/lib/rails_generator/generators/applications/app/USAGE +0 -9
  242. data/lib/rails_generator/generators/applications/app/app_generator.rb +0 -184
  243. data/lib/rails_generator/generators/components/controller/USAGE +0 -29
  244. data/lib/rails_generator/generators/components/controller/controller_generator.rb +0 -37
  245. data/lib/rails_generator/generators/components/controller/templates/controller.rb +0 -7
  246. data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +0 -8
  247. data/lib/rails_generator/generators/components/controller/templates/helper.rb +0 -2
  248. data/lib/rails_generator/generators/components/controller/templates/view.html.erb +0 -2
  249. data/lib/rails_generator/generators/components/integration_test/USAGE +0 -8
  250. data/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb +0 -16
  251. data/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb +0 -10
  252. data/lib/rails_generator/generators/components/mailer/USAGE +0 -16
  253. data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +0 -30
  254. data/lib/rails_generator/generators/components/mailer/templates/fixture.erb +0 -3
  255. data/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml +0 -0
  256. data/lib/rails_generator/generators/components/mailer/templates/mailer.rb +0 -15
  257. data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +0 -20
  258. data/lib/rails_generator/generators/components/mailer/templates/view.erb +0 -3
  259. data/lib/rails_generator/generators/components/mailer/templates/view.rhtml +0 -0
  260. data/lib/rails_generator/generators/components/migration/USAGE +0 -29
  261. data/lib/rails_generator/generators/components/migration/migration_generator.rb +0 -20
  262. data/lib/rails_generator/generators/components/migration/templates/migration.rb +0 -11
  263. data/lib/rails_generator/generators/components/model/USAGE +0 -27
  264. data/lib/rails_generator/generators/components/model/model_generator.rb +0 -45
  265. data/lib/rails_generator/generators/components/model/templates/fixtures.yml +0 -19
  266. data/lib/rails_generator/generators/components/model/templates/migration.rb +0 -16
  267. data/lib/rails_generator/generators/components/model/templates/model.rb +0 -5
  268. data/lib/rails_generator/generators/components/model/templates/unit_test.rb +0 -8
  269. data/lib/rails_generator/generators/components/observer/USAGE +0 -13
  270. data/lib/rails_generator/generators/components/observer/observer_generator.rb +0 -16
  271. data/lib/rails_generator/generators/components/observer/templates/observer.rb +0 -2
  272. data/lib/rails_generator/generators/components/observer/templates/unit_test.rb +0 -8
  273. data/lib/rails_generator/generators/components/performance_test/USAGE +0 -8
  274. data/lib/rails_generator/generators/components/performance_test/performance_test_generator.rb +0 -16
  275. data/lib/rails_generator/generators/components/performance_test/templates/performance_test.rb +0 -9
  276. data/lib/rails_generator/generators/components/plugin/USAGE +0 -25
  277. data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +0 -39
  278. data/lib/rails_generator/generators/components/plugin/templates/MIT-LICENSE +0 -20
  279. data/lib/rails_generator/generators/components/plugin/templates/README +0 -13
  280. data/lib/rails_generator/generators/components/plugin/templates/Rakefile +0 -23
  281. data/lib/rails_generator/generators/components/plugin/templates/USAGE +0 -8
  282. data/lib/rails_generator/generators/components/plugin/templates/generator.rb +0 -8
  283. data/lib/rails_generator/generators/components/plugin/templates/init.rb +0 -1
  284. data/lib/rails_generator/generators/components/plugin/templates/install.rb +0 -1
  285. data/lib/rails_generator/generators/components/plugin/templates/plugin.rb +0 -1
  286. data/lib/rails_generator/generators/components/plugin/templates/tasks.rake +0 -4
  287. data/lib/rails_generator/generators/components/plugin/templates/test_helper.rb +0 -3
  288. data/lib/rails_generator/generators/components/plugin/templates/uninstall.rb +0 -1
  289. data/lib/rails_generator/generators/components/plugin/templates/unit_test.rb +0 -8
  290. data/lib/rails_generator/generators/components/resource/USAGE +0 -23
  291. data/lib/rails_generator/generators/components/resource/resource_generator.rb +0 -74
  292. data/lib/rails_generator/generators/components/resource/templates/controller.rb +0 -2
  293. data/lib/rails_generator/generators/components/resource/templates/functional_test.rb +0 -8
  294. data/lib/rails_generator/generators/components/resource/templates/helper.rb +0 -2
  295. data/lib/rails_generator/generators/components/scaffold/USAGE +0 -29
  296. data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +0 -100
  297. data/lib/rails_generator/generators/components/scaffold/templates/controller.rb +0 -85
  298. data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +0 -45
  299. data/lib/rails_generator/generators/components/scaffold/templates/helper.rb +0 -2
  300. data/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb +0 -17
  301. data/lib/rails_generator/generators/components/scaffold/templates/style.css +0 -54
  302. data/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb +0 -18
  303. data/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb +0 -24
  304. data/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb +0 -17
  305. data/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb +0 -10
  306. data/lib/rails_generator/generators/components/session_migration/USAGE +0 -10
  307. data/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb +0 -18
  308. data/lib/rails_generator/generators/components/session_migration/templates/migration.rb +0 -16
  309. data/lib/rails_generator/lookup.rb +0 -249
  310. data/lib/rails_generator/manifest.rb +0 -53
  311. data/lib/rails_generator/options.rb +0 -150
  312. data/lib/rails_generator/scripts.rb +0 -89
  313. data/lib/rails_generator/scripts/destroy.rb +0 -29
  314. data/lib/rails_generator/scripts/generate.rb +0 -7
  315. data/lib/rails_generator/scripts/update.rb +0 -12
  316. data/lib/rails_generator/secret_key_generator.rb +0 -22
  317. data/lib/rails_generator/simple_logger.rb +0 -46
  318. data/lib/rails_generator/spec.rb +0 -44
  319. data/lib/railties_path.rb +0 -1
  320. data/lib/ruby_version_check.rb +0 -17
  321. data/lib/rubyprof_ext.rb +0 -35
  322. data/lib/source_annotation_extractor.rb +0 -102
  323. data/lib/tasks/annotations.rake +0 -20
  324. data/lib/tasks/databases.rake +0 -416
  325. data/lib/tasks/documentation.rake +0 -95
  326. data/lib/tasks/framework.rake +0 -118
  327. data/lib/tasks/gems.rake +0 -80
  328. data/lib/tasks/log.rake +0 -9
  329. data/lib/tasks/misc.rake +0 -56
  330. data/lib/tasks/rails.rb +0 -8
  331. data/lib/tasks/routes.rake +0 -17
  332. data/lib/tasks/statistics.rake +0 -18
  333. data/lib/tasks/testing.rake +0 -139
  334. data/lib/tasks/tmp.rake +0 -37
  335. data/lib/test_help.rb +0 -27
  336. data/lib/webrick_server.rb +0 -156
@@ -1,5 +0,0 @@
1
- require 'action_controller/performance_test'
2
-
3
- ActionController::Base.perform_caching = true
4
- ActiveSupport::Dependencies.mechanism = :require
5
- Rails.logger.level = ActiveSupport::BufferedLogger::INFO
@@ -1,21 +0,0 @@
1
- require 'rubygems'
2
- require 'rubygems/installer'
3
-
4
- module Rails
5
-
6
- # this class hijacks the functionality of Gem::Installer by overloading its
7
- # initializer to only provide the information needed by
8
- # Gem::Installer#build_extensions (which happens to be what we have)
9
- class GemBuilder < Gem::Installer
10
-
11
- def initialize(spec, gem_dir)
12
- @spec = spec
13
- @gem_dir = gem_dir
14
- end
15
-
16
- # silence the underlying builder
17
- def say(message)
18
- end
19
-
20
- end
21
- end
@@ -1,251 +0,0 @@
1
- require 'rails/vendor_gem_source_index'
2
-
3
- module Gem
4
- def self.source_index=(index)
5
- @@source_index = index
6
- end
7
- end
8
-
9
- module Rails
10
- class GemDependency
11
- attr_accessor :lib, :source
12
-
13
- def self.unpacked_path
14
- @unpacked_path ||= File.join(RAILS_ROOT, 'vendor', 'gems')
15
- end
16
-
17
- @@framework_gems = {}
18
-
19
- def self.add_frozen_gem_path
20
- @@paths_loaded ||= begin
21
- source_index = Rails::VendorGemSourceIndex.new(Gem.source_index)
22
- Gem.clear_paths
23
- Gem.source_index = source_index
24
- # loaded before us - we can't change them, so mark them
25
- Gem.loaded_specs.each do |name, spec|
26
- @@framework_gems[name] = spec
27
- end
28
- true
29
- end
30
- end
31
-
32
- def framework_gem?
33
- @@framework_gems.has_key?(name)
34
- end
35
-
36
- def vendor_rails?
37
- Gem.loaded_specs.has_key?(name) && Gem.loaded_specs[name].loaded_from.empty?
38
- end
39
-
40
- def vendor_gem?
41
- Gem.loaded_specs.has_key?(name) && Gem.loaded_specs[name].loaded_from.include?(self.class.unpacked_path)
42
- end
43
-
44
- def initialize(name, options = {})
45
- require 'rubygems' unless Object.const_defined?(:Gem)
46
-
47
- if options[:requirement]
48
- req = options[:requirement]
49
- elsif options[:version]
50
- req = Gem::Requirement.create(options[:version])
51
- else
52
- req = Gem::Requirement.default
53
- end
54
-
55
- @dep = Gem::Dependency.new(name, req)
56
- @lib = options[:lib]
57
- @source = options[:source]
58
- @loaded = @frozen = @load_paths_added = false
59
- end
60
-
61
- def add_load_paths
62
- self.class.add_frozen_gem_path
63
- return if @loaded || @load_paths_added
64
- if framework_gem?
65
- @load_paths_added = @loaded = @frozen = true
66
- return
67
- end
68
- gem @dep
69
- @spec = Gem.loaded_specs[name]
70
- @frozen = @spec.loaded_from.include?(self.class.unpacked_path) if @spec
71
- @load_paths_added = true
72
- rescue Gem::LoadError
73
- end
74
-
75
- def dependencies
76
- return [] if framework_gem?
77
- all_dependencies = specification.dependencies.map do |dependency|
78
- GemDependency.new(dependency.name, :requirement => dependency.version_requirements)
79
- end
80
- all_dependencies += all_dependencies.map(&:dependencies).flatten
81
- all_dependencies.uniq
82
- end
83
-
84
- def gem_dir(base_directory)
85
- File.join(base_directory, specification.full_name)
86
- end
87
-
88
- def spec_filename(base_directory)
89
- File.join(gem_dir(base_directory), '.specification')
90
- end
91
-
92
- def load
93
- return if @loaded || @load_paths_added == false
94
- require(@lib || name) unless @lib == false
95
- @loaded = true
96
- rescue LoadError
97
- puts $!.to_s
98
- $!.backtrace.each { |b| puts b }
99
- end
100
-
101
- def name
102
- @dep.name.to_s
103
- end
104
-
105
- def requirement
106
- r = @dep.version_requirements
107
- (r == Gem::Requirement.default) ? nil : r
108
- end
109
-
110
- def frozen?
111
- @frozen ||= vendor_rails? || vendor_gem?
112
- end
113
-
114
- def loaded?
115
- @loaded ||= begin
116
- if vendor_rails?
117
- true
118
- elsif specification.nil?
119
- false
120
- else
121
- # check if the gem is loaded by inspecting $"
122
- # specification.files lists all the files contained in the gem
123
- gem_files = specification.files
124
- # select only the files contained in require_paths - typically in bin and lib
125
- require_paths_regexp = Regexp.new("^(#{specification.require_paths*'|'})/")
126
- gem_lib_files = gem_files.select { |f| require_paths_regexp.match(f) }
127
- # chop the leading directory off - a typical file might be in
128
- # lib/gem_name/file_name.rb, but it will be 'require'd as gem_name/file_name.rb
129
- gem_lib_files.map! { |f| f.split('/', 2)[1] }
130
- # if any of the files from the above list appear in $", the gem is assumed to
131
- # have been loaded
132
- !(gem_lib_files & $").empty?
133
- end
134
- end
135
- end
136
-
137
- def load_paths_added?
138
- # always try to add load paths - even if a gem is loaded, it may not
139
- # be a compatible version (ie random_gem 0.4 is loaded and a later spec
140
- # needs >= 0.5 - gem 'random_gem' will catch this and error out)
141
- @load_paths_added
142
- end
143
-
144
- def install
145
- cmd = "#{gem_command} #{install_command.join(' ')}"
146
- puts cmd
147
- puts %x(#{cmd})
148
- end
149
-
150
- def unpack_to(directory)
151
- FileUtils.mkdir_p directory
152
- Dir.chdir directory do
153
- Gem::GemRunner.new.run(unpack_command)
154
- end
155
-
156
- # Gem.activate changes the spec - get the original
157
- real_spec = Gem::Specification.load(specification.loaded_from)
158
- write_spec(directory, real_spec)
159
-
160
- end
161
-
162
- def write_spec(directory, spec)
163
- # copy the gem's specification into GEMDIR/.specification so that
164
- # we can access information about the gem on deployment systems
165
- # without having the gem installed
166
- File.open(spec_filename(directory), 'w') do |file|
167
- file.puts spec.to_yaml
168
- end
169
- end
170
-
171
- def refresh_spec(directory)
172
- real_gems = Gem.source_index.installed_source_index
173
- exact_dep = Gem::Dependency.new(name, "= #{specification.version}")
174
- matches = real_gems.search(exact_dep)
175
- installed_spec = matches.first
176
- if File.exist?(File.dirname(spec_filename(directory)))
177
- if installed_spec
178
- # we have a real copy
179
- # get a fresh spec - matches should only have one element
180
- # note that there is no reliable method to check that the loaded
181
- # spec is the same as the copy from real_gems - Gem.activate changes
182
- # some of the fields
183
- real_spec = Gem::Specification.load(matches.first.loaded_from)
184
- write_spec(directory, real_spec)
185
- puts "Reloaded specification for #{name} from installed gems."
186
- else
187
- # the gem isn't installed locally - write out our current specs
188
- write_spec(directory, specification)
189
- puts "Gem #{name} not loaded locally - writing out current spec."
190
- end
191
- else
192
- if framework_gem?
193
- puts "Gem directory for #{name} not found - check if it's loading before rails."
194
- else
195
- puts "Something bad is going on - gem directory not found for #{name}."
196
- end
197
- end
198
- end
199
-
200
- def ==(other)
201
- self.name == other.name && self.requirement == other.requirement
202
- end
203
- alias_method :"eql?", :"=="
204
-
205
- def hash
206
- @dep.hash
207
- end
208
-
209
- def specification
210
- # code repeated from Gem.activate. Find a matching spec, or the currently loaded version.
211
- # error out if loaded version and requested version are incompatible.
212
- @spec ||= begin
213
- matches = Gem.source_index.search(@dep)
214
- matches << @@framework_gems[name] if framework_gem?
215
- if Gem.loaded_specs[name] then
216
- # This gem is already loaded. If the currently loaded gem is not in the
217
- # list of candidate gems, then we have a version conflict.
218
- existing_spec = Gem.loaded_specs[name]
219
- unless matches.any? { |spec| spec.version == existing_spec.version } then
220
- raise Gem::Exception,
221
- "can't activate #{@dep}, already activated #{existing_spec.full_name}"
222
- end
223
- # we're stuck with it, so change to match
224
- @dep.version_requirements = Gem::Requirement.create("=#{existing_spec.version}")
225
- existing_spec
226
- else
227
- # new load
228
- matches.last
229
- end
230
- end
231
- end
232
-
233
- private
234
- def gem_command
235
- RUBY_PLATFORM =~ /win32/ ? 'gem.bat' : 'gem'
236
- end
237
-
238
- def install_command
239
- cmd = %w(install) << name
240
- cmd << "--version" << %("#{requirement.to_s}") if requirement
241
- cmd << "--source" << @source if @source
242
- cmd
243
- end
244
-
245
- def unpack_command
246
- cmd = %w(unpack) << name
247
- cmd << "--version" << "= "+specification.version.to_s if requirement
248
- cmd
249
- end
250
- end
251
- end
@@ -1,342 +0,0 @@
1
- # Copyright (c) 2005 Zed A. Shaw
2
- # You can redistribute it and/or modify it under the same terms as Ruby.
3
- #
4
- # Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html
5
- # for more information.
6
-
7
- require 'optparse'
8
- require 'yaml'
9
- require 'etc'
10
-
11
- require 'mongrel'
12
- require 'rails/mongrel_server/handler'
13
-
14
- module Rails
15
- module MongrelServer
16
- def self.send_signal(signal, pid_file)
17
- pid = open(pid_file).read.to_i
18
- print "Sending #{signal} to Mongrel at PID #{pid}..."
19
- begin
20
- Process.kill(signal, pid)
21
- rescue Errno::ESRCH
22
- puts "Process does not exist. Not running."
23
- end
24
-
25
- puts "Done."
26
- end
27
-
28
- class RailsConfigurator < Mongrel::Configurator
29
- def setup_mime_types
30
- mime = {}
31
-
32
- if defaults[:mime_map]
33
- Mongrel.log("Loading additional MIME types from #{defaults[:mime_map]}")
34
- mime = load_mime_map(defaults[:mime_map], mime)
35
- end
36
-
37
- mime.each {|k,v| Mongrel::DirHandler::add_mime_type(k,v) }
38
- end
39
-
40
- def mount_rails(prefix)
41
- ENV['RAILS_ENV'] = defaults[:environment]
42
- ::RAILS_ENV.replace(defaults[:environment]) if defined?(::RAILS_ENV)
43
-
44
- env_location = "#{defaults[:cwd]}/config/environment"
45
- require env_location
46
-
47
- ActionController::Base.relative_url_root = defaults[:prefix]
48
- uri prefix, :handler => Rails::MongrelServer::RailsHandler.new
49
- end
50
- end
51
-
52
- class Start < GemPlugin::Plugin "/commands"
53
- include Mongrel::Command::Base
54
-
55
- def configure
56
- options [
57
- ["-e", "--environment ENV", "Rails environment to run as", :@environment, ENV['RAILS_ENV'] || "development"],
58
- ["-d", "--daemonize", "Run daemonized in the background", :@daemon, false],
59
- ['-p', '--port PORT', "Which port to bind to", :@port, 3000],
60
- ['-a', '--address ADDR', "Address to bind to", :@address, "0.0.0.0"],
61
- ['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"],
62
- ['-P', '--pid FILE', "Where to write the PID", :@pid_file, "tmp/pids/mongrel.pid"],
63
- ['-n', '--num-procs INT', "Number of processors active before clients denied", :@num_procs, 1024],
64
- ['-o', '--timeout TIME', "Time to wait (in seconds) before killing a stalled thread", :@timeout, 60],
65
- ['-t', '--throttle TIME', "Time to pause (in hundredths of a second) between accepting clients", :@throttle, 0],
66
- ['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil],
67
- ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, RAILS_ROOT],
68
- ['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, "public"],
69
- ['-B', '--debug', "Enable debugging mode", :@debug, false],
70
- ['-C', '--config PATH', "Use a config file", :@config_file, nil],
71
- ['-S', '--script PATH', "Load the given file as an extra config script", :@config_script, nil],
72
- ['-G', '--generate PATH', "Generate a config file for use with -C", :@generate, nil],
73
- ['', '--user USER', "User to run as", :@user, nil],
74
- ['', '--group GROUP', "Group to run as", :@group, nil],
75
- ['', '--prefix PATH', "URL prefix for Rails app", :@prefix, nil],
76
-
77
- ['-b', '--binding ADDR', "Address to bind to (deprecated, use -a)", :@address, "0.0.0.0"],
78
- ['-u', '--debugger', "Enable debugging mode (deprecated, use -B)", :@debug, false]
79
- ]
80
- end
81
-
82
- def validate
83
- if @config_file
84
- valid_exists?(@config_file, "Config file not there: #@config_file")
85
- return false unless @valid
86
- @config_file = File.expand_path(@config_file)
87
- load_config
88
- return false unless @valid
89
- end
90
-
91
- @cwd = File.expand_path(@cwd)
92
- valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
93
-
94
- # Change there to start, then we'll have to come back after daemonize
95
- Dir.chdir(@cwd)
96
-
97
- valid?(@prefix[0] == ?/ && @prefix[-1] != ?/, "Prefix must begin with / and not end in /") if @prefix
98
- valid_dir? File.dirname(@log_file), "Path to log file not valid: #@log_file"
99
- valid_dir? File.dirname(@pid_file), "Path to pid file not valid: #@pid_file"
100
- valid_dir? @docroot, "Path to docroot not valid: #@docroot"
101
- valid_exists? @mime_map, "MIME mapping file does not exist: #@mime_map" if @mime_map
102
- valid_exists? @config_file, "Config file not there: #@config_file" if @config_file
103
- valid_dir? File.dirname(@generate), "Problem accessing directory to #@generate" if @generate
104
- valid_user? @user if @user
105
- valid_group? @group if @group
106
-
107
- return @valid
108
- end
109
-
110
- def run
111
- if @generate
112
- @generate = File.expand_path(@generate)
113
- Mongrel.log(:error, "** Writing config to \"#@generate\".")
114
- open(@generate, "w") {|f| f.write(settings.to_yaml) }
115
- Mongrel.log(:error, "** Finished. Run \"mongrel_rails start -C #@generate\" to use the config file.")
116
- exit 0
117
- end
118
-
119
- config = RailsConfigurator.new(settings) do
120
- defaults[:log] = $stdout if defaults[:environment] == 'development'
121
-
122
- Mongrel.log("=> Rails #{Rails.version} application starting on http://#{defaults[:host]}:#{defaults[:port]}")
123
-
124
- unless defaults[:daemon]
125
- Mongrel.log("=> Call with -d to detach")
126
- Mongrel.log("=> Ctrl-C to shutdown server")
127
- start_debugger if defaults[:debug]
128
- end
129
-
130
- if defaults[:daemon]
131
- if File.exist? defaults[:pid_file]
132
- Mongrel.log(:error, "!!! PID file #{defaults[:pid_file]} already exists. Mongrel could be running already. Check your #{defaults[:log_file]} for errors.")
133
- Mongrel.log(:error, "!!! Exiting with error. You must stop mongrel and clear the .pid before I'll attempt a start.")
134
- exit 1
135
- end
136
-
137
- daemonize
138
-
139
- Mongrel.log("Daemonized, any open files are closed. Look at #{defaults[:pid_file]} and #{defaults[:log_file]} for info.")
140
- Mongrel.log("Settings loaded from #{@config_file} (they override command line).") if @config_file
141
- end
142
-
143
- Mongrel.log("Starting Mongrel listening at #{defaults[:host]}:#{defaults[:port]}, further information can be found in log/mongrel-#{defaults[:host]}-#{defaults[:port]}.log")
144
-
145
- listener do
146
- prefix = defaults[:prefix] || '/'
147
-
148
- if defaults[:debug]
149
- Mongrel.log("Installing debugging prefixed filters. Look in log/mongrel_debug for the files.")
150
- debug(prefix)
151
- end
152
-
153
- setup_mime_types
154
- dir_handler = Mongrel::DirHandler.new(defaults[:docroot], false)
155
- dir_handler.passthrough_missing_files = true
156
-
157
- unless defaults[:environment] == 'production'
158
- Mongrel.log("Mounting DirHandler at #{prefix}...")
159
- uri prefix, :handler => dir_handler
160
- end
161
-
162
-
163
- Mongrel.log("Starting Rails with #{defaults[:environment]} environment...")
164
- Mongrel.log("Mounting Rails at #{prefix}...")
165
- mount_rails(prefix)
166
- Mongrel.log("Rails loaded.")
167
-
168
-
169
- Mongrel.log("Loading any Rails specific GemPlugins" )
170
- load_plugins
171
-
172
- if defaults[:config_script]
173
- Mongrel.log("Loading #{defaults[:config_script]} external config script")
174
- run_config(defaults[:config_script])
175
- end
176
-
177
- setup_signals
178
- end
179
- end
180
-
181
- config.run
182
- Mongrel.log("Mongrel #{Mongrel::Const::MONGREL_VERSION} available at #{@address}:#{@port}")
183
-
184
- if config.defaults[:daemon]
185
- config.write_pid_file
186
- else
187
- Mongrel.log("Use CTRL-C to stop.")
188
- tail "log/#{config.defaults[:environment]}.log"
189
- end
190
-
191
- config.join
192
-
193
- if config.needs_restart
194
- unless RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw/
195
- cmd = "ruby #{__FILE__} start #{original_args.join(' ')}"
196
- Mongrel.log("Restarting with arguments: #{cmd}")
197
- config.stop(false, true)
198
- config.remove_pid_file
199
-
200
- if config.defaults[:daemon]
201
- system cmd
202
- else
203
- Mongrel.log(:error, "Can't restart unless in daemon mode.")
204
- exit 1
205
- end
206
- else
207
- Mongrel.log("Win32 does not support restarts. Exiting.")
208
- end
209
- end
210
- end
211
-
212
- def load_config
213
- settings = {}
214
- begin
215
- settings = YAML.load_file(@config_file)
216
- ensure
217
- Mongrel.log(:error, "** Loading settings from #{@config_file} (they override command line).") unless @daemon || settings[:daemon]
218
- end
219
-
220
- settings[:includes] ||= ["mongrel"]
221
-
222
- # Config file settings will override command line settings
223
- settings.each do |key, value|
224
- key = key.to_s
225
- if config_keys.include?(key)
226
- key = 'address' if key == 'host'
227
- self.instance_variable_set("@#{key}", value)
228
- else
229
- failure "Unknown configuration setting: #{key}"
230
- @valid = false
231
- end
232
- end
233
- end
234
-
235
- def config_keys
236
- @config_keys ||=
237
- %w(address host port cwd log_file pid_file environment docroot mime_map daemon debug includes config_script num_processors timeout throttle user group prefix)
238
- end
239
-
240
- def settings
241
- config_keys.inject({}) do |hash, key|
242
- value = self.instance_variable_get("@#{key}")
243
- key = 'host' if key == 'address'
244
- hash[key.to_sym] ||= value
245
- hash
246
- end
247
- end
248
-
249
- def start_debugger
250
- require_library_or_gem 'ruby-debug'
251
- Debugger.start
252
- Debugger.settings[:autoeval] = true if Debugger.respond_to?(:settings)
253
- Mongrel.log("=> Debugger enabled")
254
- rescue Exception
255
- Mongrel.log(:error, "You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'")
256
- exit
257
- end
258
-
259
- def tail(log_file)
260
- cursor = File.size(log_file)
261
- last_checked = Time.now
262
- tail_thread = Thread.new do
263
- File.open(log_file, 'r') do |f|
264
- loop do
265
- f.seek cursor
266
- if f.mtime > last_checked
267
- last_checked = f.mtime
268
- contents = f.read
269
- cursor += contents.length
270
- print contents
271
- end
272
- sleep 1
273
- end
274
- end
275
- end
276
- tail_thread
277
- end
278
- end
279
-
280
- class Stop < GemPlugin::Plugin "/commands"
281
- include Mongrel::Command::Base
282
-
283
- def configure
284
- options [
285
- ['-c', '--chdir PATH', "Change to dir before starting (will be expanded).", :@cwd, "."],
286
- ['-f', '--force', "Force the shutdown (kill -9).", :@force, false],
287
- ['-w', '--wait SECONDS', "Wait SECONDS before forcing shutdown", :@wait, "0"],
288
- ['-P', '--pid FILE', "Where the PID file is located.", :@pid_file, "log/mongrel.pid"]
289
- ]
290
- end
291
-
292
- def validate
293
- @cwd = File.expand_path(@cwd)
294
- valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
295
-
296
- Dir.chdir @cwd
297
-
298
- valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?"
299
- return @valid
300
- end
301
-
302
- def run
303
- if @force
304
- @wait.to_i.times do |waiting|
305
- exit(0) if not File.exist? @pid_file
306
- sleep 1
307
- end
308
-
309
- Mongrel::send_signal("KILL", @pid_file) if File.exist? @pid_file
310
- else
311
- Mongrel::send_signal("TERM", @pid_file)
312
- end
313
- end
314
- end
315
-
316
-
317
- class Restart < GemPlugin::Plugin "/commands"
318
- include Mongrel::Command::Base
319
-
320
- def configure
321
- options [
322
- ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, '.'],
323
- ['-P', '--pid FILE', "Where the PID file is located", :@pid_file, "log/mongrel.pid"]
324
- ]
325
- end
326
-
327
- def validate
328
- @cwd = File.expand_path(@cwd)
329
- valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
330
-
331
- Dir.chdir @cwd
332
-
333
- valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?"
334
- return @valid
335
- end
336
-
337
- def run
338
- MongrelServer::send_signal("USR2", @pid_file)
339
- end
340
- end
341
- end
342
- end