Class: Serverspec::Type::OctopusDeployEnvironment

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

Instance Method Summary collapse

Constructor Details

#initialize(serverUrl, apiKey, environment_name) ⇒ OctopusDeployEnvironment



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

def initialize(serverUrl, apiKey, environment_name)
  @name = "Octopus Deploy Environment #{environment_name}"
  @runner = Specinfra::Runner
  @serverUrl = serverUrl
  @apiKey = apiKey

  if (serverUrl.nil?)
    puts "'serverUrl' was not provided. Unable to connect to Octopus server to validate configuration."
    return
  end
  if (apiKey.nil?)
    puts "'apiKey' was not provided. Unable to connect to Octopus server to validate configuration."
    return
  end

  @environment = get_environment_via_api(serverUrl, apiKey, environment_name)
end

Instance Method Details

#exists?Boolean



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

def exists?
  !@environment.nil?
end