Skip to content

Commit

Permalink
Merge pull request #4 from dvandersluis/v1.0
Browse files Browse the repository at this point in the history
v1.0.0
  • Loading branch information
dvandersluis authored Jan 24, 2025
2 parents 45f38a3 + a2648d8 commit 39529c5
Show file tree
Hide file tree
Showing 39 changed files with 396 additions and 143 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Lint

on:
push:
branches: [ "master", "v1.0" ]
pull_request:
branches: [ "master", "v1.0" ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
rubocop:
name: Run Rubocop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ruby # Latest stable CRuby version
bundler-cache: true
- name: rubocop
run: bundle exec rubocop
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Test

on:
push:
branches: [ "master", "v1.0" ]
pull_request:
branches: [ "master", "v1.0" ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4', 'head']

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rspec
39 changes: 34 additions & 5 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,60 @@
inherit_gem:
rubocop_defaults: .rubocop.yml
inherit_from: .rubocop_todo.yml

require:
- rubocop/cop/internal_affairs
- rubocop-performance
- rubocop-rspec

inherit_mode:
merge:
- Exclude
- IgnoredMethods

AllCops:
TargetRubyVersion: 2.6
NewCops: enable
TargetRubyVersion: 3.0
SuggestExtensions:
rubocop-rake: false
Exclude:
- .pryrc

Layout/IndentFirstArrayElement:
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent

Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation

Layout/EndAlignment:
EnforcedStyleAlignWith: variable

Naming/FileName:
Exclude:
- lib/bundler-dependencies.rb

RSpec/ExampleLength:
Max: 10
Exclude:
- spec/bundler/dependencies/cli_spec.rb

RSpec/ContextWording:
Enabled: false

RSpec/NamedSubject:
Enabled: false

RSpec/NestedGroups:
Max: 5

RSpec/NotToNot:
EnforcedStyle: to_not

Style/FormatStringToken:
Enabled: false

Style/NumericPredicate:
Enabled: false

Style/MethodCallWithArgsParentheses:
IgnoredMethods:
AllowedMethods:
- and
- method_option
33 changes: 33 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2025-01-24 18:08:13 UTC using RuboCop version 1.71.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: Severity, Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'bundler-dependencies.gemspec'

# Offense count: 14
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'lib/bundler/dependencies.rb'
- 'lib/bundler/dependencies/cli.rb'
- 'lib/bundler/dependencies/cli/command.rb'
- 'lib/bundler/dependencies/cli/count.rb'
- 'lib/bundler/dependencies/cli/find.rb'
- 'lib/bundler/dependencies/cli/graph.rb'
- 'lib/bundler/dependencies/cli/with_gem.rb'
- 'lib/bundler/dependencies/command.rb'
- 'lib/bundler/dependencies/graph.rb'
- 'lib/bundler/dependencies/scanner.rb'
- 'lib/bundler/dependencies/spec.rb'
- 'lib/bundler/dependencies/visitor.rb'
- 'lib/bundler/dependencies/visitors/paths.rb'
- 'lib/bundler/dependencies/visitors/shell_tree.rb'
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.2
3.4.1
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# CHANGELOG

## 1.0.0 (2025-01-24)

### New features
* Gem now works as a bundle plugin!

### Bug fixes
* Fixed command name outputted when calling `bundle dependencies help`.

### Changes
* Minimum supported Ruby version increased to 2.7.
* `thor` version restrictions were relaxed, now allows any `1.x.y` version.

## 0.6.0 (2019-11-18)

### New features
Expand Down
11 changes: 10 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
# frozen_string_literal: true

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

source 'https://rubygems.org'

# Specify your gem's dependencies in bundler-dependencies.gemspec
gemspec

gem 'rubocop_defaults', github: 'dvandersluis/rubocop_defaults'
gem 'pry'
gem 'rake'
gem 'rspec'
gem 'rubocop'
gem 'rubocop-performance'
gem 'rubocop-rspec'

plugin 'bundler-dependencies', path: '.' unless ENV['CI']
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2019 Daniel Vandersluis
Copyright 2019-2025 Daniel Vandersluis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
44 changes: 38 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Bundler::Dependencies

[![Build Status](https://travis-ci.org/dvandersluis/bundler-dependencies.svg?branch=master)](https://travis-ci.org/dvandersluis/bundler-dependencies)
![Test](https://github.com/dvandersluis/bundler-dependencies/actions/workflows/test.yml/badge.svg)
![Lint](https://github.com/dvandersluis/bundler-dependencies/actions/workflows/lint.yml/badge.svg)
[![Gem Version](https://badge.fury.io/rb/bundler-dependencies.svg)](https://badge.fury.io/rb/bundler-dependencies)

Bundler plugin to inspect dependencies of gems used by your project.
Expand All @@ -9,10 +10,46 @@ A project's `Gemfile.lock` shows some basic information about what gems are dire

Each dependency is a potential point of failure, vulnerability, maintenance and *complexity* for a project, so the goal of `bundle dependencies` is to shed some light on what's being installed by what. This shouldn't stop you from installing gems that are useful to your project, but to be able to make an educated decision if a gem with 25 dependencies is a worthy tradeoff, for example.

## Installation

Add this line to your application's Gemfile:

```sh
plugin 'bundler-graph'
```

And then execute:

```sh
$ bundle install
```

Alternately, you can install the plugin directly:

```sh
$ bundle plugin install bundle-dependencies
```

## Usage

```sh
bundler dependencies [command]
[--path=PATH] # Path to Gemfile.lock to scan
[-W, --without=one two three] # Gems to ignore
[-R, --without-rails] # Ignore all Rails gems
```

Requires a `Gemfile.lock` or `gems.locked` file to evaluate.

## Commands

**NOTE:** By default, `bundler dependencies` runs the `count` command.

### Getting Help

* `bundle dependencies help` to get an overview of all commands.
* `bundle dependencies help COMMAND` to get help for a specific command.

### Count

Check how many dependencies each gem in the Gemfile has (use the `--minimum N` switch to limit the output to gems with at least `N` dependencies):
Expand Down Expand Up @@ -55,11 +92,6 @@ The following options can be used with any command:
* `--without foo bar baz`/`-W foo bar baz`: Exclude the listed gems from the scan. Any uses either directly in your Gemfile or as dependencies will be excluded, and not be counted.
* `--without-rails`/`-R`: Quick option to exclude all 1st party Rails gems from the scan.

### Getting Help

* `bundle dependencies help` to get an overview of all commands.
* `bundle dependencies help COMMAND` to get help for a specific command.

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
Expand Down
8 changes: 7 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
desc 'Run RuboCop'
RuboCop::RakeTask.new(:rubocop)

task default: %i[spec rubocop]
10 changes: 0 additions & 10 deletions bin/bundle-dependencies

This file was deleted.

3 changes: 0 additions & 3 deletions bin/bundler-dependencies

This file was deleted.

8 changes: 3 additions & 5 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'bundler/dependencies'
Expand All @@ -7,8 +8,5 @@ require 'bundler/dependencies'
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require 'irb'
IRB.start(__FILE__)
require 'pry'
Pry.start
Loading

0 comments on commit 39529c5

Please sign in to comment.