bundler_date 0.1.0 → 0.2.0

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
2
  SHA256:
3
- metadata.gz: dfbc41b7014f9d4bdb8a5175f86f773604d276a96be5f2431a9a9a3e0afb704b
4
- data.tar.gz: d652c9a1526afb25b51a9be8c4e02f54f75c279e0c30fb82a1eaa6791814756c
3
+ metadata.gz: e45a0add0849e68a32088d21db56e62e36dda33a0a194f96207d3d4c275ccab5
4
+ data.tar.gz: cf10b6c2b6afb0c101bccd62c91c2b8b1a4571575406ad9e18c7c4beb46a274e
5
5
  SHA512:
6
- metadata.gz: 918b36ed952637cfbc3c265e4b8a1aab3d6c9d1eeeecf2a4d444fd8f9638a4be8addcefb321c745d005b03ed54df5460f82abf3c48485799fbd8eef4f4325e65
7
- data.tar.gz: '0068fbd9db513f3632f9737992b95fbd6a2864d40dce44c53c2603fea4e16b43511c08d7f4bd8d8a1dfa44daa79d33fe2f5de1ccf9c221f1967d0ca19e691b5a'
6
+ metadata.gz: cad886b8b7c5294472206e7479969c56ec071f5b891a6f349c8bc7b924350b1d591e85dd69d86b883f7b553d613a7f295c84583b7d044bc8e49a3c4603a8838d
7
+ data.tar.gz: 42ef1f151f4da2b0ea29bf6d223aa90aab8f4594d3432e2a1473a17db7cfb79314f6cff354833e70e652675db3614a39405ffe3b18310a2d3b0f35f743d450ce
@@ -3,7 +3,7 @@ name: Ruby
3
3
  on: [push,pull_request]
4
4
 
5
5
  jobs:
6
- build:
6
+ test:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
9
  - uses: actions/checkout@v2
@@ -11,8 +11,13 @@ jobs:
11
11
  uses: ruby/setup-ruby@v1
12
12
  with:
13
13
  ruby-version: 2.7.1
14
- - name: Run the default task
14
+ - name: build
15
15
  run: |
16
- gem install bundler -v 2.2.6
16
+ gem install bundler
17
17
  bundle install
18
- bundle exec rake
18
+ - name: lint
19
+ run: bundle exec rubocop
20
+ - name: test
21
+ run: |
22
+ git submodule update --init
23
+ bin/test
data/.gitmodules ADDED
@@ -0,0 +1,9 @@
1
+ [submodule "test/bats"]
2
+ path = test/bats
3
+ url = https://github.com/bats-core/bats-core.git
4
+ [submodule "test/test_helper/bats-support"]
5
+ path = test/test_helper/bats-support
6
+ url = https://github.com/bats-core/bats-support.git
7
+ [submodule "test/test_helper/bats-assert"]
8
+ path = test/test_helper/bats-assert
9
+ url = https://github.com/bats-core/bats-assert.git
data/.rubocop.yml CHANGED
@@ -1,6 +1,8 @@
1
1
  AllCops:
2
2
  NewCops: enable
3
3
  TargetRubyVersion: 2.6
4
+ Exclude:
5
+ - test/bats/**/*
4
6
 
5
7
  Style/StringLiterals:
