Skip to content

Commit 99c6084

Browse files
committed
Revert "Develop (#15)"
This reverts commit 8ac0cfe.
1 parent 8ac0cfe commit 99c6084

7 files changed

Lines changed: 42 additions & 1154 deletions

File tree

install.sh

Lines changed: 14 additions & 257 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,9 @@ set -e
66
echo "🚀 Installing Syncable IaC CLI..."
77
echo ""
88

9-
# Color codes for better output
10-
RED='\033[0;31m'
11-
GREEN='\033[0;32m'
12-
YELLOW='\033[1;33m'
13-
BLUE='\033[0;34m'
14-
NC='\033[0m' # No Color
15-
16-
# Helper functions
17-
print_success() {
18-
echo -e "${GREEN}$1${NC}"
19-
}
20-
21-
print_warning() {
22-
echo -e "${YELLOW}⚠️ $1${NC}"
23-
}
24-
25-
print_error() {
26-
echo -e "${RED}$1${NC}"
27-
}
28-
29-
print_info() {
30-
echo -e "${BLUE}ℹ️ $1${NC}"
31-
}
32-
33-
print_step() {
34-
echo -e "${BLUE}🔧 $1${NC}"
35-
}
36-
379
# Check if Rust is installed
3810
if ! command -v cargo &> /dev/null; then
39-
print_error "Rust is not installed. Please install Rust first:"
11+
echo "Rust is not installed. Please install Rust first:"
4012
echo " curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh"
4113
exit 1
4214
fi
@@ -46,250 +18,35 @@ RUST_VERSION=$(rustc --version | cut -d' ' -f2)
4618
MIN_VERSION="1.70.0"
4719

4820
if [ "$(printf '%s\n' "$MIN_VERSION" "$RUST_VERSION" | sort -V | head -n1)" != "$MIN_VERSION" ]; then
49-
print_error "Rust version $RUST_VERSION is too old. Please update to at least $MIN_VERSION"
21+
echo "Rust version $RUST_VERSION is too old. Please update to at least $MIN_VERSION"
5022
echo " rustup update"
5123
exit 1
5224
fi
5325

54-
print_success "Rust $RUST_VERSION detected"
26+
echo "Rust $RUST_VERSION detected"
5527
echo ""
5628

5729
# Clone repository if not already in it
5830
if [ ! -f "Cargo.toml" ] || [ ! -d "src" ]; then
59-
print_step "Cloning Syncable CLI repository..."
60-
git clone https://github.com/syncable-dev/syncable-cli.git
31+
echo "📦 Cloning Syncable CLI repository..."
32+
git clone https://github.com/yourusername/syncable-cli.git
6133
cd syncable-cli
6234
fi
6335

64-
print_step "Building Syncable CLI (this may take a few minutes)..."
36+
echo "🔨 Building Syncable CLI (this may take a few minutes)..."
6537
cargo build --release
6638

6739
echo ""
68-
print_step "Installing Syncable CLI..."
40+
echo "📦 Installing Syncable CLI..."
6941
cargo install --path .
7042

