-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create runtimes config section for default_manager
Showing
5 changed files
with
66 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ def delete_profile(name) | |
end | ||
|
||
Spectator.describe MStrap::Configuration do | ||
let(config_def) do | ||
let(config_def_v1_0) do | ||
MStrap::Defs::ConfigDef.from_hcl(<<-HCL) | ||
version = "1.0" | ||
|
@@ -50,6 +50,8 @@ Spectator.describe MStrap::Configuration do | |
HCL | ||
end | ||
|
||
let(config_def) { config_def_v1_0 } | ||
|
||
let(personal_profile_def) do | ||
MStrap::Defs::ProfileDef.from_hcl(<<-HCL) | ||
version = "1.0" | ||
|
@@ -315,6 +317,44 @@ Spectator.describe MStrap::Configuration do | |
end | ||
end | ||
|
||
describe "#runtime_manager" do | ||
context "for v1.0 configs" do | ||
subject { MStrap::Configuration.new(config_def_v1_0) } | ||
|
||
it "defaults to asdf" do | ||
expect(subject.runtime_manager).to be_a(MStrap::RuntimeManagers::ASDF) | ||
end | ||
end | ||
|
||
context "for v1.1 configs" do | ||
let(config_def_v1_1) do | ||
MStrap::Defs::ConfigDef.from_hcl(<<-HCL) | ||
version = "1.1" | ||
runtimes { | ||
default_manager = "mise" | ||
} | ||
user { | ||
name = "Reginald Testington" | ||
email = "[email protected]" | ||
} | ||
profile "personal" { | ||
url = "ssh://[email protected]/reggiemctest/mstrap-personal.git" | ||
} | ||
HCL | ||
end | ||
|
||
subject { MStrap::Configuration.new(config_def_v1_1) } | ||
|
||
it "can be set through runtimes.default_manager" do | ||
expect(subject.runtime_manager).to be_a(MStrap::RuntimeManagers::Mise) | ||
end | ||
end | ||
end | ||
|
||
describe "#save!" do | ||
it "saves the loaded configuration back to disk" do | ||
subject = MStrap::Configuration.new(config_def) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module MStrap | ||
module Defs | ||
class RuntimesConfigDef | ||
include HCL::Serializable | ||
|
||
@[HCL::Attribute] | ||
property default_manager = "asdf" | ||
|
||
def_equals_and_hash @default_manager | ||
|
||
def initialize | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters