Class: TuneSpec::Parser
- Inherits:
-
Object
- Object
- TuneSpec::Parser
- Defined in:
- lib/tune_spec/parser.rb
Instance Attribute Summary collapse
-
#original_args ⇒ Object
readonly
Returns the value of attribute original_args.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
-
#parser ⇒ Object
rubocop:disable MethodLength.
Constructor Details
#initialize(args) ⇒ Parser
Returns a new instance of Parser.
15 16 17 |
# File 'lib/tune_spec/parser.rb', line 15 def initialize(args) @original_args = args end |
Instance Attribute Details
#original_args ⇒ Object (readonly)
Returns the value of attribute original_args.
13 14 15 |
# File 'lib/tune_spec/parser.rb', line 13 def original_args @original_args end |
Class Method Details
.parse(args) ⇒ Object
9 10 11 |
# File 'lib/tune_spec/parser.rb', line 9 def self.parse(args) new(args).parse end |
Instance Method Details
#parse ⇒ Object
19 20 21 |
# File 'lib/tune_spec/parser.rb', line 19 def parse parser.parse!(original_args) end |
#parser ⇒ Object
rubocop:disable MethodLength
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/tune_spec/parser.rb', line 24 def parser OptionParser.new do |parser| parser.summary_width = 34 parser. = "Usage: tune [options]\n\n" parser.on('--init [PATH]', 'Create framework folder structure') do |dir| base_path = dir || 'lib' %w[groups pages steps].each do |folder| FileUtils.mkdir_p(base_path) path = "#{base_path}/#{folder}" exists = directory_exists?(path) print_directory(path, exists) create_directory(path) unless exists end end end end |