# [Ruby], <s>126</s> 124 bytes

Saved 2 bytes by changing output colours from `ABCEFG` to `123456`

<!-- language-all: lang-ruby -->

    ->n{a=($/+?.*w=n.size*4)*w
    a[q=w*w/2]=?2
    c=[1,2,3]
    n.map{|i|c[j=i/2,2]=c[j+1]*s= ~0**i,-c[j]*s
    a[q+=s+j*w*s]="#{c[1]%7}"}
    a}

[Try it online!][TIO-le1c75cu]

[Ruby]: https://www.ruby-lang.org/
[TIO-le1c75cu]: https://tio.run/##TYzdCoJAFITv9ynECurs@rcGXZ18kOVcbJKwQmJtspTaq28aQjIMzHwM8@guL1@hj85Nr3G/TXgRg8MmtuZ9heMBHNPqjg5cIgkLyUpUmZAiJ9bEN932gxlKVaNJpJgGU@QZgcXgkwIYEU1gqvMHR8trcGAJw01fqox2pzEcmR592z1tUCmVikVE7M@k@HnFZpKvei4WEfkv "Ruby – Try It Online"

Takes an array of numbers `0,1,2,3` corresponding to `E,W,S,N` or equivalently `x+=1,x-=1, z+=1,z-=1`. Outputs the path of the cube traced on a string of `w*w` periods, where `w` is four times the length of the input. 

The cube is represented as a vector `c=[x,y,z]` starting at `[1,2,3]` which rolls in the `xz` plane. The colour is determined by the current `y` coordinate. If the cube is rotated 180 degrees, the y coordinate becomes negative, so the possible values are `-3,-2,-1,1,2,3` with opposite faces adding to zero. To display, the number is taken mod 7 and this is converted to a character, so the possible displayed colours are `1,2,3,4,5,6`

The vector is rotated by 90 degrees by swapping two coordinates and changing the sign of one of them, similar to Arnauld's answer, but where he uses an array, I use the formula `c[j,2]=c[j+1]*s,-c[j]*s` where `c[j,2]` is a block of 2 array elements starting at `j`=0 or 1 and `s` is the sign of the rotation, +1 or -1.

**Commented code**

    ->n{a=($/+?.*w=n.size*4)*w            #make a string of w*w periods separated in lines by /n 
    a[q=w*w/2]=?2                         #set q to the centre of the field (padding by the /n characters ensures w*w/2 is central horizontally as well as vertically)
    c=[1,2,3]                             #put a 2 at position q. Set up a vector c for colours x,y,z
    n.map{|i|                             #iterate through array of directions. j=1 for vertical, 0 for horizontal. s=1 for increase, -1 for decrease
    c[j=i/2,2]=c[j+1]*s= ~0**i,-c[j]*s    #in accordance with value of j, swap c[0]&c[1] or c[1]&c[2] and change the sign of one in accordance with s
    a[q+=s+j*w*s]="#{c[1]%7}"}            #modify the value of q by s (horizontal) or (1+w)s (vertical) and save colour%7 at a[q]
    a}                                    #return the final string a. 


# [Ruby], 131 bytes

Version with 2D array is slightly longer due to clumsy 2D array initialization in Ruby.

<!-- language-all: lang-ruby -->

    ->n{a=(0..w=n.size*4).map{[0]*w}
    c=[1,a[z=x=w/2][x]=2,3]
    n.map{|i|c[j=i/2,2]=c[j+1]*s= ~0**i,-c[j]*s
    a[z+=s*j][x+=s-s*j]=c[1]%7}
    a}

[Try it online!][TIO-le0qhmga]

[Ruby]: https://www.ruby-lang.org/
[TIO-le0qhmga]: https://tio.run/##dYzBCoMwDIbvfQovg63WWutgp@xFSg6dTKgwkXVSp3av3lVxhx3kJ@RPvvx59rd3qCFk13bScBScO2i5NeOdnk/8obtJCaTOkwpUwbQaYQCXS1QDgmQlknY9ms1cqQZMLplEiDYtkFpIPoJSw7K4iCOJ8RQsbWI69mxx8bbAw8UT7UOtlGCbEH9/u8R40vUvS1Yu2Vo7fKHlDivZpn8evg "Ruby – Try It Online"