ku1ik / rainbow

Ruby gem for colorizing printed text on ANSI terminals
MIT License
813 stars 68 forks source link

Use `git ls-files -z` in gemspec #96

Closed pocke closed 4 years ago

pocke commented 4 years ago

Currently, the gemspec has a warning about $INPUT_RECORD_SEPARATOR.

$ bundle exec ruby -w -rrainbow -e 
/home/pocke/ghq/github.com/sickill/rainbow/rainbow.gemspec:18: warning: global variable `$INPUT_RECORD_SEPARATOR' not initialized

This pull request suppresses the warning. I think using -z option and split("\x0") is better than the current. bundle gem's boilerplate also has the style.


RuboCop's new cop added an offense. And I got warnings about .rubocop.yml. So this pull request also suppresses the warning.

olleolleolle commented 4 years ago

We could:

Example in IRB:

image
olleolleolle commented 4 years ago

We can also simplify away the git need:

spec.files = Dir['lib/**/*.rb'] + %w[Changelog.md README.markdown LICENSE]
pocke commented 4 years ago

Yes, $INPUT_RECORD_SEPARATOR is an alias of $/ and added by English.

I think -z is more appropriate than using $/ or the aliases. Because -z treats file path that contains newlines.

Bundler also has been changed from $/ to -z. https://github.com/bundler/bundler/commit/ec9165fdffe63f6d5a8b2a9a302252ec1116618c#diff-bfb3596c9458be429d82bf6b31f82364L16

However, we probably never add a file that contains a newline. But I think -z is the new standard style of gemspec, so we can follow it.

By the way, Dir['lib/**/*.rb'] seems reasonable. But I usually do not see this style in gemspec, so it's possible to have any problems. I guess it probably works well.

Thanks for your comment!

olleolleolle commented 4 years ago

Superseded by #97 - thanks for raising this issue, @pocke - and for fixing the RuboCop build failures! 🍏 💚 GREEN AGAIN!

olleolleolle commented 4 years ago

Am closing this with a thanks!

pocke commented 4 years ago

Thanks!