class Serverspec::Type::JenkinsPlugin
Public Class Methods
new(name = nil, options = {})
click to toggle source
Calls superclass method
Serverspec::Type::JenkinsBase::new
# File lib/serverspec_extra_types/types/jenkins_plugin.rb, line 11 def initialize(name = nil, options = {}) super(name, options) end
Public Instance Methods
exist?()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_plugin.rb, line 27 def exist? inspection != nil end
has_version?(version)
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_plugin.rb, line 35 def has_version?(version) self.version == version.to_s end
inspection()
click to toggle source
# 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)
click to toggle source
# 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()
click to toggle source
# 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()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_plugin.rb, line 31 def url "#{@url_base}/pluginManager/api/json?depth=1" end
version()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_plugin.rb, line 39 def version inspection['version'].to_s end
Private Instance Methods
get_inspection()
click to toggle source
rubocop:disable Naming/AccessorMethodName
# File lib/serverspec_extra_types/types/jenkins_plugin.rb, line 56 def get_inspection userpass = @user ? "-u #{@user}:#{@password}" : '' command = "curl -s #{userpass} #{url} #{@insecure ? '-k' : ''} #{@redirects ? '-L' : ''}" @get_inspection ||= @runner.run_command(command) end