github.com/bilus/oya@v0.0.3-0.20190301162104-da4acbd394c6/features/builtins.feature (about) 1 Feature: Built-ins 2 3 Background: 4 Given I'm in project dir 5 6 Scenario: Run other tasks 7 Given file ./Oyafile containing 8 """ 9 Project: project 10 11 baz: | 12 echo "baz" 13 14 bar: | 15 echo "bar" 16 $Tasks.baz() 17 """ 18 When I run "oya run bar" 19 Then the command succeeds 20 And the command outputs to stdout 21 """ 22 bar 23 baz 24 25 """ 26 27 Scenario: Run pack's tasks 28 Given file ./Oyafile containing 29 """ 30 Project: project 31 32 Require: 33 github.com/test/foo: v0.0.1 34 35 Import: 36 foo: github.com/test/foo 37 """ 38 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 39 """ 40 bar: | 41 echo "bar" 42 $Tasks.baz() 43 44 baz: | 45 echo "baz" 46 """ 47 When I run "oya run foo.bar" 48 Then the command succeeds 49 And the command outputs to stdout 50 """ 51 bar 52 baz 53 54 """ 55 56 Scenario: Pack can only run its own tasks 57 Given file ./Oyafile containing 58 """ 59 Project: project 60 61 Require: 62 github.com/test/foo: v0.0.1 63 github.com/test/bar: v0.0.1 64 65 Import: 66 foo: github.com/test/foo 67 bar: github.com/test/bar 68 """ 69 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 70 """ 71 foo: | 72 echo "foo" 73 """ 74 And file ./.oya/packs/github.com/test/bar@v0.0.1/Oyafile containing 75 """ 76 bar: | 77 $Tasks.foo() 78 """ 79 When I run "oya run bar.bar" 80 Then the command fails with error matching 81 """" 82 .*variable not found.* 83 """" 84 85 Scenario: Access Oyafile base directory 86 Given file ./Oyafile containing 87 """ 88 Project: project 89 """ 90 And file ./subdir/Oyafile containing 91 """ 92 all: | 93 echo $BasePath 94 """ 95 When I run "oya run --recurse all" 96 Then the command succeeds 97 And the command outputs to stdout text matching 98 """ 99 ^.*subdir 100 101 """ 102 103 Scenario: Access pack base directory 104 Given file ./Oyafile containing 105 """ 106 Project: project 107 108 Require: 109 github.com/test/foo: v0.0.1 110 111 Import: 112 foo: github.com/test/foo 113 """ 114 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 115 """ 116 all: | 117 echo $BasePath 118 """ 119 When I run "oya run foo.all" 120 Then the command succeeds 121 And the command outputs to stdout text matching 122 """ 123 ^.*github.com/test/foo@v0.0.1 124 125 """ 126 127 Scenario: Access Oyafile Project name 128 Given file ./Oyafile containing 129 """ 130 Project: project 131 132 all: | 133 echo $Project 134 """ 135 When I run "oya run all" 136 Then the command succeeds 137 And the command outputs to stdout text matching 138 """ 139 project 140 141 """ 142 143 Scenario: Access Oyafile Project name in nested dir 144 Given file ./Oyafile containing 145 """ 146 Project: project 147 """ 148 And file ./subdir/Oyafile containing 149 """ 150 all: | 151 echo $Project 152 """ 153 When I run "oya run --recurse all" 154 Then the command succeeds 155 And the command outputs to stdout text matching 156 """ 157 project 158 159 """ 160 161 Scenario: Access Oyafile Project name inside pack 162 Given file ./Oyafile containing 163 """ 164 Project: project 165 166 Require: 167 github.com/test/foo: v0.0.1 168 169 Import: 170 foo: github.com/test/foo 171 """ 172 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 173 """ 174 all: | 175 echo $Project 176 """ 177 When I run "oya run foo.all" 178 Then the command succeeds 179 And the command outputs to stdout text matching 180 """ 181 project 182 183 """ 184 185 Scenario: Run render 186 Given file ./Oyafile containing 187 """ 188 Project: project 189 Values: 190 foo: bar 191 192 all: | 193 $Render("./templates/file.txt") 194 """ 195 And file ./templates/file.txt containing 196 """ 197 $foo 198 """ 199 When I run "oya run all" 200 Then the command succeeds 201 And file ./file.txt contains 202 """ 203 bar 204 """ 205 206 Scenario: Run render in alias scope can access variables directly 207 Given file ./Oyafile containing 208 """ 209 Project: project 210 211 Import: 212 foo: github.com/test/foo 213 214 Require: 215 github.com/test/foo: v1.0.0 216 217 Values: 218 foo: 219 other: banana 220 """ 221 And file ./.oya/packs/github.com/test/foo@v1.0.0/Oyafile containing 222 """ 223 Values: 224 foo: bar 225 226 all: | 227 $Render("$BasePath/templates/file.txt") 228 """ 229 And file ./.oya/packs/github.com/test/foo@v1.0.0/templates/file.txt containing 230 """ 231 $foo 232 $other 233 """ 234 When I run "oya run foo.all" 235 Then the command succeeds 236 And file ./file.txt contains 237 """ 238 bar 239 banana 240 """ 241 242 Scenario: Use sprig functions (http://masterminds.github.io/sprig) 243 Given file ./Oyafile containing 244 """ 245 Project: project 246 247 foo: | 248 echo $Upper(Join(" ", Args)) 249 """ 250 When I run "oya run foo bar baz qux" 251 Then the command succeeds 252 And the command outputs to stdout 253 """ 254 BAR BAZ QUX 255 256 """