-
Notifications
You must be signed in to change notification settings - Fork 553
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
Fix global config load #311
Conversation
global_config_path = File.join(File.expand_path("~"), '.simplecov') | ||
load global_config_path if File.exist?(global_config_path) | ||
if ENV['HOME'] | ||
global_config_path = File.join(File.expand_path("~"), '.simplecov') |
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 is linux specific. I wonder what the behavior would be on windows. There is also an etc library that can give the home directory is the USER is either set or passed in. I think it can even check the passwd file.
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.
Ok, thanks for noticing. I will try to create something cross-OS.
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.
Actually, I think I spoke too soon, as the '~' as pre-existing. I do think there should be a more general solution.
require 'etc'
home_dir = Dir.home || Etc.getpwuid.dir || (user = ENV["USER"] && Dir.home(user))
Thanks. And sorry for not looking into this myself. |
No problem.. I actually remembered it from a RubyTapas episode... |
0.9.1, 2014-09-21 ([changes](simplecov-ruby/simplecov@v0.9.0...v0.9.1)) ==================== ## Bugfixes * In 0.9.0, we introduced a regression that made SimpleCov no-op mode fail on Ruby 1.8, while dropping 1.8 support altogether is announced only for v1.0. This has been fixed. See [#333](simplecov-ruby/simplecov#333) (thanks (@sferik) 0.9.0, 2014-07-17 ([changes](simplecov-ruby/simplecov@v0.8.2...v0.9.0)) ==================== **A warm welcome and big thank you to the new contributors [@xaviershay](https://github.com/xaviershay), [@sferik](https://github.com/sferik) and especially [@bf4](https://github.com/bf4) for tackling a whole lot of issues and pull requests for this release!** ## Enhancements * New interface to specify multiple formatters. See [#317](simplecov-ruby/simplecov#317) (thanks @sferik) * Document in the README how to exclude code from coverage reports, and that the feature shouldn't be abused for skipping untested private code. See [#304](simplecov-ruby/simplecov#304) * Clarify Ruby version support. See [#279](simplecov-ruby/simplecov#279) (thanks @deivid-rodriguez) ## Bugfixes * Ensure calculations return Floats, not Fixnum or Rational. Fixes segfaults with mathn. See [#245](simplecov-ruby/simplecov#245) (thanks to @bf4) * Using `Kernel.exit` instead of exit to avoid uncaught throw :IRB_EXIT when exiting irb sessions. See [#287](simplecov-ruby/simplecov#287) (thanks @wless1) See [#285](simplecov-ruby/simplecov#285) * Does not look for .simplecov in ~/ when $HOME is not set. See [#311](simplecov-ruby/simplecov#311) (thanks @lasseebert) * Exit with code only if it's Numeric > 0. See [#302](simplecov-ruby/simplecov#303 @hajder) * Make default filter case insensitive. See [#280](simplecov-ruby/simplecov#280) (thanks @ryanatball) * Improve regexp that matches functional tests. See [#276](simplecov-ruby/simplecov#276) (thanks @sferik) * Fix TravisCI [#272](simplecov-ruby/simplecov#272) [#278](simplecov-ruby/simplecov#278), [#302](simplecov-ruby/simplecov#302) * Fix global config load. See [#311](simplecov-ruby/simplecov#311) (thanks @lasseebert)
This fix prevents an error when
$HOME
is not set in the build environment. (Then~
can not be expanded)I'm not sure how to write a unit test for this, so I didn't. Tried to use the branch on environments with and without
$HOME
, which worked as expected.