Skip to content

Commit

Permalink
Skip versions that are partial semvers (0.1) and the ones that don't …
Browse files Browse the repository at this point in the history
…have proper elm-package.json persent.

Fixes: #37
  • Loading branch information
gdotdesign committed Aug 17, 2017
1 parent 0807677 commit cb0b02c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
17 changes: 7 additions & 10 deletions lib/elm_install/identifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,23 +133,20 @@ def json(directory)
path = File.join(directory, 'elm-package.json')
JSON.parse(File.read(path))
rescue JSON::ParserError
exit "Invalid JSON in file: #{path.bold}"
{}
warn "Invalid JSON in file: #{path.bold}"
rescue Errno::ENOENT
exit "Could not find file: #{path.bold}"
{}
warn "Could not find file: #{path.bold}"
end

Contract String => NilClass
Contract String => Hash
# Exits the current process and logs a given message.
#
# @param message [String] The message
#
# @return nil
def exit(message)
Logger.arrow message
Process.abort
nil
# @return [Hash] An empty hash
def warn(message)
Logger.arrow message if @options[:vebose]
{}
end
end
end
1 change: 1 addition & 0 deletions lib/elm_install/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def versions
repo
.tags
.map(&:name)
.select { |tag| tag =~ /(.*\..*\..*)/ }
.map { |tag| Semverse::Version.try_new tag }
.compact
end
Expand Down

0 comments on commit cb0b02c

Please sign in to comment.