1+ # Makefile for try - Fresh directories for every vibe
2+
3+ SHELL := /bin/bash
4+ RUBY := ruby
5+ SCRIPT := try.rb
6+ TEST_DIR := tests
7+
8+ # Default target
9+ .PHONY : help
10+ help : # # Show this help message
11+ @echo " try - Fresh directories for every vibe"
12+ @echo " "
13+ @echo " Available targets:"
14+ @grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | sort | awk ' BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
15+
16+ .PHONY : test
17+ test : # # Run all tests
18+ @echo " Running tests..."
19+ cd $(TEST_DIR ) && $(RUBY ) -I.. -e " require 'rake'; load 'Rakefile'; Rake::Task['test'].invoke"
20+
21+ .PHONY : test-pr
22+ test-pr : # # Run only PR command tests
23+ @echo " Running PR command tests..."
24+ $(RUBY ) $(TEST_DIR ) /test_pr_command.rb
25+
26+ .PHONY : lint
27+ lint : # # Check Ruby syntax
28+ @echo " Checking Ruby syntax..."
29+ $(RUBY ) -c $(SCRIPT )
30+ @for file in $(TEST_DIR ) /test_* .rb; do \
31+ echo " Checking $$ file..." ; \
32+ $(RUBY ) -c " $$ file" ; \
33+ done
34+
35+ .PHONY : install
36+ install : # # Install try.rb to ~/.local/
37+ @echo " Installing $( SCRIPT) to ~/.local/..."
38+ @mkdir -p ~ /.local
39+ @cp $(SCRIPT ) ~ /.local/
40+ @chmod +x ~ /.local/$(SCRIPT )
41+ @echo " Installed! Add to your shell:"
42+ @echo " eval \"\$ $( ~/.local/$( SCRIPT) init ~ /src/tries) \" "
43+
44+ .PHONY : install-global
45+ install-global : # # Install try.rb to /usr/local/bin/
46+ @echo " Installing $( SCRIPT) to /usr/local/bin/..."
47+ @sudo cp $(SCRIPT ) /usr/local/bin/try
48+ @sudo chmod +x /usr/local/bin/try
49+ @echo " Installed globally! Add to your shell:"
50+ @echo " eval \"\$ $( try init ~ /src/tries) \" "
51+
52+ .PHONY : demo
53+ demo : # # Show example commands
54+ @echo " try - Example commands:"
55+ @echo " "
56+ @echo " Basic usage:"
57+ @echo " ./$( SCRIPT) --help # Show help"
58+ @echo " ./$( SCRIPT) init ~/src/tries # Generate shell integration"
59+ @echo " "
60+ @echo " Clone repositories:"
61+ @echo " ./$( SCRIPT) clone https://github.com/user/repo.git"
62+ @echo " ./$( SCRIPT) clone git@github.com:user/repo.git my-fork"
63+ @echo " "
64+ @echo " Work with PRs:"
65+ @echo " ./$( SCRIPT) pr 123 # PR from current repo"
66+ @echo " ./$( SCRIPT) pr user/repo#456 # PR from specific repo"
67+ @echo " ./$( SCRIPT) pr https://github.com/user/repo/pull/789"
68+ @echo " "
69+ @echo " Worktrees:"
70+ @echo " ./$( SCRIPT) worktree dir # From current repo"
71+ @echo " ./$( SCRIPT) worktree ~/path/to/repo my-branch # From specific repo"
72+
73+ .PHONY : version
74+ version : # # Show version information
75+ @echo " try.rb - Fresh directories for every vibe"
76+ @echo " Ruby version: $$ ($( RUBY) --version)"
77+ @echo " Script: $( SCRIPT) "
78+
79+ .PHONY : clean
80+ clean : # # Clean up temporary files
81+ @echo " Cleaning up..."
82+ @find . -name " *.tmp" -delete
83+ @find . -name " *~" -delete
84+ @echo " Clean complete"
85+
86+ .PHONY : check-deps
87+ check-deps : # # Check for required dependencies
88+ @echo " Checking dependencies..."
89+ @command -v $(RUBY ) > /dev/null 2>&1 || { echo " Ruby is required but not installed" ; exit 1; }
90+ @echo " ✓ Ruby found: $$ ($( RUBY) --version)"
91+ @command -v git > /dev/null 2>&1 || { echo " Git is required but not installed" ; exit 1; }
92+ @echo " ✓ Git found: $$ (git --version)"
93+ @command -v gh > /dev/null 2>&1 && echo " ✓ GitHub CLI found: $$ (gh --version | head -1)" || echo " ! GitHub CLI not found (optional for PR features)"
94+ @echo " Dependencies check complete"
95+
96+ .PHONY : dev-setup
97+ dev-setup : check-deps # # Set up development environment
98+ @echo " Setting up development environment..."
99+ @echo " All dependencies satisfied"
100+ @echo " "
101+ @echo " To test locally:"
102+ @echo " make test"
103+ @echo " "
104+ @echo " To install locally:"
105+ @echo " make install"
106+
107+ .PHONY : all
108+ all : lint test # # Run all checks and tests
109+
110+ # Development shortcuts
111+ .PHONY : t
112+ t : test # # Shortcut for test
113+
114+ .PHONY : l
115+ l : lint # # Shortcut for lint
116+
117+ .PHONY : i
118+ i : install # # Shortcut for install
0 commit comments