Class: Serverspec::Type::JenkinsPlugin
- Inherits:
-
JenkinsBase
- Object
- Base
- ApiBase
- JenkinsBase
- Serverspec::Type::JenkinsPlugin
- Defined in:
- lib/serverspec_extra_types/types/jenkins_plugin.rb
Instance Method Summary collapse
- #exist? ⇒ Boolean
- #has_version?(version) ⇒ Boolean
-
#initialize(name = nil, options = {}) ⇒ JenkinsPlugin
constructor
A new instance of JenkinsPlugin.
- #inspection ⇒ Object
- #installed?(_provider = nil, version = nil) ⇒ Boolean
- #length ⇒ Object
- #url ⇒ Object
- #version ⇒ Object
Methods inherited from ApiBase
Constructor Details
#initialize(name = nil, options = {}) ⇒ JenkinsPlugin
Returns a new instance of JenkinsPlugin.
11 12 13 |
# File 'lib/serverspec_extra_types/types/jenkins_plugin.rb', line 11 def initialize(name = nil, = {}) super(name, ) end |
Instance Method Details
#exist? ⇒ Boolean
27 28 29 |
# File 'lib/serverspec_extra_types/types/jenkins_plugin.rb', line 27 def exist? inspection != nil end |
#has_version?(version) ⇒ Boolean
35 36 37 |
# File 'lib/serverspec_extra_types/types/jenkins_plugin.rb', line 35 def has_version?(version) self.version == version.to_s end |
#inspection ⇒ Object
15 16 17 |
# File 'lib/serverspec_extra_types/types/jenkins_plugin.rb', line 15 def inspection @inspection ||= ::MultiJson.load(get_inspection.stdout)['plugins'].find { |plugin| plugin['shortName'] == @name } end |
#installed?(_provider = nil, version = nil) ⇒ Boolean
19 20 21 22 23 24 25 |
# File 'lib/serverspec_extra_types/types/jenkins_plugin.rb', line 19 def installed?(_provider = nil, version = nil) if version !inspection.nil? && inspection['version'].to_s == version.to_s else !inspection.nil? end end |
#length ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/serverspec_extra_types/types/jenkins_plugin.rb', line 43 def length if inspection.is_a? String inspection.length elsif inspection.is_a? Array inspection.length else 1 end end |
#url ⇒ Object
31 32 33 |
# File 'lib/serverspec_extra_types/types/jenkins_plugin.rb', line 31 def url "#{@url_base}/pluginManager/api/json?depth=1" end |
#version ⇒ Object
39 40 41 |
# File 'lib/serverspec_extra_types/types/jenkins_plugin.rb', line 39 def version inspection['version'].to_s end |