Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git-scm.com.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2022-10-05 16:57:07 +0300
committerJeff King <peff@peff.net>2022-10-05 16:57:07 +0300
commit4509a5ae61f6f48baa494b406af2bc56985065a9 (patch)
tree8fc7dc4d6fd9f452637baca09ab49befe6a4844c
parent2623bae6825e8750fe843b17c078f7f8811e1d0a (diff)
run rubocop --autocorrect
This picks up corrections from some new cops. Looking at the diff, they all seem pretty reasonable.
-rw-r--r--app/controllers/application_controller.rb2
-rw-r--r--app/helpers/application_helper.rb6
-rw-r--r--app/services/download_service.rb2
-rw-r--r--lib/tasks/book2.rake8
-rw-r--r--lib/tasks/index.rake10
-rwxr-xr-xscript/doc_importer4
6 files changed, 15 insertions, 17 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index cd003fcb..3e9171f6 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -24,6 +24,6 @@ class ApplicationController < ActionController::Base
end
def not_found_template
- Rails.root.join("public/404.html")
+ Rails.public_path.join('404.html')
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 4fbabe55..a9583995 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -4,9 +4,9 @@ require "iso8601"
module ApplicationHelper
def sidebar_link_options(section)
- if %w[about documentation downloads community].include?(@section) && @section == section ||
- %w[ reference book videos external-links
- guis logos].include?(@subsection) && @subsection == section
+ if (%w[about documentation downloads community].include?(@section) && @section == section) ||
+ (%w[ reference book videos external-links
+ guis logos].include?(@subsection) && @subsection == section)
{ class: "active" }
else
{}
diff --git a/app/services/download_service.rb b/app/services/download_service.rb
index 81c48d0a..0c9a535a 100644
--- a/app/services/download_service.rb
+++ b/app/services/download_service.rb
@@ -75,7 +75,7 @@ class DownloadService
private
def files_from_github(repository)
- @octokit = Octokit::Client.new(access_token: ENV["GITHUB_API_TOKEN"])
+ @octokit = Octokit::Client.new(access_token: ENV.fetch("GITHUB_API_TOKEN", nil))
downloads = []
releases = @octokit.releases(repository)
diff --git a/lib/tasks/book2.rake b/lib/tasks/book2.rake
index b61372e8..d96f3315 100644
--- a/lib/tasks/book2.rake
+++ b/lib/tasks/book2.rake
@@ -48,14 +48,14 @@ def genbook(code, &get_content)
# select the chapter files
if /(book\/[01].*\/1-[^\/]*\.asc|ch[0-9]{2}-.*\.asc)/.match?(filename)
chnumber += 1
- chapters ["ch#{secnumber}"] = ["chapter", chnumber, filename]
+ chapters["ch#{secnumber}"] = ["chapter", chnumber, filename]
secnumber += 1
end
# detect the appendices
next unless filename =~ /(book\/[ABC].*\.asc|[ABC].*\.asc)/
appnumber += 1
- chapters ["ch#{secnumber}"] = ["appendix", appnumber, filename]
+ chapters["ch#{secnumber}"] = ["appendix", appnumber, filename]
secnumber += 1
end
@@ -93,7 +93,7 @@ def genbook(code, &get_content)
puts "not including #{chapter_title}\n"
break
end
- chapter_type, chapter_number = chapters ["ch#{index}"]
+ chapter_type, chapter_number = chapters["ch#{index}"]
chapter = entry
next if !chapter_title
@@ -196,7 +196,7 @@ end
desc "Generate book html directly from git repo"
task remote_genbook2: :environment do
- @octokit = Octokit::Client.new(access_token: ENV["GITHUB_API_TOKEN"])
+ @octokit = Octokit::Client.new(access_token: ENV.fetch("GITHUB_API_TOKEN", nil))
if ENV["GENLANG"]
books = Book.all_books.select { |code, _repo| code == ENV["GENLANG"] }
diff --git a/lib/tasks/index.rake b/lib/tasks/index.rake
index 3272ce68..39bfb3b4 100644
--- a/lib/tasks/index.rake
+++ b/lib/tasks/index.rake
@@ -35,7 +35,7 @@ end
def index_l10n_doc(filter_tags, doc_list, get_content)
ActiveRecord::Base.logger.level = Logger::WARN
- rebuild = ENV["REBUILD_DOC"]
+ rebuild = ENV.fetch("REBUILD_DOC", nil)
rerun = ENV["RERUN"] || rebuild || false
filter_tags.call(rebuild, false).sort_by { |tag| Version.version_to_num(tag.first[1..]) }.each do |tag|
@@ -161,7 +161,7 @@ end
def index_doc(filter_tags, doc_list, get_content)
ActiveRecord::Base.logger.level = Logger::WARN
- rebuild = ENV["REBUILD_DOC"]
+ rebuild = ENV.fetch("REBUILD_DOC", nil)
rerun = ENV["RERUN"] || rebuild || false
tags = filter_tags.call(rebuild).sort_by { |tag| Version.version_to_num(tag.first[1..]) }
@@ -202,7 +202,7 @@ def index_doc(filter_tags, doc_list, get_content)
end
puts "Found #{doc_files.size} entries"
- doc_limit = ENV["ONLY_BUILD_DOC"]
+ doc_limit = ENV.fetch("ONLY_BUILD_DOC", nil)
# generate command-list content
generated = {}
@@ -304,7 +304,7 @@ end
def github_index_doc(index_fun, repo)
Octokit.auto_paginate = true
- @octokit = Octokit::Client.new(access_token: ENV["GITHUB_API_TOKEN"])
+ @octokit = Octokit::Client.new(access_token: ENV.fetch("GITHUB_API_TOKEN", nil))
repo = ENV["GIT_REPO"] || repo
@@ -345,7 +345,7 @@ def github_index_doc(index_fun, repo)
end
def local_index_doc(index_fun)
- dir = ENV["GIT_REPO"]
+ dir = ENV.fetch("GIT_REPO", nil)
Dir.chdir(dir) do
tag_filter = lambda do |tagname, gettags = true|
if gettags
diff --git a/script/doc_importer b/script/doc_importer
index 6abca5bf..208e95e5 100755
--- a/script/doc_importer
+++ b/script/doc_importer
@@ -15,6 +15,4 @@ html.gsub!(/linkgit:(.*)\[(\d+)\]/) do |line|
"<a href='/docs/#{x[1]}'>#{x[1]}[#{x[2]}]</a>"
end
-File.open("./git-diff.html", "w+") do |f|
- f.write html
-end
+File.write("./git-diff.html", html)