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.
- data/bin/rails +8 -18
- metadata +118 -452
- data/CHANGELOG +0 -2071
- data/MIT-LICENSE +0 -20
- data/README +0 -256
- data/Rakefile +0 -411
- data/bin/about +0 -4
- data/bin/console +0 -3
- data/bin/dbconsole +0 -3
- data/bin/destroy +0 -3
- data/bin/generate +0 -3
- data/bin/performance/benchmarker +0 -3
- data/bin/performance/profiler +0 -3
- data/bin/performance/request +0 -3
- data/bin/plugin +0 -3
- data/bin/process/inspector +0 -3
- data/bin/process/reaper +0 -3
- data/bin/process/spawner +0 -3
- data/bin/runner +0 -3
- data/bin/server +0 -3
- data/builtin/rails_info/rails/info.rb +0 -125
- data/builtin/rails_info/rails/info_controller.rb +0 -9
- data/builtin/rails_info/rails/info_helper.rb +0 -2
- data/builtin/rails_info/rails_info_controller.rb +0 -2
- data/config.ru +0 -17
- data/configs/apache.conf +0 -40
- data/configs/databases/frontbase.yml +0 -28
- data/configs/databases/ibm_db.yml +0 -62
- data/configs/databases/mysql.yml +0 -57
- data/configs/databases/oracle.yml +0 -39
- data/configs/databases/postgresql.yml +0 -51
- data/configs/databases/sqlite2.yml +0 -19
- data/configs/databases/sqlite3.yml +0 -22
- data/configs/empty.log +0 -0
- data/configs/initializers/inflections.rb +0 -10
- data/configs/initializers/mime_types.rb +0 -5
- data/configs/initializers/new_rails_defaults.rb +0 -17
- data/configs/lighttpd.conf +0 -54
- data/configs/locales/en.yml +0 -5
- data/configs/routes.rb +0 -43
- data/dispatches/dispatch.fcgi +0 -24
- data/dispatches/dispatch.rb +0 -10
- data/dispatches/gateway.cgi +0 -97
- data/doc/README_FOR_APP +0 -5
- data/doc/guides/html/2_2_release_notes.html +0 -1185
- data/doc/guides/html/actioncontroller_basics.html +0 -1270
- data/doc/guides/html/activerecord_validations_callbacks.html +0 -749
- data/doc/guides/html/association_basics.html +0 -2585
- data/doc/guides/html/authors.html +0 -240
- data/doc/guides/html/benchmarking_and_profiling.html +0 -1018
- data/doc/guides/html/caching_with_rails.html +0 -583
- data/doc/guides/html/command_line.html +0 -434
- data/doc/guides/html/configuring.html +0 -438
- data/doc/guides/html/creating_plugins.html +0 -1594
- data/doc/guides/html/debugging_rails_applications.html +0 -1175
- data/doc/guides/html/finders.html +0 -1090
- data/doc/guides/html/form_helpers.html +0 -638
- data/doc/guides/html/getting_started_with_rails.html +0 -2066
- data/doc/guides/html/index.html +0 -349
- data/doc/guides/html/layouts_and_rendering.html +0 -1406
- data/doc/guides/html/migrations.html +0 -921
- data/doc/guides/html/routing_outside_in.html +0 -2213
- data/doc/guides/html/security.html +0 -1346
- data/doc/guides/html/testing_rails_applications.html +0 -1859
- data/doc/guides/source/2_2_release_notes.txt +0 -435
- data/doc/guides/source/actioncontroller_basics/changelog.txt +0 -5
- data/doc/guides/source/actioncontroller_basics/cookies.txt +0 -34
- data/doc/guides/source/actioncontroller_basics/csrf.txt +0 -32
- data/doc/guides/source/actioncontroller_basics/filters.txt +0 -119
- data/doc/guides/source/actioncontroller_basics/http_auth.txt +0 -24
- data/doc/guides/source/actioncontroller_basics/index.txt +0 -40
- data/doc/guides/source/actioncontroller_basics/introduction.txt +0 -9
- data/doc/guides/source/actioncontroller_basics/methods.txt +0 -39
- data/doc/guides/source/actioncontroller_basics/parameter_filtering.txt +0 -14
- data/doc/guides/source/actioncontroller_basics/params.txt +0 -93
- data/doc/guides/source/actioncontroller_basics/request_response_objects.txt +0 -43
- data/doc/guides/source/actioncontroller_basics/rescue.txt +0 -67
- data/doc/guides/source/actioncontroller_basics/session.txt +0 -187
- data/doc/guides/source/actioncontroller_basics/streaming.txt +0 -91
- data/doc/guides/source/actioncontroller_basics/verification.txt +0 -40
- data/doc/guides/source/active_record_basics.txt +0 -181
- data/doc/guides/source/activerecord_validations_callbacks.txt +0 -404
- data/doc/guides/source/association_basics.txt +0 -1840
- data/doc/guides/source/authors.txt +0 -39
- data/doc/guides/source/benchmarking_and_profiling/appendix.txt +0 -95
- data/doc/guides/source/benchmarking_and_profiling/digging_deeper.txt +0 -105
- data/doc/guides/source/benchmarking_and_profiling/edge_rails_features.txt +0 -185
- data/doc/guides/source/benchmarking_and_profiling/gameplan.txt +0 -27
- data/doc/guides/source/benchmarking_and_profiling/index.txt +0 -242
- data/doc/guides/source/benchmarking_and_profiling/rubyprof.txt +0 -179
- data/doc/guides/source/benchmarking_and_profiling/statistics.txt +0 -57
- data/doc/guides/source/caching_with_rails.txt +0 -367
- data/doc/guides/source/command_line.txt +0 -147
- data/doc/guides/source/configuring.txt +0 -225
- data/doc/guides/source/creating_plugins/acts_as_yaffle.txt +0 -191
- data/doc/guides/source/creating_plugins/appendix.txt +0 -46
- data/doc/guides/source/creating_plugins/controllers.txt +0 -59
- data/doc/guides/source/creating_plugins/core_ext.txt +0 -123
- data/doc/guides/source/creating_plugins/custom_route.txt +0 -69
- data/doc/guides/source/creating_plugins/gem.txt +0 -1
- data/doc/guides/source/creating_plugins/generator_method.txt +0 -89
- data/doc/guides/source/creating_plugins/helpers.txt +0 -51
- data/doc/guides/source/creating_plugins/index.txt +0 -52
- data/doc/guides/source/creating_plugins/migration_generator.txt +0 -156
- data/doc/guides/source/creating_plugins/models.txt +0 -76
- data/doc/guides/source/creating_plugins/odds_and_ends.txt +0 -69
- data/doc/guides/source/creating_plugins/test_setup.txt +0 -230
- data/doc/guides/source/debugging_rails_applications.txt +0 -733
- data/doc/guides/source/finders.txt +0 -668
- data/doc/guides/source/form_helpers.txt +0 -345
- data/doc/guides/source/getting_started_with_rails.txt +0 -1256
- data/doc/guides/source/images/belongs_to.png +0 -0
- data/doc/guides/source/images/bullet.gif +0 -0
- data/doc/guides/source/images/csrf.png +0 -0
- data/doc/guides/source/images/habtm.png +0 -0
- data/doc/guides/source/images/has_many.png +0 -0
- data/doc/guides/source/images/has_many_through.png +0 -0
- data/doc/guides/source/images/has_one.png +0 -0
- data/doc/guides/source/images/has_one_through.png +0 -0
- data/doc/guides/source/images/header_backdrop.png +0 -0
- data/doc/guides/source/images/icons/README +0 -5
- data/doc/guides/source/images/icons/callouts/1.png +0 -0
- data/doc/guides/source/images/icons/callouts/10.png +0 -0
- data/doc/guides/source/images/icons/callouts/11.png +0 -0
- data/doc/guides/source/images/icons/callouts/12.png +0 -0
- data/doc/guides/source/images/icons/callouts/13.png +0 -0
- data/doc/guides/source/images/icons/callouts/14.png +0 -0
- data/doc/guides/source/images/icons/callouts/15.png +0 -0
- data/doc/guides/source/images/icons/callouts/2.png +0 -0
- data/doc/guides/source/images/icons/callouts/3.png +0 -0
- data/doc/guides/source/images/icons/callouts/4.png +0 -0
- data/doc/guides/source/images/icons/callouts/5.png +0 -0
- data/doc/guides/source/images/icons/callouts/6.png +0 -0
- data/doc/guides/source/images/icons/callouts/7.png +0 -0
- data/doc/guides/source/images/icons/callouts/8.png +0 -0
- data/doc/guides/source/images/icons/callouts/9.png +0 -0
- data/doc/guides/source/images/icons/caution.png +0 -0
- data/doc/guides/source/images/icons/example.png +0 -0
- data/doc/guides/source/images/icons/home.png +0 -0
- data/doc/guides/source/images/icons/important.png +0 -0
- data/doc/guides/source/images/icons/next.png +0 -0
- data/doc/guides/source/images/icons/note.png +0 -0
- data/doc/guides/source/images/icons/prev.png +0 -0
- data/doc/guides/source/images/icons/tip.png +0 -0
- data/doc/guides/source/images/icons/up.png +0 -0
- data/doc/guides/source/images/icons/warning.png +0 -0
- data/doc/guides/source/images/polymorphic.png +0 -0
- data/doc/guides/source/images/rails_logo_remix.gif +0 -0
- data/doc/guides/source/images/ruby_on_rails_by_mike_rundle2.gif +0 -0
- data/doc/guides/source/images/session_fixation.png +0 -0
- data/doc/guides/source/index.txt +0 -118
- data/doc/guides/source/layouts_and_rendering.txt +0 -982
- data/doc/guides/source/migrations/anatomy_of_a_migration.txt +0 -85
- data/doc/guides/source/migrations/changelog.txt +0 -5
- data/doc/guides/source/migrations/creating_a_migration.txt +0 -109
- data/doc/guides/source/migrations/foreign_keys.txt +0 -8
- data/doc/guides/source/migrations/index.txt +0 -22
- data/doc/guides/source/migrations/rakeing_around.txt +0 -111
- data/doc/guides/source/migrations/scheming.txt +0 -47
- data/doc/guides/source/migrations/using_models_in_migrations.txt +0 -46
- data/doc/guides/source/migrations/writing_a_migration.txt +0 -159
- data/doc/guides/source/routing_outside_in.txt +0 -986
- data/doc/guides/source/security.txt +0 -984
- data/doc/guides/source/stylesheets/base.css +0 -358
- data/doc/guides/source/stylesheets/forms.css +0 -35
- data/doc/guides/source/stylesheets/more.css +0 -82
- data/doc/guides/source/templates/guides.html.erb +0 -97
- data/doc/guides/source/templates/inline.css +0 -165
- data/doc/guides/source/testing_rails_applications.txt +0 -995
- data/environments/boot.rb +0 -109
- data/environments/development.rb +0 -17
- data/environments/environment.rb +0 -75
- data/environments/production.rb +0 -24
- data/environments/test.rb +0 -22
- data/fresh_rakefile +0 -10
- data/helpers/application.rb +0 -15
- data/helpers/application_helper.rb +0 -3
- data/helpers/performance_test.rb +0 -9
- data/helpers/test_helper.rb +0 -38
- data/html/404.html +0 -30
- data/html/422.html +0 -30
- data/html/500.html +0 -33
- data/html/favicon.ico +0 -0
- data/html/images/rails.png +0 -0
- data/html/index.html +0 -274
- data/html/javascripts/application.js +0 -2
- data/html/javascripts/controls.js +0 -963
- data/html/javascripts/dragdrop.js +0 -973
- data/html/javascripts/effects.js +0 -1128
- data/html/javascripts/prototype.js +0 -4320
- data/html/robots.txt +0 -5
- data/lib/code_statistics.rb +0 -107
- data/lib/commands.rb +0 -17
- data/lib/commands/about.rb +0 -3
- data/lib/commands/console.rb +0 -45
- data/lib/commands/dbconsole.rb +0 -67
- data/lib/commands/destroy.rb +0 -6
- data/lib/commands/generate.rb +0 -6
- data/lib/commands/ncgi/listener +0 -86
- data/lib/commands/ncgi/tracker +0 -69
- data/lib/commands/performance/benchmarker.rb +0 -24
- data/lib/commands/performance/profiler.rb +0 -50
- data/lib/commands/performance/request.rb +0 -6
- data/lib/commands/plugin.rb +0 -967
- data/lib/commands/process/inspector.rb +0 -68
- data/lib/commands/process/reaper.rb +0 -149
- data/lib/commands/process/spawner.rb +0 -219
- data/lib/commands/process/spinner.rb +0 -57
- data/lib/commands/runner.rb +0 -48
- data/lib/commands/server.rb +0 -49
- data/lib/commands/servers/base.rb +0 -31
- data/lib/commands/servers/lighttpd.rb +0 -94
- data/lib/commands/servers/mongrel.rb +0 -69
- data/lib/commands/servers/new_mongrel.rb +0 -16
- data/lib/commands/servers/thin.rb +0 -25
- data/lib/commands/servers/webrick.rb +0 -66
- data/lib/commands/update.rb +0 -4
- data/lib/console_app.rb +0 -30
- data/lib/console_sandbox.rb +0 -6
- data/lib/console_with_helpers.rb +0 -26
- data/lib/dispatcher.rb +0 -24
- data/lib/fcgi_handler.rb +0 -237
- data/lib/initializer.rb +0 -1038
- data/lib/performance_test_help.rb +0 -5
- data/lib/rails/gem_builder.rb +0 -21
- data/lib/rails/gem_dependency.rb +0 -251
- data/lib/rails/mongrel_server/commands.rb +0 -342
- data/lib/rails/mongrel_server/handler.rb +0 -55
- data/lib/rails/plugin.rb +0 -124
- data/lib/rails/plugin/loader.rb +0 -152
- data/lib/rails/plugin/locator.rb +0 -100
- data/lib/rails/rack.rb +0 -6
- data/lib/rails/rack/logger.rb +0 -28
- data/lib/rails/rack/static.rb +0 -35
- data/lib/rails/vendor_gem_source_index.rb +0 -140
- data/lib/rails/version.rb +0 -9
- data/lib/rails_generator.rb +0 -43
- data/lib/rails_generator/base.rb +0 -263
- data/lib/rails_generator/commands.rb +0 -616
- data/lib/rails_generator/generated_attribute.rb +0 -46
- data/lib/rails_generator/generators/applications/app/USAGE +0 -9
- data/lib/rails_generator/generators/applications/app/app_generator.rb +0 -184
- data/lib/rails_generator/generators/components/controller/USAGE +0 -29
- data/lib/rails_generator/generators/components/controller/controller_generator.rb +0 -37
- data/lib/rails_generator/generators/components/controller/templates/controller.rb +0 -7
- data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +0 -8
- data/lib/rails_generator/generators/components/controller/templates/helper.rb +0 -2
- data/lib/rails_generator/generators/components/controller/templates/view.html.erb +0 -2
- data/lib/rails_generator/generators/components/integration_test/USAGE +0 -8
- data/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb +0 -16
- data/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb +0 -10
- data/lib/rails_generator/generators/components/mailer/USAGE +0 -16
- data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +0 -30
- data/lib/rails_generator/generators/components/mailer/templates/fixture.erb +0 -3
- data/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml +0 -0
- data/lib/rails_generator/generators/components/mailer/templates/mailer.rb +0 -15
- data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +0 -20
- data/lib/rails_generator/generators/components/mailer/templates/view.erb +0 -3
- data/lib/rails_generator/generators/components/mailer/templates/view.rhtml +0 -0
- data/lib/rails_generator/generators/components/migration/USAGE +0 -29
- data/lib/rails_generator/generators/components/migration/migration_generator.rb +0 -20
- data/lib/rails_generator/generators/components/migration/templates/migration.rb +0 -11
- data/lib/rails_generator/generators/components/model/USAGE +0 -27
- data/lib/rails_generator/generators/components/model/model_generator.rb +0 -45
- data/lib/rails_generator/generators/components/model/templates/fixtures.yml +0 -19
- data/lib/rails_generator/generators/components/model/templates/migration.rb +0 -16
- data/lib/rails_generator/generators/components/model/templates/model.rb +0 -5
- data/lib/rails_generator/generators/components/model/templates/unit_test.rb +0 -8
- data/lib/rails_generator/generators/components/observer/USAGE +0 -13
- data/lib/rails_generator/generators/components/observer/observer_generator.rb +0 -16
- data/lib/rails_generator/generators/components/observer/templates/observer.rb +0 -2
- data/lib/rails_generator/generators/components/observer/templates/unit_test.rb +0 -8
- data/lib/rails_generator/generators/components/performance_test/USAGE +0 -8
- data/lib/rails_generator/generators/components/performance_test/performance_test_generator.rb +0 -16
- data/lib/rails_generator/generators/components/performance_test/templates/performance_test.rb +0 -9
- data/lib/rails_generator/generators/components/plugin/USAGE +0 -25
- data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +0 -39
- data/lib/rails_generator/generators/components/plugin/templates/MIT-LICENSE +0 -20
- data/lib/rails_generator/generators/components/plugin/templates/README +0 -13
- data/lib/rails_generator/generators/components/plugin/templates/Rakefile +0 -23
- data/lib/rails_generator/generators/components/plugin/templates/USAGE +0 -8
- data/lib/rails_generator/generators/components/plugin/templates/generator.rb +0 -8
- data/lib/rails_generator/generators/components/plugin/templates/init.rb +0 -1
- data/lib/rails_generator/generators/components/plugin/templates/install.rb +0 -1
- data/lib/rails_generator/generators/components/plugin/templates/plugin.rb +0 -1
- data/lib/rails_generator/generators/components/plugin/templates/tasks.rake +0 -4
- data/lib/rails_generator/generators/components/plugin/templates/test_helper.rb +0 -3
- data/lib/rails_generator/generators/components/plugin/templates/uninstall.rb +0 -1
- data/lib/rails_generator/generators/components/plugin/templates/unit_test.rb +0 -8
- data/lib/rails_generator/generators/components/resource/USAGE +0 -23
- data/lib/rails_generator/generators/components/resource/resource_generator.rb +0 -74
- data/lib/rails_generator/generators/components/resource/templates/controller.rb +0 -2
- data/lib/rails_generator/generators/components/resource/templates/functional_test.rb +0 -8
- data/lib/rails_generator/generators/components/resource/templates/helper.rb +0 -2
- data/lib/rails_generator/generators/components/scaffold/USAGE +0 -29
- data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +0 -100
- data/lib/rails_generator/generators/components/scaffold/templates/controller.rb +0 -85
- data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +0 -45
- data/lib/rails_generator/generators/components/scaffold/templates/helper.rb +0 -2
- data/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb +0 -17
- data/lib/rails_generator/generators/components/scaffold/templates/style.css +0 -54
- data/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb +0 -18
- data/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb +0 -24
- data/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb +0 -17
- data/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb +0 -10
- data/lib/rails_generator/generators/components/session_migration/USAGE +0 -10
- data/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb +0 -18
- data/lib/rails_generator/generators/components/session_migration/templates/migration.rb +0 -16
- data/lib/rails_generator/lookup.rb +0 -249
- data/lib/rails_generator/manifest.rb +0 -53
- data/lib/rails_generator/options.rb +0 -150
- data/lib/rails_generator/scripts.rb +0 -89
- data/lib/rails_generator/scripts/destroy.rb +0 -29
- data/lib/rails_generator/scripts/generate.rb +0 -7
- data/lib/rails_generator/scripts/update.rb +0 -12
- data/lib/rails_generator/secret_key_generator.rb +0 -22
- data/lib/rails_generator/simple_logger.rb +0 -46
- data/lib/rails_generator/spec.rb +0 -44
- data/lib/railties_path.rb +0 -1
- data/lib/ruby_version_check.rb +0 -17
- data/lib/rubyprof_ext.rb +0 -35
- data/lib/source_annotation_extractor.rb +0 -102
- data/lib/tasks/annotations.rake +0 -20
- data/lib/tasks/databases.rake +0 -416
- data/lib/tasks/documentation.rake +0 -95
- data/lib/tasks/framework.rake +0 -118
- data/lib/tasks/gems.rake +0 -80
- data/lib/tasks/log.rake +0 -9
- data/lib/tasks/misc.rake +0 -56
- data/lib/tasks/rails.rb +0 -8
- data/lib/tasks/routes.rake +0 -17
- data/lib/tasks/statistics.rake +0 -18
- data/lib/tasks/testing.rake +0 -139
- data/lib/tasks/tmp.rake +0 -37
- data/lib/test_help.rb +0 -27
- data/lib/webrick_server.rb +0 -156
@@ -1,150 +0,0 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
|
3
|
-
module Rails
|
4
|
-
module Generator
|
5
|
-
module Options
|
6
|
-
def self.included(base)
|
7
|
-
base.extend(ClassMethods)
|
8
|
-
class << base
|
9
|
-
if respond_to?(:inherited)
|
10
|
-
alias_method :inherited_without_options, :inherited
|
11
|
-
end
|
12
|
-
alias_method :inherited, :inherited_with_options
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
module ClassMethods
|
17
|
-
def inherited_with_options(sub)
|
18
|
-
inherited_without_options(sub) if respond_to?(:inherited_without_options)
|
19
|
-
sub.extend(Rails::Generator::Options::ClassMethods)
|
20
|
-
end
|
21
|
-
|
22
|
-
def mandatory_options(options = nil)
|
23
|
-
if options
|
24
|
-
write_inheritable_attribute(:mandatory_options, options)
|
25
|
-
else
|
26
|
-
read_inheritable_attribute(:mandatory_options) or write_inheritable_attribute(:mandatory_options, {})
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def default_options(options = nil)
|
31
|
-
if options
|
32
|
-
write_inheritable_attribute(:default_options, options)
|
33
|
-
else
|
34
|
-
read_inheritable_attribute(:default_options) or write_inheritable_attribute(:default_options, {})
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# Merge together our class options. In increasing precedence:
|
39
|
-
# default_options (class default options)
|
40
|
-
# runtime_options (provided as argument)
|
41
|
-
# mandatory_options (class mandatory options)
|
42
|
-
def full_options(runtime_options = {})
|
43
|
-
default_options.merge(runtime_options).merge(mandatory_options)
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
# Each instance has an options hash that's populated by #parse.
|
49
|
-
def options
|
50
|
-
@options ||= {}
|
51
|
-
end
|
52
|
-
attr_writer :options
|
53
|
-
|
54
|
-
protected
|
55
|
-
# Convenient access to class mandatory options.
|
56
|
-
def mandatory_options
|
57
|
-
self.class.mandatory_options
|
58
|
-
end
|
59
|
-
|
60
|
-
# Convenient access to class default options.
|
61
|
-
def default_options
|
62
|
-
self.class.default_options
|
63
|
-
end
|
64
|
-
|
65
|
-
# Merge together our instance options. In increasing precedence:
|
66
|
-
# default_options (class default options)
|
67
|
-
# options (instance options)
|
68
|
-
# runtime_options (provided as argument)
|
69
|
-
# mandatory_options (class mandatory options)
|
70
|
-
def full_options(runtime_options = {})
|
71
|
-
self.class.full_options(options.merge(runtime_options))
|
72
|
-
end
|
73
|
-
|
74
|
-
# Parse arguments into the options hash. Classes may customize
|
75
|
-
# parsing behavior by overriding these methods:
|
76
|
-
# #banner Usage: ./script/generate [options]
|
77
|
-
# #add_options! Options:
|
78
|
-
# some options..
|
79
|
-
# #add_general_options! General Options:
|
80
|
-
# general options..
|
81
|
-
def parse!(args, runtime_options = {})
|
82
|
-
self.options = {}
|
83
|
-
|
84
|
-
@option_parser = OptionParser.new do |opt|
|
85
|
-
opt.banner = banner
|
86
|
-
add_options!(opt)
|
87
|
-
add_general_options!(opt)
|
88
|
-
opt.parse!(args)
|
89
|
-
end
|
90
|
-
|
91
|
-
return args
|
92
|
-
ensure
|
93
|
-
self.options = full_options(runtime_options)
|
94
|
-
end
|
95
|
-
|
96
|
-
# Raise a usage error. Override usage_message to provide a blurb
|
97
|
-
# after the option parser summary.
|
98
|
-
def usage(message = usage_message)
|
99
|
-
raise UsageError, "#{@option_parser}\n#{message}"
|
100
|
-
end
|
101
|
-
|
102
|
-
def usage_message
|
103
|
-
''
|
104
|
-
end
|
105
|
-
|
106
|
-
# Override with your own usage banner.
|
107
|
-
def banner
|
108
|
-
"Usage: #{$0} [options]"
|
109
|
-
end
|
110
|
-
|
111
|
-
# Override to add your options to the parser:
|
112
|
-
# def add_options!(opt)
|
113
|
-
# opt.on('-v', '--verbose') { |value| options[:verbose] = value }
|
114
|
-
# end
|
115
|
-
def add_options!(opt)
|
116
|
-
end
|
117
|
-
|
118
|
-
# Adds general options like -h and --quiet. Usually don't override.
|
119
|
-
def add_general_options!(opt)
|
120
|
-
opt.separator ''
|
121
|
-
opt.separator 'Rails Info:'
|
122
|
-
opt.on('-v', '--version', 'Show the Rails version number and quit.')
|
123
|
-
opt.on('-h', '--help', 'Show this help message and quit.') { |v| options[:help] = v }
|
124
|
-
|
125
|
-
opt.separator ''
|
126
|
-
opt.separator 'General Options:'
|
127
|
-
|
128
|
-
opt.on('-p', '--pretend', 'Run but do not make any changes.') { |v| options[:pretend] = v }
|
129
|
-
opt.on('-f', '--force', 'Overwrite files that already exist.') { options[:collision] = :force }
|
130
|
-
opt.on('-s', '--skip', 'Skip files that already exist.') { options[:collision] = :skip }
|
131
|
-
opt.on('-q', '--quiet', 'Suppress normal output.') { |v| options[:quiet] = v }
|
132
|
-
opt.on('-t', '--backtrace', 'Debugging: show backtrace on errors.') { |v| options[:backtrace] = v }
|
133
|
-
opt.on('-c', '--svn', 'Modify files with subversion. (Note: svn must be in path)') do
|
134
|
-
options[:svn] = `svn status`.inject({}) do |opt, e|
|
135
|
-
opt[e.chomp[7..-1]] = true
|
136
|
-
opt
|
137
|
-
end
|
138
|
-
end
|
139
|
-
opt.on('-g', '--git', 'Modify files with git. (Note: git must be in path)') do
|
140
|
-
options[:git] = `git status`.inject({:new => {}, :modified => {}}) do |opt, e|
|
141
|
-
opt[:new][e.chomp[14..-1]] = true if e =~ /new file:/
|
142
|
-
opt[:modified][e.chomp[14..-1]] = true if e =~ /modified:/
|
143
|
-
opt
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
@@ -1,89 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/options'
|
2
|
-
|
3
|
-
module Rails
|
4
|
-
module Generator
|
5
|
-
module Scripts
|
6
|
-
|
7
|
-
# Generator scripts handle command-line invocation. Each script
|
8
|
-
# responds to an invoke! class method which handles option parsing
|
9
|
-
# and generator invocation.
|
10
|
-
class Base
|
11
|
-
include Options
|
12
|
-
default_options :collision => :ask, :quiet => false
|
13
|
-
|
14
|
-
# Run the generator script. Takes an array of unparsed arguments
|
15
|
-
# and a hash of parsed arguments, takes the generator as an option
|
16
|
-
# or first remaining argument, and invokes the requested command.
|
17
|
-
def run(args = [], runtime_options = {})
|
18
|
-
begin
|
19
|
-
parse!(args.dup, runtime_options)
|
20
|
-
rescue OptionParser::InvalidOption => e
|
21
|
-
# Don't cry, script. Generators want what you think is invalid.
|
22
|
-
end
|
23
|
-
|
24
|
-
# Generator name is the only required option.
|
25
|
-
unless options[:generator]
|
26
|
-
usage if args.empty?
|
27
|
-
options[:generator] ||= args.shift
|
28
|
-
end
|
29
|
-
|
30
|
-
# Look up generator instance and invoke command on it.
|
31
|
-
Rails::Generator::Base.instance(options[:generator], args, options).command(options[:command]).invoke!
|
32
|
-
rescue => e
|
33
|
-
puts e
|
34
|
-
puts " #{e.backtrace.join("\n ")}\n" if options[:backtrace]
|
35
|
-
raise SystemExit
|
36
|
-
end
|
37
|
-
|
38
|
-
protected
|
39
|
-
# Override with your own script usage banner.
|
40
|
-
def banner
|
41
|
-
"Usage: #{$0} generator [options] [args]"
|
42
|
-
end
|
43
|
-
|
44
|
-
def usage_message
|
45
|
-
usage = "\nInstalled Generators\n"
|
46
|
-
Rails::Generator::Base.sources.inject([]) do |mem, source|
|
47
|
-
# Using an association list instead of a hash to preserve order,
|
48
|
-
# for aesthetic reasons more than anything else.
|
49
|
-
label = source.label.to_s.capitalize
|
50
|
-
pair = mem.assoc(label)
|
51
|
-
mem << (pair = [label, []]) if pair.nil?
|
52
|
-
pair[1] |= source.names
|
53
|
-
mem
|
54
|
-
end.each do |label, names|
|
55
|
-
usage << " #{label}: #{names.join(', ')}\n" unless names.empty?
|
56
|
-
end
|
57
|
-
|
58
|
-
usage << <<end_blurb
|
59
|
-
|
60
|
-
More are available at http://wiki.rubyonrails.org/rails/pages/AvailableGenerators
|
61
|
-
1. Download, for example, login_generator.zip
|
62
|
-
2. Unzip to directory #{Dir.user_home}/.rails/generators/login
|
63
|
-
to use the generator with all your Rails apps
|
64
|
-
end_blurb
|
65
|
-
|
66
|
-
if Object.const_defined?(:RAILS_ROOT)
|
67
|
-
usage << <<end_blurb
|
68
|
-
or to #{File.expand_path(RAILS_ROOT)}/lib/generators/login
|
69
|
-
to use with this app only.
|
70
|
-
end_blurb
|
71
|
-
end
|
72
|
-
|
73
|
-
usage << <<end_blurb
|
74
|
-
3. Run generate with no arguments for usage information
|
75
|
-
#{$0} login
|
76
|
-
|
77
|
-
Generator gems are also available:
|
78
|
-
1. gem search -r generator
|
79
|
-
2. gem install login_generator
|
80
|
-
3. #{$0} login
|
81
|
-
|
82
|
-
end_blurb
|
83
|
-
return usage
|
84
|
-
end
|
85
|
-
end # Base
|
86
|
-
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../scripts'
|
2
|
-
|
3
|
-
module Rails::Generator::Scripts
|
4
|
-
class Destroy < Base
|
5
|
-
mandatory_options :command => :destroy
|
6
|
-
|
7
|
-
protected
|
8
|
-
def usage_message
|
9
|
-
usage = "\nInstalled Generators\n"
|
10
|
-
Rails::Generator::Base.sources.each do |source|
|
11
|
-
label = source.label.to_s.capitalize
|
12
|
-
names = source.names
|
13
|
-
usage << " #{label}: #{names.join(', ')}\n" unless names.empty?
|
14
|
-
end
|
15
|
-
|
16
|
-
usage << <<end_blurb
|
17
|
-
|
18
|
-
script/generate command. For instance, 'script/destroy migration CreatePost'
|
19
|
-
will delete the appropriate XXX_create_post.rb migration file in db/migrate,
|
20
|
-
while 'script/destroy scaffold Post' will delete the posts controller and
|
21
|
-
views, post model and migration, all associated tests, and the map.resources
|
22
|
-
:posts line in config/routes.rb.
|
23
|
-
|
24
|
-
For instructions on finding new generators, run script/generate.
|
25
|
-
end_blurb
|
26
|
-
return usage
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Rails
|
2
|
-
# A class for creating random secret keys. This class will do its best to create a
|
3
|
-
# random secret key that's as secure as possible, using whatever methods are
|
4
|
-
# available on the current platform. For example:
|
5
|
-
#
|
6
|
-
# generator = Rails::SecretKeyGenerator("some unique identifier, such as the application name")
|
7
|
-
# generator.generate_secret # => "f3f1be90053fa851... (some long string)"
|
8
|
-
#
|
9
|
-
# This class is *deprecated* in Rails 2.2 in favor of ActiveSupport::SecureRandom.
|
10
|
-
# It is currently a wrapper around ActiveSupport::SecureRandom.
|
11
|
-
class SecretKeyGenerator
|
12
|
-
def initialize(identifier)
|
13
|
-
end
|
14
|
-
|
15
|
-
# Generate a random secret key with the best possible method available on
|
16
|
-
# the current platform.
|
17
|
-
def generate_secret
|
18
|
-
ActiveSupport::SecureRandom.hex(64)
|
19
|
-
end
|
20
|
-
deprecate :generate_secret=>"You should use ActiveSupport::SecureRandom.hex(64)"
|
21
|
-
end
|
22
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module Rails
|
2
|
-
module Generator
|
3
|
-
class SimpleLogger # :nodoc:
|
4
|
-
attr_reader :out
|
5
|
-
attr_accessor :quiet
|
6
|
-
|
7
|
-
def initialize(out = $stdout)
|
8
|
-
@out = out
|
9
|
-
@quiet = false
|
10
|
-
@level = 0
|
11
|
-
end
|
12
|
-
|
13
|
-
def log(status, message, &block)
|
14
|
-
@out.print("%12s %s%s\n" % [status, ' ' * @level, message]) unless quiet
|
15
|
-
indent(&block) if block_given?
|
16
|
-
end
|
17
|
-
|
18
|
-
def indent(&block)
|
19
|
-
@level += 1
|
20
|
-
if block_given?
|
21
|
-
begin
|
22
|
-
block.call
|
23
|
-
ensure
|
24
|
-
outdent
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def outdent
|
30
|
-
@level -= 1
|
31
|
-
if block_given?
|
32
|
-
begin
|
33
|
-
block.call
|
34
|
-
ensure
|
35
|
-
indent
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
def method_missing(method, *args, &block)
|
42
|
-
log(method.to_s, args.first, &block)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/lib/rails_generator/spec.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
module Rails
|
2
|
-
module Generator
|
3
|
-
# A spec knows where a generator was found and how to instantiate it.
|
4
|
-
# Metadata include the generator's name, its base path, and the source
|
5
|
-
# which yielded it (PathSource, GemPathSource, etc.)
|
6
|
-
class Spec
|
7
|
-
attr_reader :name, :path, :source
|
8
|
-
|
9
|
-
def initialize(name, path, source)
|
10
|
-
@name, @path, @source = name, path, source
|
11
|
-
end
|
12
|
-
|
13
|
-
# Look up the generator class. Require its class file, find the class
|
14
|
-
# in ObjectSpace, tag it with this spec, and return.
|
15
|
-
def klass
|
16
|
-
unless @klass
|
17
|
-
require class_file
|
18
|
-
@klass = lookup_class
|
19
|
-
@klass.spec = self
|
20
|
-
end
|
21
|
-
@klass
|
22
|
-
end
|
23
|
-
|
24
|
-
def class_file
|
25
|
-
"#{path}/#{name}_generator.rb"
|
26
|
-
end
|
27
|
-
|
28
|
-
def class_name
|
29
|
-
"#{name.camelize}Generator"
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
# Search for the first Class descending from Rails::Generator::Base
|
34
|
-
# whose name matches the requested class name.
|
35
|
-
def lookup_class
|
36
|
-
ObjectSpace.each_object(Class) do |obj|
|
37
|
-
return obj if obj.ancestors.include?(Rails::Generator::Base) and
|
38
|
-
obj.name.split('::').last == class_name
|
39
|
-
end
|
40
|
-
raise NameError, "Missing #{class_name} class in #{class_file}"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/lib/railties_path.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
RAILTIES_PATH = File.join(File.dirname(__FILE__), '..')
|
data/lib/ruby_version_check.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
min_release = "1.8.2 (2004-12-25)"
|
2
|
-
ruby_release = "#{RUBY_VERSION} (#{RUBY_RELEASE_DATE})"
|
3
|
-
if ruby_release =~ /1\.8\.3/
|
4
|
-
abort <<-end_message
|
5
|
-
|
6
|
-
Rails does not work with Ruby version 1.8.3.
|
7
|
-
Please upgrade to version 1.8.4 or downgrade to 1.8.2.
|
8
|
-
|
9
|
-
end_message
|
10
|
-
elsif ruby_release < min_release
|
11
|
-
abort <<-end_message
|
12
|
-
|
13
|
-
Rails requires Ruby version #{min_release} or later.
|
14
|
-
You're running #{ruby_release}; please upgrade to continue.
|
15
|
-
|
16
|
-
end_message
|
17
|
-
end
|
data/lib/rubyprof_ext.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'prof'
|
2
|
-
|
3
|
-
module Prof #:nodoc:
|
4
|
-
# Adapted from Shugo Maeda's unprof.rb
|
5
|
-
def self.print_profile(results, io = $stderr)
|
6
|
-
total = results.detect { |i|
|
7
|
-
i.method_class.nil? && i.method_id == :"#toplevel"
|
8
|
-
}.total_time
|
9
|
-
total = 0.001 if total < 0.001
|
10
|
-
|
11
|
-
io.puts " %% cumulative self self total"
|
12
|
-
io.puts " time seconds seconds calls ms/call ms/call name"
|
13
|
-
|
14
|
-
sum = 0.0
|
15
|
-
for r in results
|
16
|
-
sum += r.self_time
|
17
|
-
|
18
|
-
name = if r.method_class.nil?
|
19
|
-
r.method_id.to_s
|
20
|
-
elsif r.method_class.is_a?(Class)
|
21
|
-
"#{r.method_class}##{r.method_id}"
|
22
|
-
else
|
23
|
-
"#{r.method_class}.#{r.method_id}"
|
24
|
-
end
|
25
|
-
io.printf "%6.2f %8.3f %8.3f %8d %8.2f %8.2f %s\n",
|
26
|
-
r.self_time / total * 100,
|
27
|
-
sum,
|
28
|
-
r.self_time,
|
29
|
-
r.count,
|
30
|
-
r.self_time * 1000 / r.count,
|
31
|
-
r.total_time * 1000 / r.count,
|
32
|
-
name
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|