libyear-bundler 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8ab149dc302594c069829c10cc93253a4a9165d2
4
- data.tar.gz: 8f6a974c411bc9b72d799b137f715cd7c35260a1
2
+ SHA256:
3
+ metadata.gz: 3b113205ec01de873ddfdb08d3f57bae32d490e7c8507fd1a66a1fb6b3eb908b
4
+ data.tar.gz: 6d8e7d769640f59408f32d348cbef9c3b0ac05afa4d599d1bf1263e6eb9c236c
5
5
  SHA512:
6
- metadata.gz: 424dad3f3c7ef8e6f42cb406714ec080193ca59f4c3d55b7e38d631d0d0ac97a670e9db076c993a9a1c976e31dd47cbe08f3ccf32dc7466c20379fcdda6d1acd
7
- data.tar.gz: aad230cd11ee0313b1d1bce97fa489b020c92fd15686deb9ecefa4ac96a9a2393cd27aa998edfd9983c66f4dd168c131752aae1d5c53fc4e273d8757c10beec2
6
+ metadata.gz: e0faaddd13daf54352167af88c80299210f4cdb7bae8509406058f8322e5a0d1eb637d8d75a22cebc0a9384b6c60c2e2b7166561f52c7dee9aa9f43e283ea7af
7
+ data.tar.gz: cbed8858a0ef38a2ce323354add6bd64035ffe43bd69cd41f0d381f5486c27b9d81d20e7e8e01424bd6eb5d5e5f93054a5ec3f6ed51a8d1581ffbad0eaae4859
data/.rubocop.yml CHANGED
@@ -3,6 +3,12 @@ inherit_from: .rubocop_todo.yml
3
3
  AllCops:
4
4
  TargetRubyVersion: 2.1.10
5
5
 
6
+ Layout/IndentArray:
7
+ EnforcedStyle: consistent
8
+
9
+ Layout/MultilineMethodCallIndentation:
10
+ EnforcedStyle: indented
11
+
6
12
  Metrics/AbcSize:
7
13
  Max: 27
8
14
 
@@ -20,11 +26,5 @@ Metrics/LineLength:
20
26
  Metrics/MethodLength:
21
27
  Enabled: false
22
28
 
23
- Style/IndentArray:
24
- EnforcedStyle: consistent
25
-
26
- Style/MultilineMethodCallIndentation:
27
- EnforcedStyle: indented
28
-
29
29
  Style/StringLiterals:
30
30
  Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -6,14 +6,6 @@
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
10
- # Cop supports --auto-correct.
11
- # Configuration parameters: Include, TreatCommentsAsGroupSeparators.
12
- # Include: **/*.gemspec
13
- Gemspec/OrderedDependencies:
14
- Exclude:
15
- - 'libyear-bundler.gemspec'
16
-
17
9
  # Offense count: 1
18
10
  # Cop supports --auto-correct.
19
11
  # Configuration parameters: EnforcedStyle, SupportedStyles.
data/CHANGELOG.md CHANGED
@@ -17,7 +17,26 @@ Fixed:
17
17
 
18
18
  - None
19
19
 
20
- ## 0.5.0 (2017-12-12)
20
+ ## 0.5.1 (2019-05-09)
21
+
22
+ Breaking changes:
23
+
24
+ - None
25
+
26
+ Added:
27
+
28
+ - None
29
+
30
+ Fixed:
31
+
32
+ - Stable Ruby releases are no longer considered pre-releases (80534fa)
33
+ - Avoid crash due to malformed version strings by skipping those dependencies (7b0b2cf)
34
+
35
+ Dependencies:
36
+
37
+ - Support bundler 2
38
+
39
+ ## 0.5.0 (2017-12-27)
21
40
 
22
41
  Breaking changes:
23
42
 
data/CONTRIBUTING.md CHANGED
@@ -12,7 +12,7 @@ bundle exec rspec
12
12
  ## Releases
13
13
 
14
14
  1. Set the version in `lib/libyear_bundler/version.rb`
15
- - Follow SEMVER
15
+ - Follow SemVer
16
16
  - Only use integer-dot-integer-dot-integer format, never "pre-releases"
17
17
  1. In the changelog,
18
18
  - Replace "Unreleased" with the date in ISO-8601 format
data/README.md CHANGED
@@ -2,15 +2,16 @@
2
2
 
3
3
  A simple measure of dependency freshness for ruby apps.
4
4
 
