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.
181 182 183 184 185 |
# File 'lib/bundler_auto_update.rb', line 181 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.
178 179 180 |
# File 'lib/bundler_auto_update.rb', line 178 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
178 179 180 |
# File 'lib/bundler_auto_update.rb', line 178 def minor @minor end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
178 179 180 |
# File 'lib/bundler_auto_update.rb', line 178 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
178 179 180 |
# File 'lib/bundler_auto_update.rb', line 178 def @options end |
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
178 179 180 |
# File 'lib/bundler_auto_update.rb', line 178 def patch @patch end |
#version ⇒ Object
Returns the value of attribute version.
179 180 181 |
# File 'lib/bundler_auto_update.rb', line 179 def version @version end |
Instance Method Details
#available_versions ⇒ Object
198 199 200 201 |
# File 'lib/bundler_auto_update.rb', line 198 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
203 204 205 |
# File 'lib/bundler_auto_update.rb', line 203 def gem_remote_list_output CommandRunner.run "gem list #{name} -r -a" end |
#last_version(version_type) ⇒ Object
187 188 189 190 191 192 193 194 195 196 |
# File 'lib/bundler_auto_update.rb', line 187 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 |