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 :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