5
- Applied to a whole Gemfile, `libyear-bundler` provides a single number for
6
- determining the maintenance burden of an app’s dependencies. It is a simple
7
- measure of the time between the release date of the installed dependency and the
8
- release date of the newest version of the dependency.
5
+ ```bash
6
+ $ libyear-bundler Gemfile
7
+ activesupport 4.2.7.1 2016-08-10 5.1.3 2017-08-03 1.0
8
+ i18n 0.8.0 2017-01-31 0.8.6 2017-07-10 0.4
9
+ json 1.8.6 2017-01-13 2.1.0 2017-04-18 0.3
10
+ System is 1.7 libyears behind
11
+ ```
9
12
 
10
- The inspiration for libyear comes from the technical report “Measuring
11
- Dependency Freshness in Software Systems”[1]. Other metrics for determining
12
- dependency freshness outlined in the paper are available in libyear-bundler. See
13
- the Usage section for details.
13
+ `libyear-bundler` tells you how out-of-date your Gemfile is, in *a single
14
+ number*.
14
15
 
15
16
  # Install
16
17
 
@@ -20,31 +21,30 @@ gem install libyear-bundler
20
21
 
21
22
  ## Usage
22
23
 
23
- Run `libyear-bundler` in a directory with a Gemfile. Verbosity is on by default.
24
- For simpler output, see the `--grand-total` option.
24
+ Run `libyear-bundler` in a directory with a Gemfile.
25
25
 
26
- ### Options
26
+ ### `--libyears` (default)
27
27
 
28
- #### `--libyears` (default)
29
28
  Measures the time between your dependencies' installed and newest versions, in
30
29
  years.
31
30
 
32
31
  ```bash
33
32
  $ libyear-bundler Gemfile
34
- activesupport 4.2.7.1 2016-08-10 5.1.3 2017-08-03 1.0
35
- i18n 0.8.0 2017-01-31 0.8.6 2017-07-10 0.4
36
- json 1.8.6 2017-01-13 2.1.0 2017-04-18 0.3
37
- minitest 5.10.1 2016-12-02 5.10.3 2017-07-21 0.6
38
- minitest_to_rspec 0.6.0 2015-06-09 0.8.0 2017-01-02 1.6
39
- ruby_parser 3.8.4 2017-01-13 3.10.1 2017-07-21 0.5
40
- sexp_processor 4.8.0 2017-02-01 4.10.0 2017-07-17 0.5
41
- thread_safe 0.3.5 2015-03-11 0.3.6 2017-02-22 2.0
42
- tzinfo 1.2.2 2014-08-08 1.2.3 2017-03-25 2.6
33
+ activesupport 4.2.7.1 2016-08-10 5.1.3 2017-08-03 1.0
34
+ i18n 0.8.0 2017-01-31 0.8.6 2017-07-10 0.4
35
+ json 1.8.6 2017-01-13 2.1.0 2017-04-18 0.3
36
+ minitest 5.10.1 2016-12-02 5.10.3 2017-07-21 0.6
37
+ minitest_to_rspec 0.6.0 2015-06-09 0.8.0 2017-01-02 1.6
38
+ ruby_parser 3.8.4 2017-01-13 3.10.1 2017-07-21 0.5
39
+ sexp_processor 4.8.0 2017-02-01 4.10.0 2017-07-17 0.5
40
+ thread_safe 0.3.5 2015-03-11 0.3.6 2017-02-22 2.0
41
+ tzinfo 1.2.2 2014-08-08 1.2.3 2017-03-25 2.6
43
42
  System is 9.4 libyears behind
44
43
 
45
44
  ```
46
45
 
47
- #### `--releases`
46
+ ### `--releases`
47
+
48
48
  Measures the number of releases between your dependencies' installed and newest
49
49
  versions
50
50
 
@@ -63,8 +63,8 @@ Total releases behind: 70
63
63
 
64
64
  ```
65
65
 
66
+ ### `--versions`
66
67
 
67
- #### `--versions`
68
68
  Measures the number of major, minor, and patch versions between your
69
69
  dependencies' installed and newest versions
70
70
 
@@ -83,7 +83,8 @@ Major, minor, patch versions behind: 2, 6, 10
83
83
 
84
84
  ```
85
85
 
86
- #### `--all`
86
+ ### `--all`
87
+
87
88
  Returns relevant data for each outdated gem, including 'libyears', 'releases',
88
89
  and 'versions' metrics
89
90
 
@@ -103,7 +104,8 @@ Total releases behind: 70
103
104
  Major, minor, patch versions behind: 2, 6, 10
