From 6fbca4c377e3a49b0e77df3479807fa4e890b7ce Mon Sep 17 00:00:00 2001 From: cpt Date: Thu, 7 Mar 2024 19:17:46 +0100 Subject: [PATCH 1/2] Reparatie poging Verwijder scripts die niet meer in progit2 staan Neem wijzigingen in gelijknamige scripts in progit2 over Neem nieuwe bestanden over uit progit2 --- .github/workflows/pr-build.yml | 4 +- .github/workflows/release-on-merge.yml | 4 +- .gitignore | 2 +- .tgitconfig | 2 +- .travis.yml | 34 ----- Gemfile | 24 ++-- Gemfile.lock | 95 -------------- Rakefile | 143 ++++++++++++++++++--- atlas.json | 2 +- book/07-git-tools/git-credential-read-only | 0 book/index.asc | 1 - script/tag_on_master | 19 --- 12 files changed, 143 insertions(+), 187 deletions(-) delete mode 100644 .travis.yml delete mode 100644 Gemfile.lock mode change 100755 => 100644 book/07-git-tools/git-credential-read-only delete mode 100644 book/index.asc delete mode 100644 script/tag_on_master diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index e3036652..f7fed92b 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -2,13 +2,13 @@ name: Pull Request Build on: pull_request: - branches: [ main, master ] + branches: [ main ] jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 diff --git a/.github/workflows/release-on-merge.yml b/.github/workflows/release-on-merge.yml index d71107f7..c0ece187 100644 --- a/.github/workflows/release-on-merge.yml +++ b/.github/workflows/release-on-merge.yml @@ -2,13 +2,13 @@ name: Release on push to main on: push: - branches: [ main, master ] + branches: [ main ] jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.gitignore b/.gitignore index aee8d999..0e6f5086 100644 --- a/.gitignore +++ b/.gitignore @@ -2,11 +2,11 @@ output .DS_Store # build artifacts -Gemfile.lock progit.html progit.pdf progit.pdfmarks progit.epub +progit.fb2.zip progit-kf8.epub progit.mobi contributors.txt diff --git a/.tgitconfig b/.tgitconfig index 9a9773b3..a1a52037 100644 --- a/.tgitconfig +++ b/.tgitconfig @@ -1,6 +1,6 @@ [bugtraq] url = https://github.com/progit/progit2/issues/%BUGID% - logregex = "[Ii]ssues?:?(\\s*(,|and)?\\s*#?\\d+)+\n(\\d+)" + logregex = "(?:[Cc]lose[sd]?|[Ff]ix(?:e[sd])?|[Rr]esolve[sd]?):?\\s+(?:[Ii]ssues?\\s+#?|#)\\d+(?:(?:,|\\s+and)\\s+(?:[Ii]ssues?\\s+#?|#)\\d+)*\n(\\d+)" [tgit] icon = Pro.ico diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7f747e0e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -language: ruby -sudo: false -git: - depth: false -cache: bundler -before_install: - - wget https://raw.githubusercontent.com/progit/progit2-pub/master/bootstrap.sh - - sh bootstrap.sh -script: bundle exec rake book:build -after_success: bundle exec rake book:tag -deploy: - provider: releases - file_glob: true - file: - - progit*.epub - - progit*.mobi - - progit*.pdf - skip_cleanup: true - on: - tags: true - api-key: $GITHUB_API_TOKEN -branches: - only: - - master - - /^2\.1(\.\d+)+$/ - -addons: - apt: - packages: - - epubcheck -notifications: - email: - on_success: never - on_failure: always \ No newline at end of file diff --git a/Gemfile b/Gemfile index 33dd0ac5..9c9ccfa7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,16 +1,18 @@ source 'https://rubygems.org' -gem 'rake' -gem 'asciidoctor', '1.5.8' +gem 'rake', '13.1.0' +gem 'asciidoctor', '2.0.21' -gem 'json' -gem 'awesome_print' +gem 'json', '2.6.3' +gem 'awesome_print', '1.9.2' -gem 'asciidoctor-epub3', :git => 'https://github.com/asciidoctor/asciidoctor-epub3' -gem 'asciidoctor-pdf', '1.5.0.alpha.16' +gem 'asciidoctor-fb2', '0.7.0' +gem 'asciidoctor-epub3', '2.1.0' +gem 'asciidoctor-pdf', '2.3.13' -gem 'coderay' -gem 'pygments.rb' -gem 'thread_safe' -gem 'epubcheck' -gem 'kindlegen' +gem 'coderay', '1.1.3' +gem 'pygments.rb', '2.4.1' +gem 'thread_safe', '0.3.6' +gem 'epubcheck-ruby', '5.1.0.0' +gem 'html-proofer', '5.0.8' +gem 'kindlegen', '3.1.1' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index d927e9ff..00000000 --- a/Gemfile.lock +++ /dev/null @@ -1,95 +0,0 @@ -GIT - remote: https://github.com/asciidoctor/asciidoctor-epub3 - revision: ba930925a1df617312f986c7599b5162473b716f - specs: - asciidoctor-epub3 (1.5.0.alpha.9.dev) - asciidoctor (~> 1.5.0) - gepub (~> 0.6.9.2) - thread_safe (~> 0.3.6) - -GEM - remote: https://rubygems.org/ - specs: - Ascii85 (1.0.3) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) - afm (0.2.2) - asciidoctor (1.5.8) - asciidoctor-pdf (1.5.0.alpha.16) - asciidoctor (>= 1.5.0) - prawn (>= 1.3.0, < 2.3.0) - prawn-icon (= 1.3.0) - prawn-svg (>= 0.21.0, < 0.28.0) - prawn-table (= 0.2.2) - prawn-templates (>= 0.0.3, <= 0.1.1) - safe_yaml (~> 1.0.4) - thread_safe (~> 0.3.6) - treetop (= 1.5.3) - awesome_print (1.8.0) - coderay (1.1.2) - css_parser (1.6.0) - addressable - epubcheck (3.0.1) - gepub (0.6.9.2) - nokogiri (~> 1.6.1) - rubyzip (>= 1.1.1) - hashery (2.1.2) - json (2.3.0) - kindlegen (3.0.3) - rake - rubyzip - mini_portile2 (2.1.0) - multi_json (1.13.1) - nokogiri (1.6.8.1) - mini_portile2 (~> 2.1.0) - pdf-core (0.7.0) - pdf-reader (2.1.0) - Ascii85 (~> 1.0.0) - afm (~> 0.2.1) - hashery (~> 2.0) - ruby-rc4 - ttfunk - polyglot (0.3.5) - prawn (2.2.2) - pdf-core (~> 0.7.0) - ttfunk (~> 1.5) - prawn-icon (1.3.0) - prawn (>= 1.1.0, < 3.0.0) - prawn-svg (0.27.1) - css_parser (~> 1.3) - prawn (>= 0.11.1, < 3) - prawn-table (0.2.2) - prawn (>= 1.3.0, < 3.0.0) - prawn-templates (0.1.1) - pdf-reader (~> 2.0) - prawn (~> 2.2) - public_suffix (4.0.6) - pygments.rb (1.2.1) - multi_json (>= 1.0.0) - rake (12.3.3) - ruby-rc4 (0.1.5) - rubyzip (2.3.0) - safe_yaml (1.0.4) - thread_safe (0.3.6) - treetop (1.5.3) - polyglot (~> 0.3) - ttfunk (1.5.1) - -PLATFORMS - ruby - -DEPENDENCIES - asciidoctor (= 1.5.8) - asciidoctor-epub3! - asciidoctor-pdf (= 1.5.0.alpha.16) - awesome_print - coderay - epubcheck - json - kindlegen - pygments.rb - rake - thread_safe - -BUNDLED WITH - 1.16.1 diff --git a/Rakefile b/Rakefile index 5b5702aa..4f7c3dac 100644 --- a/Rakefile +++ b/Rakefile @@ -1,35 +1,138 @@ namespace :book do - desc 'build basic book formats' - task :build do - begin - version_string = ENV['TRAVIS_TAG'] || `git describe --tags`.chomp - if version_string.empty? - version_string = '0' + # Variables referenced for build + version_string = `git describe --tags --abbrev=0`.chomp + if version_string.empty? + version_string = '0' + else + versions = version_string.split('.') + version_string = versions[0] + '.' + versions[1] + '.' + versions[2].to_i.next.to_s + end + date_string = Time.now.strftime('%Y-%m-%d') + params = "--attribute revnumber='#{version_string}' --attribute revdate='#{date_string}'" + header_hash = `git rev-parse --short HEAD`.strip + + # Check contributors list + # This checks commit hash stored in the header of list against current HEAD + def check_contrib + if File.exist?('book/contributors.txt') + current_head_hash = `git rev-parse --short HEAD`.strip + header = `head -n 1 book/contributors.txt`.strip + # Match regex, then coerce resulting array to string by join + header_hash = header.scan(/[a-f0-9]{7,}/).join + + if header_hash == current_head_hash + puts "Hash on header of contributors list (#{header_hash}) matches the current HEAD (#{current_head_hash})" + else + puts "Hash on header of contributors list (#{header_hash}) does not match the current HEAD (#{current_head_hash}), refreshing" + sh "rm book/contributors.txt" + # Reenable and invoke task again + Rake::Task['book/contributors.txt'].reenable + Rake::Task['book/contributors.txt'].invoke end - date_string = Time.now.strftime("%Y-%m-%d") - params = "--attribute revnumber='#{version_string}' --attribute revdate='#{date_string}'" - puts "Generating contributors list" - `git shortlog -s | grep -v -E "(Straub|Chacon)" | cut -f 2- | column -c 120 > book/contributors.txt` + end + end + + desc 'build basic book formats' + task :build => [:build_html, :build_epub, :build_fb2, :build_mobi, :build_pdf] do + begin + # Run check + Rake::Task['book:check'].invoke + + # Rescue to ignore checking errors + rescue => e + puts e.message + puts 'Error when checking books (ignored)' + end + end + + desc 'build basic book formats (for ci)' + task :ci => [:build_html, :build_epub, :build_fb2, :build_mobi, :build_pdf] do + # Run check, but don't ignore any errors + Rake::Task['book:check'].invoke + end + + desc 'generate contributors list' + file 'book/contributors.txt' do + puts 'Generating contributors list' + sh "echo 'Contributors as of #{header_hash}:\n' > book/contributors.txt" + sh "git shortlog -s HEAD | grep -v -E '(Straub|Chacon|dependabot)' | cut -f 2- | sort | column -c 120 >> book/contributors.txt" + end + + desc 'build HTML format' + task :build_html => 'book/contributors.txt' do + check_contrib() + + puts 'Converting to HTML...' + sh "bundle exec asciidoctor #{params} -a data-uri progit.asc" + puts ' -- HTML output at progit.html' - puts "Converting to HTML..." - `bundle exec asciidoctor #{params} progit.asc` - puts " -- HTML output at progit.html" + end + + desc 'build Epub format' + task :build_epub => 'book/contributors.txt' do + check_contrib() + + puts 'Converting to EPub...' + sh "bundle exec asciidoctor-epub3 #{params} progit.asc" + puts ' -- Epub output at progit.epub' + + end - puts "Converting to EPub..." - `bundle exec asciidoctor-epub3 #{params} progit.asc` - puts " -- Epub output at progit.epub" + desc 'build FB2 format' + task :build_fb2 => 'book/contributors.txt' do + check_contrib() + + puts 'Converting to FB2...' + sh "bundle exec asciidoctor-fb2 #{params} progit.asc" + puts ' -- FB2 output at progit.fb2.zip' + + end + + desc 'build Mobi format' + task :build_mobi => 'book/contributors.txt' do + check_contrib() puts "Converting to Mobi (kf8)..." - `bundle exec asciidoctor-epub3 #{params} -a ebook-format=kf8 progit.asc` + sh "bundle exec asciidoctor-epub3 #{params} -a ebook-format=kf8 progit.asc" puts " -- Mobi output at progit.mobi" + end - puts "Converting to PDF... (this one takes a while)" - `bundle exec asciidoctor-pdf #{params} progit.asc 2>/dev/null` - puts " -- PDF output at progit.pdf" + desc 'build PDF format' + task :build_pdf => 'book/contributors.txt' do + check_contrib() + puts 'Converting to PDF... (this one takes a while)' + sh "bundle exec asciidoctor-pdf #{params} progit.asc 2>/dev/null" + puts ' -- PDF output at progit.pdf' + end + + desc 'Check generated books' + task :check => [:build_html, :build_epub] do + puts 'Checking generated books' + + sh "htmlproofer progit.html" + sh "epubcheck progit.epub" + end + + desc 'Clean all generated files' + task :clean do + begin + puts 'Removing generated files' + + FileList['book/contributors.txt', 'progit.html', 'progit-kf8.epub', 'progit.epub', 'progit.fb2.zip', 'progit.mobi', 'progit.pdf'].each do |file| + rm file + + # Rescue if file not found + rescue Errno::ENOENT => e + begin + puts e.message + puts 'Error removing files (ignored)' + end + end end end + end task :default => "book:build" diff --git a/atlas.json b/atlas.json index d66a60a3..b75c8d65 100644 --- a/atlas.json +++ b/atlas.json @@ -1,5 +1,5 @@ { - "branch": "master", + "branch": "main", "files": [ "book/cover.html", "LICENSE.asc", diff --git a/book/07-git-tools/git-credential-read-only b/book/07-git-tools/git-credential-read-only old mode 100755 new mode 100644 diff --git a/book/index.asc b/book/index.asc deleted file mode 100644 index 9b0c1cfa..00000000 --- a/book/index.asc +++ /dev/null @@ -1 +0,0 @@ -== Index diff --git a/script/tag_on_master b/script/tag_on_master deleted file mode 100644 index 6757a299..00000000 --- a/script/tag_on_master +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# This is for running on Travis. It automatically tags any merge to Master as a release in the 2.1.x series. -if [[ $TRAVIS_PULL_REQUEST != 'false' || "$TRAVIS_BRANCH" != 'master' ]]; then - # Don't run on pull requests - echo 'This only runs on a merge to master.' - exit 0 -fi - -# Compute the next tag number -LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3) -PATCH=$(($LASTPATCH+1)) -echo $PATCH - -# Create a tag -curl -H "Authorization: token $GITHUB_KEY" \ - -X POST \ - -d "{\"ref\":\"refs/tags/2.1.$PATCH\", \"sha\":\"$TRAVIS_COMMIT\"}" \ - https://api.github.com/repos/progit/progit2/git/refs From 0c6375c6e10734ed9687aa47dbf220dda12457ca Mon Sep 17 00:00:00 2001 From: cpt Date: Thu, 7 Mar 2024 19:18:31 +0100 Subject: [PATCH 2/2] Reparatie poging Neem nieuwe bestanden over uit progit2 --- .github/ISSUE_TEMPLATE/bug_report.yml | 131 ++++++++++++++++++++ .github/ISSUE_TEMPLATE/enhancement_idea.yml | 34 +++++ .github/dependabot.yml | 19 +++ CITATION.cff | 29 +++++ SECURITY.md | 5 + 5 files changed, 218 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/enhancement_idea.yml create mode 100644 .github/dependabot.yml create mode 100644 CITATION.cff create mode 100644 SECURITY.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..6660cdf8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,131 @@ +name: Bug report +description: Create a report to help us improve +labels: ["bug"] +body: + - type: checkboxes + attributes: + label: There's no existing/similar bug report. + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + + - type: checkboxes + attributes: + label: This report is about a single actionable bug. + description: Please create one issue per bug, split up your bug reports if needed. + options: + - label: I'm reporting a single actionable bug + required: true + + - type: checkboxes + attributes: + label: This report is about the ProGit book, version 2, English language. + description: Bug reports about translations or the first version of the book are not accepted. + options: + - label: This bug is not about a translation or old version + required: true + + - type: checkboxes + attributes: + label: Bug covers book website/pdf + description: This bug is about the book as found on the [website](https://www.git-scm.com/book/en/v2) or the PDF. + options: + - label: I confirm the bug is about the book as found on the website/pdf + validations: + required: false + + - type: checkboxes + attributes: + label: Problem is present in the Pro Git book on the website? + description: If you found an issue in the pdf/epub/mobi files, you've checked if the problem is also present in the Pro Git book on the [website](https://www.git-scm.com/book/en/v2). + options: + - label: This bug also affects the Pro Git book as published on the website. + validations: + required: false + + - type: dropdown + attributes: + label: Which version of the book is affected? + description: | + It's important for us to know if the problem is in the source or in the tooling that creates the pdf/epub/mobi files. + Therefore, please select which versions are affected. + options: + - "Source files" + - "Tooling" + - "Source files and tooling" + - "I don't know" + validations: + required: true + + - type: textarea + attributes: + label: "Describe the bug:" + description: A clear and concise description of what the bug is. + validations: + required: true + + - type: textarea + attributes: + label: "Steps to reproduce:" + description: Please write the steps needed to reproduce the bug here. + placeholder: Provide a ordered list of steps to reproduce. + value: | + 1. Go to '...' + 2. Click on '...' + 3. 'Scroll down to '...' + 4. See error + validations: + required: true + + - type: textarea + attributes: + label: "Expected behavior:" + description: A clear and concise description of what you expected to happen. + placeholder: I expected ... to happen. + validations: + required: true + + - type: textarea + attributes: + label: "Screenshots:" + description: If applicable, add screenshots to help explain your problem. + placeholder: "Tip: you can drag your screenshot into this field, or you can copy/paste." + validations: + required: false + + - type: textarea + attributes: + label: "Additional context:" + description: | + Add any other context about the problem here. + You can also put references to similar bugs here. + placeholder: "Example: this bug also affect issues #1 and #2." + validations: + required: false + + - type: input + attributes: + label: Device + description: Tell us what kind of device you're using to access the content. + placeholder: mobile device / desktop / laptop / e-book reader + validations: + required: false + + - type: input + attributes: + label: Operating system + description: If the problem is with the book or the published files, we need to know what operating system you run on your device. + placeholder: | + Windows 10 Home Edition + validations: + required: false + + - type: input + attributes: + label: Browser/application + version + description: What browser/application are you using? We also need the version number of the browser/application. + placeholder: | + Google Chrome 91.0.4472.164 + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/enhancement_idea.yml b/.github/ISSUE_TEMPLATE/enhancement_idea.yml new file mode 100644 index 00000000..f0b19c19 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/enhancement_idea.yml @@ -0,0 +1,34 @@ +name: Enhancement idea +description: Suggest an idea for the ProGit2 book or repository +labels: ["enhancement"] +body: + - type: textarea + attributes: + label: General overview of your idea. + description: Give a general overview of your idea. + validations: + required: true + + - type: textarea + attributes: + label: What problem will this solve? + description: Explain what problem you're trying to solve. + validations: + required: true + + - type: textarea + attributes: + label: Have you thought about other solutions? + description: Describe any alternative solutions to the problem. + validations: + required: false + + - type: dropdown + attributes: + label: Do you want to help with this enhancement idea? + options: + - "Yes" + - "Maybe" + - "No" + validations: + required: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..6adcdcdb --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,19 @@ +version: 2 +updates: + # Maintain dependencies for Ruby + - package-ecosystem: "bundler" + directory: "/" + schedule: + interval: "daily" # Checks on Monday through Friday. + + # Maintain GitHub Action runners + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" # Checks on Monday through Friday. + + # Set default reviewer and labels + reviewers: + - "ben" + labels: + - "dependabot" diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 00000000..b311dcdd --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,29 @@ +# This CITATION.cff file was generated with cffinit. +# Visit https://bit.ly/cffinit to generate yours today! + +cff-version: 1.2.0 +title: Pro Git +message: >- + If you use this software, please cite it using the + metadata from this file. +type: software +authors: + - given-names: Scott + family-names: Chacon + email: schacon@gmail.com + - given-names: Ben + family-names: Straub + email: ben@straub.cc +identifiers: + - type: url + value: 'https://git-scm.com/book/en/v2' + description: Pro Git website +repository-code: 'https://github.com/progit/progit2' +url: 'https://git-scm.com/book/en/v2' +keywords: + - git + - book + - asciidoc + - pro-git +license: CC-BY-NC-SA-3.0 +version: '2' diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..f1ed9cb6 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,5 @@ +## Reporting a security issue + +If you find any security issue or vulnerability, please email [ben@straub.cc](mailto:ben@straub.cc) with your report. + +Do not open a issue on the `progit/progit2` repository or discuss the vulnerability in public.