bundler_diffgems 0.2.1 → 0.3.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.
- checksums.yaml +4 -4
- data/README.md +26 -2
- data/lib/bundler_diffgems/cli.rb +35 -4
- data/lib/bundler_diffgems/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93542c8c3bcf1356c0afee9d3e863bc6d66cb7c7
|
4
|
+
data.tar.gz: 9be0727d0e366e5c5cce1d185af3728697b2a67e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c44b986538ca36b9d5af7cbfb07bd1ff5d86d67d9036ede86370d7723dada3b8deb29fb990a968196bad9c1e70db7cfb1590446b5a66e09eb44119fc718b07c
|
7
|
+
data.tar.gz: 9f754a9ab5de525da7c0b765ad7effb0c3e9ab4dc8b498cc4b96a3dd16b42407bf1b53f5612549dd64168776098ef98a40f47140064821a0709378caf05f17b4
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[](https://travis-ci.org/sinsoku/bundler_diffgems)
|
5
5
|
[](https://codecov.io/gh/sinsoku/bundler_diffgems)
|
6
6
|
|
7
|
-
|
7
|
+
A bundler subcommand that use Git, compare with the previous Gemfile.lock, and display updated gems and comapre links.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -24,13 +24,37 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
+
Run `bundle update` as usual:
|
28
|
+
|
27
29
|
```
|
28
30
|
$ bundle update
|
29
31
|
Fetching gem metadata from https://rubygems.org
|
30
|
-
|
32
|
+
...
|
33
|
+
```
|
34
|
+
|
35
|
+
Then `bundle diffgems`:
|
36
|
+
|
37
|
+
```
|
31
38
|
$ bundle diffgems
|
32
39
|
rake: 11.3.0 => 12.0.0 - https://github.com/ruby/rake/compare/v11.3.0...v12.0.0
|
33
40
|
rspec: 3.5.0 =>
|
41
|
+
...
|
42
|
+
```
|
43
|
+
|
44
|
+
You can see updated gems with compare links.
|
45
|
+
|
46
|
+
## Options
|
47
|
+
|
48
|
+
Options are:
|
49
|
+
|
50
|
+
```
|
51
|
+
Usage: bundle diffgems [options]
|
52
|
+
-c, --commit COMMIT Specify a commit
|
53
|
+
-f, --format FORMATTER Choose a formatter
|
54
|
+
default
|
55
|
+
md_table
|
56
|
+
--escape-json Escape output as a JSON string
|
57
|
+
-v, --version Display the version
|
34
58
|
```
|
35
59
|
|
36
60
|
## Development
|
data/lib/bundler_diffgems/cli.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'gems_comparator'
|
3
|
+
require 'json'
|
3
4
|
require 'optparse'
|
4
5
|
|
5
6
|
module BundlerDiffgems
|
@@ -19,8 +20,12 @@ module BundlerDiffgems
|
|
19
20
|
|
20
21
|
def invoke
|
21
22
|
parse_options!
|
23
|
+
set_access_token!
|
24
|
+
|
22
25
|
gems = GemsComparator.compare(before_lockfile, after_lockfile)
|
23
|
-
|
26
|
+
output = formatter.new.render(gems)
|
27
|
+
output = JSON.dump(output) if @escape_json
|
28
|
+
puts output
|
24
29
|
rescue => e
|
25
30
|
puts e.inspect
|
26
31
|
end
|
@@ -41,14 +46,40 @@ module BundlerDiffgems
|
|
41
46
|
File.read(file_name)
|
42
47
|
end
|
43
48
|
|
44
|
-
def parse_options!
|
49
|
+
def parse_options! # rubocop:disable Metrics/MethodLength
|
45
50
|
opt = OptionParser.new
|
46
|
-
opt.
|
47
|
-
opt.on('-
|
51
|
+
opt.banner = 'Usage: bundle diffgems [options]'
|
52
|
+
opt.on('-c', '--commit COMMIT', 'Specify a commit') { |val| @commit = val }
|
53
|
+
formatter_desc = [
|
54
|
+
'Choose a formatter',
|
55
|
+
' default',
|
56
|
+
' md_table'
|
57
|
+
]
|
58
|
+
opt.on('-f', '--format FORMATTER', *formatter_desc) { |val| @format = val.to_sym }
|
59
|
+
opt.on('--escape-json', 'Escape output as a JSON string') do |val|
|
60
|
+
@escape_json = val
|
61
|
+
end
|
62
|
+
opt.on('-v', '--version', 'Display the version') do
|
63
|
+
puts BundlerDiffgems::VERSION
|
64
|
+
exit
|
65
|
+
end
|
48
66
|
options = opt.parse(@args)
|
49
67
|
@commit ||= options.shift
|
50
68
|
end
|
51
69
|
|
70
|
+
def set_access_token!
|
71
|
+
return if GemsComparator.config.client.access_token
|
72
|
+
hub_config_path = "#{ENV['HOME']}/.config/hub"
|
73
|
+
return unless File.exist?(hub_config_path)
|
74
|
+
|
75
|
+
yaml = YAML.load_file(hub_config_path)
|
76
|
+
oauth_token = yaml.dig('github.com', 0, 'oauth_token')
|
77
|
+
return if oauth_token.nil?
|
78
|
+
GemsComparator.configure do |config|
|
79
|
+
config.client = Octokit::Client.new(access_token: oauth_token)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
52
83
|
def commit
|
53
84
|
@commit || DEFAULT_OPTIONS[:commit]
|
54
85
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler_diffgems
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sinsoku
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gems_comparator
|