Class: Rascal::EnvironmentsDefinition::Gitlab
- Inherits:
-
Object
- Object
- Rascal::EnvironmentsDefinition::Gitlab
- Defined in:
- lib/rascal/environments_definition/gitlab.rb
Defined Under Namespace
Classes: Config
Class Method Summary collapse
Instance Method Summary collapse
- #available_environment_names ⇒ Object
- #environment(name) ⇒ Object
-
#initialize(config_path) ⇒ Gitlab
constructor
A new instance of Gitlab.
Constructor Details
#initialize(config_path) ⇒ Gitlab
Returns a new instance of Gitlab.
35 36 37 38 39 40 41 |
# File 'lib/rascal/environments_definition/gitlab.rb', line 35 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
7 8 9 10 11 12 13 14 |
# File 'lib/rascal/environments_definition/gitlab.rb', line 7 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_names ⇒ Object
49 50 51 |
# File 'lib/rascal/environments_definition/gitlab.rb', line 49 def available_environment_names environments.collect(&:name).sort end |
#environment(name) ⇒ Object
43 44 45 46 47 |
# File 'lib/rascal/environments_definition/gitlab.rb', line 43 def environment(name) environments.detect do |e| e.name == name end end |