Class: Drakkon::Gems::Gem

Inherits:
Object
  • Object
show all
Includes:
GemHelpers
Defined in:
lib/drakkon/gem/gem.rb

Overview

General Encompasing thingy

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GemHelpers

#config_file, #do_the_check, #file_edit, #files_exist?, #load_modules, #module_duplicates, #module_duplicates?, #module_index, #path?, #path_files, #prompt, #prompt_file, #prompt_modules, #read_config, #refresh_modules, #select_files, #select_modules, #source?, #source_setup, #sources, #valid_mod?, #valid_structure?, #valid_version?

Constructor Details

#initialize(opts = {}) ⇒ Gem

Returns a new instance of Gem.



12
13
14
15
# File 'lib/drakkon/gem/gem.rb', line 12

def initialize(opts = {})
  @opts = opts
  @data = {}
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



10
11
12
# File 'lib/drakkon/gem/gem.rb', line 10

def args
  @args
end

#configObject

Returns the value of attribute config.



10
11
12
# File 'lib/drakkon/gem/gem.rb', line 10

def config
  @config
end

#dataObject

Returns the value of attribute data.



10
11
12
# File 'lib/drakkon/gem/gem.rb', line 10

def data
  @data
end

#modulesObject

Returns the value of attribute modules.



10
11
12
# File 'lib/drakkon/gem/gem.rb', line 10

def modules
  @modules
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/drakkon/gem/gem.rb', line 10

def name
  @name
end

#optsObject

Returns the value of attribute opts.



10
11
12
# File 'lib/drakkon/gem/gem.rb', line 10

def opts
  @opts
end

#sourceObject

Returns the value of attribute source.



10
11
12
# File 'lib/drakkon/gem/gem.rb', line 10

def source
  @source
end

Instance Method Details

#edit(name, details, action = :modules) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/drakkon/gem/gem.rb', line 17

def edit(name, details, action = :modules)
  @name = name.to_sym
  @source = details[:source]
  @data = details[:data]
  do_the_check(installing: false)

  case action
  when :modules then select_modules
  when :files then select_files
  when :refresh then refresh_modules
  end

  update_gem_data
end

#intall_setup(args) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/drakkon/gem/gem.rb', line 32

def intall_setup(args)
  @args = args
  source_setup
  do_the_check
  select_modules

  update_gem_data
end

#prompt_sourceObject



51
# File 'lib/drakkon/gem/gem.rb', line 51

def prompt_source; end

#update_gem_dataObject



41
42
43
44
45
46
47
48
49
# File 'lib/drakkon/gem/gem.rb', line 41

def update_gem_data
  gem_data = {
    source: source,
    data: data
  }

  Settings.gems[name.to_sym] = gem_data
  Settings.write
end