Class: Bundler::AutoUpdate::Dependency
- Inherits:
-
Object
- Object
- Bundler::AutoUpdate::Dependency
- Defined in:
- lib/bundler_auto_update.rb
Instance Attribute Summary collapse
-
#major ⇒ Object
readonly
Returns the value of attribute major.
-
#minor ⇒ Object
readonly
Returns the value of attribute minor.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#patch ⇒ Object
readonly
Returns the value of attribute patch.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #available_versions ⇒ Object
- #gem_remote_list_output ⇒ Object
-
#initialize(name, version = nil, options = nil) ⇒ Dependency
constructor
A new instance of Dependency.
- #last_version(version_type) ⇒ Object
Constructor Details
#initialize(name, version = nil, options = nil) ⇒ Dependency
Returns a new instance of Dependency.
194 195 196 197 198 |
# File 'lib/bundler_auto_update.rb', line 194 def initialize(name, version = nil, = nil) @name, @version, @options = name, version, @major, @minor, @patch = version.split('.') if version end |
Instance Attribute Details
#major ⇒ Object (readonly)
Returns the value of attribute major.
191 192 193 |
# File 'lib/bundler_auto_update.rb', line 191 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
191 192 193 |
# File 'lib/bundler_auto_update.rb', line 191 def minor @minor end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
191 192 193 |
# File 'lib/bundler_auto_update.rb', line 191 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
191 192 193 |
# File 'lib/bundler_auto_update.rb', line 191 def @options end |
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
191 192 193 |
# File 'lib/bundler_auto_update.rb', line 191 def patch @patch end |
#version ⇒ Object
Returns the value of attribute version.
192 193 194 |
# File 'lib/bundler_auto_update.rb', line 192 def version @version end |
Instance Method Details
#available_versions ⇒ Object
211 212 213 214 |
# File 'lib/bundler_auto_update.rb', line 211 def available_versions the_gem_line = gem_remote_list_output.scan(/^#{name}\s.*$/).first the_gem_line.scan /\d+\.\d+\.\d+/ end |
#gem_remote_list_output ⇒ Object
216 217 218 |
# File 'lib/bundler_auto_update.rb', line 216 def gem_remote_list_output CommandRunner.run "gem list #{name} -r -a" end |
#last_version(version_type) ⇒ Object
200 201 202 203 204 205 206 207 208 209 |
# File 'lib/bundler_auto_update.rb', line 200 def last_version(version_type) case version_type when :patch available_versions.select { |v| v =~ /^#{major}\.#{minor}\D/ }.first when :minor available_versions.select { |v| v =~ /^#{major}\./ }.first when :major available_versions.first end end |