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
# File 'lib/devkitkat/command.rb', line 5

def initialize
  @options = {}
  option_parser.parse!

  @script, @target, *@args = ARGV

  show_help if script == 'help'
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



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

def create_tmp_dir
  FileUtils.mkdir_p(tmp_dir)
end

#kit_rootObject



30
31
32
# File 'lib/devkitkat/command.rb', line 30

def kit_root
  Dir.pwd # TODO: root_path
end

#tmp_dirObject



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

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

#tty?Boolean

Returns:

  • (Boolean)


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

def tty?
  options[:tty]
end

#variablesObject



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

def variables
  options[:variables]
end