Class: Enterprise::Welcome
- Inherits:
-
Object
- Object
- Enterprise::Welcome
- Defined in:
- lib/enterprise/scripts.rb
Constant Summary collapse
- BANNER =
' _ __ __ __ __ _ ___ _(_) /_/ / __ __/ / ___ ___ / /____ _______ ____(_)__ ___ / _ `/ / __/ _ \/ // / _ \ / -_) _ \/ __/ -_) __/ _ \/ __/ (_-</ -_) \_, /_/\__/_//_/\_,_/_.__/ \__/_//_/\__/\__/_/ / .__/_/ /_/___/\__/ /___/ /_/ '
Class Method Summary collapse
Instance Method Summary collapse
- #hostname ⇒ Object
- #ip ⇒ Object
- #mac ⇒ Object
- #network ⇒ Object
- #node ⇒ Object
- #run ⇒ Object
- #wait_for_ip ⇒ Object
Class Method Details
.run ⇒ Object
17 18 19 |
# File 'lib/enterprise/scripts.rb', line 17 def self.run new.run end |
Instance Method Details
#hostname ⇒ Object
61 62 63 |
# File 'lib/enterprise/scripts.rb', line 61 def hostname node['hostname'] end |
#ip ⇒ Object
53 54 55 |
# File 'lib/enterprise/scripts.rb', line 53 def ip node['ipaddress'] || 'X.X.X.X' end |
#mac ⇒ Object
57 58 59 |
# File 'lib/enterprise/scripts.rb', line 57 def mac node['macaddress'] || 'XX:XX:XX:XX:XX:XX' end |
#network ⇒ Object
65 66 67 |
# File 'lib/enterprise/scripts.rb', line 65 def network node['network'] end |
#node ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/enterprise/scripts.rb', line 69 def node @node ||= begin system = Ohai::System.new system.all_plugins system.data end end |
#run ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/enterprise/scripts.rb', line 21 def run puts BANNER.green wait_for_ip puts <<-MESSAGE.gsub(/^ {6}/, '') Welcome to GitHub Enterprise ---------------------------------------------------------------------- IP Address: #{ip} MAC Address: #{mac} Hostname: #{hostname} Visit http://#{ip}/setup to setup GitHub Enterprise. MESSAGE end |
#wait_for_ip ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/enterprise/scripts.rb', line 42 def wait_for_ip 1.upto(5) do address = node['ipaddress'] return if address.to_s =~ /^(?:\d+\.){3}\d+$/ @node = nil sleep 1 end end |