github.com/tooploox/oya@v0.0.21-0.20230524103240-1cda1861aad6/features/builtins.feature (about) 1 Feature: Built-ins 2 3 Background: 4 Given I'm in project dir 5 6 Scenario: Access Oyafile base directory 7 Given file ./Oyafile containing 8 """ 9 Project: project 10 """ 11 And file ./subdir/Oyafile containing 12 """ 13 all: | 14 echo ${Oya[BasePath]} 15 """ 16 When I run "oya run --recurse all" 17 Then the command succeeds 18 And the command outputs text matching 19 """ 20 ^.*subdir 21 22 """ 23 24 Scenario: Access pack base directory 25 Given file ./Oyafile containing 26 """ 27 Project: project 28 29 Require: 30 github.com/test/foo: v0.0.1 31 32 Import: 33 foo: github.com/test/foo 34 """ 35 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 36 """ 37 all: | 38 echo ${Oya[BasePath]} 39 """ 40 When I run "oya run foo.all" 41 Then the command succeeds 42 And the command outputs text matching 43 """ 44 ^.*github.com/test/foo@v0.0.1 45 46 """ 47 48 Scenario: Access Oyafile Project name 49 Given file ./Oyafile containing 50 """ 51 Project: project 52 53 all: | 54 echo ${Oya[Project]} 55 """ 56 When I run "oya run all" 57 Then the command succeeds 58 And the command outputs text matching 59 """ 60 project 61 62 """ 63 64 Scenario: Access Oyafile Project name in nested dir 65 Given file ./Oyafile containing 66 """ 67 Project: project 68 """ 69 And file ./subdir/Oyafile containing 70 """ 71 all: | 72 echo ${Oya[Project]} 73 """ 74 When I run "oya run --recurse all" 75 Then the command succeeds 76 And the command outputs text matching 77 """ 78 project 79 80 """ 81 82 Scenario: Access Oyafile Project name inside pack 83 Given file ./Oyafile containing 84 """ 85 Project: project 86 87 Require: 88 github.com/test/foo: v0.0.1 89 90 Import: 91 foo: github.com/test/foo 92 """ 93 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 94 """ 95 all: | 96 echo ${Oya[Project]} 97 """ 98 When I run "oya run foo.all" 99 Then the command succeeds 100 And the command outputs text matching 101 """ 102 project 103 104 """ 105 106 Scenario: Use plush helpers when rendering 107 Given file ./Oyafile containing 108 """ 109 Project: project 110 111 Values: 112 arr: 113 - 1 114 - 2 115 - 3 116 117 foo: | 118 oya render template.txt 119 """ 120 And file ./template.txt containing 121 """ 122 <%= Len("box") %> 123 """ 124 When I run "oya run foo" 125 Then the command succeeds 126 And file ./template.txt contains 127 """ 128 3 129 """ 130 131 Scenario: Use sprig functions when rendering (http://masterminds.github.io/sprig) 132 Given file ./Oyafile containing 133 """ 134 Project: project 135 136 Values: 137 arr: 138 - 1 139 - 2 140 - 3 141 142 foo: | 143 oya render template.txt 144 """ 145 And file ./template.txt containing 146 """ 147 <%= Upper(Join(", ", arr)) %> 148 """ 149 When I run "oya run foo bar baz qux" 150 Then the command succeeds 151 And file ./template.txt contains 152 """ 153 1, 2, 3 154 """ 155 156 Scenario: Use imported pack alias in pack's tasks 157 Given file ./Oyafile containing 158 """ 159 Project: project 160 161 Require: 162 github.com/test/foo: v0.0.1 163 164 Import: 165 foo: github.com/test/foo 166 """ 167 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 168 """ 169 bar: | 170 echo "${Oya[Import.Alias]}" 171 """ 172 When I run "oya run foo.bar" 173 Then the command succeeds 174 And the command outputs 175 """ 176 foo 177 178 """