-
-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for New command #825
Conversation
args_joined = args.join(" ") | ||
|
||
if args_joined.empty? | ||
puts "You must provide a path." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should raise an error or otherwise terminate the process and return an exit code other than 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd do something like
arg_string = args.join(" ")
raise ArgumentError, "You must specify a path." if arg_string.empty?
install_path = File.expand_path(arg_string, Dir.pwd)
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks good to me. I wasn't sure on whether raising an exception was desired behaviour - I'll update it.
Wrote some tests around the New command.
Fixed an issue where FileUtils.cp_r was copying all files in sub-directories into the new directory, rather than preserving directory structure. Changed it to just make a copy of the site template directory then delete the sample post.