Skip to content

Commit

Permalink
Patch existing find_or_initialize_version_from_spec to make size an o…
Browse files Browse the repository at this point in the history
…ptional parameter.
  • Loading branch information
cmeiklejohn authored and gnarg committed Nov 4, 2012
1 parent 0f4273a commit 820d830
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/pusher.rb
Expand Up @@ -46,7 +46,7 @@ def pull_spec

def find
@rubygem = Rubygem.find_or_initialize_by_name(spec.name)
@version = @rubygem.find_or_initialize_version_from_spec(spec)
@version = @rubygem.find_or_initialize_version_from_spec(spec, size)

if @version.new_record?
true
Expand Down
5 changes: 3 additions & 2 deletions app/models/rubygem.rb
Expand Up @@ -230,9 +230,10 @@ def yank!(version)
end
end

def find_or_initialize_version_from_spec(spec)
version = self.versions.find_or_initialize_by_number_and_platform(spec.version.to_s, spec.original_platform.to_s)
def find_or_initialize_version_from_spec(spec, size = nil)
version = self.versions.find_or_initialize_by_number_and_platform(spec.version.to_s, spec.original_platform.to_s)
version.rubygem = self
version.size = size if size
version
end

Expand Down

0 comments on commit 820d830

Please sign in to comment.