Class: BundleUpdateInteractive::OutdatedGem
- Inherits:
-
Object
- Object
- BundleUpdateInteractive::OutdatedGem
- Defined in:
- lib/bundle_update_interactive/outdated_gem.rb
Instance Attribute Summary collapse
-
#current_lockfile_entry ⇒ Object
readonly
Returns the value of attribute current_lockfile_entry.
-
#gemfile_groups ⇒ Object
readonly
Returns the value of attribute gemfile_groups.
-
#updated_lockfile_entry ⇒ Object
readonly
Returns the value of attribute updated_lockfile_entry.
-
#vulnerable ⇒ Object
writeonly
Sets the attribute vulnerable.
Instance Method Summary collapse
- #changelog_uri ⇒ Object
- #current_git_version ⇒ Object
- #current_version ⇒ Object
- #git_version_changed? ⇒ Boolean
-
#initialize(current_lockfile_entry:, updated_lockfile_entry:, gemfile_groups:) ⇒ OutdatedGem
constructor
A new instance of OutdatedGem.
- #name ⇒ Object
- #semver_change ⇒ Object
- #updated_git_version ⇒ Object
- #updated_version ⇒ Object
- #vulnerable? ⇒ Boolean
Constructor Details
#initialize(current_lockfile_entry:, updated_lockfile_entry:, gemfile_groups:) ⇒ OutdatedGem
Returns a new instance of OutdatedGem.
8 9 10 11 12 13 14 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 8 def initialize(current_lockfile_entry:, updated_lockfile_entry:, gemfile_groups:) @current_lockfile_entry = current_lockfile_entry @updated_lockfile_entry = updated_lockfile_entry @gemfile_groups = gemfile_groups @changelog_locator = ChangelogLocator.new @vulnerable = nil end |
Instance Attribute Details
#current_lockfile_entry ⇒ Object (readonly)
Returns the value of attribute current_lockfile_entry.
5 6 7 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 5 def current_lockfile_entry @current_lockfile_entry end |
#gemfile_groups ⇒ Object (readonly)
Returns the value of attribute gemfile_groups.
5 6 7 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 5 def gemfile_groups @gemfile_groups end |
#updated_lockfile_entry ⇒ Object (readonly)
Returns the value of attribute updated_lockfile_entry.
5 6 7 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 5 def updated_lockfile_entry @updated_lockfile_entry end |
#vulnerable=(value) ⇒ Object (writeonly)
Sets the attribute vulnerable
6 7 8 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 6 def vulnerable=(value) @vulnerable = value end |
Instance Method Details
#changelog_uri ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 28 def changelog_uri return @changelog_uri if defined?(@changelog_uri) @changelog_uri = if git_version_changed? "https://github.com/#{github_repo}/compare/#{current_git_version}...#{updated_git_version}" elsif updated_lockfile_entry.rubygems_source? changelog_locator.find_changelog_uri(name: name, version: updated_version.to_s) else begin Gem::Specification.find_by_name(name)&.homepage rescue Gem::MissingSpecError nil end end end |
#current_git_version ⇒ Object
53 54 55 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 53 def current_git_version current_lockfile_entry.git_version end |
#current_version ⇒ Object
45 46 47 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 45 def current_version current_lockfile_entry.version end |
#git_version_changed? ⇒ Boolean
61 62 63 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 61 def git_version_changed? current_git_version && updated_git_version && current_git_version != updated_git_version end |
#name ⇒ Object
16 17 18 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 16 def name current_lockfile_entry.name end |
#semver_change ⇒ Object
20 21 22 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 20 def semver_change @semver_change ||= SemverChange.new(current_version, updated_version) end |
#updated_git_version ⇒ Object
57 58 59 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 57 def updated_git_version updated_lockfile_entry.git_version end |
#updated_version ⇒ Object
49 50 51 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 49 def updated_version updated_lockfile_entry.version end |
#vulnerable? ⇒ Boolean
24 25 26 |
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 24 def vulnerable? @vulnerable end |