From dcc6687679939eb050c090fbf2bb77b5b81c51a6 Mon Sep 17 00:00:00 2001 From: 3v0k4 Date: Wed, 4 Dec 2024 17:44:47 +0100 Subject: [PATCH] chore: tidy up repo --- .github/workflows/main.yml | 7 +++---- .gitignore | 2 ++ .rubocop.yml | 9 +++++++++ CHANGELOG.md | 2 +- README.md | 2 +- degem.gemspec | 23 +++++++---------------- sig/degem.rbs | 4 ---- test/test_degem.rb | 6 ++++-- 8 files changed, 27 insertions(+), 28 deletions(-) delete mode 100644 sig/degem.rbs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 93fe725..2177bc9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Ruby +name: Test on: push: @@ -14,7 +14,7 @@ jobs: strategy: matrix: ruby: - - '3.3.6' + - 3.3 steps: - uses: actions/checkout@v4 @@ -23,5 +23,4 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Run the default task - run: bundle exec rake + - run: bin/rake test diff --git a/.gitignore b/.gitignore index 9106b2a..bd9f156 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ /pkg/ /spec/reports/ /tmp/ + +.DS_Store diff --git a/.rubocop.yml b/.rubocop.yml index 6263654..a6747a0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,9 +1,18 @@ require: - rubocop-minitest + - rubocop-performance - rubocop-rake + - rubocop-thread_safety + +AllCops: + TargetRubyVersion: 3.1 + NewCops: enable Style/StringLiterals: EnforcedStyle: double_quotes Style/StringLiteralsInInterpolation: EnforcedStyle: double_quotes + +Layout/LineLength: + Max: 120 diff --git a/CHANGELOG.md b/CHANGELOG.md index d4469d8..35648ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ## [Unreleased] -## [0.1.0] - 2024-11-19 +## [0.1.0] - Initial release diff --git a/README.md b/README.md index cbb2156..14255fb 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@

-Find unused gems in your bundle (ie, an app with a `Gemfile` or a gem with both a `Gemfile` and a gemspec). +Find unused gems in the Ruby bundle (ie, an app with a `Gemfile` or a gem with both a `Gemfile` and a gemspec). Notice that, given the dynamic nature of Ruby, it's not possible to identify unused gems with confidence. diff --git a/degem.gemspec b/degem.gemspec index 5f591f0..083e87d 100644 --- a/degem.gemspec +++ b/degem.gemspec @@ -8,27 +8,17 @@ Gem::Specification.new do |spec| spec.authors = ["3v0k4"] spec.email = ["riccardo.odone@gmail.com"] - spec.summary = "Write a short summary, because RubyGems requires one." - spec.description = "Write a longer description or delete this line." - spec.homepage = "http://example.com" + spec.summary = "Find unused gems in the Ruby bundle" + spec.description = "Degem finds unused gems in the Ruby bundle (ie, an app with a `Gemfile` or a gem with both a `Gemfile` and a gemspec)." + spec.homepage = "https://github.com/3v0k4/degem" spec.license = "MIT" spec.required_ruby_version = ">= 3.1.0" - spec.metadata["allowed_push_host"] = "http://example.com" - spec.metadata["homepage_uri"] = spec.homepage - spec.metadata["source_code_uri"] = "http://example.com" - spec.metadata["changelog_uri"] = "http://example.com" + spec.metadata["source_code_uri"] = spec.homepage + spec.metadata["changelog_uri"] = "https://github.com/3v0k4/favicon_factory/blob/main/CHANGELOG.md" - # Specify which files should be added to the gem when it is released. - # The `git ls-files -z` loads the files in the RubyGem that have been added into git. - gemspec = File.basename(__FILE__) - spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls| - ls.readlines("\x0", chomp: true).reject do |f| - (f == gemspec) || - f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile]) - end - end + spec.files = Dir.glob("lib/**/*") + Dir.glob("exe/*") spec.bindir = "exe" spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] @@ -38,4 +28,5 @@ Gem::Specification.new do |spec| # For more information and examples about making a new gem, check out our # guide at: https://bundler.io/guides/creating_gem.html + spec.metadata["rubygems_mfa_required"] = "true" end diff --git a/sig/degem.rbs b/sig/degem.rbs deleted file mode 100644 index 59024f8..0000000 --- a/sig/degem.rbs +++ /dev/null @@ -1,4 +0,0 @@ -module Degem - VERSION: String - # See the writing guide of rbs: https://github.com/ruby/rbs#guides -end diff --git a/test/test_degem.rb b/test/test_degem.rb index 8fb257e..392f1ca 100644 --- a/test/test_degem.rb +++ b/test/test_degem.rb @@ -684,18 +684,20 @@ def test_e2e__it_prints_unused_gems Bundler.with_unbundled_env do Dir.chdir(GEM_DIR) do - Open3.capture3("bundle gem myapp") unless skip + Open3.capture3("bundle gem myapp --test=minitest") unless skip Dir.chdir(File.join(GEM_DIR, "myapp")) do Open3.capture3("bundle config set --local path vendor") unless skip Open3.capture3("bundle install") unless skip + Open3.capture3("git config --global user.email 'email@example.com'") + Open3.capture3("git config --global user.name 'name'") Open3.capture3("git commit --all -m 'init'") unless skip Open3.capture3("bundle add favicon_factory") unless skip Open3.capture3("git commit --all -m 'add favicon_factory'") unless skip Open3.capture3("bundle add --path '../../..' degem") unless skip Open3.capture3('echo \'require "rubocop"\' >> lib/myapp.rb') unless skip - out, err, status = Open3.capture3("bundle exec degem Gemfile") + _out, err, status = Open3.capture3("bundle exec degem Gemfile") assert_equal 0, status.exitstatus refute_includes err, "myapp" # required in tests