-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblueprint
More file actions
executable file
·36 lines (29 loc) · 823 Bytes
/
blueprint
File metadata and controls
executable file
·36 lines (29 loc) · 823 Bytes
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
#!/usr/bin/env ruby
#
# Blueprints
# Usage: bp react my-new-react-app
#
#
BLUEPRINTS = {
bun: "bun",
react: "git@gitlab.com:monkeychai/blueprints/react-starter.git",
"laravel-react" => "git@gitlab.com:monkeychai/blueprints/laravel-react.git"
}
target, dest = ARGV
# Abort with error message and provide available options
def abort(msg)
puts "ERROR: #{msg}"
puts " [#{BLUEPRINTS.keys.join(', ')}]"
exit 1
end
abort "Please specify a blueprint:" if target.nil?
dest = "project-#{target}" if dest.nil?
blueprint = BLUEPRINTS[target] || BLUEPRINTS[target.to_sym]
abort "Unknown blueprint '#{target}'" if blueprint.nil?
if blueprint == "bun"
%x(bun create monkeychai/bun-api #{dest})
%x(bun run #{dest}/bin/setup.ts run #{dest})
else
# Clone the blueprint
%x(git clone #{blueprint} #{dest})
end