bundleup 0.9.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.3 --conservative --no-document
16
- - gem install executable-hooks --conservative --no-document
@@ -1 +0,0 @@
1
- Release notes for this project are kept here: https://github.com/mattbrictson/bundleup/releases
@@ -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/
@@ -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
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in bundleup.gemspec
4
- gemspec
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
@@ -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
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,30 +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.homepage = "https://github.com/mattbrictson/bundleup"
15
- spec.license = "MIT"
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
21
-
22
- spec.required_ruby_version = ">= 2.4.0"
23
-
24
- spec.add_development_dependency "bundler", "~> 2.0"
25
- spec.add_development_dependency "minitest", "~> 5.0"
26
- spec.add_development_dependency "minitest-reporters", "~> 1.1"
27
- spec.add_development_dependency "rake", "~> 13.0"
28
- spec.add_development_dependency "rubocop", "0.78.0"
29
- spec.add_development_dependency "rubocop-performance", "1.5.2"
30
- 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
@@ -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
@@ -1,59 +0,0 @@
1
- # rubocop:disable Metrics/BlockLength
2
- module Bundleup
3
- GemStatus = Struct.new(:name,
4
- :old_version,
5
- :new_version,
6
- :newest_version,
7
- :pin) do
8
- def pinned?
9
- !pin.nil?
10
- end
11
-
12
- def upgraded?
13
- new_version != old_version
14
- end
15
-
16
- def added?
17
- old_version.nil?
18
- end
19
-
20
- def removed?
21
- new_version.nil?
22
- end
23
-
24
- def color
25
- if major_upgrade? || removed?
26
- :red
27
- elsif minor_upgrade?
28
- :yellow
29
- elsif added?
30
- :blue
31
- else
32
- :plain
33
- end
34
- end
35
-
36
- def major_upgrade?
37
- return false if new_version.nil? || old_version.nil?
38
-
39
- major(new_version) != major(old_version)
40
- end
41
-
42
- def minor_upgrade?
43
- return false if new_version.nil? || old_version.nil?
44
-
45
- !major_upgrade? && minor(new_version) != minor(old_version)
46
- end
47
-
48
- private
49
-
50
- def major(version)
51
- version.split(".", 2)[0]
52
- end
53
-
54
- def minor(version)
55
- version.split(".", 3)[1]
56
- end
57
- end
58
- end
59
- # rubocop:enable Metrics/BlockLength