From 544e832de81dd2ccea7b41b9ec79d90535a92142 Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Fri, 20 Oct 2023 18:07:22 -0700 Subject: [PATCH] Extract generate_index command to rubygems-generate_index gem --- .../ISSUE_TEMPLATE/bundler-related-issue.md | 74 -- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/config.yml | 2 +- .github/dependabot.yml | 14 +- .github/workflows/bundler.yml | 82 -- .github/workflows/daily-bundler.yml | 53 -- .github/workflows/daily-rubygems.yml | 60 -- .github/workflows/install-rubygems.yml | 129 --- .github/workflows/jruby-bundler.yml | 65 -- .github/workflows/legacy-git.yml | 32 - .github/workflows/realworld-bundler.yml | 123 --- .github/workflows/ruby-core.yml | 68 -- .github/workflows/rubygems.yml | 28 +- .github/workflows/system-rubygems-bundler.yml | 74 -- .github/workflows/truffleruby-bundler.yml | 40 - .github/workflows/ubuntu-lint.yml | 19 +- .github/workflows/weekly-update.yml | 43 - .rubocop.yml | 11 +- Gemfile | 11 + Gemfile.lock | 61 ++ Manifest.txt | 11 + README.md | 59 ++ Rakefile | 745 +----------------- .../commands/generate_index_command.rb | 2 +- lib/rubygems/indexer.rb | 18 +- lib/rubygems_plugin.rb | 6 + rubygems-generate_index.gemspec | 33 + rubygems-update.gemspec | 38 - test/rubygems/test_gem_indexer.rb | 2 +- 29 files changed, 231 insertions(+), 1674 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bundler-related-issue.md delete mode 100644 .github/workflows/bundler.yml delete mode 100644 .github/workflows/daily-bundler.yml delete mode 100644 .github/workflows/daily-rubygems.yml delete mode 100644 .github/workflows/install-rubygems.yml delete mode 100644 .github/workflows/jruby-bundler.yml delete mode 100644 .github/workflows/legacy-git.yml delete mode 100644 .github/workflows/realworld-bundler.yml delete mode 100644 .github/workflows/ruby-core.yml delete mode 100644 .github/workflows/system-rubygems-bundler.yml delete mode 100644 .github/workflows/truffleruby-bundler.yml delete mode 100644 .github/workflows/weekly-update.yml create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 Manifest.txt create mode 100644 README.md create mode 100644 lib/rubygems_plugin.rb create mode 100644 rubygems-generate_index.gemspec delete mode 100644 rubygems-update.gemspec diff --git a/.github/ISSUE_TEMPLATE/bundler-related-issue.md b/.github/ISSUE_TEMPLATE/bundler-related-issue.md deleted file mode 100644 index 037ce7bb..00000000 --- a/.github/ISSUE_TEMPLATE/bundler-related-issue.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -name: Bundler related issue -about: This template is intended for Bundler specific related issues. -title: '' -labels: 'Bundler' -assignees: '' - ---- - - - -### Describe the problem as clearly as you can - - - -### Did you try upgrading rubygems & bundler? - - - -### Post steps to reproduce the problem - - - -### Which command did you run? - - - -### What were you expecting to happen? - - - -### What actually happened? - - - -### If not included with the output of your command, run `bundle env` and paste the output below - - diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 545e18b0..c2a8b6f3 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -3,4 +3,4 @@ blank_issues_enabled: true contact_links: - name: Installation or Execution failed about: Check the Discussions section for reports of a failing installation. Submit your experience (plus logs) if you cannot find reports similar to yours. - url: https://github.com/rubygems/rubygems/discussions + url: https://github.com/rubygems/rubygems-generate_index/discussions diff --git a/.github/config.yml b/.github/config.yml index bdf8267b..676405d6 100644 --- a/.github/config.yml +++ b/.github/config.yml @@ -1,5 +1,5 @@ newPRWelcomeComment: | - Thanks for opening a pull request and helping make RubyGems and Bundler better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality. + Thanks for opening a pull request and helping make rubygems-generate_index better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality. We use GitHub Actions to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of GitHub Actions in the PR status window below. diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4fd8df37..5ace4600 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,14 +1,6 @@ version: 2 updates: - - package-ecosystem: 'github-actions' - directory: '/' + - package-ecosystem: "github-actions" + directory: "/" schedule: - interval: 'weekly' - - package-ecosystem: 'cargo' - directory: '/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib' - schedule: - interval: 'weekly' - - package-ecosystem: 'cargo' - directory: '/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/' - schedule: - interval: 'weekly' + interval: "weekly" diff --git a/.github/workflows/bundler.yml b/.github/workflows/bundler.yml deleted file mode 100644 index 6e25a76d..00000000 --- a/.github/workflows/bundler.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: bundler - -on: - pull_request: - - push: - branches: - - master - -concurrency: - group: ci-${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -permissions: # added using https://github.com/step-security/secure-workflows - contents: read - -defaults: - run: - shell: bash - -jobs: - bundler: - name: Bundler ${{ matrix.bundler.name }} on ${{ matrix.os.name }} (${{ matrix.ruby.name }}) - runs-on: ${{ matrix.os.value }} - strategy: - fail-fast: false - matrix: - os: - - { name: Ubuntu, value: ubuntu-22.04 } - - ruby: - - { name: ruby-2.6, value: 2.6.10 } - - { name: ruby-2.7, value: 2.7.8 } - - { name: ruby-3.0, value: 3.0.6 } - - { name: ruby-3.1, value: 3.1.4 } - - { name: ruby-3.2, value: 3.2.2 } - - bundler: - - { name: 2, value: '' } - - { name: 3, value: 3.0.0 } - - exclude: - - { bundler: { name: 3, value: 3.0.0 }, ruby: { name: ruby-2.6, value: 2.6.10 } } - - include: - - { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.0, value: 3.0.6 }, timeout: 90 } - - { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.1, value: 3.1.4 }, timeout: 90 } - - { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-2.7, value: 2.7.8 }, timeout: 90 } - - { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.2, value: 3.2.2 }, timeout: 90 } - - - { os: { name: Windows, value: windows-2022 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-2.7, value: 2.7.8 }, timeout: 150 } - - { os: { name: Windows, value: windows-2022 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.0, value: 3.0.6 }, timeout: 150 } - - { os: { name: Windows, value: windows-2022 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.1, value: 3.1.4 }, timeout: 150 } - - { os: { name: Windows, value: windows-2022 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.2, value: 3.2.2 }, timeout: 150 } - - env: - RGV: .. - RUBYOPT: --disable-gems - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - name: Setup ruby - uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 - with: - ruby-version: ${{ matrix.ruby.value }} - bundler: none - - name: Install graphviz (Ubuntu) - run: sudo apt-get install graphviz -y - if: matrix.bundler.value == '' && matrix.os.name == 'Ubuntu' - - name: Install graphviz (macOS) - run: brew install graphviz - if: matrix.bundler.value == '' && matrix.os.name == 'macOS' - - name: Prepare dependencies - run: | - bin/rake spec:parallel_deps - - name: Replace version - run: BUNDLER_SPEC_SUB_VERSION=${{ matrix.bundler.value }} bin/rake override_version - if: matrix.bundler.value != '' - - name: Run Test - run: | - bin/parallel_rspec - working-directory: ./bundler - timeout-minutes: ${{ matrix.timeout || 60 }} diff --git a/.github/workflows/daily-bundler.yml b/.github/workflows/daily-bundler.yml deleted file mode 100644 index 301f7064..00000000 --- a/.github/workflows/daily-bundler.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: daily-bundler - -on: - schedule: - - cron: '0 0 * * *' - -permissions: - contents: read - -defaults: - run: - shell: bash - -jobs: - daily_bundler: - name: Bundler (ruby-head) - runs-on: ubuntu-22.04 - if: github.repository == 'rubygems/rubygems' - env: - RGV: .. - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - - name: Set up Ruby - uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 - with: - ruby-version: ruby-head - bundler: none - - - name: Show Ruby version - run: ruby --version - - - name: Prepare dependencies - run: | - sudo apt-get install graphviz -y - bin/rake spec:parallel_deps - - - name: Run Test - run: | - bin/rake spec:all - - name: Get previous status - if: always() - run: echo "OLD_STATUS=$(curl -sS 'https://api.github.com/repos/rubygems/rubygems/actions/workflows/daily-bundler.yml/runs?event=schedule&branch=master' | jq '.workflow_runs | .[1].conclusion')" >> $GITHUB_ENV - - - uses: 8398a7/action-slack@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 # v3.15.1 - with: - status: ${{ job.status }} - fields: repo,message,commit,author,action,eventName,ref,workflow - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required - if: failure() && env.OLD_STATUS == '"success"' - - timeout-minutes: 60 diff --git a/.github/workflows/daily-rubygems.yml b/.github/workflows/daily-rubygems.yml deleted file mode 100644 index d21af29f..00000000 --- a/.github/workflows/daily-rubygems.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: daily-rubygems - -on: - schedule: - - cron: '0 0 * * *' - workflow_dispatch: - -permissions: - contents: read - -jobs: - daily_rubygems: - name: Rubygems (${{ matrix.ruby }}) - runs-on: ${{ matrix.os }} - if: github.repository == 'rubygems/rubygems' - strategy: - fail-fast: false - matrix: - os: [ ubuntu-22.04 ] - ruby: [ ruby-head, truffleruby-head ] - cargo: [ stable ] - include: - - { os: windows-2022, ruby: mswin, cargo: stable-x86_64-pc-windows-msvc } - env: - TRUFFLERUBYOPT: "--experimental-options --testing-rubygems" - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - - name: Set up Ruby - uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 - with: - ruby-version: ${{ matrix.ruby }} - bundler: none - - - uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 - with: - toolchain: ${{ matrix.cargo }} - components: rustfmt - - - name: Show Ruby version - run: ruby --version - - - name: Test rubygems - run: | - rake setup - rake test - - - name: Get previous status - if: always() - run: echo "OLD_STATUS=$(curl -sS 'https://api.github.com/repos/rubygems/rubygems/actions/workflows/daily-rubygems.yml/runs?event=schedule&branch=master' | jq '.workflow_runs | .[1].conclusion')" >> $GITHUB_ENV - - - uses: 8398a7/action-slack@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 # v3.15.1 - with: - status: ${{ job.status }} - fields: repo,message,commit,action,workflow - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required - if: failure() && env.OLD_STATUS == '"success"' - - timeout-minutes: 60 diff --git a/.github/workflows/install-rubygems.yml b/.github/workflows/install-rubygems.yml deleted file mode 100644 index beab58de..00000000 --- a/.github/workflows/install-rubygems.yml +++ /dev/null @@ -1,129 +0,0 @@ -name: install-rubygems - -on: - pull_request: - - push: - branches: - - master - -concurrency: - group: ci-${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -permissions: # added using https://github.com/step-security/secure-workflows - contents: read - -jobs: - install_rubygems_ubuntu: - name: Install Rubygems on Ubuntu (${{ matrix.ruby.name }}, ${{ matrix.openssl.name }}) - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - ruby: - - { name: "2.6", value: 2.6.10 } - - { name: "2.7", value: 2.7.8 } - - { name: "3.0", value: 3.0.6 } - - { name: "3.1", value: 3.1.4 } - - { name: "3.2", value: 3.2.2 } - - { name: jruby-9.4, value: jruby-9.4.2.0 } - - { name: truffleruby-22, value: truffleruby-22.3.0 } - openssl: - - { name: "openssl", value: true } - - { name: "no-openssl", value: false } - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - name: Setup ruby - uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 - with: - ruby-version: ${{ matrix.ruby.value }} - bundler: none - - name: Check successful install without warnings - run: | - ruby -Ilib -S rake install 2> errors.txt || (cat errors.txt && exit 1) - test ! -s errors.txt || (cat errors.txt && exit 1) - - name: Check downgrading - run: gem update --system 3.3.3 - - name: Check installing fileutils - run: gem install fileutils - - name: Check installing with upgraded fileutils - run: | - ruby -Ilib -S rake install 2> errors.txt || (cat errors.txt && exit 1) - test ! -s errors.txt || (cat errors.txt && exit 1) - - name: Run a local rubygems command - run: gem list bundler - env: - RUBYOPT: -Itest/rubygems/fake_certlib - if: matrix.openssl.value == false - - name: Run a local rubygems command - run: gem list bundler - if: matrix.openssl.value == true - - name: Run a remote rubygems command - run: gem outdated - if: matrix.openssl.value == true - - name: Check commands in presence of a plugin that leaves unresolved dependencies print no warnings - run: | - gem install attempt:0.6.2 rspec:3.10.0 rspec:3.11.0 - mkdir -p tmp/plugin-home - echo "require 'attempt'" > tmp/plugin-home/rubygems_plugin.rb - RUBYOPT=-Itmp/plugin-home gem env version 2> errors.txt || (cat errors.txt && exit 1) - test ! -s errors.txt || (cat errors.txt && exit 1) - RUBYOPT=-Itmp/plugin-home gem install sys-admin:1.8.1 2> errors.txt || (cat errors.txt && exit 1) - test ! -s errors.txt || (cat errors.txt && exit 1) - - name: Run bundler installed as a default gem - run: bundle --version - - name: Check bundler man pages were installed and are properly picked up - run: bundle install --help | grep -q BUNDLE-INSTALL - - name: Check bundler fallback man pages are properly picked up - run: sudo rm $(which man) && bundle install --help - - name: Build bundler - run: gem build bundler.gemspec - working-directory: ./bundler - - name: Install built bundler - run: gem install bundler-*.gem --verbose --backtrace > output.txt - working-directory: ./bundler - - name: Check bundler install didn't hit the network - run: if grep -q 'GET http' output.txt; then false; else true; fi - working-directory: ./bundler - - name: Check rails can be installed - run: gem install rails --verbose --backtrace - timeout-minutes: 10 - - install_rubygems_windows: - name: Install Rubygems on Windows (${{ matrix.ruby.name }}) - runs-on: windows-2022 - strategy: - fail-fast: false - matrix: - ruby: - - { name: "3.1", value: 3.1.4 } # Rails 7 - - { name: "3.2", value: 3.2.2 } # Rails 7 - - { name: jruby-9.4, value: jruby-9.4.2.0, rails-args: "--skip-webpack-install" } # Rails 6 - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - name: Setup ruby - uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 - with: - ruby-version: ${{ matrix.ruby.value }} - bundler: none - - name: Setup java - uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 - with: - distribution: temurin - java-version: 19.0.2 - if: startsWith(matrix.ruby.name, 'jruby') - - name: Install rubygems - run: ruby setup.rb - shell: bash - - name: Check installation didn't modify any source controlled files - run: git diff --exit-code - shell: bash - - name: Check we can install a Gemfile with git sources - run: bundle init && bundle add fileutils --git https://github.com/ruby/fileutils - shell: bash - - name: Generate a Rails application - run: gem install rails --version 7.0.8 && rails new foo ${{ matrix.ruby.rails-args }} - shell: bash - - timeout-minutes: 20 diff --git a/.github/workflows/jruby-bundler.yml b/.github/workflows/jruby-bundler.yml deleted file mode 100644 index 00e20f93..00000000 --- a/.github/workflows/jruby-bundler.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: jruby-bundler - -on: - pull_request: - - push: - branches: - - master - -concurrency: - group: ci-${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -permissions: # added using https://github.com/step-security/secure-workflows - contents: read - -defaults: - run: - shell: bash - -jobs: - jruby_bundler: - name: Bundler on JRuby (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - - env: - RGV: .. - - strategy: - fail-fast: false - matrix: - os: [ubuntu-22.04, windows-2022] - - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - name: Setup ruby - uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 - with: - ruby-version: jruby-9.4.2.0 - bundler: none - - name: Setup java - uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 - with: - distribution: temurin - java-version: 19.0.2 - if: "!startsWith(matrix.os.name, 'ubuntu')" - - name: Prepare dependencies - run: | - bin/rake spec:parallel_deps - - name: Run Test - run: | - bin/parallel_rspec --tag jruby_only --tag jruby - working-directory: ./bundler - if: startsWith(matrix.os.name, 'ubuntu') - - name: Install local bundler - run: | - bin/rake bundler:install:local - if: startsWith(matrix.os.name, 'ubuntu') - - name: Run a warbler project - run: | - cd spec/realworld/fixtures/warbler - bundle install - bundle exec warble - java -jar warbler.jar - if: startsWith(matrix.os.name, 'ubuntu') diff --git a/.github/workflows/legacy-git.yml b/.github/workflows/legacy-git.yml deleted file mode 100644 index 05a7f581..00000000 --- a/.github/workflows/legacy-git.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: legacy-git - -on: - pull_request: - - push: - branches: - - master - -concurrency: - group: ci-${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -permissions: # added using https://github.com/step-security/secure-workflows - contents: read - -jobs: - legacy_git: - name: Verify behavior under old git - runs-on: ubuntu-22.04 - container: - image: centos/ruby-27-centos7@sha256:b24b875dcdb6cb8f2145706dcaac74bb25ae3b9d9f7ba69d7ae700a7aee1e1bd - options: --user=root - steps: - # This locked with v3.6.0 for node18, centos7 image is only working with actions/checkout@v3 - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - - name: Install rubygems - run: ruby setup.rb - - name: Check we can install a Gemfile with git sources - run: bundle init && bundle add fileutils --git https://github.com/ruby/fileutils - - timeout-minutes: 10 diff --git a/.github/workflows/realworld-bundler.yml b/.github/workflows/realworld-bundler.yml deleted file mode 100644 index c941c420..00000000 --- a/.github/workflows/realworld-bundler.yml +++ /dev/null @@ -1,123 +0,0 @@ -name: realworld - -on: - pull_request: - - push: - branches: - - master - -concurrency: - group: ci-${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -permissions: # added using https://github.com/step-security/secure-workflows - contents: read - -jobs: - bundler: - name: Realworld Bundler ${{ matrix.bundler.name }} on ${{ matrix.os.name }} (${{ matrix.ruby.name }}) - runs-on: ${{ matrix.os.value }} - strategy: - fail-fast: false - matrix: - os: - - { name: Ubuntu, value: ubuntu-22.04 } - - ruby: - - { name: ruby-2.6, value: 2.6.10 } - - { name: ruby-2.7, value: 2.7.8 } - - { name: ruby-3.0, value: 3.0.6 } - - { name: ruby-3.1, value: 3.1.4 } - - { name: ruby-3.2, value: 3.2.2 } - - bundler: - - { name: 2, value: '' } - - { name: 3, value: 3.0.0 } - - exclude: - - { bundler: { name: 3, value: 3.0.0 }, ruby: { name: ruby-2.6, value: 2.6.10 } } - - include: - - { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-2.7, value: 2.7.8 } } - - { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.0, value: 3.0.6 } } - - { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.1, value: 3.1.4 } } - - { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.2, value: 3.2.2 } } - env: - RGV: .. - RUBYOPT: --disable-gems - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - name: Setup ruby - uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 - with: - ruby-version: ${{ matrix.ruby.value }} - bundler: none - - name: Prepare dependencies - run: bin/rake spec:deps - - name: Replace version - run: BUNDLER_SPEC_SUB_VERSION=${{ matrix.bundler.value }} bin/rake override_version - if: matrix.bundler.value != '' - - name: Run Test - run: bin/rake spec:realworld - - name: Upload used cassettes as artifact - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 - with: - name: cassettes-bundler-${{ matrix.bundler.name }}-${{ matrix.os.value }}-${{ matrix.ruby.name }} - path: ./bundler/spec/support/artifice/used_cassettes.txt - timeout-minutes: 20 - - system_rubygems_bundler: - name: Realworld Bundler ${{ matrix.bundler.name }} against system Rubygems (${{ matrix.ruby.name }}) - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - include: - - { bundler: { name: 2, value: '' }, ruby: { name: ruby-2.6, value: 2.6.10 } } - - { bundler: { name: 2, value: '' }, ruby: { name: ruby-2.7, value: 2.7.8 } } - - { bundler: { name: 2, value: '' }, ruby: { name: ruby-3.0, value: 3.0.6 } } - - { bundler: { name: 2, value: '' }, ruby: { name: ruby-3.1, value: 3.1.4 } } - - { bundler: { name: 2, value: '' }, ruby: { name: ruby-3.2, value: 3.2.2 } } - - { bundler: { name: 3, value: 3.0.0 }, ruby: { name: ruby-2.7, value: 2.7.8 } } - - { bundler: { name: 3, value: 3.0.0 }, ruby: { name: ruby-3.0, value: 3.0.6 } } - - { bundler: { name: 3, value: 3.0.0 }, ruby: { name: ruby-3.1, value: 3.1.4 } } - - { bundler: { name: 3, value: 3.0.0 }, ruby: { name: ruby-3.2, value: 3.2.2 } } - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - name: Setup ruby - uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 - with: - ruby-version: ${{ matrix.ruby.value }} - bundler: none - - name: Prepare dependencies - run: bin/rake spec:deps - - name: Replace version - run: BUNDLER_SPEC_SUB_VERSION=${{ matrix.bundler.value }} bin/rake override_version - if: matrix.bundler.value != '' - - name: Run Test - run: bin/rake spec:realworld - - name: Upload used cassettes as artifact - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 - with: - name: cassettes-system-rubygems-bundler-${{ matrix.bundler.name }}-${{ matrix.ruby.name }} - path: ./bundler/spec/support/artifice/used_cassettes.txt - timeout-minutes: 20 - - check_unused_cassettes: - name: Check unused cassettes - needs: [bundler, system_rubygems_bundler] - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - name: Setup ruby - uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 - with: - ruby-version: 3.2.2 - bundler: none - - name: Download all used cassettes as artifacts - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 - with: - path: ./bundler/spec/support/artifice/used_vcr_cassettes - - name: Check unused cassettes - run: bin/rake spec:realworld:check_unused_cassettes diff --git a/.github/workflows/ruby-core.yml b/.github/workflows/ruby-core.yml deleted file mode 100644 index 01b54471..00000000 --- a/.github/workflows/ruby-core.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: ruby-core - -on: - pull_request: - - push: - branches: - - master - -concurrency: - group: ci-${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -permissions: # added using https://github.com/step-security/secure-workflows - contents: read - -jobs: - ruby_core: - name: ${{matrix.target}} under a ruby-core setup - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - target: [Rubygems, Bundler] - steps: - - name: Set up latest ruby head - uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 - with: - ruby-version: head - bundler: none - - name: Save latest buildable revision to environment - run: echo "REF=$(ruby -v | cut -d')' -f1 | cut -d' ' -f5)" >> $GITHUB_ENV - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - repository: ruby/ruby - path: ruby/ruby - fetch-depth: 10 - - name: Checkout the latest buildable revision - run: git switch -c ${{ env.REF }} - working-directory: ruby/ruby - - name: Install libraries - run: | - set -x - sudo apt-get update -q || : - sudo apt-get install --no-install-recommends -q -y build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev bison autoconf ruby - - name: Build Ruby - run: | - ./autogen.sh - ./configure -C --disable-install-doc - make -j2 - working-directory: ruby/ruby - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - path: rubygems/rubygems - - name: Sync tools - run: | - ruby tool/sync_default_gems.rb rubygems - working-directory: ruby/ruby - - name: Test RubyGems - run: make -j2 -s test-all TESTS="rubygems --no-retry" - working-directory: ruby/ruby - if: matrix.target == 'Rubygems' - - name: Test Bundler - run: | - git add . - make test-bundler-parallel - working-directory: ruby/ruby - if: matrix.target == 'Bundler' diff --git a/.github/workflows/rubygems.yml b/.github/workflows/rubygems.yml index 4243902a..69161b79 100644 --- a/.github/workflows/rubygems.yml +++ b/.github/workflows/rubygems.yml @@ -11,7 +11,7 @@ concurrency: group: ci-${{ github.ref }}-${{ github.workflow }} cancel-in-progress: true -permissions: # added using https://github.com/step-security/secure-workflows +permissions: # added using https://github.com/step-security/secure-workflows contents: read jobs: @@ -46,19 +46,25 @@ jobs: - os: { name: Windows, value: windows-2022 } ruby: { name: mswin, value: mswin } + - os: { name: Ubuntu, value: ubuntu-22.04 } + ruby: { name: ruby-head, value: ruby-head } + + - os: { name: Ubuntu, value: ubuntu-22.04 } + ruby: { name: truffleruby-head, value: truffleruby-head } + steps: - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - name: Setup ruby (Ubuntu/macOS) uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 with: ruby-version: ${{ matrix.ruby.value }} - bundler: none + bundler-cache: true if: matrix.os.name != 'Windows' - name: Setup ruby (Windows) uses: ruby/setup-ruby-pkgs@070791aab73b96ab166e572b2e4a0f056c410394 # v1.33.0 with: ruby-version: ${{ matrix.ruby.value }} - bundler: none + bundler-cache: true mingw: clang if: matrix.os.name == 'Windows' - name: Configure bindgen @@ -67,19 +73,7 @@ jobs: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV echo "BINDGEN_EXTRA_CLANG_ARGS=$((gcm clang).source -replace "bin\clang.exe","include")" >> $env:GITHUB_ENV if: matrix.ruby.name == 'mswin' - - name: Install Dependencies - run: rake setup - name: Run Test - run: rake test - if: "!startsWith(matrix.ruby.name, 'truffleruby') && !startsWith(matrix.ruby.name, 'jruby')" - - name: Run Test isolatedly - run: rake test:isolated - if: matrix.ruby.name == '3.2' && matrix.os.name != 'Windows' - - name: Run Test (JRuby) - run: JRUBY_OPTS=--debug rake test - if: startsWith(matrix.ruby.name, 'jruby') - - name: Run Test (Truffleruby) - run: TRUFFLERUBYOPT="--experimental-options --testing-rubygems" rake test - if: startsWith(matrix.ruby.name, 'truffleruby') + run: bundle exec rake test - timeout-minutes: 60 + timeout-minutes: 20 diff --git a/.github/workflows/system-rubygems-bundler.yml b/.github/workflows/system-rubygems-bundler.yml deleted file mode 100644 index e37b9dab..00000000 --- a/.github/workflows/system-rubygems-bundler.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: system-rubygems-bundler - -on: - pull_request: - paths: - - bundler/** - - .github/workflows/system-rubygems-bundler.yml - - .rubocop_bundler.yml - - push: - branches: - - master - -concurrency: - group: ci-${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -permissions: # added using https://github.com/step-security/secure-workflows - contents: read - -defaults: - run: - shell: bash - -jobs: - system_rubygems_bundler: - name: Bundler ${{ matrix.bundler.name }} against system Rubygems (${{ matrix.ruby.name }}) - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - include: - - { bundler: { name: 2, value: '' }, ruby: { name: ruby-2.6, value: 2.6.10 } } - - { bundler: { name: 2, value: '' }, ruby: { name: ruby-2.7, value: 2.7.8 } } - - { bundler: { name: 2, value: '' }, ruby: { name: ruby-3.0, value: 3.0.6 } } - - { bundler: { name: 2, value: '' }, ruby: { name: ruby-3.1, value: 3.1.4 } } - - { bundler: { name: 2, value: '' }, ruby: { name: ruby-3.2, value: 3.2.2 } } - - { bundler: { name: 3, value: 3.0.0 }, ruby: { name: ruby-2.7, value: 2.7.8 } } - - { bundler: { name: 3, value: 3.0.0 }, ruby: { name: ruby-3.0, value: 3.0.6 } } - - { bundler: { name: 3, value: 3.0.0 }, ruby: { name: ruby-3.1, value: 3.1.4 } } - - { bundler: { name: 3, value: 3.0.0 }, ruby: { name: ruby-3.2, value: 3.2.2 } } - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - name: Setup ruby - uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 - with: - ruby-version: ${{ matrix.ruby.value }} - bundler: none - - name: Install graphviz - run: sudo apt-get install graphviz -y - if: matrix.bundler.value == '' - - name: Prepare dependencies - run: | - bin/rake spec:parallel_deps - - name: Replace version - run: BUNDLER_SPEC_SUB_VERSION=${{ matrix.bundler.value }} bin/rake override_version - if: matrix.bundler.value != '' - - name: Run Test - run: | - bin/parallel_rspec - working-directory: ./bundler - - name: Save system RubyGems version to ENV - run: | - RGV=$(ruby -e 'puts Gem::VERSION.split(".")[0..2].join(".")') - echo "RGV=v$RGV" >> $GITHUB_ENV - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - path: bundler/tmp/rubygems - ref: ${{ env.RGV }} - - name: Run Rubygems Requirement tests against local bundler, to make sure bundler monkeypatches preserve the behaviour - run: | - ruby -I../../lib:lib:test test/rubygems/test_gem_requirement.rb - working-directory: ./bundler/tmp/rubygems - timeout-minutes: 60 diff --git a/.github/workflows/truffleruby-bundler.yml b/.github/workflows/truffleruby-bundler.yml deleted file mode 100644 index 2803d025..00000000 --- a/.github/workflows/truffleruby-bundler.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: truffleruby-bundler - -on: - pull_request: - - push: - branches: - - master - -concurrency: - group: ci-${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -permissions: # added using https://github.com/step-security/secure-workflows - contents: read - -defaults: - run: - shell: bash - -jobs: - truffleruby_bundler: - name: Bundler (Truffleruby) - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - name: Setup ruby - uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 - with: - ruby-version: truffleruby-22.3 - bundler: none - - name: Prepare dependencies - run: | - bin/rake spec:parallel_deps - - name: Run Test - run: | - bin/parallel_rspec --tag truffleruby_only --tag truffleruby - working-directory: ./bundler - timeout-minutes: 20 diff --git a/.github/workflows/ubuntu-lint.yml b/.github/workflows/ubuntu-lint.yml index 3a3b658e..0d5c08b0 100644 --- a/.github/workflows/ubuntu-lint.yml +++ b/.github/workflows/ubuntu-lint.yml @@ -2,16 +2,13 @@ name: ubuntu-lint on: pull_request: - - push: - branches: - - master + merge_group: concurrency: group: ci-${{ github.ref }}-${{ github.workflow }} cancel-in-progress: true -permissions: # added using https://github.com/step-security/secure-workflows +permissions: # added using https://github.com/step-security/secure-workflows contents: read jobs: @@ -26,15 +23,7 @@ jobs: uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0 with: ruby-version: 3.2.2 - bundler: none - - name: Install Dependencies - run: rake setup + bundler-cache: true - name: Run Lint - run: rake rubocop - - name: Generate docs - run: rake docs - - name: Install & Check Dependencies - run: bin/rake dev:frozen_deps - - name: Misc checks - run: bin/rake check_rvm_integration man:check check_rubygems_integration + run: bundle exec rake rubocop timeout-minutes: 15 diff --git a/.github/workflows/weekly-update.yml b/.github/workflows/weekly-update.yml deleted file mode 100644 index 9704f39f..00000000 --- a/.github/workflows/weekly-update.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: weekly-update - -on: - schedule: - - cron: '0 0 * * 0' - workflow_dispatch: - -permissions: - contents: write - pull-requests: write - -jobs: - weekly_update: - name: Rubygems weekly update - runs-on: ${{ matrix.os }} - if: github.repository == 'rubygems/rubygems' - strategy: - matrix: - os: [ ubuntu-latest ] - steps: - - name: Config git - run: | - git config --global user.name "License Update" - git config --global user.email license.update@rubygems.org - git config --global push.autoSetupRemote true - - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - - name: Check versions - run: | - ruby --version - rake --version - - - name: Update SPDX license list - run: | - rake update_licenses_branch - git diff --no-ext-diff --ignore-submodules --quiet "${BASE##*/}" -- || { - git push origin - gh pr create --base "${BASE##*/}" --fill --label "rubygems: enhancement" - } - env: - BASE: ${{ github.ref }} - GH_TOKEN: ${{ github.token }} diff --git a/.rubocop.yml b/.rubocop.yml index e588db08..0da5e56b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -11,6 +11,7 @@ AllCops: - lib/rubygems/tsort/**/* - lib/rubygems/optparse/**/* - bundler/lib/bundler/vendor/**/* + - vendor/bundle/**/* CacheRootDirectory: tmp/rubocop MaxFilesInCache: 5000 @@ -244,8 +245,8 @@ Lint/SafeNavigationConsistency: Lint/ScriptPermission: Enabled: true Exclude: - - 'bundler/lib/bundler/templates/Executable' - - 'bundler/lib/bundler/templates/Executable.*' + - "bundler/lib/bundler/templates/Executable" + - "bundler/lib/bundler/templates/Executable.*" Lint/ShadowedArgument: Enabled: true @@ -409,8 +410,8 @@ Layout/SpaceInsideBlockBraces: Enabled: true SpaceBeforeBlockParameters: false Exclude: - - bundler/lib/bundler/templates/Gemfile - - bundler/lib/bundler/templates/gems.rb + - bundler/lib/bundler/templates/Gemfile + - bundler/lib/bundler/templates/gems.rb Layout/SpaceInsideHashLiteralBraces: Enabled: true @@ -497,7 +498,7 @@ Naming/ClassAndModuleCamelCase: Naming/FileName: Enabled: true Exclude: - - 'bundler/spec/realworld/fixtures/warbler/bin/warbler-example.rb' + - "bundler/spec/realworld/fixtures/warbler/bin/warbler-example.rb" Naming/MemoizedInstanceVariableName: Enabled: true diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..916f9a8d --- /dev/null +++ b/Gemfile @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Specify your gem's dependencies in rubygems-generate_index.gemspec +gemspec + +gem "rake", "~> 13.0" +gem "rubocop", "~> 1.21" +gem "rubocop-performance", "~> 1.19" +gem "test-unit", "~> 3.0" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..679403db --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,61 @@ +PATH + remote: . + specs: + rubygems-generate_index (1.0.0) + compact_index (~> 0.14.0) + +GEM + remote: https://rubygems.org/ + specs: + ast (2.4.2) + base64 (0.1.1) + compact_index (0.14.0) + json (2.6.3) + language_server-protocol (3.17.0.3) + parallel (1.23.0) + parser (3.2.2.3) + ast (~> 2.4.1) + racc + power_assert (2.0.3) + racc (1.7.1) + rainbow (3.1.1) + rake (13.0.6) + regexp_parser (2.8.1) + rexml (3.2.6) + rubocop (1.56.3) + base64 (~> 0.1.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) + parallel (~> 1.10) + parser (>= 3.2.2.3) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) + rubocop-performance (1.19.1) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + ruby-progressbar (1.13.0) + test-unit (3.6.1) + power_assert + unicode-display_width (2.4.2) + +PLATFORMS + arm64-darwin + arm64-linux + ruby + x64-linux + +DEPENDENCIES + rake (~> 13.0) + rubocop (~> 1.21) + rubocop-performance (~> 1.19) + rubygems-generate_index! + test-unit (~> 3.0) + +BUNDLED WITH + 2.4.19 diff --git a/Manifest.txt b/Manifest.txt new file mode 100644 index 00000000..e1b3546d --- /dev/null +++ b/Manifest.txt @@ -0,0 +1,11 @@ +CODE_OF_CONDUCT.md +Gemfile +Gemfile.lock +LICENSE.txt +MIT.txt +Manifest.txt +README.md +lib/rubygems/commands/generate_index_command.rb +lib/rubygems/indexer.rb +lib/rubygems_plugin.rb +rubygems-generate_index.gemspec diff --git a/README.md b/README.md new file mode 100644 index 00000000..0752049c --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# rubygems-generate_index + +rubygems-generate_index generates the index files for a `gem server` directory. + +The generate_index command creates a set of indexes for serving gems +statically. The command expects a 'gems' directory under the path given to +the --directory option. The given directory will be the directory you serve +as the gem repository. + +For `gem generate_index --directory /path/to/repo`, expose /path/to/repo via +your HTTP server configuration (not /path/to/repo/gems). + +When done, it will generate a set of files like this: + +``` + gems/*.gem # .gem files you want to + # index + + specs..gz # specs index + latest_specs..gz # latest specs index + prerelease_specs..gz # prerelease specs index + quick/Marshal./.gemspec.rz # Marshal quick index file +``` + +The .rz extension files are compressed with the inflate algorithm. +The Marshal version number comes from ruby's Marshal::MAJOR_VERSION and +Marshal::MINOR_VERSION constants. It is used to ensure compatibility. + +This gem is a replacement for the `gem generate_index` command that was removed in RubyGems 3.5.0. + +## Installation + +Add this line to your application's Gemfile: + +```ruby +gem 'rubygems-generate_index' +``` + +And then execute: + + $ bundle install + +Or install it yourself as: + + $ gem install rubygems-generate_index + +## Development + +After checking out the repo, run `bundle install` to install dependencies. Then, run `rake test` to run the tests. + +To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). + +## Contributing + +Bug reports and pull requests are welcome on GitHub at https://github.com/rubygems/rubygems-generate_index. + +## License + +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). diff --git a/Rakefile b/Rakefile index cf806b0b..92393e44 100644 --- a/Rakefile +++ b/Rakefile @@ -1,528 +1,24 @@ # frozen_string_literal: true -RakeFileUtils.verbose_flag = false - -require "rubygems" -require "rubygems/package_task" +require "bundler/gem_tasks" require "rake/testtask" -module RubyGems - module DevTasks - include FileUtils - - extend self - - def bundle_dev_gemfile(*args) - name = RUBY_VERSION.start_with?("2.6") ? "dev26_gems" : "dev_gems" - sh "ruby", "-I", "lib", "bundler/spec/support/bundle.rb", *args, "--gemfile=tool/bundler/#{name}.rb" - end - - def bundle_support_gemfile(name, *args) - sh "ruby", "-I", "lib", "bundler/spec/support/bundle.rb", *args, "--gemfile=tool/bundler/#{name}.rb" - end - end -end - -desc "Setup Rubygems dev environment" -task :setup do - RubyGems::DevTasks.bundle_dev_gemfile "install" - RubyGems::DevTasks.bundle_support_gemfile "release_gems","lock" - RubyGems::DevTasks.bundle_support_gemfile "test_gems", "lock" - RubyGems::DevTasks.bundle_support_gemfile "rubocop_gems", "lock" - RubyGems::DevTasks.bundle_support_gemfile "standard_gems", "lock" -end - -desc "Update Rubygems dev environment" -task :update do - RubyGems::DevTasks.bundle_dev_gemfile "update" - RubyGems::DevTasks.bundle_support_gemfile "release_gems", "lock", "--update" - RubyGems::DevTasks.bundle_support_gemfile "test_gems", "lock", "--update" - RubyGems::DevTasks.bundle_support_gemfile "rubocop_gems", "lock", "--update" - RubyGems::DevTasks.bundle_support_gemfile "standard_gems", "lock", "--update" -end - -desc "Update the locked bundler version in dev environment" -task :update_locked_bundler do |_, _args| - RubyGems::DevTasks.bundle_support_gemfile "dev_gems", "update", "--bundler" - RubyGems::DevTasks.bundle_support_gemfile "release_gems", "update", "--bundler" - RubyGems::DevTasks.bundle_support_gemfile "test_gems", "update", "--bundler" - RubyGems::DevTasks.bundle_support_gemfile "rubocop_gems", "update", "--bundler" - RubyGems::DevTasks.bundle_support_gemfile "standard_gems", "update", "--bundler" -end - -desc "Update specific development dependencies" -task :update_dev_dep do |_, args| - RubyGems::DevTasks.bundle_dev_gemfile "update", *args -end - -desc "Update RSpec related gems" -task :update_rspec_deps do |_, _args| - RubyGems::DevTasks.bundle_dev_gemfile "update", "rspec-core", "rspec-expectations", "rspec-mocks" - RubyGems::DevTasks.bundle_support_gemfile "rubocop_gems", "lock", "--update", "rspec-core", "rspec-expectations", "rspec-mocks" - RubyGems::DevTasks.bundle_support_gemfile "standard_gems", "lock", "--update", "rspec-core", "rspec-expectations", "rspec-mocks" -end - -desc "Setup git hooks" -task :git_hooks do - sh "git config core.hooksPath .githooks" -end - -Rake::TestTask.new do |t| - t.ruby_opts = %w[-w] - t.ruby_opts << "-rdevkit" if RbConfig::CONFIG["host_os"].include?("mingw") - +Rake::TestTask.new(:test) do |t| t.libs << "test" + t.libs << "lib" t.test_files = FileList["test/**/test_*.rb"] end -namespace "test" do - desc "Run each test isolatedly by specifying the relative test file path" - task "isolated" do - FileList["test/**/{bundler_,}test_*.rb"].each do |file| - sh Gem.ruby, "-Ilib:test:bundler/lib", file - end - end -end - -task :default => [:test, :spec] - -spec = Gem::Specification.load(File.expand_path("rubygems-update.gemspec", __dir__)) -v = spec.version - -require "rdoc/task" - -RDoc::Task.new :rdoc => "docs", :clobber_rdoc => "clobber_docs" do |doc| - doc.main = "README.md" - doc.title = "RubyGems #{v} API Documentation" - - rdoc_files = Rake::FileList.new %w[lib bundler/lib] - rdoc_files.add %w[CHANGELOG.md LICENSE.txt MIT.txt CODE_OF_CONDUCT.md CONTRIBUTING.md - MAINTAINERS.txt Manifest.txt POLICIES.md README.md UPGRADING.md bundler/CHANGELOG.md - bundler/doc/contributing/README.md bundler/LICENSE.md bundler/README.md - hide_lib_for_update/note.txt].map(&:freeze) - - doc.rdoc_files = rdoc_files - - doc.rdoc_dir = "doc" -end - -# No big deal if Automatiek is not available. This might be just because -# `rake` is executed from release tarball. -if File.exist?("tool/automatiek.rake") - load "tool/automatiek.rake" - - # We currently ship Molinillo master branch as of - # https://github.com/CocoaPods/Molinillo/commit/7cc27a355e861bdf593e2cde7bf1bca3daae4303 - desc "Vendor a specific version of molinillo to rubygems" - Automatiek::RakeTask.new("molinillo") do |lib| - lib.version = "master" - lib.download = { :github => "https://github.com/CocoaPods/Molinillo" } - lib.namespace = "Molinillo" - lib.prefix = "Gem::Resolver" - lib.vendor_lib = "lib/rubygems/resolver/molinillo" - lib.license_path = "LICENSE" - - lib.dependency("tsort") do |sublib| - sublib.version = "v0.1.1" - sublib.download = { :github => "https://github.com/ruby/tsort" } - sublib.namespace = "TSort" - sublib.prefix = "Gem" - sublib.vendor_lib = "lib/rubygems/tsort" - sublib.license_path = "LICENSE.txt" - end - end - - # We currently ship optparse 0.3.0 plus the following changes: - # * Remove top aliasing the `::OptParse` constant to `OptionParser`, since we - # don't need it and it triggers redefinition warnings since the default - # optparse gem also does the aliasing. - # * Add an empty .document file to the library's root path to hint RDoc that - # this library should not be documented. - desc "Vendor a specific version of optparse to rubygems" - Automatiek::RakeTask.new("optparse") do |lib| - lib.version = "v0.3.0" - lib.download = { :github => "https://github.com/ruby/optparse" } - lib.namespace = "OptionParser" - lib.prefix = "Gem" - lib.vendor_lib = "lib/rubygems/optparse" - lib.license_path = "COPYING" - end - - desc "Vendor a specific version of pub_grub to bundler" - Automatiek::RakeTask.new("pub_grub") do |lib| - lib.version = "main" - lib.download = { :github => "https://github.com/jhawthorn/pub_grub" } - lib.namespace = "PubGrub" - lib.prefix = "Bundler" - lib.vendor_lib = "bundler/lib/bundler/vendor/pub_grub" - lib.license_path = "LICENSE.txt" - end - - desc "Vendor a specific version of tsort to bundler" - Automatiek::RakeTask.new("tsort") do |lib| - lib.version = "v0.1.1" - lib.download = { :github => "https://github.com/ruby/tsort" } - lib.namespace = "TSort" - lib.prefix = "Bundler" - lib.vendor_lib = "bundler/lib/bundler/vendor/tsort" - lib.license_path = "LICENSE.txt" - end - - desc "Vendor a specific version of thor to bundler" - Automatiek::RakeTask.new("thor") do |lib| - lib.version = "v1.3.0" - lib.download = { :github => "https://github.com/rails/thor" } - lib.namespace = "Thor" - lib.prefix = "Bundler" - lib.vendor_lib = "bundler/lib/bundler/vendor/thor" - lib.license_path = "LICENSE.md" - end - - desc "Vendor a specific version of fileutils to bundler" - Automatiek::RakeTask.new("fileutils") do |lib| - lib.version = "v1.7.0" - lib.download = { :github => "https://github.com/ruby/fileutils" } - lib.namespace = "FileUtils" - lib.prefix = "Bundler" - lib.vendor_lib = "bundler/lib/bundler/vendor/fileutils" - lib.license_path = "LICENSE.txt" - end - - # We currently include the following changes over the official version: - # * Avoid requiring the optional `net-http-pipeline` dependency, so that its version can be selected by end users. - desc "Vendor a specific version of net-http-persistent to bundler" - Automatiek::RakeTask.new("net-http-persistent") do |lib| - lib.version = "v4.0.2" - lib.download = { :github => "https://github.com/drbrain/net-http-persistent" } - lib.namespace = "Net::HTTP::Persistent" - lib.prefix = "Bundler::Persistent" - lib.vendor_lib = "bundler/lib/bundler/vendor/net-http-persistent" - lib.license_path = "README.rdoc" - - lib.dependency("connection_pool") do |sublib| - sublib.version = "v2.3.0" - sublib.download = { :github => "https://github.com/mperham/connection_pool" } - sublib.namespace = "ConnectionPool" - sublib.prefix = "Bundler" - sublib.vendor_lib = "bundler/lib/bundler/vendor/connection_pool" - sublib.license_path = "LICENSE" - end - - lib.dependency("uri") do |sublib| - sublib.version = "v0.12.2" - sublib.download = { :github => "https://github.com/ruby/uri" } - sublib.namespace = "URI" - sublib.prefix = "Bundler" - sublib.vendor_lib = "bundler/lib/bundler/vendor/uri" - sublib.license_path = "LICENSE.txt" - end - end -end - -namespace :rubocop do - desc "Setup gems necessary to lint Ruby code" - task(:setup) do - sh "ruby", "-I", "lib", "bundler/spec/support/bundle.rb", "install", "--gemfile=tool/bundler/lint_gems.rb" - end - - desc "Run rubocop. Pass positional arguments as Rake arguments, e.g. `rake 'rubocop:run[-a]'`" - task :run do |_, args| - sh "bin/rubocop", *args - end -end - -task rubocop: %w[rubocop:setup rubocop:run] - -# -------------------------------------------------------------------- -# Creating a release - -task :prerelease => %w[clobber install_release_dependencies test bundler:build_metadata check_deprecations] -task :postrelease => %w[upload guides:publish blog:publish bundler:build_metadata:clean] - -desc "Check for deprecated methods with expired deprecation horizon" -task :check_deprecations do - if v.segments[1] == 0 && v.segments[2] == 0 - sh("bin/rubocop -r ./tool/cops/deprecations --only Rubygems/Deprecations") - else - puts "Skipping deprecation checks since not releasing a major version." - end -end - -desc "Install release dependencies" -task :install_release_dependencies do - require_relative "tool/release" - - Release.install_dependencies! -end - -desc "Prepare a release" -task :prepare_release, [:version] => [:install_release_dependencies] do |_t, opts| - require_relative "tool/release" - - Release.new(opts[:version] || v.to_s).prepare! -end - -desc "Install rubygems to local system" -task :install => [:clear_package, :package] do - sh "ruby -Ilib exe/gem install --no-document pkg/rubygems-update-#{v}.gem --backtrace && update_rubygems --no-document --backtrace" -end - -desc "Clears previously built package" -task :clear_package do - rm_rf "pkg" -end - -desc "Generates the changelog for a specific target version" -task :generate_changelog, [:version] do |_t, opts| - require_relative "tool/release" - - Release.for_rubygems(opts[:version]).cut_changelog! -end - -desc "Release rubygems-#{v}" -task :release => :prerelease do - Rake::Task["package"].invoke - sh "gem push pkg/rubygems-update-#{v}.gem" - Rake::Task["postrelease"].invoke -end - -Gem::PackageTask.new(spec) {} - -Rake::Task["package"].enhance ["pkg/rubygems-#{v}.tgz", "pkg/rubygems-#{v}.zip"] - -file "pkg/rubygems-#{v}" => "pkg/rubygems-update-#{v}" do |t| - require "find" - - dest_root = File.expand_path t.name - - cd t.source do - Find.find "." do |file| - dest = File.expand_path file, dest_root - - if File.directory? file - mkdir_p dest - else - rm_f dest - safe_ln file, dest - end - end - end -end - -file "pkg/rubygems-#{v}.zip" => "pkg/rubygems-#{v}" do - cd "pkg" do - if Gem.win_platform? - sh "7z a rubygems-#{v}.zip rubygems-#{v}" - else - sh "zip -q -r rubygems-#{v}.zip rubygems-#{v}" - end - end -end - -file "pkg/rubygems-#{v}.tgz" => "pkg/rubygems-#{v}" do - cd "pkg" do - tar_version = `tar --version` - if tar_version.include?("bsdtar") - # bsdtar, as used by at least FreeBSD and macOS, uses `--uname` and `--gname`. - sh "tar -czf rubygems-#{v}.tgz --uname=rubygems:0 --gname=rubygems:0 rubygems-#{v}" - else # If a third variant is added, change this line to: elsif tar_version =~ /GNU tar/ - # GNU Tar, as used by many Linux distros, uses `--owner` and `--group`. - sh "tar -czf rubygems-#{v}.tgz --owner=rubygems:0 --group=rubygems:0 rubygems-#{v}" - end - end -end - -desc "Upload the release to GitHub releases" -task :upload_to_github do - require_relative "tool/release" - - Release.for_rubygems(v).create_for_github! -end - -desc "Upload release to S3" -task :upload_to_s3 do - require "aws-sdk-s3" - - s3 = Aws::S3::Resource.new(region:"us-west-2") - %w[zip tgz].each do |ext| - obj = s3.bucket("oregon.production.s3.rubygems.org").object("rubygems/rubygems-#{v}.#{ext}") - obj.upload_file("pkg/rubygems-#{v}.#{ext}", acl: "public-read") - end -end - -desc "Upload release to rubygems.org" -task :upload => %w[upload_to_github upload_to_s3] - -directory "../guides.rubygems.org" do - sh "git", "clone", - "https://github.com/rubygems/guides.git", - "../guides.rubygems.org" -end - -namespace "guides" do - task "pull" => %w[../guides.rubygems.org] do - chdir "../guides.rubygems.org" do - sh "git", "pull" - end - end - - task "update" => %w[../guides.rubygems.org] do - lib_dir = File.join Dir.pwd, "lib" - - chdir "../guides.rubygems.org" do - ruby "-I", lib_dir, "-S", "rake", "command_guide" - ruby "-I", lib_dir, "-S", "rake", "spec_guide" - end - end - - task "commit" => %w[../guides.rubygems.org] do - chdir "../guides.rubygems.org" do - sh "git", "diff", "--quiet" - rescue StandardError - sh "git", "commit", "command-reference.md", "specification-reference.md", - "-m", "Rebuild for RubyGems #{v}" - end - end - - task "push" => %w[../guides.rubygems.org] do - chdir "../guides.rubygems.org" do - sh "git", "push" - end - end - - desc "Updates and publishes the guides for the just-released RubyGems" - task "publish" - - task "publish" => %w[ - guides:pull - guides:update - guides:commit - guides:push - ] -end - -directory "../blog.rubygems.org" do - sh "git", "clone", - "https://github.com/rubygems/rubygems.github.io.git", - "../blog.rubygems.org" -end - -namespace "blog" do - date = Time.now.strftime "%Y-%m-%d" - post_page = "_posts/#{date}-#{v}-released.md" - checksums = "" - - task "checksums" => "package" do - require "net/http" - Dir["pkg/*{tgz,zip,gem}"].each do |file| - digest = OpenSSL::Digest::SHA256.file(file).hexdigest - basename = File.basename(file) - - checksums += "* #{basename} \n" - checksums += " #{digest}\n" - - release_url = URI("https://rubygems.org/#{file.end_with?("gem") ? "gems" : "rubygems"}/#{basename}") - response = Net::HTTP.get_response(release_url) - - if response.is_a?(Net::HTTPSuccess) - released_digest = OpenSSL::Digest::SHA256.hexdigest(response.body) - - if digest != released_digest - abort "Checksum of #{file} (#{digest}) doesn't match checksum of released package at #{release_url} (#{released_digest})" - end - elsif response.is_a?(Net::HTTPForbidden) - abort "#{basename} has not been yet uploaded to rubygems.org" - else - abort "Error fetching released package to verify checksums: #{response}\n#{response.body}" - end - end - end - - task "pull" => %w[../blog.rubygems.org] do - chdir "../blog.rubygems.org" do - sh "git", "pull" - end - end - - path = File.join "../blog.rubygems.org", post_page - - task "update" => [path] - - file path => "checksums" do - name = `git config --get user.name`.strip - email = `git config --get user.email`.strip - - require_relative "tool/changelog" - history = Changelog.for_rubygems(v.to_s) - - require "tempfile" - - Tempfile.open "blog_post" do |io| - io.write <<-ANNOUNCEMENT ---- -title: #{v} Released -layout: post -author: #{name} -author_email: #{email} ---- - -RubyGems #{v} includes #{history.change_types_for_blog}. - -To update to the latest RubyGems you can run: - - gem update --system - -To install RubyGems by hand see the [Download RubyGems][download] page. - -#{history.release_notes_for_blog.join("\n")} - -SHA256 Checksums: - -#{checksums} - -[download]: https://rubygems.org/pages/download - - ANNOUNCEMENT - - io.flush +require "rubocop/rake_task" - sh(ENV["EDITOR"] || "vim", io.path) - - FileUtils.cp io.path, path - end - end - - task "commit" => %w[../blog.rubygems.org] do - chdir "../blog.rubygems.org" do - sh "git", "add", post_page - sh "git", "commit", post_page, - "-m", "Added #{v} release announcement" - end - end - - task "push" => %w[../blog.rubygems.org] do - chdir "../blog.rubygems.org" do - sh "git", "push" - end - end - - desc "Updates and publishes the blog for the just-released RubyGems" - task "publish" => %w[ - blog:pull - blog:update - blog:commit - blog:push - ] -end - -# Misc Tasks --------------------------------------------------------- +RuboCop::RakeTask.new module Rubygems class ProjectFiles def self.all files = [] - exclude = %r{\A(?:\.|bundler/(?!lib|exe|[^/]+\.md|bundler.gemspec)|tool/|Rakefile|bin|test)} - tracked_files = `git ls-files`.split("\n") + exclude = /\A(?:\.|Rakefile|bin|test)/ + tracked_files = `git ls-files -z`.split("\0") tracked_files.each do |path| next unless File.file?(path) @@ -547,229 +43,4 @@ task :check_manifest do end end -license_last_update = nil - -desc "Update License list from SPDX.org" -task :update_licenses do - load "tool/generate_spdx_license_list.rb" - license_last_update = generate_spdx_license_list -end - -desc "Create branch to update License list" -task :update_licenses_branch => :update_licenses do - if license_last_update - file, mtime = license_last_update - date = mtime.strftime("%Y-%m-%d") - branch_name = "license-list-#{date}" - system(*%w[git checkout -b], branch_name, exception: true) - system(*%w[git commit -m], "Update SPDX license list as of #{date}", *file, exception: true) - end -end - -require_relative "bundler/spec/support/rubygems_ext" - -desc "Run specs" -task :spec do - chdir("bundler") do - sh("bin/rspec") - end -end - -namespace :dev do - desc "Ensure dev dependencies are installed" - task :deps do - Spec::Rubygems.dev_setup - end - - desc "Ensure dev dependencies are installed, and make sure no lockfile changes are generated" - task :frozen_deps => :deps do - Spec::Rubygems.check_source_control_changes( - :success_message => "Development dependencies were installed and the lockfile is in sync", - :error_message => "Development dependencies were installed but the lockfile is out of sync. Commit the updated lockfile and try again" - ) - end -end - -namespace :spec do - desc "Ensure spec dependencies are installed" - task :deps => "dev:deps" do - Spec::Rubygems.install_test_deps - end - - desc "Ensure spec dependencies for running in parallel are installed" - task :parallel_deps => "dev:deps" do - Spec::Rubygems.install_parallel_test_deps - end - - desc "Run all specs" - task :all => %w[spec:regular spec:realworld] - - desc "Run the regular spec suite" - task :regular do - chdir("bundler") do - sh("bin/parallel_rspec") - end - end - - desc "Run the real-world spec suite" - task :realworld do - chdir("bundler") do - sh("BUNDLER_SPEC_PRE_RECORDED=1 bin/rspec --tag realworld") - end - end - - namespace :realworld do - desc "Re-record cassettes for the realworld specs" - task :record do - chdir("bundler") do - sh("rm -rf spec/support/artifice/vcr_cassettes && bin/rspec --tag realworld") - end - end - - task :check_unused_cassettes do - chdir("bundler") do - used_cassettes = Dir.glob("spec/support/artifice/used_vcr_cassettes/**/*.txt").flat_map {|f| File.readlines(f).map(&:strip) } - all_cassettes = Dir.glob("spec/support/artifice/vcr_cassettes/**/*").select {|f| File.file?(f) } - unused_cassettes = all_cassettes - used_cassettes - - raise "The following cassettes are unused:\n#{unused_cassettes.join("\n")}\n" if unused_cassettes.any? - - puts "No cassettes unused" - end - end - end -end - -desc "Check RVM integration" -task :check_rvm_integration do - # The rubygems-bundler gem is installed by RVM by default and it could easily - # break when we change bundler. Make sure that binstubs still run with it - # installed. - sh("RUBYOPT=-Ilib gem install rubygems-bundler rake && RUBYOPT=-Ibundler/lib rake -T") -end - -desc "Check RubyGems integration" -task :check_rubygems_integration do - # Bundler monkeypatches RubyGems in some ways that could potentially break gem - # activation. Run a non trivial binstub activation, with two different - # versions of a dependent gem installed. - sh("ruby -Ilib -S gem install reline:0.3.0 reline:0.3.1 irb && ruby -Ibundler/lib -rbundler -S irb --version") -end - -namespace :man do - if RUBY_ENGINE == "jruby" - task(:build) {} - else - file "index.txt" do - index = Dir["bundler/lib/bundler/man/*.ronn"].map do |ronn| - roff = "#{File.dirname(ronn)}/#{File.basename(ronn, ".ronn")}" - [ronn, roff] - end - index.map! do |(ronn, roff)| - date = ENV["MAN_PAGES_DATE"] || Time.now.strftime("%Y-%m-%d") - sh "bin/ronn --warnings --roff --pipe --date #{date} #{ronn} > #{roff}" - [File.read(ronn).split(" ").first, File.basename(roff)] - end - index = index.sort_by(&:first) - justification = index.map {|(n, _f)| n.length }.max + 4 - File.open("bundler/lib/bundler/man/index.txt", "w") do |f| - index.each do |name, filename| - f << name.ljust(justification) << filename << "\n" - end - end - end - task :build_all_pages => "index.txt" - - desc "Make sure ronn is installed" - task :check_ronn do - Spec::Rubygems.gem_require("ronn") - rescue Gem::LoadError => e - abort("We couldn't activate ronn (#{e.requirement}). Try `gem install ronn:'#{e.requirement}'` to be able to build the help pages") - end - - desc "Remove all built man pages" - task :clean do - leftovers = Dir["bundler/lib/bundler/man/*"].reject do |f| - File.extname(f) == ".ronn" - end - rm leftovers if leftovers.any? - end - - desc "Build the man pages" - task :build => [:check_ronn, :clean, :build_all_pages] - - desc "Sets target date for building man pages to the one currently present" - task :set_current_date do - require "date" - ENV["MAN_PAGES_DATE"] = Date.parse(File.readlines("bundler/lib/bundler/man/bundle-add.1")[3].split('"')[5]).strftime("%Y-%m-%d") - end - - desc "Verify man pages are in sync" - task :check => [:check_ronn, :set_current_date, :build] do - Spec::Rubygems.check_source_control_changes( - :success_message => "Man pages are in sync", - :error_message => "Man pages are out of sync. Please run `rake man:build` and commit the results." - ) - end - end -end - -task :override_version do - next unless version = ENV["BUNDLER_SPEC_SUB_VERSION"] - Spec::Path.replace_version_file(version) -end - -namespace :bundler do - chdir(File.expand_path("bundler", __dir__)) do - require_relative "bundler/lib/bundler/gem_tasks" - end - require_relative "bundler/spec/support/build_metadata" - require_relative "tool/release" - - Bundler::GemHelper.tag_prefix = "bundler-" - - task :build_metadata do - Spec::BuildMetadata.write_build_metadata - end - - namespace :build_metadata do - task :clean do - Spec::BuildMetadata.reset_build_metadata - end - end - - task :build => ["bundler:build_metadata"] do - Rake::Task["bundler:build_metadata:clean"].tap(&:reenable).invoke - end - - desc "Push to rubygems.org" - task "release:rubygem_push" => ["bundler:release:setup", "man:check", "bundler:build_metadata", "bundler:release:github"] - - desc "Generates the changelog for a specific target version" - task :generate_changelog, [:version] do |_t, opts| - Release.for_bundler(opts[:version]).cut_changelog! - end - - namespace :release do - desc "Install gems needed for releasing" - task :setup do - Release.install_dependencies! - end - - desc "Push the release to GitHub releases" - task :github do - gemspec_version = Bundler::GemHelper.gemspec.version - - Release.for_bundler(gemspec_version).create_for_github! - end - end -end - -namespace :bundler3 do - task :install do - ENV["BUNDLER_SPEC_SUB_VERSION"] = "3.0.0" - Rake::Task["override_version"].invoke - Rake::Task["install"].invoke - sh("git", "checkout", "--", "bundler/lib/bundler/version.rb") - end -end +task default: [:test, :rubocop] diff --git a/lib/rubygems/commands/generate_index_command.rb b/lib/rubygems/commands/generate_index_command.rb index ce580cfa..2e086027 100644 --- a/lib/rubygems/commands/generate_index_command.rb +++ b/lib/rubygems/commands/generate_index_command.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative "../command" +require "rubygems/command" require_relative "../indexer" ## diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb index f4c981b9..f1f82917 100644 --- a/lib/rubygems/indexer.rb +++ b/lib/rubygems/indexer.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require_relative "../rubygems" -require_relative "package" +require "rubygems" +require "rubygems/package" require "tmpdir" ## @@ -411,8 +411,7 @@ def update_index # +dest+. For a latest index, does not ensure the new file is minimal. def update_specs_index(index, source, dest) - Gem.load_safe_marshal - specs_index = Gem::SafeMarshal.safe_load Gem.read_binary(source) + specs_index = marshal_load Gem.read_binary(source) index.each do |spec| platform = spec.original_platform @@ -426,4 +425,15 @@ def update_specs_index(index, source, dest) Marshal.dump specs_index, io end end + + private + + def marshal_load(string) + if Gem.respond_to?(:load_safe_marshal) + Gem.load_safe_marshal + Gem::SafeMarshal.safe_load string + else + Marshal.load string + end + end end diff --git a/lib/rubygems_plugin.rb b/lib/rubygems_plugin.rb new file mode 100644 index 00000000..80bff0fc --- /dev/null +++ b/lib/rubygems_plugin.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require "rubygems/command_manager" +require_relative "rubygems/commands/generate_index_command" + +Gem::CommandManager.instance.register_command :generate_index diff --git a/rubygems-generate_index.gemspec b/rubygems-generate_index.gemspec new file mode 100644 index 00000000..b05e0c5c --- /dev/null +++ b/rubygems-generate_index.gemspec @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +Gem::Specification.new do |s| + s.name = "rubygems-generate_index" + s.version = "1.0.0" + s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"] + s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"] + + s.summary = "Generates the index files for a gem server directory" + s.homepage = "https://github.com/rubygems/rubygems-generate_index" + + s.metadata["homepage_uri"] = s.homepage + s.metadata["source_code_uri"] = "https://github.com/rubygems/rubygems-generate_index" + s.metadata["changelog_uri"] = "https://github.com/rubygems/rubygems-generate_index" + + s.licenses = ["Ruby", "MIT"] + + s.files = File.read("Manifest.txt").split + s.bindir = "exe" + s.executables = s.files.grep(%r{\Aexe/}) {|f| File.basename(f) } + s.require_paths = ["lib"] + s.rdoc_options = ["--main", "README.md", "--title=RubyGems Generate Index Documentation"] + s.extra_rdoc_files = [ + "LICENSE.txt", + "MIT.txt", "Manifest.txt", "README.md", + "CODE_OF_CONDUCT.md" + ] + + s.required_ruby_version = Gem::Requirement.new(">= 2.6.0") + s.required_rubygems_version = Gem::Requirement.new(">= 0") + + s.add_dependency "compact_index", "~> 0.14.0" +end diff --git a/rubygems-update.gemspec b/rubygems-update.gemspec deleted file mode 100644 index f07cedbf..00000000 --- a/rubygems-update.gemspec +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -Gem::Specification.new do |s| - s.name = "rubygems-update" - s.version = "3.5.0.dev" - s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"] - s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"] - - s.summary = "RubyGems is a package management framework for Ruby. This gem is downloaded and installed by `gem update --system`, so that the `gem` CLI can update itself." - s.description = "A package (also known as a library) contains a set of functionality - that can be invoked by a Ruby program, such as reading and parsing an XML file. We call - these packages 'gems' and RubyGems is a tool to install, create, manage and load these - packages in your Ruby environment. RubyGems is also a client for RubyGems.org, a public - repository of Gems that allows you to publish a Gem that can be shared and used by other - developers. See our guide on publishing a Gem at guides.rubygems.org" - s.homepage = "https://guides.rubygems.org" - s.metadata = { "source_code_uri" => "https://github.com/rubygems/rubygems" } - s.licenses = ["Ruby", "MIT"] - - s.files = File.read(File.expand_path("Manifest.txt", __dir__)).split - s.bindir = "exe" - s.executables = ["update_rubygems"] - s.require_paths = ["hide_lib_for_update"] - s.rdoc_options = ["--main", "README.md", "--title=RubyGems Update Documentation"] - s.extra_rdoc_files = [ - "LICENSE.txt", "MAINTAINERS.txt", - "MIT.txt", "Manifest.txt", "README.md", - "UPGRADING.md", "POLICIES.md", "CODE_OF_CONDUCT.md", - "CONTRIBUTING.md", - "bundler/LICENSE.md", "bundler/README.md", - "hide_lib_for_update/note.txt", *Dir["bundler/lib/bundler/man/*.1", :base => __dir__] - ] - - s.required_ruby_version = Gem::Requirement.new(">= 2.6.0") - s.required_rubygems_version = Gem::Requirement.new(">= 0") - - s.specification_version = 4 -end diff --git a/test/rubygems/test_gem_indexer.rb b/test/rubygems/test_gem_indexer.rb index 56bf3d92..7300dcaa 100644 --- a/test/rubygems/test_gem_indexer.rb +++ b/test/rubygems/test_gem_indexer.rb @@ -33,7 +33,7 @@ def setup end def teardown - FileUtils.rm_rf(@indexer.directory) + FileUtils.rm_rf(@indexer.directory) if @indexer&.directory ensure super end