| 1 |
-- metadata.yaml -- |
| 2 |
main: "main/hello.mcl" # this is not the default, the default is "main.mcl" |
| 3 |
files: "files/" # these are some extra files we can use (is the default) |
| 4 |
path: "path/" # where to look for modules, defaults to using a global |
| 5 |
-- main/h2g2.mcl -- |
| 6 |
import "third.mcl" |
| 7 |
|
| 8 |
$answer = 42 + $third.three |
| 9 |
-- main/hello.mcl -- |
| 10 |
import "fmt" |
| 11 |
import "h2g2.mcl" |
| 12 |
import "mod1/" |
| 13 |
|
| 14 |
# imports as example1 |
| 15 |
import "git://github.com/purpleidea/mgmt-example1/" |
| 16 |
import "git://github.com/purpleidea/mgmt-example2/" |
| 17 |
|
| 18 |
$answer = $h2g2.answer |
| 19 |
|
| 20 |
test "hello" { |
| 21 |
anotherstr => fmt.printf("the answer is: %d", $answer), |
| 22 |
} |
| 23 |
test "hello2" { |
| 24 |
anotherstr => fmt.printf("i imported local: %s", $mod1.name), |
| 25 |
} |
| 26 |
test "hello3" { |
| 27 |
anotherstr => fmt.printf("i imported remote: %s and %s", $example1.name, $example2.ex1), |
| 28 |
} |
| 29 |
-- main/third.mcl -- |
| 30 |
$three = 3 |
| 31 |
-- main/mod1/metadata.yaml -- |
| 32 |
# empty metadata file (use defaults) |
| 33 |
-- main/mod1/main.mcl -- |
| 34 |
import "mod1/" # the nested version, not us |
| 35 |
|
| 36 |
$name = "this is module mod1 which contains: " + $mod1.name |
| 37 |
-- main/mod1/mod1/metadata.yaml -- |
| 38 |
# empty metadata file (use defaults) |
| 39 |
-- main/mod1/mod1/main.mcl -- |
| 40 |
$name = "this is the nested local module mod1" |
| 41 |
-- path/github.com/purpleidea/mgmt-example1/metadata.yaml -- |
| 42 |
main: "main.mcl" |
| 43 |
files: "files/" # these are some extra files we can use (is the default) |
| 44 |
-- path/github.com/purpleidea/mgmt-example1/main.mcl -- |
| 45 |
# this is a pretty lame module! |
| 46 |
import "mod1/" # yet another similarly named "mod1" import |
| 47 |
|
| 48 |
$name = "i am github.com/purpleidea/mgmt-example1/ and i contain: " + $mod1.name |
| 49 |
-- path/github.com/purpleidea/mgmt-example1/mod1/metadata.yaml -- |
| 50 |
# empty metadata file (use defaults) |
| 51 |
-- path/github.com/purpleidea/mgmt-example1/mod1/main.mcl -- |
| 52 |
$name = "this is the nested git module mod1" |
| 53 |
-- path/github.com/purpleidea/mgmt-example2/metadata.yaml -- |
| 54 |
main: "main.mcl" |
| 55 |
files: "files/" # these are some extra files we can use (is the default) |
| 56 |
path: "path/" # specify this, even though we already imported in parent |
| 57 |
parentpathblock: false |
| 58 |
-- path/github.com/purpleidea/mgmt-example2/main.mcl -- |
| 59 |
# this is a pretty lame module! |
| 60 |
import "git://github.com/purpleidea/mgmt-example1/" # import another module |
| 61 |
$ex1 = $example1.name |
| 62 |
|
| 63 |
$name = "i am github.com/purpleidea/mgmt-example2/ and i contain: " + $ex1 |
| 64 |
-- OUTPUT -- |
| 65 |
Edge: FuncValue -> call # fn |
| 66 |
Edge: FuncValue -> call # fn |
| 67 |
Edge: FuncValue -> call # fn |
| 68 |
Edge: FuncValue -> call # fn |
| 69 |
Edge: FuncValue -> call # fn |
| 70 |
Edge: FuncValue -> call # fn |
| 71 |
Edge: FuncValue -> call # fn |
| 72 |
Vertex: FuncValue |
| 73 |
Vertex: FuncValue |
| 74 |
Vertex: FuncValue |
| 75 |
Vertex: FuncValue |
| 76 |
Vertex: FuncValue |
| 77 |
Vertex: FuncValue |
| 78 |
Vertex: FuncValue |
| 79 |
Vertex: call |
| 80 |
Vertex: call |
| 81 |
Vertex: call |
| 82 |
Vertex: call |
| 83 |
Vertex: call |
| 84 |
Vertex: call |
| 85 |
Vertex: call |
| 86 |
Vertex: const |
| 87 |
Vertex: const |
| 88 |
Vertex: const |
| 89 |
Vertex: const |
| 90 |
Vertex: const |
| 91 |
Vertex: const |
| 92 |
Vertex: const |
| 93 |
Vertex: const |
| 94 |
Vertex: const |
| 95 |
Vertex: const |
| 96 |
Vertex: const |
| 97 |
Vertex: const |
| 98 |
Vertex: const |
| 99 |
Vertex: const |
| 100 |
Vertex: const |
| 101 |
Vertex: const |
| 102 |
Vertex: const |
| 103 |
Vertex: const |