bundler_date 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: dfbc41b7014f9d4bdb8a5175f86f773604d276a96be5f2431a9a9a3e0afb704b
4
+ data.tar.gz: d652c9a1526afb25b51a9be8c4e02f54f75c279e0c30fb82a1eaa6791814756c
5
+ SHA512:
6
+ metadata.gz: 918b36ed952637cfbc3c265e4b8a1aab3d6c9d1eeeecf2a4d444fd8f9638a4be8addcefb321c745d005b03ed54df5460f82abf3c48485799fbd8eef4f4325e65
7
+ data.tar.gz: '0068fbd9db513f3632f9737992b95fbd6a2864d40dce44c53c2603fea4e16b43511c08d7f4bd8d8a1dfa44daa79d33fe2f5de1ccf9c221f1967d0ca19e691b5a'
@@ -0,0 +1,18 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.7.1
14
+ - name: Run the default task
15
+ run: |
16
+ gem install bundler -v 2.2.6
17
+ bundle install
18
+ bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,17 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ TargetRubyVersion: 2.6
4
+
5
+ Style/StringLiterals:
6
+ Enabled: true
7
+ EnforcedStyle: double_quotes
8
+
9
+ Style/StringLiteralsInInterpolation:
10
+ Enabled: true
11
+ EnforcedStyle: double_quotes
12
+
13
+ Layout/LineLength:
14
+ Max: 120
15
+
16
+ Style/Documentation:
17
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in bundler_date.gemspec
6
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Pavel Kozlov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # BundlerDate
2
+
3
+ ## Installation
4
+
5
+ Specify the plugin in your Gemfile:
6
+
7
+ ```ruby
8
+ plugin 'bundler_date'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle install
14
+
15
+ Or install it yourself as:
16
+
17
+ $ bundle plugin install bundler_date
18
+
19
+ ## Usage
20
+
21
+ $ 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/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
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__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/bundler_date/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "bundler_date"
7
+ spec.version = BundlerDate::VERSION
8
+ spec.authors = ["Pavel Kozlov"]
9
+ spec.email = ["loadkpi@gmail.com"]
10
+
11
+ spec.summary = "Bundler plugin to show the release dates of gems."
12
+ spec.description = "Bundler plugin to show the release dates of gems."
13
+ spec.homepage = "https://github.com/loadkpi/bundler_date."
14
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/loadkpi/bundler_date."
18
+ spec.metadata["changelog_uri"] = "https://github.com/loadkpi/bundler_date/blob/master/CHANGELOG.md"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_dependency "bundler", "~> 2.0"
30
+ spec.add_dependency "gems"
31
+ spec.add_dependency "terminal-table"
32
+
33
+ spec.add_development_dependency "rake", "~> 13.0"
34
+ spec.add_development_dependency "rspec", "~> 3.0"
35
+ spec.add_development_dependency "rubocop", "~> 1.7"
36
+ spec.add_development_dependency "rubocop-rake"
37
+ spec.add_development_dependency "rubocop-rspec"
38
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "gems"
4
+ require "terminal-table"
5
+
6
+ require_relative "bundler_date/ui"
7
+ require_relative "bundler_date/version"
8
+
9
+ module BundlerDate
10
+ class Command
11
+ def exec(_command_name, _args)
12
+ resolve_specs!
13
+ UI.show(ui_rows)
14
+ end
15
+
16
+ private
17
+
18
+ def ui_rows
19
+ @specs.sort_by(&:name).map do |spec|
20
+ 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
24
+ )
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! }
32
+ end
33
+ end
34
+
35
+ # Register this class as a handler for the `date` command
36
+ Bundler::Plugin::API.command("date", Command)
37
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "ui/terminal_table"
4
+ require_relative "ui/ui_row"
5
+
6
+ module BundlerDate
7
+ module UI
8
+ module_function
9
+
10
+ def show(ui_rows)
11
+ msg = TerminalTable.new(Row::HEADERS, ui_rows)
12
+ Bundler.ui.info msg.to_str
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BundlerDate
4
+ module UI
5
+ class TerminalTable
6
+ def initialize(headings, ui_rows)
7
+ @table = ::Terminal::Table.new(headings: headings, rows: ui_rows.map(&:to_ary)).tap do |t|
8
+ t.style = { border_x: "", border_y: "", border_i: "" }
9
+ end
10
+ end
11
+
12
+ def to_str
13
+ @table.render
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BundlerDate
4
+ module UI
5
+ class Row
6
+ UNDEFINED = "undefined"
7
+ HEADERS = [
8
+ "Gem", "Current", "Current Date", "Latest", "Latest Date", "Days between"
9
+ ].freeze
10
+
11
+ def initialize(gem_name, current_version, current_date, latest_version, latest_date)
12
+ @gem_name = gem_name.to_s
13
+ @current_version = current_version.to_s
14
+ @current_date = Date.parse(current_date.to_s) if current_date
15
+ @latest_version = latest_version.to_s
16
+ @latest_date = latest_date ? Date.parse(latest_date.to_s) : ""
17
+ @latest_date = Date.parse(latest_date.to_s) if latest_date
18
+ end
19
+
20
+ def to_ary
21
+ [
22
+ @gem_name,
23
+ @current_version,
24
+ @current_date || UNDEFINED,
25
+ @latest_version,
26
+ @latest_date || UNDEFINED,
27
+ days_between || UNDEFINED
28
+ ]
29
+ end
30
+
31
+ private
32
+
33
+ def days_between
34
+ return unless @current_date.is_a?(Date) && @latest_date.is_a?(Date)
35
+
36
+ (@latest_date - @current_date).to_i
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BundlerDate
4
+ VERSION = "0.1.0"
5
+ end
data/plugins.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler_date"
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundler_date
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Pavel Kozlov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-04-09 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: '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
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: terminal-table
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
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: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ 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
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.7'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.7'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rake
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
+ - !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
+ description: Bundler plugin to show the release dates of gems.
126
+ email:
127
+ - loadkpi@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".github/workflows/main.yml"
133
+ - ".gitignore"
134
+ - ".rspec"
135
+ - ".rubocop.yml"
136
+ - Gemfile
137
+ - LICENSE.md
138
+ - README.md
139
+ - Rakefile
140
+ - bin/console
141
+ - bin/setup
142
+ - bundler_date.gemspec
143
+ - lib/bundler_date.rb
144
+ - lib/bundler_date/ui.rb
145
+ - lib/bundler_date/ui/terminal_table.rb
146
+ - lib/bundler_date/ui/ui_row.rb
147
+ - lib/bundler_date/version.rb
148
+ - plugins.rb
149
+ homepage: https://github.com/loadkpi/bundler_date.
150
+ licenses: []
151
+ metadata:
152
+ homepage_uri: https://github.com/loadkpi/bundler_date.
153
+ source_code_uri: https://github.com/loadkpi/bundler_date.
154
+ changelog_uri: https://github.com/loadkpi/bundler_date/blob/master/CHANGELOG.md
155
+ post_install_message:
156
+ rdoc_options: []
157
+ require_paths:
158
+ - lib
159
+ required_ruby_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: 2.6.0
164
+ required_rubygems_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ requirements: []
170
+ rubygems_version: 3.1.2
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: Bundler plugin to show the release dates of gems.
174
+ test_files: []