aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/command.rb
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-03-10 21:34:34 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-03-10 21:34:34 +0100
commit264222bc4494ec6db6720aa7e3b2c1af0e22bbfa (patch)
tree0b5401f38c175ba0c1d46cc9672519e7a6b24660 /railties/lib/rails/command.rb
parent1e4de9bf9e7cf2224d1c392b112b2fa6da0ed09b (diff)
downloadrails-264222bc4494ec6db6720aa7e3b2c1af0e22bbfa.tar.gz
rails-264222bc4494ec6db6720aa7e3b2c1af0e22bbfa.tar.bz2
rails-264222bc4494ec6db6720aa7e3b2c1af0e22bbfa.zip
Remove unfinished command infrastructure.
If we're gonna do this right, it will look mighty different from this anyway. (Looking at you, Rails 5.1). It isn't being used in any code as of now, so yanking is the best option.
Diffstat (limited to 'railties/lib/rails/command.rb')
-rw-r--r--railties/lib/rails/command.rb70
1 files changed, 0 insertions, 70 deletions
diff --git a/railties/lib/rails/command.rb b/railties/lib/rails/command.rb
deleted file mode 100644
index f7753cbb83..0000000000
--- a/railties/lib/rails/command.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-require 'rails/commands/commands_tasks'
-
-module Rails
- class Command #:nodoc:
- attr_reader :argv
-
- def initialize(argv = [])
- @argv = argv
-
- @option_parser = build_option_parser
- @options = {}
- end
-
- def self.run(task_name, argv)
- command_name = command_name_for(task_name)
-
- if command = command_for(command_name)
- command.new(argv).run(command_name)
- else
- Rails::CommandsTasks.new(argv).run_command!(task_name)
- end
- end
-
- def run(command_name)
- parse_options_for(command_name)
- @option_parser.parse! @argv
-
- public_send(command_name)
- end
-
- def self.options_for(command_name, &options_to_parse)
- @@command_options[command_name] = options_to_parse
- end
-
- def self.set_banner(command_name, banner)
- options_for(command_name) { |opts, _| opts.banner = banner }
- end
-
- private
- @@commands = []
- @@command_options = {}
-
- def parse_options_for(command_name)
- @@command_options.fetch(command_name, proc {}).call(@option_parser, @options)
- end
-
- def build_option_parser
- OptionParser.new do |opts|
- opts.on('-h', '--help', 'Show this help.') do
- puts opts
- exit
- end
- end
- end
-
- def self.inherited(command)
- @@commands << command
- end
-
- def self.command_name_for(task_name)
- task_name.gsub(':', '_').to_sym
- end
-
- def self.command_for(command_name)
- @@commands.find do |command|
- command.public_instance_methods.include?(command_name)
- end
- end
- end
-end