Class: Arli::Commands::Base

Inherits:
Object
  • Object
show all
Includes:
Helpers::Output
Defined in:
lib/arli/commands/base.rb

Direct Known Subclasses

Bundle, Generate, Install, Search

Constant Summary

Constants included from Helpers::Output

Helpers::Output::CHAR_FAILURE, Helpers::Output::CHAR_SUCCESS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Output

#___, #__p, #__pf, #__pt, #abort?, #action_fail, #action_ok, #backup?, #cursor, #debug, #debug?, disable!, enable!, enabled?, #error, #fuck, #header, #hr, #indent_cursor, #info, #ok, #overwrite?, #print_action_failure, #print_action_starting, #print_action_success, #print_target_dir, #quiet?, #raise_invalid_arli_command!, #report_exception, #verbose?

Constructor Details

#initialize(config: Arli.config) ⇒ Base

Returns a new instance of Base.



16
17
18
19
# File 'lib/arli/commands/base.rb', line 16

def initialize(config: Arli.config)
  self.config = config
  setup
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



14
15
16
# File 'lib/arli/commands/base.rb', line 14

def config
  @config
end

#nameObject

Returns the value of attribute name.



14
15
16
# File 'lib/arli/commands/base.rb', line 14

def name
  @name
end

Instance Method Details

#library_pathObject



29
30
31
# File 'lib/arli/commands/base.rb', line 29

def library_path
  config.libraries.path
end

#paramsObject



47
48
49
# File 'lib/arli/commands/base.rb', line 47

def params
  ''
end

#run(*args) ⇒ Object



42
43
44
45
# File 'lib/arli/commands/base.rb', line 42

def run(*args)
  raise Arli::Errors::AbstractMethodCalled,
    'This method must be implemented in subclasses'
end

#runtimeObject



21
22
23
# File 'lib/arli/commands/base.rb', line 21

def runtime
  config.runtime
end

#setupObject



37
38
39
40
# File 'lib/arli/commands/base.rb', line 37

def setup
  FileUtils.mkdir_p(library_path) unless Dir.exist?(library_path)
  FileUtils.mkdir_p(temp_path) unless Dir.exist?(temp_path)
end

#temp_pathObject



33
34
35
# File 'lib/arli/commands/base.rb', line 33

def temp_path
  config.libraries.temp_dir
end