Class: BundleUpdateInteractive::OutdatedGem

Inherits:
Object
  • Object
show all
Defined in:
lib/bundle_update_interactive/outdated_gem.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**attrs) ⇒ OutdatedGem

Returns a new instance of OutdatedGem.



16
17
18
19
20
21
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 16

def initialize(**attrs)
  @vulnerable = nil
  @changelog_locator = ChangelogLocator.new

  attrs.each { |name, value| public_send(:"#{name}=", value) }
end

Instance Attribute Details

#changelog_uriObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 35

def changelog_uri
  return @changelog_uri if defined?(@changelog_uri)

  @changelog_uri =
    if (diff_url = build_git_diff_url)
      diff_url
    elsif (found_uri = rubygems_source? && locate_changelog_uri)
      found_uri
    else
      begin
        Gem::Specification.find_by_name(name)&.homepage
      rescue Gem::MissingSpecError
        nil
      end
    end
end

#current_git_versionObject

Returns the value of attribute current_git_version.



5
6
7
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 5

def current_git_version
  @current_git_version
end

#current_versionObject

Returns the value of attribute current_version.



5
6
7
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 5

def current_version
  @current_version
end

#gemfile_groupsObject

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

#gemfile_requirementObject

Returns the value of attribute gemfile_requirement.



5
6
7
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 5

def gemfile_requirement
  @gemfile_requirement
end

#git_source_uriObject

Returns the value of attribute git_source_uri.



5
6
7
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 5

def git_source_uri
  @git_source_uri
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 5

def name
  @name
end

#rubygems_source=(value) ⇒ Object (writeonly)

Sets the attribute rubygems_source

Parameters:

  • value

    the value to set the attribute rubygems_source to.



14
15
16
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 14

def rubygems_source=(value)
  @rubygems_source = value
end

#updated_git_versionObject

Returns the value of attribute updated_git_version.



5
6
7
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 5

def updated_git_version
  @updated_git_version
end

#updated_versionObject

Returns the value of attribute updated_version.



5
6
7
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 5

def updated_version
  @updated_version
end

#vulnerable=(value) ⇒ Object (writeonly)

Sets the attribute vulnerable

Parameters:

  • value

    the value to set the attribute vulnerable to.



14
15
16
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 14

def vulnerable=(value)
  @vulnerable = value
end

Instance Method Details

#git_version_changed?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 52

def git_version_changed?
  current_git_version && updated_git_version && current_git_version != updated_git_version
end

#rubygems_source?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 31

def rubygems_source?
  @rubygems_source
end

#semver_changeObject



23
24
25
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 23

def semver_change
  @semver_change ||= SemverChange.new(current_version, updated_version)
end

#vulnerable?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/bundle_update_interactive/outdated_gem.rb', line 27

def vulnerable?
  @vulnerable
end