Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Getting things to work on windows #129

Closed
wants to merge 4 commits into from

3 participants

@mtscout6

This is a continuation of work done by @bebac for pull request #109

bebac and others added some commits
@bebac bebac Fix tempfile binmode on windows
Apparently the ':encoding => 'binary'' option does not change file to binmode, at least not on windows.

This changeset changes file to binary mode by calling binmode on the IO object.
eb9a6ca
@bebac bebac Update geminabox.rb
Change tempfile in atomic_write to binary mode
e6c7109
@mtscout6 mtscout6 Merge remote-tracking branch 'upstream/master' into temp-file-windows e9a19c2
@mtscout6 mtscout6 Fixed spec file usage on windows e466f2f
@mlapierre mlapierre referenced this pull request from a commit in mlapierre/geminabox
@mlapierre mlapierre Fix to enable the server to work on Windows
Changes made as per: geminabox#129
23a19e8
@reggieb
Owner

I've just released 0.12.4. This adds the binary mode changes to the latest version of the Geminabox code. This should fix these issues. Please reopen or log a new issue if you think otherwise.

@reggieb reggieb closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 12, 2013
  1. @bebac

    Fix tempfile binmode on windows

    bebac authored
    Apparently the ':encoding => 'binary'' option does not change file to binmode, at least not on windows.
    
    This changeset changes file to binary mode by calling binmode on the IO object.
  2. @bebac

    Update geminabox.rb

    bebac authored
    Change tempfile in atomic_write to binary mode
Commits on Aug 27, 2013
  1. @mtscout6
  2. @mtscout6
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 6 deletions.
  1. +6 −1 lib/geminabox.rb
  2. +3 −5 lib/geminabox/incoming_gem.rb
View
7 lib/geminabox.rb
@@ -234,6 +234,7 @@ def atomic_write(file_name)
temp_dir = File.join(settings.data, "_temp")
FileUtils.mkdir_p(temp_dir)
temp_file = Tempfile.new("." + File.basename(file_name), temp_dir)
+ temp_file.binmode
yield temp_file
temp_file.close
File.rename(temp_file.path, file_name)
@@ -243,7 +244,11 @@ def atomic_write(file_name)
helpers do
def spec_for(gem_name, version)
spec_file = File.join(settings.data, "quick", "Marshal.#{Gem.marshal_version}", "#{gem_name}-#{version}.gemspec.rz")
- Marshal.load(Gem.inflate(File.read(spec_file))) if File.exists? spec_file
+
+ File::open(spec_file, 'r') do |unzipped_spec_file|
+ unzipped_spec_file.binmode
+ Marshal.load(Gem.inflate(unzipped_spec_file.read)) if File.exists? spec_file
+ end
end
# Return a list of versions of gem 'gem_name' with the dependencies of each version.
View
8 lib/geminabox/incoming_gem.rb
@@ -5,11 +5,9 @@ def initialize(gem_data, root_path = Geminabox.settings.data)
end
digest = Digest::SHA1.new
- if RbConfig::CONFIG["MAJOR"].to_i <= 1 and RbConfig::CONFIG["MINOR"].to_i <= 8
- @tempfile = Tempfile.new("gem")
- else
- @tempfile = Tempfile.new("gem", :encoding => 'binary')
- end
+
+ @tempfile = Tempfile.new("gem")
+ @tempfile.binmode
while data = gem_data.read(1024**2)
@tempfile.write data
Something went wrong with that request. Please try again.