Skip to content
This repository
Browse code

Added versions:test and versions:live commands.

  • Loading branch information...
commit 41d423214b87e977c5ffd0ed5ad4434909026cdf 1 parent 64c9e58
Graham Ashton authored
22  Thorfile
@@ -80,3 +80,25 @@ class Integration < Thor
80 80
   def latest
81 81
   end
82 82
 end
  83
+
  84
+class Versions < Thor
  85
+  desc "test", "show current versions on test server"
  86
+  def test
  87
+    _check_server(:test)
  88
+  end
  89
+  
  90
+  desc "live", "show current versions on live server"
  91
+  def live
  92
+    _check_server(:live)
  93
+  end
  94
+  
  95
+  def _check_server(type)
  96
+    versions = ApplicationVersion.check_current_versions(type)
  97
+    versions.sort! { |a, b| a.application.name <=> b.application.name }
  98
+    puts sprintf("%-15s %s", "Application", "Version")
  99
+    puts "-" * 78
  100
+    versions.each do |version|
  101
+      puts sprintf("%-15s %s", version.application.name, version.version)
  102
+    end
  103
+  end
  104
+end
4  lib/integral/database.rb
@@ -59,10 +59,12 @@ def self.find_current
59 59
   end
60 60
   
61 61
   def self.check_current_versions(type)
  62
+    versions = []
62 63
     Application.find(:all, :conditions => ["active = ?", true]).each do |app|
63  
-      find_or_create_by_application_id_and_version(
  64
+      versions << find_or_create_by_application_id_and_version(
64 65
           :application => app, :version => app.current_version(type))
65 66
     end
  67
+    versions
66 68
   end
67 69
 end
68 70
 

0 notes on commit 41d4232

Please sign in to comment.
Something went wrong with that request. Please try again.