Class: Serverspec::Type::OctopusDeployProjectGroup

Inherits:
Base
  • Object
show all
Defined in:
lib/octopus_serverspec_extensions/type/octopus_deploy_project_group.rb

Instance Method Summary collapse

Constructor Details

#initialize(*url_and_api_key, project_group_name) ⇒ OctopusDeployProjectGroup

Returns a new instance of OctopusDeployProjectGroup.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_project_group.rb', line 15

def initialize(*url_and_api_key, project_group_name)
  serverUrl, apiKey = get_octopus_creds(url_and_api_key)

  raise "'project_group_name' was not provided. Unable to connect to Octopus server to validate configuration."  if project_group_name.nil?

  @project_group_name = project_group_name

  @name = "Octopus Deploy Project Group #{project_group_name}"
  @runner = Specinfra::Runner
  @serverUrl = serverUrl
  @apiKey = apiKey

  @serverSupportsSpaces = check_supports_spaces(serverUrl)
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_project_group.rb', line 30

def exists?
  load_resource_if_nil
  (!@project_group.nil?) && (@project_group != [])
end

#has_description?(project_group_description) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
38
39
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_project_group.rb', line 35

def has_description?(project_group_description)
  load_resource_if_nil
  return false if @project_group.nil?
  @project_group["Description"] == project_group_description
end

#in_space(space_name) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_project_group.rb', line 41

def in_space(space_name)
  # allows us to tag .in_space() onto the end of the resource. as in
  # describe octopus_account("account name").in_space("MyNewSpace") do
  @spaceId = get_space_id(space_name)
  if @project_group_name.nil?
    raise "'project_group_name' was not provided. Please provide a project group name and try again."
  end
  self
end