change all GitHub links to Gab's GitLab at code.gab.com

This commit is contained in:
robcolbert
2019-07-03 13:26:13 -04:00
parent ddae395f91
commit 1ef1a3881d
18 changed files with 101 additions and 90 deletions

View File

@@ -33,11 +33,11 @@ module GabSocial
end
def repository
ENV.fetch('GITHUB_REPOSITORY') { 'gab-ai-inc/gab-social' }
ENV.fetch('GITHUB_REPOSITORY') { 'gab/social/gab-social' }
end
def source_base_url
ENV.fetch('SOURCE_BASE_URL') { "https://github.com/#{repository}" }
ENV.fetch('SOURCE_BASE_URL') { "https://code.gab.com/#{repository}" }
end
# specify git tag or commit hash here

View File

@@ -1,57 +1,66 @@
# frozen_string_literal: true
# 2019-07-02 (Rjc)
# Don't run what command? I see no command here.
# This is certainly not the command you are looking for.
# Gab doesn't do this
namespace :repo do
desc 'Generate the AUTHORS.md file'
task :authors do
# Gab AI, Inc., does not disclose information about contributors to the Gab
# Social project in this way. Please refer to our public git repository or
# contact us directly at legal@gab.com with any questions about the
# contributors to Gab Social.
end
desc 'Replace pull requests with authors in the CHANGELOG.md file'
task :changelog do
path = Rails.root.join('CHANGELOG.md')
tmp = Tempfile.new
# task :authors do
# # Gab AI, Inc., does not disclose information about contributors to the Gab
# # Social project in this way. Please refer to our public git repository or
# # contact us directly at legal@gab.com with any questions about the
# # contributors to Gab Social.
# end
HttpLog.config.compact_log = true
# desc 'Replace pull requests with authors in the CHANGELOG.md file'
# task :changelog do
# path = Rails.root.join('CHANGELOG.md')
# tmp = Tempfile.new
begin
File.open(path, 'r') do |file|
file.each_line do |line|
if line.start_with?('-')
new_line = line.gsub(/#([[:digit:]]+)*/) do |pull_request_reference|
pull_request_number = pull_request_reference[1..-1]
response = nil
# HttpLog.config.compact_log = true
loop do
response = HTTP.headers('Authorization' => "token #{ENV['GITHUB_API_TOKEN']}").get("https://api.github.com/repos/gab-ai-inc/gab-social/pulls/#{pull_request_number}")
# begin
# File.open(path, 'r') do |file|
# file.each_line do |line|
# if line.start_with?('-')
# new_line = line.gsub(/#([[:digit:]]+)*/) do |pull_request_reference|
# pull_request_number = pull_request_reference[1..-1]
# response = nil
if response.code == 403
sleep_for = (response.headers['X-RateLimit-Reset'].to_i - Time.now.to_i).abs
puts "Sleeping for #{sleep_for} seconds to get over rate limit"
sleep sleep_for
else
break
end
end
# loop do
# # (Rjc) 2019-07-03
# # this can't possibly work
# # will adapt post-launch I am trying to ship
# response = HTTP.headers('Authorization' => "token #{ENV['GITLAB_API_TOKEN']}").get("https://api.code.gab.com/repos/gab/social/gab-social/pulls/#{pull_request_number}")
pull_request = Oj.load(response.to_s)
"[#{pull_request['user']['login']}](#{pull_request['html_url']})"
end
# if response.code == 403
# sleep_for = (response.headers['X-RateLimit-Reset'].to_i - Time.now.to_i).abs
# puts "Sleeping for #{sleep_for} seconds to get over rate limit"
# sleep sleep_for
# else
# break
# end
# end
tmp.puts new_line
else
tmp.puts line
end
end
end
# pull_request = Oj.load(response.to_s)
# "[#{pull_request['user']['login']}](#{pull_request['html_url']})"
# end
tmp.close
FileUtils.mv(tmp.path, path)
ensure
tmp.close
tmp.unlink
end
end
# tmp.puts new_line
# else
# tmp.puts line
# end
# end
# end
# tmp.close
# FileUtils.mv(tmp.path, path)
# ensure
# tmp.close
# tmp.unlink
# end
# end
end