Class: BundleUpdateInteractive::CLI::Row
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- BundleUpdateInteractive::CLI::Row
- Defined in:
- lib/bundle_update_interactive/cli/row.rb
Constant Summary collapse
- SEMVER_COLORS =
{ major: :red, minor: :yellow, patch: :green }.freeze
Instance Method Summary collapse
- #apply_semver_highlight(value) ⇒ Object
- #formatted_changelog_uri ⇒ Object
- #formatted_current_version ⇒ Object
- #formatted_gem_name ⇒ Object
- #formatted_gemfile_groups ⇒ Object
- #formatted_gemfile_requirement ⇒ Object
- #formatted_updated_version ⇒ Object
-
#initialize(outdated_gem) ⇒ Row
constructor
A new instance of Row.
Constructor Details
#initialize(outdated_gem) ⇒ Row
Returns a new instance of Row.
14 15 16 17 |
# File 'lib/bundle_update_interactive/cli/row.rb', line 14 def initialize(outdated_gem) super @pastel = BundleUpdateInteractive.pastel end |
Instance Method Details
#apply_semver_highlight(value) ⇒ Object
46 47 48 49 |
# File 'lib/bundle_update_interactive/cli/row.rb', line 46 def apply_semver_highlight(value) color = git_version_changed? ? :cyan : SEMVER_COLORS.fetch(semver_change.severity) pastel.decorate(value, color) end |
#formatted_changelog_uri ⇒ Object
42 43 44 |
# File 'lib/bundle_update_interactive/cli/row.rb', line 42 def formatted_changelog_uri pastel.blue(changelog_uri) end |
#formatted_current_version ⇒ Object
23 24 25 |
# File 'lib/bundle_update_interactive/cli/row.rb', line 23 def formatted_current_version [current_version.to_s, current_git_version].compact.join(" ") end |
#formatted_gem_name ⇒ Object
19 20 21 |
# File 'lib/bundle_update_interactive/cli/row.rb', line 19 def formatted_gem_name vulnerable? ? pastel.white.on_red(name) : apply_semver_highlight(name) end |
#formatted_gemfile_groups ⇒ Object
34 35 36 |
# File 'lib/bundle_update_interactive/cli/row.rb', line 34 def formatted_gemfile_groups gemfile_groups&.map(&:inspect)&.join(", ") end |
#formatted_gemfile_requirement ⇒ Object
38 39 40 |
# File 'lib/bundle_update_interactive/cli/row.rb', line 38 def formatted_gemfile_requirement gemfile_requirement.to_s == ">= 0" ? "" : gemfile_requirement.to_s end |
#formatted_updated_version ⇒ Object
27 28 29 30 31 32 |
# File 'lib/bundle_update_interactive/cli/row.rb', line 27 def formatted_updated_version version = semver_change.format { |part| apply_semver_highlight(part) } git_version = apply_semver_highlight(updated_git_version) [version, git_version].compact.join(" ") end |