104
105
  ```
105
106
 
106
- #### `--grand-total`
107
+ ### `--grand-total`
108
+
107
109
  With no other options, returns the grand-total of libyears. Used with other
108
110
  flags, returns the associated grand-total.
109
111
 
@@ -127,6 +129,11 @@ $ libyear-bundler Gemfile --all --grand-total
127
129
 
128
130
  See CONTRIBUTING.md
129
131
 
132
+ ## Acknowledgements
133
+
134
+ The inspiration for libyear comes from the technical report “Measuring
135
+ Dependency Freshness in Software Systems”[1].
136
+
130
137
  ---
131
138
  [1] J. Cox, E. Bouwers, M. van Eekelen and J. Visser, Measuring Dependency
132
139
  Freshness in Software Systems. In Proceedings of the 37th International
data/bin/test ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ bundle exec rubocop
6
+ bundle exec rspec
@@ -19,6 +19,11 @@ module LibyearBundler
19
19
  bundle_outdated.lines.each_with_object([]) do |line, gems|
20
20
  match = BOP_FMT.match(line)
21
21
  next if match.nil?
22
+ if malformed_version_strings?(match)
23
+ warn "Skipping #{match['name']} because of a malformed version string"
24
+ next
25
+ end
26
+
22
27
  gem = ::LibyearBundler::Models::Gem.new(
23
28
  match['name'],
24
29
  match['installed'],
@@ -47,5 +52,12 @@ module LibyearBundler
47
52
  end
48
53
  stdout
49
54
  end
55
+
56
+ # We rely on Gem::Version to handle version strings. If the string is malformed (usually because
57
+ # of a gem installed from git), then we won't be able to determine the dependency's freshness
58
+ def malformed_version_strings?(dependency)
59
+ !Gem::Version.correct?(dependency['installed']) ||
60
+ !Gem::Version.correct?(dependency['newest'])
61
+ end
50
62
  end
51
63
  end
@@ -43,7 +43,7 @@ module LibyearBundler
43
43
  end
44
44
 
45
45
  def newest_version
46
- ::Gem::Version.new(all_versions.first['version'])
46
+ ::Gem::Version.new(all_stable_versions.first)
47
47
  end
48
48
 
49
49
  def newest_version_release_date
@@ -70,9 +70,6 @@ module LibyearBundler
70
70
 
71
71
  private
72
72
 
73
- # We'll only consider non-prerelease versions when determining the
74
- # newest version
75
- #
76
73
  # The following URL is the only official, easily-parseable document with
77
74
  # Ruby version information that I'm aware of, but is not supported as such
78
75
  # (https://github.com/ruby/www.ruby-lang.org/pull/1637#issuecomment-344934173).
@@ -87,29 +84,47 @@ module LibyearBundler
87
84
  # The Date object is passed through here due to a bug in
88
85
  # YAML#safe_load
89
86
  # https://github.com/ruby/psych/issues/262
90
- ::YAML.safe_load(response.body, [Date]).reject do |version|
91
- ::Gem::Version.new(version['version']).prerelease?
92
- end
87
+ ::YAML.safe_load(response.body, [Date])
93
88
  end
94
89
  end
95
90
 
91
+ # We'll only consider non-prerelease versions when analyzing ruby version,
92
+ # which we also implcitly do for gem versions because that's bundler's
93
+ # default behavior
94
+ def all_stable_versions
95
+ stable_releases = all_versions.reject do |version|
96
+ ::Gem::Version.new(version['version']).prerelease?
97
+ end
98
+ stable_releases.map { |release| release['version'] }
99
+ end
100
+
96
101
  def installed_version_sequence_index
97
- versions_sequence.index(installed_version.to_s)
102
+ all_stable_versions.index(installed_version.to_s)
98
103
  end
99
104
 
100
105
  def newest_version_sequence_index
101
- versions_sequence.index(newest_version.to_s)
106
+ all_stable_versions.index(newest_version.to_s)
102
107
  end
103
108
 
104
109
  def release_date(version)
105
- v = all_versions.detect { |ver| ver['version'] == version }
110
+ v = all_stable_versions.detect { |ver| ver['version'] == version }
106
111
  # YAML#safe_load provides an already-parsed Date object, so the following
107
112
  # is a Date object
108
113
  v['date']
109
114
  end
110
115
 
111
116
  def shell_out_to_ruby
112
- `ruby --version`.split[1]
117
+ # ruby appends a 'p' followed by the patch level number
118
+ # to the version number for stable releases, which returns
119
+ # a false positive using `::Gem::Version#prerelease?`.
120
+ # Understandably, because ruby is not a gem, but we'd like
121
+ # to use `prerelease?`.
122
+ # Pre-releases are appended with 'dev', and so adhere to
123
+ # `::Gem::Version`'s definition of a pre-release.
124
+ # Sources:
125
+ # - https://github.com/ruby/ruby/blob/trunk/version.h#L37
126
+ # - https://ruby-doc.org/stdlib-1.9.3/libdoc/rubygems/rdoc/Version.html
127
+ `ruby --version`.split[1].gsub(/p\d/, '')
113
128
  end