7143
echo ""
72-
print_success "Syncable CLI installed successfully!"
73-
74-
# Now install vulnerability scanning tools
75-
echo ""
76-
echo "🛡️ Setting up vulnerability scanning tools..."
77-
echo "================================================"
78-
79-
# Function to check if a command exists
80-
command_exists() {
81-
command -v "$1" >/dev/null 2>&1
82-
}
83-
84-
# Function to install tools based on platform
85-
install_vulnerability_tools() {
86-
print_step "Checking and installing vulnerability scanning tools..."
87-
88-
# 1. Rust - cargo-audit
89-
if command_exists cargo; then
90-
if ! cargo audit --version >/dev/null 2>&1; then
91-
print_step "Installing cargo-audit for Rust vulnerability scanning..."
92-
if cargo install cargo-audit; then
93-
print_success "cargo-audit installed"
94-
else
95-
print_warning "Failed to install cargo-audit"
96-
fi
97-
else
98-
print_success "cargo-audit already installed"
99-
fi
100-
fi
101-
102-
# 2. Node.js/JavaScript - npm (comes with Node.js)
103-
if command_exists npm; then
104-
print_success "npm detected (Node.js vulnerability scanning available)"
105-
else
106-
print_warning "npm not found. Install Node.js for JavaScript/TypeScript vulnerability scanning:"
107-
echo " • Download from: https://nodejs.org/"
108-
echo " • Or use package manager:"
109-
echo " - macOS: brew install node"
110-
echo " - Ubuntu/Debian: sudo apt install nodejs npm"
111-
echo " - CentOS/RHEL: sudo yum install nodejs npm"
112-
fi
113-
114-
# 3. Python - pip-audit
115-
if command_exists python3 || command_exists python; then
116-
if ! command_exists pip-audit; then
117-
print_step "Installing pip-audit for Python vulnerability scanning..."
118-
119-
# Try different installation methods
120-
if command_exists pipx; then
121-
if pipx install pip-audit; then
122-
print_success "pip-audit installed via pipx"
123-
fi
124-
elif command_exists pip3; then
125-
if pip3 install --user pip-audit; then
126-
print_success "pip-audit installed via pip3"
127-
fi
128-
elif command_exists pip; then
129-
if pip install --user pip-audit; then
130-
print_success "pip-audit installed via pip"
131-
fi
132-
else
133-
print_warning "Could not install pip-audit automatically. Install manually:"
134-
echo " • pipx install pip-audit (recommended)"
135-
echo " • pip3 install --user pip-audit"
136-
fi
137-
else
138-
print_success "pip-audit already installed"
139-
fi
140-
else
141-
print_warning "Python not found. Install Python for Python vulnerability scanning:"
142-
echo " • Download from: https://python.org/"
143-
echo " • Or use package manager:"
144-
echo " - macOS: brew install python"
145-
echo " - Ubuntu/Debian: sudo apt install python3 python3-pip"
146-
fi
147-
148-
# 4. Go - govulncheck
149-
if command_exists go; then
150-
if ! command_exists govulncheck && ! test -f "$HOME/go/bin/govulncheck"; then
151-
print_step "Installing govulncheck for Go vulnerability scanning..."
152-
if go install golang.org/x/vuln/cmd/govulncheck@latest; then
153-
print_success "govulncheck installed"
154-
print_info "Make sure ~/go/bin is in your PATH"
155-
else
156-
print_warning "Failed to install govulncheck"
157-
fi
158-
else
159-
print_success "govulncheck already installed"
160-
fi
161-
else
162-
print_warning "Go not found. Install Go for Go vulnerability scanning:"
163-
echo " • Download from: https://golang.org/"
164-
echo " • Or use package manager:"
165-
echo " - macOS: brew install go"
166-
echo " - Ubuntu/Debian: sudo apt install golang-go"
167-
fi
168-
169-
# 5. Java/Kotlin - grype (universal vulnerability scanner)
170-
if ! command_exists grype && ! test -f "$HOME/.local/bin/grype"; then
171-
print_step "Installing grype for universal vulnerability scanning (Java, containers, etc.)..."
172-
173-
case "$(uname -s)" in
174-
Darwin) # macOS
175-
if command_exists brew; then
176-
if brew install anchore/grype/grype; then
177-
print_success "grype installed via Homebrew"
178-
else
179-
install_grype_manually
180-
fi
181-
else
182-
install_grype_manually
183-
fi
184-
;;
185-
Linux)
186-
install_grype_manually
187-
;;
188-
*)
189-
print_warning "Platform not supported for automatic grype installation"
190-
print_info "Please install grype manually: https://github.com/anchore/grype"
191-
;;
192-
esac
193-
else
194-
print_success "grype already installed"
195-
fi
196-
}
197-
198-
# Function to manually install grype
199-
install_grype_manually() {
200-
print_step "Installing grype manually..."
201-
202-
# Create local bin directory
203-
mkdir -p "$HOME/.local/bin"
204-
205-
# Detect platform
206-
case "$(uname -s)" in
207-
Darwin)
208-
case "$(uname -m)" in
209-
x86_64) PLATFORM="darwin_amd64" ;;
210-
arm64|aarch64) PLATFORM="darwin_arm64" ;;
211-
*)
212-
print_warning "Unsupported macOS architecture"
213-
return 1
214-
;;
215-
esac
216-
;;
217-
Linux)
218-
case "$(uname -m)" in
219-
x86_64) PLATFORM="linux_amd64" ;;
220-
aarch64|arm64) PLATFORM="linux_arm64" ;;
221-
*)
222-
print_warning "Unsupported Linux architecture"
223-
return 1
224-
;;
225-
esac
226-
;;
227-
*)
228-
print_warning "Unsupported operating system"
229-
return 1
230-
;;
231-
esac
232-
233-
# Download and install
234-
VERSION="0.92.2"
235-
URL="https://github.com/anchore/grype/releases/download/v${VERSION}/grype_${VERSION}_${PLATFORM}.tar.gz"
236-
237-
if command_exists curl; then
238-
print_info "Downloading grype v${VERSION} for ${PLATFORM}..."
239-
if curl -L "$URL" | tar -xz -C "$HOME/.local/bin" grype; then
240-
chmod +x "$HOME/.local/bin/grype"
241-
print_success "grype installed to ~/.local/bin/grype"
242-
print_info "Make sure ~/.local/bin is in your PATH"
243-
else
244-
print_warning "Failed to download grype automatically"
245-
print_info "Please install manually: https://github.com/anchore/grype#installation"
246-
fi
247-
else
248-
print_warning "curl not found. Please install grype manually: https://github.com/anchore/grype#installation"
249-
fi
250-
}
251-
252-
# Install vulnerability scanning tools
253-
install_vulnerability_tools
254-
44+
echo "✅ Installation complete!"
25545
echo ""
256-
echo "🎯 Installation Complete!"
257-
echo "========================"
258-
print_success "Syncable CLI is ready to use!"
259-
260-
echo ""
261-
echo "📚 Quick Start Guide:"
262-
echo " sync-ctl --help # Show all commands"
263-
echo " sync-ctl analyze . # Analyze current directory"
264-
echo " sync-ctl generate . # Generate IaC files"
265-
echo " sync-ctl vuln-check . # Check for vulnerabilities"
266-
echo " sync-ctl security-scan . # Comprehensive security analysis"
267-
268-
echo ""
269-
echo "🔧 Environment Setup:"
270-
271-
# Check if common directories are in PATH
272-
PATH_ADDITIONS=""
273-
if [ -d "$HOME/.local/bin" ] && [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
274-
PATH_ADDITIONS="$PATH_ADDITIONS$HOME/.local/bin:"
275-
fi
276-
if [ -d "$HOME/go/bin" ] && [[ ":$PATH:" != *":$HOME/go/bin:"* ]]; then
277-
PATH_ADDITIONS="$PATH_ADDITIONS$HOME/go/bin:"
278-
fi
279-
280-
if [ -n "$PATH_ADDITIONS" ]; then
281-
print_warning "Some tools may not be in your PATH. Add these to your shell profile:"
282-
echo " export PATH=\"${PATH_ADDITIONS%:}:\$PATH\""
283-
echo ""
284-
echo "For current session, run:"
285-
echo " export PATH=\"${PATH_ADDITIONS%:}:\$PATH\""
286-
fi
287-
288-
echo ""
289-
print_info "For more information and examples, see:"
290-
echo " • README.md - General usage and examples"
291-
echo " • CONTRIBUTING.md - Development guide"
292-
echo " • https://github.com/syncable-dev/syncable-cli"
293-
46+
echo "🎯 Quick Start:"
47+
echo " sync-ctl --help # Show help"
48+
echo " sync-ctl analyze . # Analyze current directory"
49+
echo " sync-ctl vuln-check . # Check for vulnerabilities"
29450
echo ""
295-
print_success "Happy coding! 🚀"
51+
echo "📚 For more information, see TUTORIAL.md"
52+
echo ""

0 commit comments

Comments
 (0)