Skip to content
This repository has been archived by the owner on Jul 17, 2018. It is now read-only.

Remove unnecessary directory changing #71

Closed
aprescott opened this issue Mar 1, 2014 · 1 comment
Closed

Remove unnecessary directory changing #71

aprescott opened this issue Mar 1, 2014 · 1 comment

Comments

@aprescott
Copy link
Owner

Some parts of the code do FileUtils.cd:

# site.rb

def generate
  FileUtils.cd(@source_directory)
  # ...
end

This really shouldn't happen since it changes things for the entire running process meaning you have to be aware of what Dir.pwd is or you have to cd before doing anything relative.

Instead of cd(foo), work directly off foo in any paths.

This should also negate the acceptance test hack in spec_helper:

# TODO: Stop doing FileUtils.cd at runtime to avoid the need for this.
config.before :each do
  FileUtils.cd File.expand_path(File.join(__FILE__, "..", ".."))
end
@aprescott
Copy link
Owner Author

Dir#chdir with a block might make this easier.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant