Class: Poxy::Generator

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

Instance Method Summary collapse

Constructor Details

#initialize(arguments) ⇒ Generator

Returns a new instance of Generator.



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

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

Instance Method Details

#installObject



29
30
31
32
33
34
35
36
# File 'lib/poxy/generator.rb', line 29

def install
  if poxy_files_already_exist?
    puts "Poxy files already installed, doing nothing."
  else
    install_files
    puts "Poxy files installed to poxy/"
  end
end

#removeObject



38
39
40
41
42
43
44
45
# File 'lib/poxy/generator.rb', line 38

def remove
  if poxy_files_already_exist?
    remove_poxy_directory
    puts "Poxy was successfully removed."
  else
    puts "No existing poxy installation. Doing nothing."
  end
end

#runObject



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

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

#updateObject



19
20
21
22
23
24
25
26
27
# File 'lib/poxy/generator.rb', line 19

def update
  if poxy_files_already_exist?
    remove_poxy_directory
    install_files
    puts "Poxy files updated."
  else
    puts "No existing poxy installation. Doing nothing."
  end
end