Class: PoolParty::Installer

Inherits:
Object show all
Includes:
Askable, Pinger
Defined in:
lib/poolparty/installer.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Askable

included

Methods included from Pinger

included

Class Method Details

.allObject



97
98
99
# File 'lib/poolparty/installer.rb', line 97

def self.all
  @all ||= []
end

.descriptionObject



86
87
# File 'lib/poolparty/installer.rb', line 86

def self.description
end

.find_by_name(nm) ⇒ Object



101
102
103
104
105
# File 'lib/poolparty/installer.rb', line 101

def self.find_by_name(nm)
  all.detect do |i|
    i.name =~ /#{nm}/i
  end
end

.inherited(subclass) ⇒ Object



93
94
95
# File 'lib/poolparty/installer.rb', line 93

def self.inherited(subclass)
  all << subclass
end

.nameObject



83
84
# File 'lib/poolparty/installer.rb', line 83

def self.name
end

.to_sObject



89
90
91
# File 'lib/poolparty/installer.rb', line 89

def self.to_s
  "#{name} - #{description}"
end

Instance Method Details

#closing_messageObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/poolparty/installer.rb', line 50

def closing_message
closing_message = <<-EOE

<line>
You are now set to <blue>ride the waves</blue> with PoolParty! You'll notice there is a <blue>clouds.rb</blue> file in your current directory. 

You can start your new cloud by typing in this directory:

<blue>cloud start [-v]</blue>

You can start your clouds.rb. More samples are available here: 
<yellow>http://github.com/auser/poolparty-examples/tree/master</yellow>

<line>
EOE
  colored_say closing_message
end

#exit_msgObject



68
69
70
71
72
73
74
75
76
# File 'lib/poolparty/installer.rb', line 68

def exit_msg
  @exit_msg || <<-EOE
<red>--- quiting ---</red>
You can always restart the installer by typing #{$0}. 

If you need help, feel free to stop by the irc room:
irc.freenode.net / #poolpartyrb
  EOE
end

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/poolparty/installer.rb', line 12

def run
  begin
    self.__send__ :welcome_message
    steps.each {|c| self.__send__ c.to_sym }
    self.__send__ :closing_message
  rescue Exception => e
    colored_say e.inspect
    colored_say exit_msg
  ensure
    Colors.reset!
  end
end

#stepsObject



79
80
81
# File 'lib/poolparty/installer.rb', line 79

def steps
  @steps ||= []
end

#welcome_messageObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/poolparty/installer.rb', line 25

def welcome_message
  welcome_msg = <<-EOE
We are going to take you through the installation process of PoolParty.

First, we'll setup your environment so using PoolParty will be a <blue>breeze</blue>
  EOE

    @exit_msg = <<-EOE

<line>
<yellow>Cancelled PoolParty installation</yellow>

You can always restart this by typing:
<blue>cloud setup</blue>

<line>
EOE


  colored_say "<yellow>Welcome to PoolParty!</yellow>"
  colored_say welcome_msg
  colored_ask "Press enter to continue or Ctrl+C to exit", :no_value => true
  
end