Class: SpmPackageContext
- Inherits:
-
Struct
- Object
- Struct
- SpmPackageContext
- Defined in:
- lib/spm_version_updates/spm_package_context.rb
Overview
Carries normalized package facts through version, branch, and revision checks.
Instance Attribute Summary collapse
-
#cache_key ⇒ Object
Returns the value of attribute cache_key.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#name ⇒ Object
Returns the value of attribute name.
-
#normalized_url ⇒ Object
Returns the value of attribute normalized_url.
-
#persistent_cache_key ⇒ Object
Returns the value of attribute persistent_cache_key.
-
#repository_url ⇒ Object
Returns the value of attribute repository_url.
-
#requirement ⇒ Object
Returns the value of attribute requirement.
-
#resolved_version ⇒ Object
Returns the value of attribute resolved_version.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #add_version_tag_lookup(lookups, cache) ⇒ Object
- #branch ⇒ Object
- #branch_update?(last_commit) ⇒ Boolean
- #branch_update_warning ⇒ Object
- #branch_warning_message(last_commit) ⇒ Object
- #source_line ⇒ Object
- #source_suffix ⇒ Object
Instance Attribute Details
#cache_key ⇒ Object
Returns the value of attribute cache_key
6 7 8 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 6 def cache_key @cache_key end |
#kind ⇒ Object
Returns the value of attribute kind
6 7 8 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 6 def kind @kind end |
#name ⇒ Object
Returns the value of attribute name
6 7 8 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 6 def name @name end |
#normalized_url ⇒ Object
Returns the value of attribute normalized_url
6 7 8 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 6 def normalized_url @normalized_url end |
#persistent_cache_key ⇒ Object
Returns the value of attribute persistent_cache_key
6 7 8 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 6 def persistent_cache_key @persistent_cache_key end |
#repository_url ⇒ Object
Returns the value of attribute repository_url
6 7 8 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 6 def repository_url @repository_url end |
#requirement ⇒ Object
Returns the value of attribute requirement
6 7 8 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 6 def requirement @requirement end |
#resolved_version ⇒ Object
Returns the value of attribute resolved_version
6 7 8 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 6 def resolved_version @resolved_version end |
#source ⇒ Object
Returns the value of attribute source
6 7 8 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 6 def source @source end |
Instance Method Details
#add_version_tag_lookup(lookups, cache) ⇒ Object
18 19 20 21 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 18 def add_version_tag_lookup(lookups, cache) key = cache_key lookups[key] ||= [cache_key, repository_url, persistent_cache_key] unless cache.key?(key) end |
#branch ⇒ Object
23 24 25 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 23 def branch requirement["branch"] end |
#branch_update?(last_commit) ⇒ Boolean
27 28 29 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 27 def branch_update?(last_commit) last_commit && last_commit != resolved_version end |
#branch_update_warning ⇒ Object
35 36 37 38 39 40 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 35 def branch_update_warning last_commit = GitOperations.branch_last_commit(repository_url, branch) return unless branch_update?(last_commit) [(last_commit), last_commit, "branch: #{branch}"] end |
#branch_warning_message(last_commit) ⇒ Object
31 32 33 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 31 def (last_commit) "Newer commit available for #{name} (#{branch}): #{last_commit}" end |
#source_line ⇒ Object
42 43 44 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 42 def source_line "Source: #{source}" if source end |
#source_suffix ⇒ Object
46 47 48 |
# File 'lib/spm_version_updates/spm_package_context.rb', line 46 def source_suffix source ? " (#{source})" : "" end |