bundleup 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +33 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +16 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/CONTRIBUTING.md +29 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +64 -0
- data/Rakefile +15 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bundleup.gemspec +29 -0
- data/exe/bundleup +4 -0
- data/lib/bundleup.rb +6 -0
- data/lib/bundleup/bundle_commands.rb +30 -0
- data/lib/bundleup/cli.rb +65 -0
- data/lib/bundleup/console.rb +66 -0
- data/lib/bundleup/gem_status.rb +57 -0
- data/lib/bundleup/gemfile.rb +61 -0
- data/lib/bundleup/version.rb +3 -0
- data/sample.png +0 -0
- metadata +166 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 865cab477561de59cdd1c114ffa36195af57e18b
|
4
|
+
data.tar.gz: 71f4619cc728bcf78006f7fdb60348aa6a482756
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3e6ebb3f257b644fa58e4b8da2644fc9a2e5c86618a18389a6812372d8c9d483e26f4bde6e9f4ae39acc11f53a54b18bb31341dc9f5d64e744b5d29a497ea390
|
7
|
+
data.tar.gz: 3c8247f33348a73606f922dd3de4c876226b5ccfe6c9f6f570597b0a0a99fd1167d3792c976a2b531dfeac01b49c4cf4a6bec0a1944ba7cea00ff63cfc4565de
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- "*.gemspec"
|
4
|
+
|
5
|
+
Metrics/AbcSize:
|
6
|
+
Exclude:
|
7
|
+
- "test/**/*"
|
8
|
+
|
9
|
+
Metrics/MethodLength:
|
10
|
+
Exclude:
|
11
|
+
- "test/**/*"
|
12
|
+
|
13
|
+
Metrics/ClassLength:
|
14
|
+
Exclude:
|
15
|
+
- "test/**/*"
|
16
|
+
|
17
|
+
Style/ClassAndModuleChildren:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Style/Documentation:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Style/DoubleNegation:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Style/HashSyntax:
|
27
|
+
EnforcedStyle: hash_rockets
|
28
|
+
|
29
|
+
Style/SpaceAroundEqualsInParameterDefault:
|
30
|
+
EnforcedStyle: no_space
|
31
|
+
|
32
|
+
Style/StringLiterals:
|
33
|
+
EnforcedStyle: double_quotes
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# bundleup Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
bundleup is in a pre-1.0 state. This means that its APIs and behavior are subject to breaking changes without deprecation notices. Until 1.0, version numbers will follow a [Semver][]-ish `0.y.z` format, where `y` is incremented when new features or breaking changes are introduced, and `z` is incremented for lesser changes or bug fixes.
|
6
|
+
|
7
|
+
## [Unreleased][]
|
8
|
+
|
9
|
+
* Your contribution here!
|
10
|
+
|
11
|
+
## 0.1.0 (2015-12-24)
|
12
|
+
|
13
|
+
* Initial release
|
14
|
+
|
15
|
+
[Semver]: http://semver.org
|
16
|
+
[Unreleased]: https://github.com/mattbrictson/bundleup/compare/v0.1.0...HEAD
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
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
ADDED
@@ -0,0 +1,29 @@
|
|
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
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Matt Brictson
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# bundleup
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/bundleup.svg)](http://badge.fury.io/rb/bundleup)
|
4
|
+
[![Build Status](https://travis-ci.org/mattbrictson/bundleup.svg?branch=master)](https://travis-ci.org/mattbrictson/bundleup)
|
5
|
+
|
6
|
+
**Run `bundleup` on a Ruby project containing a Gemfile to see what gem dependencies need updating.** It is a friendlier command-line interface to [Bundler’s][bundler] `bundle update` and `bundle outdated`.
|
7
|
+
|
8
|
+
You might like bundleup because it:
|
9
|
+
|
10
|
+
* shows you exactly what gems will be updated *before* making any changes to your Gemfile.lock
|
11
|
+
* uses color to call your attention to important gem updates (based on [Semver][])
|
12
|
+
* lets you know when a version "pin" in your Gemfile is preventing an update
|
13
|
+
* relies on standard Bundler output and does not patch code or use Bundler internals
|
14
|
+
|
15
|
+
Here it is in action:
|
16
|
+
|
17
|
+
<img src="https://raw.github.com/mattbrictson/bundleup/master/sample.png" width="599" height="553" alt="Sample output">
|
18
|
+
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Assuming you have a Ruby environment, all you need to do is install the bundleup gem:
|
23
|
+
|
24
|
+
```
|
25
|
+
gem install bundleup
|
26
|
+
```
|
27
|
+
|
28
|
+
Now, within a Ruby project you can run the bundleup command (the project needs to have a Gemfile and Gemfile.lock):
|
29
|
+
|
30
|
+
```
|
31
|
+
bundleup
|
32
|
+
```
|
33
|
+
|
34
|
+
That’s it!
|
35
|
+
|
36
|
+
|
37
|
+
## How it works
|
38
|
+
|
39
|
+
bundleup starts by making a copy of your Gemfile and Gemfile.lock into a temporary working directory. Within that directory, it runs `bundle show`, then `bundle update` and `bundle show` again to find what gems versions are being used before and after Bundler does its updating magic. (Since gems are actually being installed into your Ruby environment during these steps, the process may take a few moments to complete, especially if gems with native extensions need to be compiled.)
|
40
|
+
|
41
|
+
Finally, bundleup runs `bundle outdated` to see the gems that were *not* updated due to Gemfile restrictions.
|
42
|
+
|
43
|
+
Since all this takes place in a temporary directory, your project’s actual Gemfile.lock is not affected. After displaying its findings, bundleup gives you the option of running `bundle update` once more against your project. This time your Gemfile.lock *will* be changed. You can skip this step if you want.
|
44
|
+
|
45
|
+
|
46
|
+
## Roadmap
|
47
|
+
|
48
|
+
bundleup is a very simple script at this point, but it could be more. Some possibilities:
|
49
|
+
|
50
|
+
* Automatically commit the Gemfile.lock changes with a nice commit message
|
51
|
+
* Integrate with bundler-audit to mark upgrades that have important security fixes
|
52
|
+
* Display relevant CHANGELOG entries for major upgrades
|
53
|
+
* Non-interactive mode
|
54
|
+
|
55
|
+
If you have other ideas, open an issue on GitHub!
|
56
|
+
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
Code contributions are also welcome! Read [CONTRIBUTING.md](CONTRIBUTING.md) to get started.
|
61
|
+
|
62
|
+
|
63
|
+
[bundler]: http://bundler.io
|
64
|
+
[Semver]: http://semver.org
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "chandler/tasks"
|
3
|
+
require "rake/testtask"
|
4
|
+
require "rubocop/rake_task"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
RuboCop::RakeTask.new
|
13
|
+
|
14
|
+
task "release:rubygem_push" => "chandler:push"
|
15
|
+
task :default => [:test, :rubocop]
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
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
ADDED
data/bundleup.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
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.add_development_dependency "bundler", "~> 1.11"
|
23
|
+
spec.add_development_dependency "chandler"
|
24
|
+
spec.add_development_dependency "coveralls"
|
25
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
26
|
+
spec.add_development_dependency "minitest-reporters"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rubocop"
|
29
|
+
end
|
data/exe/bundleup
ADDED
data/lib/bundleup.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "open3"
|
2
|
+
|
3
|
+
module Bundleup
|
4
|
+
class BundleCommands
|
5
|
+
include Console
|
6
|
+
|
7
|
+
def outdated
|
8
|
+
run("bundle outdated", true)
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
run("bundle show")
|
13
|
+
end
|
14
|
+
|
15
|
+
def update
|
16
|
+
run("bundle update")
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def run(cmd, fail_silently=false)
|
22
|
+
progress("Running `#{cmd}`") do
|
23
|
+
out, err, status = Open3.capture3(cmd)
|
24
|
+
next(out) if status.success? || fail_silently
|
25
|
+
|
26
|
+
fail ["Failed to execute: #{cmd}", out, err].compact.join("\n")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/bundleup/cli.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
module Bundleup
|
2
|
+
class CLI
|
3
|
+
include Console
|
4
|
+
|
5
|
+
def run
|
6
|
+
puts \
|
7
|
+
"Please wait a moment while I try upgrading a copy of your Gemfile..."
|
8
|
+
|
9
|
+
review_upgrades
|
10
|
+
review_pins
|
11
|
+
offer_bundle_update if upgrades.any?
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def review_upgrades
|
17
|
+
if upgrades.any?
|
18
|
+
puts "\nIt looks like the following gem(s) will be updated:\n\n"
|
19
|
+
print_upgrades_table
|
20
|
+
else
|
21
|
+
ok("Nothing to update.")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def review_pins
|
26
|
+
return if pins.empty?
|
27
|
+
puts "\nNote that the following gem(s) are being held back:\n\n"
|
28
|
+
print_pins_table
|
29
|
+
end
|
30
|
+
|
31
|
+
def offer_bundle_update
|
32
|
+
exec "bundle update" if confirm("\nShall I run `bundle update` for you?")
|
33
|
+
end
|
34
|
+
|
35
|
+
def gemfile
|
36
|
+
@gemfile ||= Gemfile.new
|
37
|
+
end
|
38
|
+
|
39
|
+
def upgrades
|
40
|
+
gemfile.upgrades
|
41
|
+
end
|
42
|
+
|
43
|
+
def pins
|
44
|
+
gemfile.pins
|
45
|
+
end
|
46
|
+
|
47
|
+
def print_upgrades_table
|
48
|
+
rows = tableize(upgrades) do |g|
|
49
|
+
[g.name, g.old_version || "(new)", "→", g.new_version || "(removed)"]
|
50
|
+
end
|
51
|
+
upgrades.zip(rows).each do |g, row|
|
52
|
+
color(g.color, row)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def print_pins_table
|
57
|
+
rows = tableize(pins) do |g|
|
58
|
+
pin_operator, pin_version = g.pin.split(" ", 2)
|
59
|
+
reason = [":", "pinned at", pin_operator, pin_version]
|
60
|
+
[g.name, g.new_version, "→", g.newest_version, *reason]
|
61
|
+
end
|
62
|
+
puts rows.join("\n")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,66 @@
|
|
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
|
+
color(:green, "✔ #{message}")
|
13
|
+
end
|
14
|
+
|
15
|
+
def attention(message)
|
16
|
+
color(:yellow, message)
|
17
|
+
end
|
18
|
+
|
19
|
+
def color(color_name, message)
|
20
|
+
code = ANSI_CODES[color_name]
|
21
|
+
return puts(message) if code.nil?
|
22
|
+
puts "\e[0;#{code};49m#{message}\e[0m"
|
23
|
+
end
|
24
|
+
|
25
|
+
def confirm(question)
|
26
|
+
print question.sub(/\??\z/, " [Yn]? ")
|
27
|
+
gets =~ /^($|y)/i
|
28
|
+
end
|
29
|
+
|
30
|
+
def progress(message)
|
31
|
+
print "\e[90m#{message}...\e[0m"
|
32
|
+
result = yield
|
33
|
+
puts "\r\e[90m#{message}... OK\e[0m"
|
34
|
+
result
|
35
|
+
end
|
36
|
+
|
37
|
+
# Given a two-dimensional Array of strings representing a table of data,
|
38
|
+
# translate each row into a single string by joining the values with
|
39
|
+
# whitespace such that all the columns are nicely aligned.
|
40
|
+
#
|
41
|
+
# If a block is given, map the rows through the block first. These two
|
42
|
+
# usages are equivalent:
|
43
|
+
#
|
44
|
+
# tableize(rows.map(&something))
|
45
|
+
# tableize(rows, &something)
|
46
|
+
#
|
47
|
+
# Returns a one-dimensional Array of strings, each representing a formatted
|
48
|
+
# row of the resulting table.
|
49
|
+
#
|
50
|
+
def tableize(rows, &block)
|
51
|
+
rows = rows.map(&block) if block
|
52
|
+
widths = max_length_of_each_column(rows)
|
53
|
+
rows.map do |row|
|
54
|
+
row.zip(widths).map { |value, width| value.ljust(width) }.join(" ")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def max_length_of_each_column(rows)
|
61
|
+
rows.first.count.times.map do |i|
|
62
|
+
rows.map { |values| values[i].to_s.length }.max
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Bundleup
|
2
|
+
GemStatus = Struct.new(:name,
|
3
|
+
:old_version,
|
4
|
+
:new_version,
|
5
|
+
:newest_version,
|
6
|
+
:pin) do
|
7
|
+
def pinned?
|
8
|
+
!pin.nil?
|
9
|
+
end
|
10
|
+
|
11
|
+
def upgraded?
|
12
|
+
new_version != old_version
|
13
|
+
end
|
14
|
+
|
15
|
+
def added?
|
16
|
+
old_version.nil?
|
17
|
+
end
|
18
|
+
|
19
|
+
def removed?
|
20
|
+
new_version.nil?
|
21
|
+
end
|
22
|
+
|
23
|
+
def color
|
24
|
+
if major_upgrade? || removed?
|
25
|
+
:red
|
26
|
+
elsif minor_upgrade?
|
27
|
+
:yellow
|
28
|
+
elsif added?
|
29
|
+
:blue
|
30
|
+
else
|
31
|
+
:plain
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def major_upgrade?
|
36
|
+
new = newest_version || new_version
|
37
|
+
return false if new.nil? || old_version.nil?
|
38
|
+
major(new) != major(old_version)
|
39
|
+
end
|
40
|
+
|
41
|
+
def minor_upgrade?
|
42
|
+
new = newest_version || new_version
|
43
|
+
return false if new.nil? || old_version.nil?
|
44
|
+
!major_upgrade? && minor(new) != minor(old_version)
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def major(version)
|
50
|
+
version.split(".", 2)[0].to_i
|
51
|
+
end
|
52
|
+
|
53
|
+
def minor(version)
|
54
|
+
version.split(".", 3)[1].to_i
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require "tmpdir"
|
3
|
+
|
4
|
+
module Bundleup
|
5
|
+
class Gemfile
|
6
|
+
def initialize(commands=BundleCommands.new)
|
7
|
+
@commands = commands
|
8
|
+
@gem_statuses = {}
|
9
|
+
load
|
10
|
+
end
|
11
|
+
|
12
|
+
def upgrades
|
13
|
+
@gem_statuses.values.select(&:upgraded?).sort_by(&:name)
|
14
|
+
end
|
15
|
+
|
16
|
+
def pins
|
17
|
+
@gem_statuses.values.select(&:pinned?).sort_by(&:name)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_reader :commands
|
23
|
+
|
24
|
+
def load
|
25
|
+
in_temp_dir do
|
26
|
+
find_versions(:old)
|
27
|
+
commands.update
|
28
|
+
find_versions(:new)
|
29
|
+
find_pinned_versions
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def in_temp_dir(&block)
|
34
|
+
Dir.mktmpdir do |dir|
|
35
|
+
FileUtils.cp("Gemfile", dir)
|
36
|
+
FileUtils.cp("Gemfile.lock", dir)
|
37
|
+
FileUtils.cp(Dir["*.gemspec"], dir) if Dir["*.gemspec"].any?
|
38
|
+
FileUtils.cp_r("lib", dir) if File.directory?("lib")
|
39
|
+
Dir.chdir(dir, &block)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def find_pinned_versions
|
44
|
+
expr = /\* (\S+) \(newest (\S+),.* requested (.*)\)/
|
45
|
+
commands.outdated.scan(expr) do |name, newest, pin|
|
46
|
+
gem_status(name).newest_version = newest
|
47
|
+
gem_status(name).pin = pin
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def find_versions(type)
|
52
|
+
commands.show.scan(/\* (\S+) \((\S+)(?: (\S+))?\)/) do |name, ver, sha|
|
53
|
+
gem_status(name).public_send("#{type}_version=", sha || ver)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def gem_status(name)
|
58
|
+
@gem_statuses[name] ||= GemStatus.new(name)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/sample.png
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bundleup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Brictson
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: chandler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest-reporters
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- bundleup@mattbrictson.com
|
114
|
+
executables:
|
115
|
+
- bundleup
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rubocop.yml"
|
121
|
+
- ".travis.yml"
|
122
|
+
- CHANGELOG.md
|
123
|
+
- CODE_OF_CONDUCT.md
|
124
|
+
- CONTRIBUTING.md
|
125
|
+
- Gemfile
|
126
|
+
- LICENSE.txt
|
127
|
+
- README.md
|
128
|
+
- Rakefile
|
129
|
+
- bin/console
|
130
|
+
- bin/setup
|
131
|
+
- bundleup.gemspec
|
132
|
+
- exe/bundleup
|
133
|
+
- lib/bundleup.rb
|
134
|
+
- lib/bundleup/bundle_commands.rb
|
135
|
+
- lib/bundleup/cli.rb
|
136
|
+
- lib/bundleup/console.rb
|
137
|
+
- lib/bundleup/gem_status.rb
|
138
|
+
- lib/bundleup/gemfile.rb
|
139
|
+
- lib/bundleup/version.rb
|
140
|
+
- sample.png
|
141
|
+
homepage: https://github.com/mattbrictson/bundleup
|
142
|
+
licenses:
|
143
|
+
- MIT
|
144
|
+
metadata: {}
|
145
|
+
post_install_message:
|
146
|
+
rdoc_options: []
|
147
|
+
require_paths:
|
148
|
+
- lib
|
149
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
requirements: []
|
160
|
+
rubyforge_project:
|
161
|
+
rubygems_version: 2.4.5.1
|
162
|
+
signing_key:
|
163
|
+
specification_version: 4
|
164
|
+
summary: A friendlier command-line interface for Bundler’s `update` and `outdated`
|
165
|
+
commands.
|
166
|
+
test_files: []
|