Skip to content

Commit

Permalink
Alphabetically sort filenames returned by Dir.glob
Browse files Browse the repository at this point in the history
Sheldon#build uses Ruby's Dir.glob to locate all files with "config_" in
their filename. The order in which files are located in a filesystem
will vary between environments (and possibly Ruby versions), leading to
different behaviour of Sheldon#build across different hosts. This commit
alphabetically sorts the filenames retrieved by Dir.glob, thus
eliminating variance.
  • Loading branch information
dvjones89 committed Oct 27, 2018
1 parent c624b29 commit 483f337
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sheldon/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Builder
require "fileutils"

def build(abs_build_path)
entries = Dir.glob(abs_build_path + "/*")
entries = Dir.glob(abs_build_path + "/*").sort
master_content = entries.inject("") do |buffer, entry|
is_config?(entry) ? add_entry_to_buffer(entry, buffer) : buffer
end
Expand Down

0 comments on commit 483f337

Please sign in to comment.