updated with tags

This commit is contained in:
Saurabh Bhatia 2014-03-10 17:44:44 +08:00
parent a308171f31
commit d01f2fc125
1 changed files with 8 additions and 1 deletions

View File

@ -4,6 +4,7 @@ class Admin::SitesController < OrbitBackendController
before_filter :is_admin? before_filter :is_admin?
before_filter :get_site before_filter :get_site
before_filter :git_branch before_filter :git_branch
before_filter :get_tag
# def index # def index
# @site = Site.first # @site = Site.first
@ -133,7 +134,7 @@ class Admin::SitesController < OrbitBackendController
def check_updates def check_updates
%x(git fetch origin) %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 render :json => @new_updates
end end
@ -186,4 +187,10 @@ class Admin::SitesController < OrbitBackendController
@branch = %x(git rev-parse --abbrev-ref HEAD).gsub("\n","") @branch = %x(git rev-parse --abbrev-ref HEAD).gsub("\n","")
end 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 end