railties 3.1.12 → 3.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +2292 -41
- data/README.rdoc +14 -5
- data/bin/rails +7 -0
- data/guides/code/getting_started/Gemfile +27 -0
- data/guides/code/getting_started/README.rdoc +261 -0
- data/guides/code/getting_started/Rakefile +7 -0
- data/guides/code/getting_started/app/assets/images/rails.png +0 -0
- data/guides/code/getting_started/app/assets/javascripts/application.js +9 -0
- data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/javascripts/home.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/application.css +7 -0
- data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/home.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss +56 -0
- data/guides/code/getting_started/app/controllers/application_controller.rb +3 -0
- data/guides/code/getting_started/app/controllers/comments_controller.rb +16 -0
- data/guides/code/getting_started/app/controllers/home_controller.rb +5 -0
- data/guides/code/getting_started/app/controllers/posts_controller.rb +84 -0
- data/guides/code/getting_started/app/helpers/application_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/comments_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/home_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/posts_helper.rb +5 -0
- data/guides/code/getting_started/app/models/comment.rb +3 -0
- data/guides/code/getting_started/app/models/post.rb +11 -0
- data/guides/code/getting_started/app/models/tag.rb +3 -0
- data/guides/code/getting_started/app/views/comments/_comment.html.erb +15 -0
- data/guides/code/getting_started/app/views/comments/_form.html.erb +13 -0
- data/guides/code/getting_started/app/views/home/index.html.erb +2 -0
- data/guides/code/getting_started/app/views/layouts/application.html.erb +14 -0
- data/guides/code/getting_started/app/views/posts/_form.html.erb +32 -0
- data/guides/code/getting_started/app/views/posts/edit.html.erb +6 -0
- data/guides/code/getting_started/app/views/posts/index.html.erb +27 -0
- data/guides/code/getting_started/app/views/posts/new.html.erb +5 -0
- data/guides/code/getting_started/app/views/posts/show.html.erb +31 -0
- data/guides/code/getting_started/app/views/tags/_form.html.erb +12 -0
- data/guides/code/getting_started/config.ru +4 -0
- data/guides/code/getting_started/config/application.rb +53 -0
- data/guides/code/getting_started/config/boot.rb +6 -0
- data/guides/code/getting_started/config/database.yml +25 -0
- data/guides/code/getting_started/config/environment.rb +5 -0
- data/guides/code/getting_started/config/environments/development.rb +37 -0
- data/guides/code/getting_started/config/environments/production.rb +67 -0
- data/guides/code/getting_started/config/environments/test.rb +37 -0
- data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +7 -0
- data/guides/code/getting_started/config/initializers/inflections.rb +10 -0
- data/guides/code/getting_started/config/initializers/mime_types.rb +5 -0
- data/guides/code/getting_started/config/initializers/secret_token.rb +7 -0
- data/guides/code/getting_started/config/initializers/session_store.rb +8 -0
- data/guides/code/getting_started/config/initializers/wrap_parameters.rb +14 -0
- data/guides/code/getting_started/config/locales/en.yml +5 -0
- data/guides/code/getting_started/config/routes.rb +64 -0
- data/guides/code/getting_started/db/migrate/20110901012504_create_posts.rb +11 -0
- data/guides/code/getting_started/db/migrate/20110901012815_create_comments.rb +12 -0
- data/guides/code/getting_started/db/migrate/20110901013701_create_tags.rb +11 -0
- data/guides/code/getting_started/db/schema.rb +43 -0
- data/guides/code/getting_started/db/seeds.rb +7 -0
- data/guides/code/getting_started/doc/README_FOR_APP +2 -0
- data/guides/code/getting_started/public/404.html +26 -0
- data/guides/code/getting_started/public/422.html +26 -0
- data/guides/code/getting_started/public/500.html +26 -0
- data/guides/code/getting_started/public/favicon.ico +0 -0
- data/guides/code/getting_started/public/robots.txt +5 -0
- data/guides/code/getting_started/script/rails +6 -0
- data/guides/code/getting_started/test/fixtures/comments.yml +11 -0
- data/guides/code/getting_started/test/fixtures/posts.yml +11 -0
- data/guides/code/getting_started/test/fixtures/tags.yml +9 -0
- data/guides/code/getting_started/test/functional/comments_controller_test.rb +7 -0
- data/guides/code/getting_started/test/functional/home_controller_test.rb +9 -0
- data/guides/code/getting_started/test/functional/posts_controller_test.rb +49 -0
- data/guides/code/getting_started/test/performance/browsing_test.rb +12 -0
- data/guides/code/getting_started/test/test_helper.rb +13 -0
- data/guides/code/getting_started/test/unit/comment_test.rb +7 -0
- data/guides/code/getting_started/test/unit/helpers/comments_helper_test.rb +4 -0
- data/guides/code/getting_started/test/unit/helpers/home_helper_test.rb +4 -0
- data/guides/code/getting_started/test/unit/helpers/posts_helper_test.rb +4 -0
- data/guides/code/getting_started/test/unit/post_test.rb +7 -0
- data/guides/code/getting_started/test/unit/tag_test.rb +7 -0
- data/guides/rails_guides/generator.rb +2 -1
- data/guides/source/3_0_release_notes.textile +2 -2
- data/guides/source/3_1_release_notes.textile +3 -110
- data/guides/source/action_controller_overview.textile +11 -13
- data/guides/source/action_mailer_basics.textile +7 -18
- data/guides/source/action_view_overview.textile +78 -9
- data/guides/source/active_model_basics.textile +205 -0
- data/guides/source/active_record_basics.textile +31 -31
- data/guides/source/active_record_querying.textile +288 -67
- data/guides/source/active_record_validations_callbacks.textile +69 -75
- data/guides/source/active_resource_basics.textile +48 -2
- data/guides/source/active_support_core_extensions.textile +145 -24
- data/guides/source/ajax_on_rails.textile +65 -7
- data/guides/source/api_documentation_guidelines.textile +0 -6
- data/guides/source/asset_pipeline.textile +2 -2
- data/guides/source/association_basics.textile +25 -34
- data/guides/source/caching_with_rails.textile +12 -17
- data/guides/source/command_line.textile +29 -19
- data/guides/source/configuring.textile +40 -18
- data/guides/source/contributing_to_ruby_on_rails.textile +11 -18
- data/guides/source/debugging_rails_applications.textile +10 -21
- data/guides/source/engines.textile +618 -0
- data/guides/source/form_helpers.textile +1 -12
- data/guides/source/generators.textile +9 -11
- data/guides/source/getting_started.textile +152 -152
- data/guides/source/i18n.textile +4 -5
- data/guides/source/index.html.erb +0 -1
- data/guides/source/initialization.textile +26 -26
- data/guides/source/layouts_and_rendering.textile +97 -61
- data/guides/source/migrations.textile +380 -161
- data/guides/source/performance_testing.textile +4 -10
- data/guides/source/plugins.textile +11 -19
- data/guides/source/rails_application_templates.textile +12 -4
- data/guides/source/rails_on_rack.textile +25 -19
- data/guides/source/routing.textile +6 -13
- data/guides/source/ruby_on_rails_guides_guidelines.textile +0 -5
- data/guides/source/security.textile +11 -15
- data/guides/source/testing.textile +1 -9
- data/lib/rails/application.rb +107 -42
- data/lib/rails/application/bootstrap.rb +12 -11
- data/lib/rails/application/configuration.rb +27 -21
- data/lib/rails/application/finisher.rb +40 -17
- data/lib/rails/application/route_inspector.rb +75 -0
- data/lib/rails/application/routes_reloader.rb +15 -4
- data/lib/rails/code_statistics.rb +16 -5
- data/lib/rails/commands.rb +6 -5
- data/lib/rails/commands/application.rb +8 -1
- data/lib/rails/commands/console.rb +2 -0
- data/lib/rails/commands/dbconsole.rb +2 -2
- data/lib/rails/commands/destroy.rb +0 -2
- data/lib/rails/commands/generate.rb +3 -3
- data/lib/rails/commands/plugin.rb +161 -159
- data/lib/rails/commands/plugin_new.rb +3 -2
- data/lib/rails/commands/runner.rb +4 -0
- data/lib/rails/console/app.rb +26 -22
- data/lib/rails/console/helpers.rb +9 -5
- data/lib/rails/engine.rb +70 -34
- data/lib/rails/engine/commands.rb +39 -0
- data/lib/rails/engine/configuration.rb +1 -1
- data/lib/rails/generators.rb +3 -14
- data/lib/rails/generators/actions.rb +36 -9
- data/lib/rails/generators/app_base.rb +34 -38
- data/lib/rails/generators/base.rb +4 -4
- data/lib/rails/generators/generated_attribute.rb +1 -1
- data/lib/rails/generators/named_base.rb +1 -3
- data/lib/rails/generators/rails/app/USAGE +6 -0
- data/lib/rails/generators/rails/app/app_generator.rb +6 -2
- data/lib/rails/generators/rails/app/templates/Gemfile +4 -3
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +9 -3
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +11 -5
- data/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/app/models/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/application.rb +11 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +10 -1
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +10 -1
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +6 -6
- data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +5 -0
- data/lib/rails/generators/rails/app/templates/config/routes.rb +1 -1
- data/lib/rails/generators/rails/app/templates/public/500.html +0 -1
- data/lib/rails/generators/rails/app/templates/public/index.html +1 -1
- data/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/functional/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/integration/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/unit/.empty_directory +0 -0
- data/lib/rails/generators/rails/controller/templates/controller.rb +1 -1
- data/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +17 -5
- data/lib/rails/generators/rails/plugin_new/templates/Rakefile +1 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/models/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/views/layouts/%name%/application.html.erb.tt +1 -1
- data/lib/rails/generators/rails/plugin_new/templates/gitignore +4 -3
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb +1 -1
- data/lib/rails/generators/rails/plugin_new/templates/rails/application.rb +1 -1
- data/lib/rails/generators/rails/plugin_new/templates/script/rails.tt +5 -3
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +2 -2
- data/lib/rails/generators/rails/task/USAGE +9 -0
- data/lib/rails/generators/rails/task/task_generator.rb +12 -0
- data/lib/rails/generators/rails/task/templates/task.rb +8 -0
- data/lib/rails/generators/resource_helpers.rb +3 -3
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb +0 -2
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +4 -4
- data/lib/rails/paths.rb +11 -38
- data/lib/rails/rack/debugger.rb +3 -4
- data/lib/rails/rack/logger.rb +26 -12
- data/lib/rails/railtie.rb +6 -1
- data/lib/rails/railtie/configuration.rb +12 -5
- data/lib/rails/source_annotation_extractor.rb +12 -10
- data/lib/rails/tasks/documentation.rake +3 -1
- data/lib/rails/tasks/engine.rake +1 -0
- data/lib/rails/tasks/misc.rake +1 -1
- data/lib/rails/tasks/routes.rake +3 -23
- data/lib/rails/test_help.rb +1 -2
- data/lib/rails/test_unit/testing.rake +8 -4
- data/lib/rails/version.rb +3 -3
- metadata +131 -61
- checksums.yaml +0 -7
- data/lib/rails/generators/rails/plugin/USAGE +0 -13
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +0 -54
- data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +0 -20
- data/lib/rails/generators/rails/plugin/templates/README.tt +0 -13
- data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +0 -23
- data/lib/rails/generators/rails/plugin/templates/init.rb +0 -1
- data/lib/rails/generators/rails/plugin/templates/install.rb +0 -1
- data/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt +0 -1
- data/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt +0 -4
- data/lib/rails/generators/rails/plugin/templates/uninstall.rb +0 -1
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'rails/generators'
|
2
2
|
require 'active_support/core_ext/object/inclusion'
|
3
3
|
|
4
|
-
Rails::Generators.configure!
|
5
|
-
|
6
4
|
if ARGV.first.in?([nil, "-h", "--help"])
|
7
5
|
Rails::Generators.help 'generate'
|
8
6
|
exit
|
9
7
|
end
|
10
8
|
|
11
9
|
name = ARGV.shift
|
12
|
-
|
10
|
+
|
11
|
+
root = defined?(ENGINE_ROOT) ? ENGINE_ROOT : Rails.root
|
12
|
+
Rails::Generators.invoke name, ARGV, :behavior => :invoke, :destination_root => root
|
@@ -274,198 +274,200 @@ end
|
|
274
274
|
|
275
275
|
# load default environment and parse arguments
|
276
276
|
require 'optparse'
|
277
|
-
module
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
277
|
+
module Rails
|
278
|
+
module Commands
|
279
|
+
class Plugin
|
280
|
+
attr_reader :environment, :script_name
|
281
|
+
def initialize
|
282
|
+
@environment = RailsEnvironment.default
|
283
|
+
@rails_root = RailsEnvironment.default.root
|
284
|
+
@script_name = File.basename($0)
|
285
|
+
end
|
285
286
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
287
|
+
def environment=(value)
|
288
|
+
@environment = value
|
289
|
+
RailsEnvironment.default = value
|
290
|
+
end
|
290
291
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
292
|
+
def options
|
293
|
+
OptionParser.new do |o|
|
294
|
+
o.set_summary_indent(' ')
|
295
|
+
o.banner = "Usage: plugin [OPTIONS] command"
|
296
|
+
o.define_head "Rails plugin manager."
|
296
297
|
|
297
|
-
|
298
|
-
|
298
|
+
o.separator ""
|
299
|
+
o.separator "GENERAL OPTIONS"
|
299
300
|
|
300
|
-
|
301
|
-
|
302
|
-
|
301
|
+
o.on("-r", "--root=DIR", String,
|
302
|
+
"Set an explicit rails app directory.",
|
303
|
+
"Default: #{@rails_root}") { |rails_root| @rails_root = rails_root; self.environment = RailsEnvironment.new(@rails_root) }
|
303
304
|
|
304
|
-
|
305
|
-
|
305
|
+
o.on("-v", "--verbose", "Turn on verbose output.") { |verbose| $verbose = verbose }
|
306
|
+
o.on("-h", "--help", "Show this help message.") { puts o; exit }
|
306
307
|
|
307
|
-
|
308
|
-
|
308
|
+
o.separator ""
|
309
|
+
o.separator "COMMANDS"
|
309
310
|
|
310
|
-
|
311
|
-
|
311
|
+
o.separator " install Install plugin(s) from known repositories or URLs."
|
312
|
+
o.separator " remove Uninstall plugins."
|
312
313
|
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
314
|
+
o.separator ""
|
315
|
+
o.separator "EXAMPLES"
|
316
|
+
o.separator " Install a plugin from a subversion URL:"
|
317
|
+
o.separator " #{@script_name} plugin install http://example.com/my_svn_plugin\n"
|
318
|
+
o.separator " Install a plugin from a git URL:"
|
319
|
+
o.separator " #{@script_name} plugin install git://github.com/SomeGuy/my_awesome_plugin.git\n"
|
320
|
+
o.separator " Install a plugin and add a svn:externals entry to vendor/plugins"
|
321
|
+
o.separator " #{@script_name} plugin install -x my_svn_plugin\n"
|
322
|
+
end
|
321
323
|
end
|
322
|
-
end
|
323
324
|
|
324
|
-
|
325
|
-
|
326
|
-
|
325
|
+
def parse!(args=ARGV)
|
326
|
+
general, sub = split_args(args)
|
327
|
+
options.parse!(general)
|
327
328
|
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
329
|
+
command = general.shift
|
330
|
+
if command =~ /^(install|remove)$/
|
331
|
+
command = Commands.const_get(command.capitalize).new(self)
|
332
|
+
command.parse!(sub)
|
333
|
+
else
|
334
|
+
puts "Unknown command: #{command}" unless command.blank?
|
335
|
+
puts options
|
336
|
+
exit 1
|
337
|
+
end
|
336
338
|
end
|
337
|
-
end
|
338
339
|
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
def self.parse!(args=ARGV)
|
347
|
-
Plugin.new.parse!(args)
|
348
|
-
end
|
349
|
-
end
|
340
|
+
def split_args(args)
|
341
|
+
left = []
|
342
|
+
left << args.shift while args[0] and args[0] =~ /^-/
|
343
|
+
left << args.shift if args[0]
|
344
|
+
[left, args]
|
345
|
+
end
|
350
346
|
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
@method = :http
|
355
|
-
@options = { :quiet => false, :revision => nil, :force => false }
|
347
|
+
def self.parse!(args=ARGV)
|
348
|
+
Plugin.new.parse!(args)
|
349
|
+
end
|
356
350
|
end
|
357
351
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
o.separator ""
|
364
|
-
o.separator "Options:"
|
365
|
-
o.on( "-x", "--externals",
|
366
|
-
"Use svn:externals to grab the plugin.",
|
367
|
-
"Enables plugin updates and plugin versioning.") { |v| @method = :externals }
|
368
|
-
o.on( "-o", "--checkout",
|
369
|
-
"Use svn checkout to grab the plugin.",
|
370
|
-
"Enables updating but does not add a svn:externals entry.") { |v| @method = :checkout }
|
371
|
-
o.on( "-e", "--export",
|
372
|
-
"Use svn export to grab the plugin.",
|
373
|
-
"Exports the plugin, allowing you to check it into your local repository. Does not enable updates or add an svn:externals entry.") { |v| @method = :export }
|
374
|
-
o.on( "-q", "--quiet",
|
375
|
-
"Suppresses the output from installation.",
|
376
|
-
"Ignored if -v is passed (rails plugin -v install ...)") { |v| @options[:quiet] = true }
|
377
|
-
o.on( "-r REVISION", "--revision REVISION",
|
378
|
-
"Checks out the given revision from subversion or git.",
|
379
|
-
"Ignored if subversion/git is not used.") { |v| @options[:revision] = v }
|
380
|
-
o.on( "-f", "--force",
|
381
|
-
"Reinstalls a plugin if it's already installed.") { |v| @options[:force] = true }
|
382
|
-
o.separator ""
|
383
|
-
o.separator "You can specify plugin names as given in 'plugin list' output or absolute URLs to "
|
384
|
-
o.separator "a plugin repository."
|
352
|
+
class Install
|
353
|
+
def initialize(base_command)
|
354
|
+
@base_command = base_command
|
355
|
+
@method = :http
|
356
|
+
@options = { :quiet => false, :revision => nil, :force => false }
|
385
357
|
end
|
386
|
-
end
|
387
358
|
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
359
|
+
def options
|
360
|
+
OptionParser.new do |o|
|
361
|
+
o.set_summary_indent(' ')
|
362
|
+
o.banner = "Usage: #{@base_command.script_name} install PLUGIN [PLUGIN [PLUGIN] ...]"
|
363
|
+
o.define_head "Install one or more plugins."
|
364
|
+
o.separator ""
|
365
|
+
o.separator "Options:"
|
366
|
+
o.on( "-x", "--externals",
|
367
|
+
"Use svn:externals to grab the plugin.",
|
368
|
+
"Enables plugin updates and plugin versioning.") { |v| @method = :externals }
|
369
|
+
o.on( "-o", "--checkout",
|
370
|
+
"Use svn checkout to grab the plugin.",
|
371
|
+
"Enables updating but does not add a svn:externals entry.") { |v| @method = :checkout }
|
372
|
+
o.on( "-e", "--export",
|
373
|
+
"Use svn export to grab the plugin.",
|
374
|
+
"Exports the plugin, allowing you to check it into your local repository. Does not enable updates or add an svn:externals entry.") { |v| @method = :export }
|
375
|
+
o.on( "-q", "--quiet",
|
376
|
+
"Suppresses the output from installation.",
|
377
|
+
"Ignored if -v is passed (rails plugin -v install ...)") { |v| @options[:quiet] = true }
|
378
|
+
o.on( "-r REVISION", "--revision REVISION",
|
379
|
+
"Checks out the given revision from subversion or git.",
|
380
|
+
"Ignored if subversion/git is not used.") { |v| @options[:revision] = v }
|
381
|
+
o.on( "-f", "--force",
|
382
|
+
"Reinstalls a plugin if it's already installed.") { |v| @options[:force] = true }
|
383
|
+
o.separator ""
|
384
|
+
o.separator "You can specify plugin names as given in 'plugin list' output or absolute URLs to "
|
385
|
+
o.separator "a plugin repository."
|
386
|
+
end
|
398
387
|
end
|
399
|
-
|
400
|
-
|
401
|
-
|
388
|
+
|
389
|
+
def determine_install_method
|
390
|
+
best = @base_command.environment.best_install_method
|
391
|
+
@method = :http if best == :http and @method == :export
|
392
|
+
case
|
393
|
+
when (best == :http and @method != :http)
|
394
|
+
msg = "Cannot install using subversion because `svn' cannot be found in your PATH"
|
395
|
+
when (best == :export and (@method != :export and @method != :http))
|
396
|
+
msg = "Cannot install using #{@method} because this project is not under subversion."
|
397
|
+
when (best != :externals and @method == :externals)
|
398
|
+
msg = "Cannot install using externals because vendor/plugins is not under subversion."
|
399
|
+
end
|
400
|
+
if msg
|
401
|
+
puts msg
|
402
|
+
exit 1
|
403
|
+
end
|
404
|
+
@method
|
402
405
|
end
|
403
|
-
@method
|
404
|
-
end
|
405
406
|
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
407
|
+
def parse!(args)
|
408
|
+
options.parse!(args)
|
409
|
+
if args.blank?
|
410
|
+
puts options
|
411
|
+
exit 1
|
412
|
+
end
|
413
|
+
environment = @base_command.environment
|
414
|
+
install_method = determine_install_method
|
415
|
+
puts "Plugins will be installed using #{install_method}" if $verbose
|
416
|
+
args.each do |name|
|
417
|
+
::Plugin.find(name).install(install_method, @options)
|
418
|
+
end
|
419
|
+
rescue StandardError => e
|
420
|
+
puts "Plugin not found: #{args.inspect}"
|
421
|
+
puts e.inspect if $verbose
|
410
422
|
exit 1
|
411
423
|
end
|
412
|
-
environment = @base_command.environment
|
413
|
-
install_method = determine_install_method
|
414
|
-
puts "Plugins will be installed using #{install_method}" if $verbose
|
415
|
-
args.each do |name|
|
416
|
-
::Plugin.find(name).install(install_method, @options)
|
417
|
-
end
|
418
|
-
rescue StandardError => e
|
419
|
-
puts "Plugin not found: #{args.inspect}"
|
420
|
-
puts e.inspect if $verbose
|
421
|
-
exit 1
|
422
|
-
end
|
423
|
-
end
|
424
|
-
|
425
|
-
class Remove
|
426
|
-
def initialize(base_command)
|
427
|
-
@base_command = base_command
|
428
424
|
end
|
429
425
|
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
o.banner = "Usage: #{@base_command.script_name} remove name [name]..."
|
434
|
-
o.define_head "Remove plugins."
|
426
|
+
class Remove
|
427
|
+
def initialize(base_command)
|
428
|
+
@base_command = base_command
|
435
429
|
end
|
436
|
-
end
|
437
430
|
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
431
|
+
def options
|
432
|
+
OptionParser.new do |o|
|
433
|
+
o.set_summary_indent(' ')
|
434
|
+
o.banner = "Usage: #{@base_command.script_name} remove name [name]..."
|
435
|
+
o.define_head "Remove plugins."
|
436
|
+
end
|
443
437
|
end
|
444
|
-
|
445
|
-
args
|
446
|
-
|
438
|
+
|
439
|
+
def parse!(args)
|
440
|
+
options.parse!(args)
|
441
|
+
if args.blank?
|
442
|
+
puts options
|
443
|
+
exit 1
|
444
|
+
end
|
445
|
+
root = @base_command.environment.root
|
446
|
+
args.each do |name|
|
447
|
+
::Plugin.new(name).uninstall
|
448
|
+
end
|
447
449
|
end
|
448
450
|
end
|
449
|
-
end
|
450
451
|
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
452
|
+
class Info
|
453
|
+
def initialize(base_command)
|
454
|
+
@base_command = base_command
|
455
|
+
end
|
455
456
|
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
457
|
+
def options
|
458
|
+
OptionParser.new do |o|
|
459
|
+
o.set_summary_indent(' ')
|
460
|
+
o.banner = "Usage: #{@base_command.script_name} info name [name]..."
|
461
|
+
o.define_head "Shows plugin info at {url}/about.yml."
|
462
|
+
end
|
461
463
|
end
|
462
|
-
end
|
463
464
|
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
465
|
+
def parse!(args)
|
466
|
+
options.parse!(args)
|
467
|
+
args.each do |name|
|
468
|
+
puts ::Plugin.find(name).info
|
469
|
+
puts
|
470
|
+
end
|
469
471
|
end
|
470
472
|
end
|
471
473
|
end
|
@@ -539,4 +541,4 @@ class RecursiveHTTPFetcher
|
|
539
541
|
end
|
540
542
|
end
|
541
543
|
|
542
|
-
Commands::Plugin.parse!
|
544
|
+
Rails::Commands::Plugin.parse!
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'rubygems' if ARGV.include?("--dev")
|
2
|
+
|
1
3
|
if ARGV.first != "new"
|
2
4
|
ARGV[0] = "--help"
|
3
5
|
else
|
@@ -6,5 +8,4 @@ end
|
|
6
8
|
|
7
9
|
require 'rails/generators'
|
8
10
|
require 'rails/generators/rails/plugin_new/plugin_new_generator'
|
9
|
-
|
10
|
-
Rails::Generators::PluginNewGenerator.start
|
11
|
+
Rails::Generators::PluginNewGenerator.start
|
@@ -4,6 +4,10 @@ require 'rbconfig'
|
|
4
4
|
options = { :environment => (ENV['RAILS_ENV'] || "development").dup }
|
5
5
|
code_or_file = nil
|
6
6
|
|
7
|
+
if ARGV.first.nil?
|
8
|
+
ARGV.push "-h"
|
9
|
+
end
|
10
|
+
|
7
11
|
ARGV.clone.options do |opts|
|
8
12
|
script_name = File.basename($0)
|
9
13
|
opts.banner = "Usage: runner [options] ('Some.ruby(code)' or a filename)"
|
data/lib/rails/console/app.rb
CHANGED
@@ -5,28 +5,32 @@ require 'action_controller'
|
|
5
5
|
# work around the at_exit hook in test/unit, which kills IRB
|
6
6
|
Test::Unit.run = true if Test::Unit.respond_to?(:run=)
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
module Rails
|
9
|
+
module ConsoleMethods
|
10
|
+
# reference the global "app" instance, created on demand. To recreate the
|
11
|
+
# instance, pass a non-false value as the parameter.
|
12
|
+
def app(create=false)
|
13
|
+
@app_integration_instance = nil if create
|
14
|
+
@app_integration_instance ||= new_session do |sess|
|
15
|
+
sess.host! "www.example.com"
|
16
|
+
end
|
17
|
+
end
|
16
18
|
|
17
|
-
# create a new session. If a block is given, the new session will be yielded
|
18
|
-
# to the block before being returned.
|
19
|
-
def new_session
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
19
|
+
# create a new session. If a block is given, the new session will be yielded
|
20
|
+
# to the block before being returned.
|
21
|
+
def new_session
|
22
|
+
app = Rails.application
|
23
|
+
session = ActionDispatch::Integration::Session.new(app)
|
24
|
+
yield session if block_given?
|
25
|
+
session
|
26
|
+
end
|
25
27
|
|
26
|
-
# reloads the environment
|
27
|
-
def reload!(print=true)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
# reloads the environment
|
29
|
+
def reload!(print=true)
|
30
|
+
puts "Reloading..." if print
|
31
|
+
ActionDispatch::Reloader.cleanup!
|
32
|
+
ActionDispatch::Reloader.prepare!
|
33
|
+
true
|
34
|
+
end
|
35
|
+
end
|
32
36
|
end
|