Class: Gemdiff::OutdatedGem
- Inherits:
-
Object
- Object
- Gemdiff::OutdatedGem
- Defined in:
- lib/gemdiff/outdated_gem.rb
Constant Summary collapse
- LIST_NO_V =
gems that tag releases with tag names like 1.2.3 keep it alphabetical
%w[atomic babosa cancan compass haml thread_safe]
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#new_version ⇒ Object
Returns the value of attribute new_version.
-
#old_version ⇒ Object
Returns the value of attribute old_version.
Instance Method Summary collapse
- #commits ⇒ Object
- #commits_url ⇒ Object
- #compare ⇒ Object
- #compare_message ⇒ Object
- #compare_url ⇒ Object
-
#initialize(name, old_version = nil, new_version = nil) ⇒ OutdatedGem
constructor
A new instance of OutdatedGem.
- #load_bundle_versions ⇒ Object
- #missing_versions? ⇒ Boolean
- #open ⇒ Object
- #releases ⇒ Object
- #releases_url ⇒ Object
- #repo ⇒ Object
- #repo? ⇒ Boolean
-
#set_versions(options) ⇒ Object
options :old, :new.
Constructor Details
#initialize(name, old_version = nil, new_version = nil) ⇒ OutdatedGem
Returns a new instance of OutdatedGem.
10 11 12 13 14 |
# File 'lib/gemdiff/outdated_gem.rb', line 10 def initialize(name, old_version = nil, new_version = nil) @name = name @old_version = old_version @new_version = new_version end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/gemdiff/outdated_gem.rb', line 8 def name @name end |
#new_version ⇒ Object
Returns the value of attribute new_version.
8 9 10 |
# File 'lib/gemdiff/outdated_gem.rb', line 8 def new_version @new_version end |
#old_version ⇒ Object
Returns the value of attribute old_version.
8 9 10 |
# File 'lib/gemdiff/outdated_gem.rb', line 8 def old_version @old_version end |
Instance Method Details
#commits ⇒ Object
58 59 60 |
# File 'lib/gemdiff/outdated_gem.rb', line 58 def commits `open #{commits_url}` if repo? end |
#commits_url ⇒ Object
46 47 48 |
# File 'lib/gemdiff/outdated_gem.rb', line 46 def commits_url "#{repo}/commits/master" end |
#compare ⇒ Object
66 67 68 |
# File 'lib/gemdiff/outdated_gem.rb', line 66 def compare `open #{compare_url}` if repo? end |
#compare_message ⇒ Object
50 51 52 |
# File 'lib/gemdiff/outdated_gem.rb', line 50 def "#{name}: #{new_version} > #{old_version}" end |
#compare_url ⇒ Object
54 55 56 |
# File 'lib/gemdiff/outdated_gem.rb', line 54 def compare_url "#{repo}/compare/#{compare_part}" end |
#load_bundle_versions ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/gemdiff/outdated_gem.rb', line 26 def load_bundle_versions gem = BundleInspector.new.get(@name) return false if gem.nil? @old_version ||= gem.old_version @new_version ||= gem.new_version true end |
#missing_versions? ⇒ Boolean
22 23 24 |
# File 'lib/gemdiff/outdated_gem.rb', line 22 def missing_versions? old_version.nil? || new_version.nil? end |
#open ⇒ Object
70 71 72 |
# File 'lib/gemdiff/outdated_gem.rb', line 70 def open `open #{repo}` if repo? end |
#releases ⇒ Object
62 63 64 |
# File 'lib/gemdiff/outdated_gem.rb', line 62 def releases `open #{releases_url}` if repo? end |
#releases_url ⇒ Object
42 43 44 |
# File 'lib/gemdiff/outdated_gem.rb', line 42 def releases_url "#{repo}/releases" end |
#repo ⇒ Object
34 35 36 |
# File 'lib/gemdiff/outdated_gem.rb', line 34 def repo @repo ||= RepoFinder.github_url(@name) end |
#repo? ⇒ Boolean
38 39 40 |
# File 'lib/gemdiff/outdated_gem.rb', line 38 def repo? !!repo end |
#set_versions(options) ⇒ Object
options :old, :new
17 18 19 20 |
# File 'lib/gemdiff/outdated_gem.rb', line 17 def set_versions() @old_version = [:old] @new_version = [:new] end |