6
8
  Enabled: true
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ All notable changes to this project will be documented in this file.
2
+
3
+ ## 0.2.0 - 2022-03-21
4
+
5
+ ### Breaking changes
6
+
7
+ - Lock plugin to use the new Bundler gem semantic [#1](https://github.com/loadkpi/bundler_date/pull/1)
data/Gemfile.lock ADDED
@@ -0,0 +1,46 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bundler_date (0.1.0)
5
+ bundler (>= 2.3)
6
+ terminal-table
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.1)
12
+ parallel (1.20.1)
13
+ parser (3.0.0.0)
14
+ ast (~> 2.4.1)
15
+ rainbow (3.0.0)
16
+ rake (13.0.6)
17
+ regexp_parser (2.2.1)
18
+ rexml (3.2.5)
19
+ rubocop (1.8.1)
20
+ parallel (~> 1.10)
21
+ parser (>= 3.0.0.0)
22
+ rainbow (>= 2.2.2, < 4.0)
23
+ regexp_parser (>= 1.8, < 3.0)
24
+ rexml
25
+ rubocop-ast (>= 1.2.0, < 2.0)
26
+ ruby-progressbar (~> 1.7)
27
+ unicode-display_width (>= 1.4.0, < 3.0)
28
+ rubocop-ast (1.4.0)
29
+ parser (>= 2.7.1.5)
30
+ rubocop-rake (0.5.1)
31
+ rubocop
32
+ ruby-progressbar (1.11.0)
33
+ terminal-table (1.6.0)
34
+ unicode-display_width (2.0.0)
35
+
36
+ PLATFORMS
37
+ x86_64-linux
38
+
39
+ DEPENDENCIES
40
+ bundler_date!
41
+ rake (~> 13.0)
42
+ rubocop (~> 1.7)
43
+ rubocop-rake
44
+
45
+ BUNDLED WITH
46
+ 2.3.9
data/README.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # BundlerDate
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/bundler_date.svg)](https://badge.fury.io/rb/bundler_date)
4
+
5
+ ## What?
6
+
7
+ Bundle has great command `bundle outdated` to compare installed gems with newer versions available.
8
+ It does its job but there is one problem.
9
+
10
+ Let's try it:
11
+
12
+ ```bash
13
+ $ bundle outdated
14
+
15
+ Gem Current Latest Requested Groups
16
+ loofah 2.14.0 2.15.0 = 2.14.0 default
17
+ sinatra 2.1.0 2.2.0 = 2.1.0 default
18
+ ```
19
+ Okay, we see that we have almost edge versions of each gem. The difference is one minor version for both.
20
+ Is it a big difference? We can't say definitely.
21
+
22
+ But at least we can check when these versions were released. What will we see?
23
+ * `loofash 2.14.0` was released in February 2022, `2.15.0` in March 2022
24
+ * `sinatra 2.1.0` was released in 2020(!), `2.2.0` was released in 2022.
25
+
26
+ See the difference? `bundle date` try to show it more explicit.
27
+
28
+ ```bash
29
+ $ bundle date
30
+ Gem Current Current Date Latest Latest Date Days between
31
+
32
+ loofah 2.14.0 2022-02-11 2.15.0 2022-03-14 31
33
+ sinatra 2.1.0 2020-09-04 2.2.0 2022-03-19 561
34
+ ```
35
+
3
36
  ## Installation
4
37
 
5
38
  Specify the plugin in your Gemfile:
@@ -19,18 +52,3 @@ Or install it yourself as:
19
52
  ## Usage
20
53
 
21
54
  $ bundle date
22
-
23
- ## Example
24
-
25
- ```bash
26
- $ bundle date
27
- Fetching gem metadata from https://gems.contribsys.com/.
28
-
29
- Gem Current Current Date Latest Latest Date Days between
30
-
31
- actioncable 5.2.5 2021-03-26 6.1.3.1 2021-04-09 14
32
- actionmailer 5.2.5 2021-03-26 6.1.3.1 2021-04-09 14
33
- actionpack 5.2.5 2021-03-26 6.1.3.1 2021-04-09 14
34
- actionview 5.2.5 2021-03-26 6.1.3.1 2021-04-09 14
35
- active_model_serializers 0.10.7 2017-11-15 0.10.12 2021-04-09 1241
36
- ```
data/bin/test ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+
3
+ cd "$(dirname "$0")"
4
+ ../test/bats/bin/bats ../test/test.bats
data/bundler_date.gemspec CHANGED
@@ -26,13 +26,10 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ["lib"]
28
28
 
29
- spec.add_dependency "bundler", "~> 2.0"
30
- spec.add_dependency "gems"
29
+ spec.add_dependency "bundler", ">= 2.3"
31
30
  spec.add_dependency "terminal-table"
32
31
 
33
32
  spec.add_development_dependency "rake", "~> 13.0"
34
- spec.add_development_dependency "rspec", "~> 3.0"
35
33
  spec.add_development_dependency "rubocop", "~> 1.7"
36
34
  spec.add_development_dependency "rubocop-rake"
37
- spec.add_development_dependency "rubocop-rspec"
38
35
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BundlerDate
4
+ class Spec
5
+ attr_reader :spec
6
+
7
+ def initialize(spec)
8
+ @spec = spec
9
+ end
10
+
11
+ def active_spec_list
12
+ @active_spec_list ||=
13
+ spec.source.specs
14
+ .search(spec.name)
15
+ .select { |s| s.match_platform(spec.platform) }
16
+ .sort_by(&:version)
17
+ end
18
+
19
+ def method_missing(method_name, *args)
20
+ if @spec.respond_to?(method_name)
21
+ @spec.send(method_name, *args)
22
+ else
23
+ super
24
+ end
25
+ end
26
+
27
+ def respond_to_missing?(method_name, *args)
28
+ @spec.respond_to?(method_name) or super
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BundlerDate
4
+ class SpecList
5
+ attr_reader :definition
6
+
7
+ def initialize
8
+ @definition = Bundler.definition
9
+ Bundler.ui.silence { definition.resolve }
10
+ Bundler.ui.silence { definition.resolve_remotely! }
11
+ @specs = definition.specs
12
+ end
13
+
14
+ def all
15
+ specs.sort_by(&:name)
16
+ end
17
+
18
+ def specs
19
+ @specs.map { |s| Spec.new(s) }
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "date"
4
+
3
5
  module BundlerDate
4
6
  module UI
5
7
  class Row
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BundlerDate
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/bundler_date.rb CHANGED
@@ -1,37 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "gems"
4
3
  require "terminal-table"
5
4
 
5
+ require_relative "bundler_date/spec"
6
+ require_relative "bundler_date/spec_list"
6
7
  require_relative "bundler_date/ui"
7
8
  require_relative "bundler_date/version"
8
9
 
9
10
  module BundlerDate
10
11
  class Command
11
12
  def exec(_command_name, _args)
12
- resolve_specs!
13
13
  UI.show(ui_rows)
14
14
  end
15
15
 
16
16
  private
17
17
 
18
18
  def ui_rows
19
- @specs.sort_by(&:name).map do |spec|
19
+ spec_list = SpecList.new
20
+ spec_list.all.map do |spec|
20
21
  UI::Row.new(
21
- spec.name, spec.version, spec.date,
22
- @definition.find_indexed_specs(spec).last.version,
23
- @definition.find_indexed_specs(spec).last.date
22
+ spec.name,
23
+ spec.version,
24
+ spec.date,
25
+ spec.active_spec_list.last.version,
26
+ spec.active_spec_list.last.date
24
27
  )
25
- end
26
- end
27
-
28
- def resolve_specs!
29
- @definition = Bundler.definition
30
- @specs = Bundler.ui.silence { @definition.resolve }
31
- Bundler.ui.silence { @definition.resolve_remotely! }
28
+ end.compact
32
29
  end
33
30
  end
34
31
 
35
- # Register this class as a handler for the `date` command
36
32
  Bundler::Plugin::API.command("date", Command)
37
33
  end
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler_date
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kozlov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-09 00:00:00.000000000 Z
11
+ date: 2022-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.0'
27
- - !ruby/object:Gem::Dependency
28
- name: gems
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: '0'
19
+ version: '2.3'
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - ">="
39
25
  - !ruby/object:Gem::Version
40
- version: '0'
26
+ version: '2.3'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: terminal-table
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,20 +52,6 @@ dependencies:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
54
  version: '13.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.0'
83
55
  - !ruby/object:Gem::Dependency
84
56
  name: rubocop
85
57
  requirement: !ruby/object:Gem::Requirement
@@ -108,20 +80,6 @@ dependencies:
108
80
  - - ">="
109
81
  - !ruby/object:Gem::Version
110
82
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop-rspec
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
83
  description: Bundler plugin to show the release dates of gems.
126
84
  email:
127
85
  - loadkpi@gmail.com
@@ -131,16 +89,21 @@ extra_rdoc_files: []
131
89
  files:
132
90
  - ".github/workflows/main.yml"
133
91
  - ".gitignore"
92
+ - ".gitmodules"
134
93
  - ".rspec"
135
94
  - ".rubocop.yml"
95
+ - CHANGELOG.md
136
96
  - Gemfile
97
+ - Gemfile.lock
137
98
  - LICENSE.md
138
99
  - README.md
139
100
  - Rakefile
140
- - bin/console
141
101
  - bin/setup
102
+ - bin/test
142
103
  - bundler_date.gemspec
143
104
  - lib/bundler_date.rb
105
+ - lib/bundler_date/spec.rb
106
+ - lib/bundler_date/spec_list.rb
144
107
  - lib/bundler_date/ui.rb
145
108
  - lib/bundler_date/ui/terminal_table.rb
146
109
  - lib/bundler_date/ui/ui_row.rb
@@ -167,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
130
  - !ruby/object:Gem::Version
168
131
  version: '0'
169
132
  requirements: []
170
- rubygems_version: 3.1.2
133
+ rubygems_version: 3.2.22
171
134
  signing_key:
172
135
  specification_version: 4
173
136
  summary: Bundler plugin to show the release dates of gems.
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "bundler_date"
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "irb"
15
- IRB.start(__FILE__)