RiotGames/artifact-cookbook — pull request #156 by florentdupont (2014-10-31 20:12:34+00:00)
Title: Multi-period (tar.gz) file extensions fix for extract_artifact!

Archives with multi-period extensions (like `tar.gz` for example) are not matched correctly by the `extract_artifact!` method.
The problem with the actual implementation is that `::File.extname()` for a multi-period filename extension doesn't extract all the part but only the last unique extension after the last `.`.
For instance : `foo.tar.gz` gets an extension `.gz` instead of `.tar.gz`.

The use of an heuristic is necessary to *guess* the real extension. This heuristic is done inside the new `extname()` function.

For this correction, this function will return :
```ruby
extname("test.rb") #=> ".rb"
extname("a/b/d/test.rb") #=> ".rb"
extname("foo.") #=> ""
extname("test") #=> ""
extname(".profile") #=> ""
extname(".profile.sh") #=> ".sh"
extname("myfile.tar.gz") #=> ".tar.gz"
extname("my.file.tar.gz") #=> ".tar.gz"
extname("tar.gz") #=> ".gz"
```