-
Notifications
You must be signed in to change notification settings - Fork 176
/
Copy pathTiltfile
79 lines (72 loc) · 2.71 KB
/
Tiltfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
os.putenv('TILT_GIT_RESOURCE_CHECKOUT_DIR', os.path.abspath('./.git-sources'))
load('../Tiltfile', 'git_checkout', 'deploy_from_dir')
symbols = load_dynamic('../Tiltfile')
def _case(input, url, repo, tree):
return (input, (url, repo, tree))
url_test_cases = [
_case(input='https://github.com/tilt-dev/tilt-example-html',
url='https://github.com/tilt-dev/tilt-example-html',
repo='tilt-example-html',
tree=''),
_case(input='git@example.com/path/to/repo',
url="git@example.com/path/to/repo",
repo="repo",
tree=""),
_case(input='git@example.com/path/to/repo.git',
url="git@example.com/path/to/repo.git",
repo="repo",
tree=""),
_case(input='git@example.com/path/to/repo.git@myRevisionSha',
url="git@example.com/path/to/repo.git",
repo="repo",
tree="@myRevisionSha"),
_case(input='git@example.com/path/to/repo.git#myBranchNameHere',
url="git@example.com/path/to/repo.git",
repo="repo",
tree="#myBranchNameHere"),
_case(input='git@example.com/path/to/repo.git#myBranch%23Name%40Here',
url="git@example.com/path/to/repo.git",
repo="repo",
tree="#myBranch#Name@Here"),
_case(input='https://user@example.com/path/repo.git',
url='https://user@example.com/path/repo.git',
repo='repo',
tree=''),
_case(input='ssh://user@example.com:54321/path/repo.git',
url='ssh://user@example.com:54321/path/repo.git',
repo='repo',
tree=''),
_case(input='https://user@example.com/path/repo.git@myRevisionSha',
url='https://user@example.com/path/repo.git',
repo='repo',
tree='@myRevisionSha'),
_case(input='https://user@example.com/path/repo.git@my%23Revision%40Sha',
url='https://user@example.com/path/repo.git',
repo='repo',
tree='@my#Revision@Sha'),
]
if os.name == 'nt':
url_test_cases.append(
_case(input='C:\\Path\\To\\repo',
url='C:\\Path\\To\\repo',
repo='repo',
tree=''),
)
else:
url_test_cases.append(
_case(input='/path/to/repo',
url='/path/to/repo',
repo='repo',
tree=''),
)
for case in url_test_cases:
(url, expected) = case
parse_repository_url = symbols['_parse_repository_url']
actual = parse_repository_url(url)
if expected != actual:
fail('_parse_repository_url("%s"). Expected: %s. Actual: %s' % (url, expected, actual))
repo_dir = git_checkout('https://github.com/tilt-dev/tilt-example-html')
example_dir = os.path.join(repo_dir, '0-base')
deploy_from_dir('example-html', example_dir)
if not os.path.exists('./.git-sources/tilt-example-html'):
fail('tilt-example-html failed to load in the right directory')