Class: RuboCop::Extension::Generator::CLI
- Inherits:
-
Object
- Object
- RuboCop::Extension::Generator::CLI
- Defined in:
- lib/rubocop/extension/generator/cli.rb
Constant Summary collapse
- BANNER =
"Usage: rubocop-extension-generator NAME\n\nThe NAME must start with rubocop-, like rubocop-rspec.\n"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
17 18 19 |
# File 'lib/rubocop/extension/generator/cli.rb', line 17 def initialize(argv) @argv = argv end |
Class Method Details
.run(argv) ⇒ Object
13 14 15 |
# File 'lib/rubocop/extension/generator/cli.rb', line 13 def self.run(argv) new(argv).run end |
Instance Method Details
#run ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rubocop/extension/generator/cli.rb', line 21 def run # For --help opt = OptionParser.new(BANNER) opt.version = VERSION args = opt.parse(@argv) name = args.first fail!(opt) unless name fail!(opt) unless name.match?(/\Arubocop-\w+\z/) Generator.new(name).generate end |