clarify openshift

Andrew Cantino 10 gadi atpakaļ
vecāks
revīzija
22e3d01ab2
1 mainītis faili ar 11 papildinājumiem un 2 dzēšanām
  1. 11 2
      bin/setup_openshift

+ 11 - 2
bin/setup_openshift

@@ -23,8 +23,14 @@ def set_env(key, value)
23 23
 end
24 24
 
25 25
 def check_login!
26
-  unless Dir[File.join(File.expand_path('~/.openshift'), 'token_*')].length > 0
27
-    puts "It looks like you need to log in to OpenShift.  Please run 'rhc setup' before continuing a choose the option to 'Generate a token now'."
26
+  token_file = Dir[File.join(File.expand_path('~/.openshift'), 'token_*')].first
27
+  unless token_file
28
+    puts "It looks like you need to log in to OpenShift.  Please run 'rhc setup' before continuing a choose the option to 'Generate a token now', then run bin/setup_openshift again."
29
+    exit 1
30
+  end
31
+
32
+  unless (Time.now - File.stat(token_file).mtime).to_i < 60 * 60 * 24 * 5
33
+    puts "Please run 'rhc logout' and then 'rhc account' to refresh your session, then run bin/setup_openshift again."
28 34
     exit 1
29 35
   end
30 36
 
@@ -41,6 +47,7 @@ if info =~ /must specify an application/i
41 47
   cmd = "rhc app create huginn ruby-2.0 mysql-5.5 #{foreman_cartridge} -s -r tmp-huginn"
42 48
   puts "It looks like you don't have an OpenShift app set up yet for this repo. I can make one for you."
43 49
   if yes?("Would you like me to create an OpenShift app for you now in this repo?")
50
+    puts "Okay, this may take a moment..."
44 51
     puts `#{cmd}`
45 52
 
46 53
     git_config = capture("git config --list -f tmp-huginn/.git/config").split("\n")
@@ -135,6 +142,8 @@ if first_time
135 142
   end
136 143
   puts
137 144
   puts "\t#{$config['INVITATION_CODE']}"
145
+  puts
146
+  puts "We recommend that you read https://github.com/cantino/huginn/wiki/Run-Huginn-for-free-on-OpenShift and setup Pingdom to keep your app awake!"
138 147
 end
139 148
 
140 149
 puts