Class: Devkitkat::Command

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommand

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

#argsObject (readonly)

Returns the value of attribute args.



3
4
5
# File 'lib/devkitkat/command.rb', line 3

def args
  @args
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/devkitkat/command.rb', line 3

def options
  @options
end

#scriptObject (readonly)

Returns the value of attribute script.



3
4
5
# File 'lib/devkitkat/command.rb', line 3

def script
  @script
end

#targetObject (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_dirObject



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

#kit_rootObject



35
36
37
# File 'lib/devkitkat/command.rb', line 35

def kit_root
  Dir.pwd # TODO: root_path
end

#tmp_dirObject



27
28
29
# File 'lib/devkitkat/command.rb', line 27

def tmp_dir
  File.join(kit_root, '.devkitkat')
end

#tty?Boolean

Returns:

  • (Boolean)


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

def tty?
  options[:tty]
end

#variablesObject



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

def variables
  options[:variables]
end