gem_compat_scan 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: c982e6879fd82ccea03d1a32defcaf1b72a54d7d7fd4597c72df3c6324750ae7
4
+ data.tar.gz: 716aac40d123c02f7105eaffa17b13f360bbdf64bf3e28f839a75b19d5bfa6ab
5
+ SHA512:
6
+ metadata.gz: 9ea57ad190dafb992e0f86a63fd40c5a2c6e68246fecf45af82dc3f9fbd6f10b1fec683d09c6cb5a210acd0ed015bf8baabd2035d9c5ae17757c6f61bfe5994d
7
+ data.tar.gz: 869845824b19069cda5ba276cd053e22343c65f08365f26ab109de29dc230e9724ce6d9bacd75eca81ccb7aba4ab062755b31163a2bc3da1a579a2304729ea98
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0] - 2023-08-04
4
+ ### Added
5
+ - Initial release of GemCompatScan.
6
+ - Scans Gemfile for gem versions and checks for updates.
7
+ - Generates PDF reports with gem update information.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Nidhi Sarvaiya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # GemCompatScan
2
+
3
+ GemCompatScan is a Ruby gem that helps you scan your project's Gemfile, compare the currently used gem versions with the latest available versions, and generate a PDF report with the results.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'gem_compat_scan'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ To use GemCompatScan, simply run the following command in your project's root directory:
16
+
17
+ ```ruby
18
+ bin/gem_compat_scan
19
+ ```
20
+
21
+ This command will scan your project's Gemfile, compare the currently used gem versions with the latest available versions, and generate a PDF report named gem_updates_report.pdf in the same directory.
22
+
23
+ ## Example
24
+
25
+ Assuming you have the following Gemfile:
26
+
27
+ ```ruby
28
+ source 'https://rubygems.org'
29
+
30
+ gem 'rails', '6.0.3'
31
+ gem 'devise', '~> 4.7'
32
+ gem 'sidekiq', '6.2.1'
33
+ ```
34
+
35
+ Running gem_compat_scan will generate a PDF report that looks like this:
36
+
37
+ ```yaml
38
+ Gem Updates Report
39
+
40
+ Gem: rails
41
+ Current Version: 6.0.3
42
+ Latest Version: 7.0.0
43
+
44
+ Gem: devise
45
+ Current Version: 4.7.0
46
+ Latest Version: 5.0.0
47
+
48
+ Gem: sidekiq
49
+ Current Version: 6.2.1
50
+ Latest Version: 6.3.0
51
+ ```
52
+
53
+ ## Contributing
54
+ - Fork the repository.
55
+ - Create a feature branch (git checkout -b feature/my-feature).
56
+ - Commit your changes (git commit -am 'Add some feature').
57
+ - Push to the branch (git push origin feature/my-feature).
58
+ - Create a new Pull Request.
59
+
60
+ ## License
61
+ The gem is available as open source under the terms of the MIT License.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ task default: :test
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/gem_compat_scan/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "gem_compat_scan"
7
+ spec.version = GemCompatScan::VERSION
8
+ spec.authors = ["Nidhi Sarvaiya"]
9
+ spec.email = ["sarvaiya.nidhi@gmail.com"]
10
+
11
+ spec.summary = %q{GemCompatScan: Keep your gems updated and compatible}
12
+ spec.description = %q{GemCompatScan helps Ruby on Rails developers keep their project's dependencies up-to-date and ensure compatibility with their application.}
13
+ spec.homepage = 'https://github.com/sarvaiyanidhi/gem_compat_scan'
14
+ spec.required_ruby_version = ">= 2.6.0"
15
+ spec.license = 'MIT'
16
+
17
+
18
+ # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
19
+
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ spec.metadata["source_code_uri"] = "https://github.com/sarvaiyanidhi/gem_compat_scan"
22
+ spec.metadata["changelog_uri"] = "https://github.com/sarvaiyanidhi/gem_compat_scan/blob/main/CHANGELOG.md"
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(__dir__) do
27
+ `git ls-files -z`.split("\x0").reject do |f|
28
+ (File.expand_path(f) == __FILE__) ||
29
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
30
+ end
31
+ end
32
+ spec.bindir = "exe"
33
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
+ spec.require_paths = ["lib"]
35
+
36
+ # Add runtime dependencies
37
+ spec.add_runtime_dependency 'bundler'
38
+ spec.add_runtime_dependency 'prawn'
39
+
40
+ # Optional: Add development dependencies (for testing and development)
41
+ spec.add_development_dependency 'rspec'
42
+
43
+ # Uncomment to register a new dependency of your gem
44
+ # spec.add_dependency "example-gem", "~> 1.0"
45
+
46
+ # For more information and examples about making a new gem, check out our
47
+ # guide at: https://bundler.io/guides/creating_gem.html
48
+ end
@@ -0,0 +1,32 @@
1
+ require 'bundler'
2
+ require 'gems'
3
+
4
+ module GemCompatScan
5
+ class Checker
6
+ def self.check_updates
7
+ Bundler.setup # Load Gemfile.lock
8
+ updates = []
9
+ Bundler.locked_gems.specs.each do |spec|
10
+ gem_name = spec.name
11
+ current_version = spec.version.to_s
12
+ latest_version = fetch_latest_version(gem_name)
13
+
14
+ if latest_version && latest_version > current_version
15
+ updates << {
16
+ gem: gem_name,
17
+ current_version: current_version,
18
+ latest_version: latest_version
19
+ }
20
+ end
21
+ end
22
+ updates
23
+ end
24
+
25
+ def self.fetch_latest_version(gem_name)
26
+ gem_info = Gems.info(gem_name)
27
+ gem_info['version']
28
+ rescue Gems::NotFound
29
+ nil # Return nil if gem is not found
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,26 @@
1
+ require 'prawn'
2
+
3
+ module GemCompatScan
4
+ class PDFGenerator
5
+ def self.generate_report(updates, output_path = 'gem_updates_report.pdf')
6
+ Prawn::Document.generate(output_path) do |pdf|
7
+ pdf.text 'Gem Updates Report', size: 18, style: :bold, align: :center
8
+ pdf.move_down 20
9
+
10
+ updates.each do |update|
11
+ pdf.text "Gem: #{update[:gem]}", size: 14, style: :bold
12
+ pdf.text "Current Version: #{update[:current_version]}"
13
+ pdf.text "Latest Version: #{update[:latest_version]}"
14
+
15
+ if update[:new_info]
16
+ pdf.move_down 10
17
+ pdf.text 'New Information:', style: :bold
18
+ pdf.text update[:new_info]
19
+ end
20
+
21
+ pdf.move_down 20
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GemCompatScan
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,14 @@
1
+ require 'prawn'
2
+ require 'bundler'
3
+ require 'gem_compat_scan/checker' # Load the Checker class
4
+ require 'gem_compat_scan/pdf_generator'
5
+
6
+ module GemCompatScan
7
+ def self.run
8
+ # Your existing code to scan gem versions and gather updates
9
+ updates = Checker.check_updates
10
+
11
+ # Generate the PDF report using Prawn
12
+ PDFGenerator.generate_report(updates)
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ module GemCompatScan
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem_compat_scan
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nidhi Sarvaiya
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-08-04 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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: prawn
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: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: GemCompatScan helps Ruby on Rails developers keep their project's dependencies
56
+ up-to-date and ensure compatibility with their application.
57
+ email:
58
+ - sarvaiya.nidhi@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".rspec"
64
+ - CHANGELOG.md
65
+ - LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - gem_compat_scan.gemspec
69
+ - lib/gem_compat_scan.rb
70
+ - lib/gem_compat_scan/checker.rb
71
+ - lib/gem_compat_scan/pdf_generator.rb
72
+ - lib/gem_compat_scan/version.rb
73
+ - sig/gem_compat_scan.rbs
74
+ homepage: https://github.com/sarvaiyanidhi/gem_compat_scan
75
+ licenses:
76
+ - MIT
77
+ metadata:
78
+ homepage_uri: https://github.com/sarvaiyanidhi/gem_compat_scan
79
+ source_code_uri: https://github.com/sarvaiyanidhi/gem_compat_scan
80
+ changelog_uri: https://github.com/sarvaiyanidhi/gem_compat_scan/blob/main/CHANGELOG.md
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 2.6.0
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubygems_version: 3.4.10
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: 'GemCompatScan: Keep your gems updated and compatible'
100
+ test_files: []