This commit is contained in:
BoHung Chiu 2021-03-13 19:19:04 +08:00
parent 2082585e0c
commit 7d2cc811db
1 changed files with 4 additions and 4 deletions

View File

@ -52,9 +52,9 @@ module PersonalPluginGenerator
end end
git = 'git_1.9.1/usr/bin/git' git = 'git_1.9.1/usr/bin/git'
end end
@branch = %x(#{git} rev-parse --abbrev-ref HEAD).gsub("\n","") @branch = %x(cd #{ENV['PWD']} && #{git} rev-parse --abbrev-ref HEAD).gsub("\n","")
new_commit_id = %x(#{git} log #{@branch}..origin/#{@branch} --pretty=format:"%H") new_commit_id = %x(cd #{ENV['PWD']} && #{git} log #{@branch}..origin/#{@branch} --pretty=format:"%H")
new_updates = %x(#{git} log #{@branch}..origin/#{@branch} --pretty=format:"%ad' , '%s" --date=short).split("\n").map{|log| log.gsub("'","")} new_updates = %x(cd #{ENV['PWD']} && #{git} log #{@branch}..origin/#{@branch} --pretty=format:"%ad' , '%s" --date=short).split("\n").map{|log| log.gsub("'","")}
if new_commit_id.present? if new_commit_id.present?
git_add_except_public = Dir['*'].select{|v| v!= 'public' && v!= 'log' && v != 'dump' && v != 'tmp'}.collect do |v| git_add_except_public = Dir['*'].select{|v| v!= 'public' && v!= 'log' && v != 'dump' && v != 'tmp'}.collect do |v|
"#{git} add -f --all --ignore-errors '#{v}'" "#{git} add -f --all --ignore-errors '#{v}'"
@ -70,7 +70,7 @@ module PersonalPluginGenerator
if %x[#{git} config user.email].empty? if %x[#{git} config user.email].empty?
%x[#{git} config --global user.email "orbit@rulingcom.com"] %x[#{git} config --global user.email "orbit@rulingcom.com"]
end end
system("#{git_add_except_public} ; #{git} commit -m auto_backup_before_#{type}_#{time_now} --allow-empty && #{git} reset #{commit} --mixed ; #{git_add_custom} ; #{git_restore} ; #{git_add_except_public} ; #{git} clean -f -- app/models ; #{git} commit -m complete_#{type}_#{time_now} --allow-empty") system("cd #{ENV['PWD']} && sh -l -c \"#{git_add_except_public} ; #{git} commit -m auto_backup_before_#{type}_#{time_now} --allow-empty && #{git} reset #{commit} --mixed ; #{git_add_custom} ; #{git_restore} ; #{git_add_except_public} ; #{git} clean -f -- app/models ; #{git} commit -m complete_#{type}_#{time_now} --allow-empty\"")
puts "Updated! " + new_updates.first.to_s puts "Updated! " + new_updates.first.to_s
end end
end end