114
129
 
115
130
  def version_from_bundler
@@ -130,10 +145,6 @@ module LibyearBundler
130
145
  def version_from_ruby
131
146
  ::Gem::Version.new(shell_out_to_ruby)
132
147
  end
133
-
134
- def versions_sequence
135
- all_versions.map { |version| version['version'] }
136
- end
137
148
  end
138
149
  end
139
150
  end
@@ -82,20 +82,23 @@ module LibyearBundler
82
82
 
83
83
  def put_version_delta_summary(sum_major_version, sum_minor_version, sum_patch_version)
84
84
  puts format(
85
- "Major, minor, patch versions behind: %d, %d, %d",
86
- sum_major_version,
87
- sum_minor_version,
88
- sum_patch_version
85
+ "Major, minor, patch versions behind: %<major>d, %<minor>d, %<patch>d",
86
+ major: sum_major_version,
87
+ minor: sum_minor_version,
88
+ patch: sum_patch_version
89
89
  )
90
90
  end
91
91
 
92
92
  def put_sum_seq_delta_summary(sum_seq_delta)
93
- puts format("Total releases behind: %d", sum_seq_delta)
93
+ puts format(
94
+ "Total releases behind: %<seq_delta>d",
95
+ seq_delta: sum_seq_delta
96
+ )
94
97
  end
95
98
 
96
99
  def put_summary(summary)
97
100
  if [:libyears?, :releases?, :versions?].all? { |opt| @options.send(opt) }
98
- put_libyear_summary(summary[:sum_years])
101
+ put_libyear_summary(summary[:sum_libyears])
99
102
  put_sum_seq_delta_summary(summary[:sum_seq_delta])
100
103
  put_version_delta_summary(
101
104
  summary[:sum_major_version],
@@ -1,3 +1,3 @@
1
1
  module LibyearBundler
2
- VERSION = "0.5.0".freeze
2
+ VERSION = "0.5.1".freeze
3
3
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = ["libyear-bundler"]
20
20
  spec.require_paths = ["lib"]
21
21
  spec.required_ruby_version = ">= 2.1"
22
- spec.add_dependency "bundler", "~> 1.14"
23
- spec.add_development_dependency "rubocop"
24
- spec.add_development_dependency "rspec"
22
+ spec.add_dependency "bundler", ">= 1.14", "< 3"
23
+ spec.add_development_dependency "rspec", "~> 3.7"
24
+ spec.add_development_dependency "rubocop", "~> 0.52.1"
25
25
  end
metadata CHANGED
@@ -1,57 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libyear-bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
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-12-28 00:00:00.000000000 Z
11
+ date: 2019-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.14'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '3'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.14'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3'
27
33
  - !ruby/object:Gem::Dependency
28
- name: rubocop
34
+ name: rspec
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ">="
37
+ - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '0'
39
+ version: '3.7'
34
40
  type: :development
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - ">="
44
+ - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '0'
46
+ version: '3.7'
41
47
  - !ruby/object:Gem::Dependency
42
- name: rspec
48
+ name: rubocop
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - ">="
51
+ - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '0'
53
+ version: 0.52.1
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - ">="
58
+ - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '0'
60
+ version: 0.52.1
55
61
  description:
56
62
  email:
57
63
  - jared@jaredbeck.com
@@ -70,6 +76,7 @@ files:
70
76
  - LICENSE.txt
71
77
  - README.md
72
78
  - bin/libyear-bundler
79
+ - bin/test
73
80
  - lib/libyear_bundler.rb
74
81
  - lib/libyear_bundler/bundle_outdated.rb
75
82
  - lib/libyear_bundler/calculators/libyear.rb
@@ -101,8 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
108
  - !ruby/object:Gem::Version
102
109
  version: '0'
103
110
  requirements: []
104
- rubyforge_project:
105
- rubygems_version: 2.6.13
111
+ rubygems_version: 3.0.3
106
112
  signing_key:
107
113
  specification_version: 4
108
114
  summary: A simple measure of dependency freshness