Fix tagging for current branch

This commit is contained in:
Omar Roth 2019-03-04 14:43:17 -06:00
parent 6375a62465
commit 32b9c0c840
1 changed files with 5 additions and 5 deletions

View File

@ -90,9 +90,9 @@ REDDIT_URL = URI.parse("https://www.reddit.com")
LOGIN_URL = URI.parse("https://accounts.google.com") LOGIN_URL = URI.parse("https://accounts.google.com")
PUBSUB_URL = URI.parse("https://pubsubhubbub.appspot.com") PUBSUB_URL = URI.parse("https://pubsubhubbub.appspot.com")
TEXTCAPTCHA_URL = URI.parse("http://textcaptcha.com/omarroth@hotmail.com.json") TEXTCAPTCHA_URL = URI.parse("http://textcaptcha.com/omarroth@hotmail.com.json")
CURRENT_BRANCH = `git branch | sed -n '/\* /s///p'`.strip
CURRENT_COMMIT = `git rev-list HEAD --max-count=1 --abbrev-commit`.strip CURRENT_COMMIT = `git rev-list HEAD --max-count=1 --abbrev-commit`.strip
CURRENT_VERSION = `git describe --tags $(git rev-list --tags --max-count=1)`.strip CURRENT_VERSION = `git describe --tags $(git rev-list --tags --max-count=1)`.strip
CURRENT_BRANCH = `git status | head -1`.strip
LOCALES = { LOCALES = {
"ar" => load_locale("ar"), "ar" => load_locale("ar"),
@ -2536,15 +2536,15 @@ end
get "/api/v1/stats" do |env| get "/api/v1/stats" do |env|
env.response.content_type = "application/json" env.response.content_type = "application/json"
if statistics["error"]?
halt env, status_code: 500, response: statistics.to_json
end
if !config.statistics_enabled if !config.statistics_enabled
error_message = {"error" => "Statistics are not enabled."}.to_json error_message = {"error" => "Statistics are not enabled."}.to_json
halt env, status_code: 400, response: error_message halt env, status_code: 400, response: error_message
end end
if statistics["error"]?
halt env, status_code: 500, response: statistics.to_json
end
if env.params.query["pretty"]? && env.params.query["pretty"] == "1" if env.params.query["pretty"]? && env.params.query["pretty"] == "1"
statistics.to_pretty_json statistics.to_pretty_json
else else