diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb index 503769f..1b1c73d 100644 --- a/app/controllers/admin/sites_controller.rb +++ b/app/controllers/admin/sites_controller.rb @@ -4,6 +4,7 @@ class Admin::SitesController < OrbitBackendController before_filter :is_admin? before_filter :get_site before_filter :git_branch + before_filter :get_tag # def index # @site = Site.first @@ -133,7 +134,7 @@ class Admin::SitesController < OrbitBackendController def check_updates %x(git fetch origin) - @new_updates = %x(git log #{@branch}..origin/#{@branch} --pretty=format:"%ad','%s" --date=short).split("\n").map{|log| log.gsub("'","").split(",")}.to_json + @new_updates = %x(git log #{@current_tag}..#{@latest_tag} --pretty=format:"%ad','%s" --date=short).split("\n").map{|log| log.gsub("'","").split(",")}.to_json render :json => @new_updates end @@ -185,5 +186,11 @@ class Admin::SitesController < OrbitBackendController def git_branch @branch = %x(git rev-parse --abbrev-ref HEAD).gsub("\n","") end + + def get_tag + @current_tag = %x(git describe --tags).gsub("\n","") + %x(git fetch --tag).gsub("\n","") + @latest_tag = %x(git describe --tags).gsub("\n","") + end end