Skip to content

Commit

Permalink
Only fetch repositories once per installation.
Browse files Browse the repository at this point in the history
  • Loading branch information
gdotdesign committed Aug 7, 2017
1 parent 44dabdf commit 16c5082
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/elm_install/git_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class GitSource < Source
# @return [Branch] The branch
attr_reader :branch

@@fetched = {}

Contract Uri, Branch => GitSource
# Initializes a git source by URI and branch
#
Expand Down Expand Up @@ -70,9 +72,10 @@ def copy_to(version, directory)
#
# @return [Array] The versions
def versions(constraints)
if repository.cloned?
if repository.cloned? && !@@fetched[url]
# Get updates from upstream
Logger.arrow "Getting updates for: #{package_name.bold}"
@@fetched[url] = true
repository.fetch
end

Expand Down
2 changes: 0 additions & 2 deletions lib/elm_install/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ def resolve
#
# @return nil
def resolve_dependency(dependency)
return if @dependencies[dependency.name]

@dependencies[dependency.name] ||= dependency

dependency
Expand Down

0 comments on commit 16c5082

Please sign in to comment.