Class: Rascal::EnvironmentsDefinition::Gitlab

Inherits:
Object
  • Object
show all
Defined in:
lib/rascal/environments_definition/gitlab.rb

Defined Under Namespace

Classes: Config

Constant Summary collapse

DEFAULT_KEY =
'default'.freeze
SPECIAL_KEYS =
[DEFAULT_KEY, 'stages'].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_path) ⇒ Gitlab

Returns a new instance of Gitlab.



38
39
40
41
42
43
44
# File 'lib/rascal/environments_definition/gitlab.rb', line 38

def initialize(config_path)
  @info = parse_definition(config_path.read)
  @repo_dir = config_path.parent
  @base_name = @repo_dir.basename
  @rascal_config = @info.fetch('.rascal', {})
  @rascal_environment_config = @rascal_config.delete('jobs') || {}
end

Class Method Details

.detect(path) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/rascal/environments_definition/gitlab.rb', line 10

def detect(path)
  if path.directory?
    path = path.join('.gitlab-ci.yml')
  end
  if path.file?
    new(path)
  end
end

Instance Method Details

#available_environment_namesObject



52
53
54
# File 'lib/rascal/environments_definition/gitlab.rb', line 52

def available_environment_names
  environments.collect(&:name).sort
end

#environment(name) ⇒ Object



46
47
48
49
50
# File 'lib/rascal/environments_definition/gitlab.rb', line 46

def environment(name)
  environments.detect do |e|
    e.name == name
  end
end