Class: Devkitkat::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/devkitkat/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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
  @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

Returns:

  • (Boolean)


23
24
25
# File 'lib/devkitkat/command.rb', line 23

def debug?
  options[:debug]
end

#interactive? ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/devkitkat/command.rb', line 15

def interactive?
  options[:interactive]
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

#variables ⇒ Object



19
20
21
# File 'lib/devkitkat/command.rb', line 19

def variables
  options[:variables]
end