git_update.rb revision f35e888435be4e803bf73937cb5f173050a172e6
require 'json'
require 'ontohub_net'
end
def exec
# If its push over ssh
# we need to check user persmission per branch first
if ssh?
exit 0
else
STDERR.puts "Git: You are not allowed to access #{@branch_name}!"
exit 1
end
else
exit 0
end
STDERR.puts <<-ERROR
We couldn't determine your permissions successfully because
we encountered a status code of #{error.status_code} when
querying for permissions. Please try again in a few minutes.
If this issue persists please inform an Administrator.
ERROR
exit 1
end
protected
def api
OntohubNet.new
end
def ssh?
@key_id =~ /\Akey\-\d+\Z/
end
def update_redis
Subprocess.run 'redis-cli', 'rpush', "#{Settings.redis_namespace}:queue:default", {
class: 'RepositoryUpdateWorker',
args: [@repo_path, @oldrev, @newrev, @refname, @key_id]
}.to_json
end
end