Class: Devkitkat::Command
- Inherits:
-
Object
- Object
- Devkitkat::Command
- Defined in:
- lib/devkitkat/command.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#script ⇒ Object
readonly
Returns the value of attribute script.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #create_tmp_dir ⇒ Object
- #debug? ⇒ Boolean
-
#initialize ⇒ Command
constructor
A new instance of Command.
- #kit_root ⇒ Object
- #tmp_dir ⇒ Object
- #tty? ⇒ Boolean
- #variables ⇒ Object
Constructor Details
#initialize ⇒ Command
Returns a new instance of Command.
5 6 7 8 9 10 11 12 13 |
# File 'lib/devkitkat/command.rb', line 5 def initialize @options = {} option_parser.parse! @script, @target, *@args = ARGV show_help if script == 'help' show_version if script == 'version' end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
3 4 5 |
# File 'lib/devkitkat/command.rb', line 3 def args @args end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/devkitkat/command.rb', line 3 def @options end |
#script ⇒ Object (readonly)
Returns the value of attribute script.
3 4 5 |
# File 'lib/devkitkat/command.rb', line 3 def script @script end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
3 4 5 |
# File 'lib/devkitkat/command.rb', line 3 def target @target end |
Instance Method Details
#create_tmp_dir ⇒ Object
31 32 33 |
# File 'lib/devkitkat/command.rb', line 31 def create_tmp_dir FileUtils.mkdir_p(tmp_dir) end |
#debug? ⇒ Boolean
23 24 25 |
# File 'lib/devkitkat/command.rb', line 23 def debug? [:debug] end |
#kit_root ⇒ Object
35 36 37 |
# File 'lib/devkitkat/command.rb', line 35 def kit_root Dir.pwd # TODO: root_path end |
#tmp_dir ⇒ Object
27 28 29 |
# File 'lib/devkitkat/command.rb', line 27 def tmp_dir File.join(kit_root, '.devkitkat') end |
#tty? ⇒ Boolean
15 16 17 |
# File 'lib/devkitkat/command.rb', line 15 def tty? [:tty] end |
#variables ⇒ Object
19 20 21 |
# File 'lib/devkitkat/command.rb', line 19 def variables [:variables] end |