Skip to content
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

Closed
wants to merge 7 commits into from
Closed

Add tests for New command #825

wants to merge 7 commits into from

Conversation

dnlgrv
Copy link

@dnlgrv dnlgrv commented Feb 27, 2013

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.

@dnlgrv dnlgrv mentioned this pull request Feb 27, 2013
3 tasks
args_joined = args.join(" ")

if args_joined.empty?
puts "You must provide a path."
Copy link
Member

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.

Copy link
Member

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)
...

Copy link
Author

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.

@parkr
Copy link
Member

parkr commented Mar 12, 2013

Went with the refactor in #851, but love the tests. Thanks! Added those in b306835 under your name :)

@parkr parkr closed this Mar 12, 2013
@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants