Class: Wiskey::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/wiskey/generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(arguments) ⇒ Generator

Returns a new instance of Generator.



5
6
7
# File 'lib/wiskey/generator.rb', line 5

def initialize(arguments)
  @subcommand = arguments.first
end

Instance Method Details

#installObject



27
28
29
30
31
32
33
34
# File 'lib/wiskey/generator.rb', line 27

def install
  if wiskey_files_already_exist?
    puts "Wiskey files already installed, doing nothing."
  else
    install_files
    puts "Wiskey files installed to wiskey/"
  end
end

#runObject



9
10
11
12
13
14
15
# File 'lib/wiskey/generator.rb', line 9

def run
  if @subcommand == "install"
   install
  elsif @subcommand == "update"
    update
  end
end

#updateObject



17
18
19
20
21
22
23
24
25
# File 'lib/wiskey/generator.rb', line 17

def update
  if wiskey_files_already_exist?
    remove_wiskey_directory
    install_files
    puts "Wiskey files updated."
  else
    puts "No existing wiskey installation. Doing nothing."
  end
end