Permalink
Browse files

Added versions:test and versions:live commands.

  • Loading branch information...
1 parent 64c9e58 commit 41d423214b87e977c5ffd0ed5ad4434909026cdf @gma committed Nov 10, 2008
Showing with 25 additions and 1 deletion.
  1. +22 −0 Thorfile
  2. +3 −1 lib/integral/database.rb
View
@@ -80,3 +80,25 @@ class Integration < Thor
def latest
end
end
+
+class Versions < Thor
+ desc "test", "show current versions on test server"
+ def test
+ _check_server(:test)
+ end
+
+ desc "live", "show current versions on live server"
+ def live
+ _check_server(:live)
+ end
+
+ def _check_server(type)
+ versions = ApplicationVersion.check_current_versions(type)
+ versions.sort! { |a, b| a.application.name <=> b.application.name }
+ puts sprintf("%-15s %s", "Application", "Version")
+ puts "-" * 78
+ versions.each do |version|
+ puts sprintf("%-15s %s", version.application.name, version.version)
+ end
+ end
+end
@@ -59,10 +59,12 @@ def self.find_current
end
def self.check_current_versions(type)
+ versions = []
Application.find(:all, :conditions => ["active = ?", true]).each do |app|
- find_or_create_by_application_id_and_version(
+ versions << find_or_create_by_application_id_and_version(
:application => app, :version => app.current_version(type))
end
+ versions
end
end

0 comments on commit 41d4232

Please sign in to comment.