libyear-bundler 0.2.0 → 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/.gitignore +1 -0
- data/CHANGELOG.md +29 -0
- data/lib/libyear_bundler/cli.rb +61 -5
- data/lib/libyear_bundler/query.rb +1 -1
- data/lib/libyear_bundler/version.rb +1 -1
- data/libyear-bundler.gemspec +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 734b3af6eedfa8bd832666a33e04ccf4d36dbcec
|
4
|
+
data.tar.gz: 70d4f09011a3102403bec195b4638d7dbbbc73d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb0e53a70abcd38aba307d8ea2dac3ffbace0192cd26a8f2b2de960a42c36e6aa4fbae86d951dbfa9eab27796dddbd73d10e8fa7fbfb952dc3e3795bcc595e61
|
7
|
+
data.tar.gz: 65b896dcdbbbc1feea606390b5a20b54680c95e8feb763989a651d1e646f11c2799d83c0e7c54c9c40ca1d464d67fcec3932eb15c2e058b08ad30384d28d8a31
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,35 @@
|
|
3
3
|
This project follows [semver 2.0.0][1] and the recommendations
|
4
4
|
of [keepachangelog.com][2].
|
5
5
|
|
6
|
+
## Unreleased
|
7
|
+
|
8
|
+
Breaking changes:
|
9
|
+
|
10
|
+
- None
|
11
|
+
|
12
|
+
Added:
|
13
|
+
|
14
|
+
- None
|
15
|
+
|
16
|
+
Fixed:
|
17
|
+
|
18
|
+
- None
|
19
|
+
|
20
|
+
## 0.3.0 (2017-03-24)
|
21
|
+
|
22
|
+
Breaking changes:
|
23
|
+
|
24
|
+
- None
|
25
|
+
|
26
|
+
Added:
|
27
|
+
|
28
|
+
- [#1](https://github.com/jaredbeck/libyear-bundler/pull/1)
|
29
|
+
Add --grand-total option
|
30
|
+
|
31
|
+
Fixed:
|
32
|
+
|
33
|
+
- None
|
34
|
+
|
6
35
|
## 0.2.0 (2017-03-10)
|
7
36
|
|
8
37
|
Breaking changes:
|
data/lib/libyear_bundler/cli.rb
CHANGED
@@ -5,19 +5,75 @@ require "libyear_bundler/query"
|
|
5
5
|
|
6
6
|
module LibyearBundler
|
7
7
|
class CLI
|
8
|
+
OPTIONS = %w(
|
9
|
+
--grand-total
|
10
|
+
).freeze
|
11
|
+
|
12
|
+
E_BUNDLE_OUTDATED_FAILED = 1
|
13
|
+
E_NO_GEMFILE = 2
|
14
|
+
|
8
15
|
def initialize(argv)
|
9
|
-
|
10
|
-
@gemfile_path =
|
16
|
+
@argv = argv
|
17
|
+
@gemfile_path = load_gemfile_path
|
18
|
+
validate_arguments
|
11
19
|
end
|
12
20
|
|
13
21
|
def run
|
14
|
-
|
22
|
+
if @argv.include?("--grand-total")
|
23
|
+
grand_total
|
24
|
+
else
|
25
|
+
print Report.new(query).to_s
|
26
|
+
end
|
15
27
|
end
|
16
28
|
|
17
29
|
private
|
18
30
|
|
19
|
-
def
|
20
|
-
|
31
|
+
def first_arg_is_gemfile?
|
32
|
+
!@argv.first.nil? && ::File.exist?(@argv.first)
|
33
|
+
end
|
34
|
+
|
35
|
+
def fallback_gemfile_exists?
|
36
|
+
# The envvar is set or
|
37
|
+
(!ENV["BUNDLE_GEMFILE"].nil? && ::File.exist?(ENV["BUNDLE_GEMFILE"])) ||
|
38
|
+
# Default to local Gemfile
|
39
|
+
::File.exist?("Gemfile")
|
40
|
+
end
|
41
|
+
|
42
|
+
def load_gemfile_path
|
43
|
+
if first_arg_is_gemfile?
|
44
|
+
@argv.first
|
45
|
+
elsif fallback_gemfile_exists?
|
46
|
+
'' # `bundle outdated` will default to local Gemfile
|
47
|
+
else
|
48
|
+
$stderr.puts "Gemfile not found"
|
49
|
+
exit
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def query
|
54
|
+
Query.new(@gemfile_path).execute
|
55
|
+
end
|
56
|
+
|
57
|
+
def unexpected_options
|
58
|
+
@_unexpected_options ||= begin
|
59
|
+
options = @argv.select { |arg| arg.start_with?("--") }
|
60
|
+
options.each_with_object([]) do |arg, memo|
|
61
|
+
memo << arg unless OPTIONS.include?(arg)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def validate_arguments
|
67
|
+
unless unexpected_options.empty?
|
68
|
+
puts "Unexpected args: #{unexpected_options.join(", ")}"
|
69
|
+
puts "Allowed args: #{OPTIONS.join(", ")}"
|
70
|
+
exit E_NO_GEMFILE
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def grand_total
|
75
|
+
sum_years = query.map { |gem| gem[:libyears] }.inject(0.0, :+)
|
76
|
+
puts format("%.1f", sum_years)
|
21
77
|
end
|
22
78
|
end
|
23
79
|
end
|
data/libyear-bundler.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libyear-bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Beck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
59
|
+
version: '2.1'
|
60
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
62
|
- - ">="
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.6.
|
67
|
+
rubygems_version: 2.6.11
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: A simple measure of dependency freshness
|