15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/greenhouse/commands/new.rb', line 15
def run
if arguments.length == 0
usage
exit 1
end
projects_directory = arguments.first.key
if File.exists?(projects_directory)
STDERR.puts "Directory already exists: #{projects_directory}"
STDERR.puts "You can try running `#{::Greenhouse::CLI::binary} init` from inside the directory."
exit 1
end
begin
FileUtils.mkdir(projects_directory)
rescue
STDERR.puts "Unable to create projects directory: #{projects_directory}"
exit 1
end
exec "cd #{projects_directory}; #{::Greenhouse::CLI::binary} init"
end
|