Class: Chusaku::CLI
- Inherits:
-
Object
- Object
- Chusaku::CLI
- Defined in:
- lib/chusaku/cli.rb
Overview
Enables flags for the ‘chusaku` executable.
Constant Summary collapse
- STATUS_SUCCESS =
0
- STATUS_ERROR =
1
- Finished =
Class.new(RuntimeError)
- NotARailsProject =
Class.new(RuntimeError)
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#call(args = ARGV) ⇒ Integer
Parse CLI flags, if any, and handle applicable behaviors.
-
#initialize ⇒ Chusaku::CLI
constructor
Initializes a new instance of ‘Chusaku::CLI`.
Constructor Details
#initialize ⇒ Chusaku::CLI
Initializes a new instance of ‘Chusaku::CLI`.
18 19 20 |
# File 'lib/chusaku/cli.rb', line 18 def initialize @options = {} end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/chusaku/cli.rb', line 7 def @options end |
Instance Method Details
#call(args = ARGV) ⇒ Integer
Parse CLI flags, if any, and handle applicable behaviors.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/chusaku/cli.rb', line 26 def call(args = ARGV) optparser.parse!(args) check_for_rails_project Chusaku.call() rescue NotARailsProject warn("Please run chusaku from the root of your project.") STATUS_ERROR rescue Finished STATUS_SUCCESS end |