bundleup 1.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +36 -6
- data/exe/bundleup +7 -1
- data/lib/bundleup.rb +20 -5
- data/lib/bundleup/backup.rb +29 -0
- data/lib/bundleup/cli.rb +123 -61
- data/lib/bundleup/colors.rb +56 -0
- data/lib/bundleup/commands.rb +40 -0
- data/lib/bundleup/gemfile.rb +48 -2
- data/lib/bundleup/logger.rb +64 -0
- data/lib/bundleup/pin_report.rb +37 -0
- data/lib/bundleup/report.rb +38 -0
- data/lib/bundleup/shell.rb +35 -0
- data/lib/bundleup/update_report.rb +63 -0
- data/lib/bundleup/version.rb +1 -1
- data/lib/bundleup/version_spec.rb +54 -0
- metadata +22 -125
- data/.github/release-drafter.yml +0 -17
- data/.github/workflows/push.yml +0 -12
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -57
- data/.travis.yml +0 -16
- data/CHANGELOG.md +0 -1
- data/CODE_OF_CONDUCT.md +0 -49
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -4
- data/Rakefile +0 -93
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/bundleup.gemspec +0 -40
- data/lib/bundleup/bundle_commands.rb +0 -31
- data/lib/bundleup/console.rb +0 -99
- data/lib/bundleup/gem_status.rb +0 -59
- data/lib/bundleup/upgrade.rb +0 -60
- data/sample.png +0 -0
data/.github/release-drafter.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
name-template: "$NEXT_PATCH_VERSION"
|
2
|
-
tag-template: "v$NEXT_PATCH_VERSION"
|
3
|
-
categories:
|
4
|
-
- title: "⚠️ Breaking Changes"
|
5
|
-
label: "⚠️ Breaking"
|
6
|
-
- title: "✨ New Features"
|
7
|
-
label: "✨ Feature"
|
8
|
-
- title: "🐛 Bug Fixes"
|
9
|
-
label: "🐛 Bug Fix"
|
10
|
-
- title: "📚 Documentation"
|
11
|
-
label: "📚 Docs"
|
12
|
-
- title: "🏠 Housekeeping"
|
13
|
-
label: "🏠 Housekeeping"
|
14
|
-
change-template: "- $TITLE (#$NUMBER) @$AUTHOR"
|
15
|
-
no-changes-template: "- No changes"
|
16
|
-
template: |
|
17
|
-
$CHANGES
|
data/.github/workflows/push.yml
DELETED
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-minitest
|
3
|
-
- rubocop-performance
|
4
|
-
|
5
|
-
AllCops:
|
6
|
-
TargetRubyVersion: 2.4
|
7
|
-
Exclude:
|
8
|
-
- "*.gemspec"
|
9
|
-
- "vendor/**/*"
|
10
|
-
|
11
|
-
Layout/SpaceAroundEqualsInParameterDefault:
|
12
|
-
EnforcedStyle: no_space
|
13
|
-
|
14
|
-
Metrics/AbcSize:
|
15
|
-
Exclude:
|
16
|
-
- "test/**/*"
|
17
|
-
|
18
|
-
Metrics/MethodLength:
|
19
|
-
Exclude:
|
20
|
-
- "test/**/*"
|
21
|
-
|
22
|
-
Metrics/ClassLength:
|
23
|
-
Exclude:
|
24
|
-
- "test/**/*"
|
25
|
-
|
26
|
-
Naming/MemoizedInstanceVariableName:
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
Style/BarePercentLiterals:
|
30
|
-
EnforcedStyle: percent_q
|
31
|
-
|
32
|
-
Style/ClassAndModuleChildren:
|
33
|
-
Enabled: false
|
34
|
-
|
35
|
-
Style/Documentation:
|
36
|
-
Enabled: false
|
37
|
-
|
38
|
-
Style/DoubleNegation:
|
39
|
-
Enabled: false
|
40
|
-
|
41
|
-
Style/FrozenStringLiteralComment:
|
42
|
-
Enabled: false
|
43
|
-
|
44
|
-
Style/HashEachMethods:
|
45
|
-
Enabled: true
|
46
|
-
|
47
|
-
Style/HashSyntax:
|
48
|
-
EnforcedStyle: ruby19
|
49
|
-
|
50
|
-
Style/HashTransformKeys:
|
51
|
-
Enabled: true
|
52
|
-
|
53
|
-
Style/HashTransformValues:
|
54
|
-
Enabled: true
|
55
|
-
|
56
|
-
Style/StringLiterals:
|
57
|
-
EnforcedStyle: double_quotes
|
data/.travis.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
---
|
2
|
-
sudo: false
|
3
|
-
language: ruby
|
4
|
-
cache: bundler
|
5
|
-
branches:
|
6
|
-
only:
|
7
|
-
- master
|
8
|
-
rvm:
|
9
|
-
- 2.4.9
|
10
|
-
- 2.5.7
|
11
|
-
- 2.6.5
|
12
|
-
- 2.7.0
|
13
|
-
- ruby-head
|
14
|
-
before_install:
|
15
|
-
- gem install bundler -v 2.1.4 --conservative --no-document
|
16
|
-
- gem install executable-hooks --conservative --no-document
|
data/CHANGELOG.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Release notes for this project are kept here: https://github.com/mattbrictson/bundleup/releases
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, and in the interest of
|
4
|
-
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
-
contribute through reporting issues, posting feature requests, updating
|
6
|
-
documentation, submitting pull requests or patches, and other activities.
|
7
|
-
|
8
|
-
We are committed to making participation in this project a harassment-free
|
9
|
-
experience for everyone, regardless of level of experience, gender, gender
|
10
|
-
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
-
body size, race, ethnicity, age, religion, or nationality.
|
12
|
-
|
13
|
-
Examples of unacceptable behavior by participants include:
|
14
|
-
|
15
|
-
* The use of sexualized language or imagery
|
16
|
-
* Personal attacks
|
17
|
-
* Trolling or insulting/derogatory comments
|
18
|
-
* Public or private harassment
|
19
|
-
* Publishing other's private information, such as physical or electronic
|
20
|
-
addresses, without explicit permission
|
21
|
-
* Other unethical or unprofessional conduct
|
22
|
-
|
23
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
-
threatening, offensive, or harmful.
|
28
|
-
|
29
|
-
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
-
fairly and consistently applying these principles to every aspect of managing
|
31
|
-
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
-
Conduct may be permanently removed from the project team.
|
33
|
-
|
34
|
-
This code of conduct applies both within project spaces and in public spaces
|
35
|
-
when an individual is representing the project or its community.
|
36
|
-
|
37
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
-
reported by contacting a project maintainer at matt@mattbrictson.com. All
|
39
|
-
complaints will be reviewed and investigated and will result in a response that
|
40
|
-
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
-
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
-
incident.
|
43
|
-
|
44
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
-
version 1.3.0, available at
|
46
|
-
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
-
|
48
|
-
[homepage]: http://contributor-covenant.org
|
49
|
-
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/CONTRIBUTING.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# Contributing to bundleup
|
2
|
-
|
3
|
-
Have a feature idea, bug fix, or refactoring suggestion? Contributions are welcome!
|
4
|
-
|
5
|
-
## Pull requests
|
6
|
-
|
7
|
-
1. Check [Issues][] to see if your contribution has already been discussed and/or implemented.
|
8
|
-
2. If not, open an issue to discuss your contribution. I won't accept all changes and do not want to waste your time.
|
9
|
-
3. Once you have the :thumbsup:, fork the repo, make your changes, and open a PR.
|
10
|
-
4. Don't forget to add your contribution and credit yourself in `CHANGELOG.md`!
|
11
|
-
|
12
|
-
## Coding guidelines
|
13
|
-
|
14
|
-
* This project has a coding style enforced by [RuboCop][]. Use hash rockets and double-quoted strings, and otherwise try to follow the [Ruby style guide][style].
|
15
|
-
* Writing tests is strongly encouraged! This project uses Minitest.
|
16
|
-
|
17
|
-
## Getting started
|
18
|
-
|
19
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
20
|
-
|
21
|
-
bundleup offers the following development and testing commands:
|
22
|
-
|
23
|
-
* `bin/console` loads your working copy of bundleup into an irb session
|
24
|
-
* `bundle exec bundleup` runs your working copy of the bundleup executable
|
25
|
-
* `rake` executes all of bundleup's tests and RuboCop checks
|
26
|
-
|
27
|
-
[Issues]: https://github.com/mattbrictson/bundleup/issues
|
28
|
-
[RuboCop]: https://github.com/bbatsov/rubocop
|
29
|
-
[style]: https://github.com/bbatsov/ruby-style-guide
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
require "rubocop/rake_task"
|
4
|
-
|
5
|
-
Rake::TestTask.new(:test) do |t|
|
6
|
-
t.libs << "test"
|
7
|
-
t.libs << "lib"
|
8
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
9
|
-
end
|
10
|
-
|
11
|
-
RuboCop::RakeTask.new
|
12
|
-
|
13
|
-
task default: %i[test rubocop]
|
14
|
-
|
15
|
-
Rake::Task["release"].enhance do
|
16
|
-
puts "Don't forget to publish the release on GitHub!"
|
17
|
-
system "open https://github.com/mattbrictson/bundleup/releases"
|
18
|
-
end
|
19
|
-
|
20
|
-
task bump: %w[bump:bundler bump:ruby bump:year]
|
21
|
-
|
22
|
-
namespace :bump do
|
23
|
-
task :bundler do
|
24
|
-
version = Gem.latest_version_for("bundler").to_s
|
25
|
-
replace_in_file ".travis.yml", /bundler -v (\S+)/ => version
|
26
|
-
replace_in_file "Gemfile.lock", /^BUNDLED WITH\n\s+([\d\.]+)$/ => version
|
27
|
-
end
|
28
|
-
|
29
|
-
task :ruby do
|
30
|
-
lowest = RubyVersions.lowest_supported
|
31
|
-
lowest_minor = RubyVersions.lowest_supported_minor
|
32
|
-
|
33
|
-
replace_in_file "bundleup.gemspec", /ruby_version = ">= (.*)"/ => lowest
|
34
|
-
replace_in_file ".rubocop.yml", /TargetRubyVersion: (.*)/ => lowest_minor
|
35
|
-
replace_in_file "README.md", /Ruby (\d+\.\d+)/ => lowest_minor
|
36
|
-
|
37
|
-
travis = YAML.safe_load(open(".travis.yml"))
|
38
|
-
travis["rvm"] = RubyVersions.latest_supported_patches + ["ruby-head"]
|
39
|
-
IO.write(".travis.yml", YAML.dump(travis))
|
40
|
-
end
|
41
|
-
|
42
|
-
task :year do
|
43
|
-
replace_in_file "LICENSE.txt", /\(c\) (\d+)/ => Date.today.year.to_s
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
require "date"
|
48
|
-
require "open-uri"
|
49
|
-
require "yaml"
|
50
|
-
|
51
|
-
def replace_in_file(path, replacements)
|
52
|
-
contents = IO.read(path)
|
53
|
-
orig_contents = contents.dup
|
54
|
-
replacements.each do |regexp, text|
|
55
|
-
contents.gsub!(regexp) do |match|
|
56
|
-
match[regexp, 1] = text
|
57
|
-
match
|
58
|
-
end
|
59
|
-
end
|
60
|
-
IO.write(path, contents) if contents != orig_contents
|
61
|
-
end
|
62
|
-
|
63
|
-
module RubyVersions
|
64
|
-
class << self
|
65
|
-
def lowest_supported
|
66
|
-
"#{lowest_supported_minor}.0"
|
67
|
-
end
|
68
|
-
|
69
|
-
def lowest_supported_minor
|
70
|
-
latest_supported_patches.first[/\d+\.\d+/]
|
71
|
-
end
|
72
|
-
|
73
|
-
def latest
|
74
|
-
latest_supported_patches.last
|
75
|
-
end
|
76
|
-
|
77
|
-
def latest_supported_patches
|
78
|
-
patches = [versions[:stable], versions[:security_maintenance]].flatten
|
79
|
-
patches.map(&Gem::Version.method(:new)).sort.map(&:to_s)
|
80
|
-
end
|
81
|
-
|
82
|
-
private
|
83
|
-
|
84
|
-
def versions
|
85
|
-
@_versions ||= begin
|
86
|
-
yaml = URI.open(
|
87
|
-
"https://raw.githubusercontent.com/ruby/www.ruby-lang.org/master/_data/downloads.yml"
|
88
|
-
)
|
89
|
-
YAML.safe_load(yaml, symbolize_names: true)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "bundleup"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
data/bundleup.gemspec
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "bundleup/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "bundleup"
|
8
|
-
spec.version = Bundleup::VERSION
|
9
|
-
spec.authors = ["Matt Brictson"]
|
10
|
-
spec.email = ["bundleup@mattbrictson.com"]
|
11
|
-
|
12
|
-
spec.summary = "A friendlier command-line interface for Bundler’s "\
|
13
|
-
"`update` and `outdated` commands."
|
14
|
-
spec.description = "Use `bundleup` whenever you want to update the "\
|
15
|
-
"locked Gemfile dependencies of a Ruby project. It "\
|
16
|
-
"shows exactly what gems will be updated with color "\
|
17
|
-
"output that calls attention to significant semver "\
|
18
|
-
"changes. Bundleup will also let you know when a "\
|
19
|
-
'version "pin" in your Gemfile is preventing an '\
|
20
|
-
"update. Bundleup is a standalone tool that leverages "\
|
21
|
-
"standard Bundler output and does not patch code or "\
|
22
|
-
"use Bundler internals."
|
23
|
-
spec.homepage = "https://github.com/mattbrictson/bundleup"
|
24
|
-
spec.license = "MIT"
|
25
|
-
|
26
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
|
-
spec.bindir = "exe"
|
28
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
-
spec.require_paths = ["lib"]
|
30
|
-
|
31
|
-
spec.required_ruby_version = ">= 2.4.0"
|
32
|
-
|
33
|
-
spec.add_development_dependency "bundler", "~> 2.0"
|
34
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
35
|
-
spec.add_development_dependency "minitest-reporters", "~> 1.1"
|
36
|
-
spec.add_development_dependency "rake", "~> 13.0"
|
37
|
-
spec.add_development_dependency "rubocop", "0.80.0"
|
38
|
-
spec.add_development_dependency "rubocop-minitest", "0.6.2"
|
39
|
-
spec.add_development_dependency "rubocop-performance", "1.5.2"
|
40
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require "open3"
|
2
|
-
|
3
|
-
module Bundleup
|
4
|
-
class BundleCommands
|
5
|
-
include Console
|
6
|
-
|
7
|
-
def outdated
|
8
|
-
run(%w[bundle outdated], true)
|
9
|
-
end
|
10
|
-
|
11
|
-
def list
|
12
|
-
run(%w[bundle list])
|
13
|
-
end
|
14
|
-
|
15
|
-
def update(args=[])
|
16
|
-
run(%w[bundle update] + args)
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def run(cmd, fail_silently=false)
|
22
|
-
cmd_line = cmd.join(" ")
|
23
|
-
progress("Running `#{cmd_line}`") do
|
24
|
-
out, err, status = Open3.capture3(*cmd)
|
25
|
-
next(out) if status.success? || fail_silently
|
26
|
-
|
27
|
-
raise ["Failed to execute: #{cmd_line}", out, err].compact.join("\n")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/lib/bundleup/console.rb
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
module Bundleup
|
2
|
-
module Console
|
3
|
-
ANSI_CODES = {
|
4
|
-
red: 31,
|
5
|
-
green: 32,
|
6
|
-
yellow: 33,
|
7
|
-
blue: 34,
|
8
|
-
gray: 90
|
9
|
-
}.freeze
|
10
|
-
|
11
|
-
def ok(message)
|
12
|
-
puts color(:green, "✔ #{message}")
|
13
|
-
end
|
14
|
-
|
15
|
-
def attention(message)
|
16
|
-
puts color(:yellow, message)
|
17
|
-
end
|
18
|
-
|
19
|
-
def color(color_name, message)
|
20
|
-
code = ANSI_CODES[color_name]
|
21
|
-
return message if code.nil?
|
22
|
-
|
23
|
-
"\e[0;#{code};49m#{message}\e[0m"
|
24
|
-
end
|
25
|
-
|
26
|
-
def confirm(question)
|
27
|
-
print question.sub(/\??\z/, " [Yn]? ")
|
28
|
-
$stdin.gets =~ /^($|y)/i
|
29
|
-
end
|
30
|
-
|
31
|
-
# Runs a block in the background and displays a spinner until it completes.
|
32
|
-
def progress(message, &block)
|
33
|
-
spinner = %w[/ - \\ |].cycle
|
34
|
-
print "\e[90m#{message}... \e[0m"
|
35
|
-
result = observing_thread(block, 0.5, 0.1) do
|
36
|
-
print "\r\e[90m#{message}... #{spinner.next} \e[0m"
|
37
|
-
end
|
38
|
-
puts "\r\e[90m#{message}... OK\e[0m"
|
39
|
-
result
|
40
|
-
rescue StandardError
|
41
|
-
puts "\r\e[90m#{message}...\e[0m \e[31mFAILED\e[0m"
|
42
|
-
raise
|
43
|
-
end
|
44
|
-
|
45
|
-
# Given a two-dimensional Array of strings representing a table of data,
|
46
|
-
# translate each row into a single string by joining the values with
|
47
|
-
# whitespace such that all the columns are nicely aligned.
|
48
|
-
#
|
49
|
-
# If a block is given, map the rows through the block first. These two
|
50
|
-
# usages are equivalent:
|
51
|
-
#
|
52
|
-
# tableize(rows.map(&something))
|
53
|
-
# tableize(rows, &something)
|
54
|
-
#
|
55
|
-
# Returns a one-dimensional Array of strings, each representing a formatted
|
56
|
-
# row of the resulting table.
|
57
|
-
#
|
58
|
-
def tableize(rows, &block)
|
59
|
-
rows = rows.map(&block) if block
|
60
|
-
widths = max_length_of_each_column(rows)
|
61
|
-
rows.map do |row|
|
62
|
-
row.zip(widths).map { |value, width| value.ljust(width) }.join(" ")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
private
|
67
|
-
|
68
|
-
def max_length_of_each_column(rows)
|
69
|
-
Array.new(rows.first.count) do |i|
|
70
|
-
rows.map { |values| values[i].to_s.length }.max
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Starts the `callable` in a background thread and waits for it to complete.
|
75
|
-
# If the callable fails with an exception, it will be raised here. Otherwise
|
76
|
-
# the main thread is paused for an `initial_wait` time in seconds, and
|
77
|
-
# subsequently for `periodic_wait` repeatedly until the thread completes.
|
78
|
-
# After each wait, `yield` is called to allow a block to execute.
|
79
|
-
def observing_thread(callable, initial_wait, periodic_wait)
|
80
|
-
thread = Thread.new(&callable)
|
81
|
-
wait_for_exit(thread, initial_wait)
|
82
|
-
loop do
|
83
|
-
break if wait_for_exit(thread, periodic_wait)
|
84
|
-
|
85
|
-
yield
|
86
|
-
end
|
87
|
-
thread.value
|
88
|
-
end
|
89
|
-
|
90
|
-
def wait_for_exit(thread, seconds)
|
91
|
-
thread.join(seconds)
|
92
|
-
rescue StandardError
|
93
|
-
# Sanity check. If we get an exception, the thread should be dead.
|
94
|
-
raise if thread.alive?
|
95
|
-
|
96
|
-
thread
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|