-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
128 lines (111 loc) · 3.42 KB
/
Makefile
File metadata and controls
128 lines (111 loc) · 3.42 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# TUS Client Makefile
.PHONY: build test test-short test-verbose test-coverage clean deps help install run-example
# Build the TUS client
build:
go build -o tusc main.go
# Install dependencies
deps:
go mod tidy
go mod download
# Run all tests
test:
go test -v ./...
# Run quick tests only
test-short:
go test -short -v ./...
# Run tests with verbose output
test-verbose:
go test -v -count=1 ./...
# Run tests with coverage
test-coverage:
go test -v -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Clean build artifacts and test files
clean:
rm -f tusc tusc-v2
rm -f coverage.out coverage.html
rm -f .tusc_v2_*.json
rm -f tusc_test_*.txt
# Install the binary to GOPATH/bin
install: build
go install
# Run example upload (requires TUS server)
run-example:
@echo "Example usage commands:"
@echo ""
@echo "1. Build the client:"
@echo " make build"
@echo ""
@echo "2. Show server options:"
@echo " ./tusc -t http://localhost:1080/files options"
@echo ""
@echo "3. Upload a file:"
@echo " ./tusc -t http://localhost:1080/files upload test.txt"
@echo ""
@echo "4. Upload with verbose output:"
@echo " ./tusc -t http://localhost:1080/files --verbose upload large_file.dat"
@echo ""
@echo "5. Upload with custom headers:"
@echo " ./tusc -t http://localhost:1080/files -H 'Authorization:Bearer token' upload file.txt"
@echo ""
@echo "6. Using environment variables:"
@echo " export TUSC_ENDPOINT=http://localhost:1080/files"
@echo " export TUSC_CHUNK_SIZE=4"
@echo " ./tusc upload file.txt"
# Compare v1 vs current version
compare:
@echo "TUS CLI v1 vs Current Version Comparison:"
@echo ""
@echo "v1 Features (in v1/ folder):"
@echo " - Custom HTTP implementation"
@echo " - Manual state management"
@echo " - Complex file hashing"
@echo " - Concurrent upload detection"
@echo " - Custom retry logic"
@echo ""
@echo "Current Version Features:"
@echo " - Official TUS Go client library"
@echo " - Built-in state management"
@echo " - Simplified codebase"
@echo " - urfave/cli framework"
@echo " - Automatic resumable uploads"
@echo ""
@echo "Benefits:"
@echo " - ~70% less code"
@echo " - More reliable (uses official library)"
@echo " - Better error handling"
@echo " - Cleaner architecture"
@echo " - Easier to maintain"
# Development helpers
dev-setup: deps
go mod verify
# Lint the code (requires golangci-lint)
lint:
golangci-lint run
# Format the code
fmt:
go fmt ./...
# Vet the code
vet:
go vet ./...
# Run all quality checks
check: fmt vet lint test
help:
@echo "Available targets:"
@echo " build - Build the TUS client v2 binary"
@echo " deps - Install and tidy dependencies"
@echo " test - Run all tests"
@echo " test-short - Run quick tests only"
@echo " test-verbose - Run tests with verbose output"
@echo " test-coverage - Run tests with coverage report"
@echo " clean - Clean build artifacts and test files"
@echo " install - Install binary to GOPATH/bin"
@echo " run-example - Show usage examples"
@echo " compare - Compare v1 vs v2 features"
@echo " dev-setup - Set up development environment"
@echo " lint - Lint the code"
@echo " fmt - Format the code"
@echo " vet - Vet the code"
@echo " check - Run all quality checks"
@echo " help - Show this help message"