class Serverspec::Type::JenkinsJob
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_job.rb, line 11 def initialize(name = nil, options = {}) super(name, options) end
Public Instance Methods
directory?()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 34 def directory? inspection['_class'] == 'com.cloudbees.hudson.plugins.folder.Folder' end
folder?()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 78 def folder? directory? end
freestyle?()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 46 def freestyle? inspection['_class'] == 'hudson.model.FreeStyleProject' end
freestyle_project?()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 50 def freestyle_project? freestyle? end
has_description?(desc)
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 86 def has_description?(desc) inspection['description'] == desc end
has_display_name?(text)
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 102 def has_display_name?(text) inspection['displayName'] == text end
has_empty_job_list?()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 110 def has_empty_job_list? inspection['jobs'].empty? end
has_full_display_name?(text)
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 106 def has_full_display_name?(text) inspection['fullDisplayName'] == text end
has_full_name?(text)
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 90 def has_full_name?(text) inspection['fullName'] == text end
has_job?(_job)
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 94 def has_job?(_job) inspection['jobs'].find { |job| job['name'] == _job } end
has_job_count?(count)
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 98 def has_job_count?(count) inspection['jobs'].length == count end
has_job_type?(type)
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 70 def has_job_type?(type) inspection['_class'] == type end
has_name?(text)
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 82 def has_name?(text) inspection['name'] == text end
has_project_type?(type)
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 74 def has_project_type?(type) has_job_type?(type) end
inspection()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 15 def inspection @inspection ||= ::MultiJson.load(get_inspection.stdout) end
length()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 24 def length if inspection.is_a? String inspection.length elsif inspection.is_a? Array inspection.length else 1 end end
maven?()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 54 def maven? inspection['_class'] == 'hudson.maven.MavenModuleSet' end
maven_project?()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 58 def maven_project? maven? end
multibranch?()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 38 def multibranch? inspection['_class'] == 'org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject' end
multibranch_project?()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 42 def multibranch_project? multibranch? end
pipeline?()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 62 def pipeline? inspection['_class'] == 'org.jenkinsci.plugins.workflow.job.WorkflowJob' end
pipeline_project?()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 66 def pipeline_project? pipeline? end
url()
click to toggle source
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 19 def url jobname = @name.gsub('/', '/job/') "#{@url_base}/job/#{jobname}/api/json" end
Private Instance Methods
get_inspection()
click to toggle source
rubocop:disable Naming/AccessorMethodName
# File lib/serverspec_extra_types/types/jenkins_job.rb, line 117 def get_inspection userpass = @user ? "-u #{@user}:#{@password}" : '' command = "curl -s #{userpass} #{url} #{@insecure ? '-k' : ''} #{@redirects ? '-L' : ''}" @get_inspection ||= @runner.run_command(command) end