Merge pull request #4139 from brauliomartinezlm/remove_found_ruby187_hack
Remove unnecessary ruby187 hacks
This commit is contained in:
commit
3cd60c3061
6 changed files with 9 additions and 36 deletions
|
|
@ -107,6 +107,7 @@ everything is set up.
|
||||||
* Cleanup of script/server
|
* Cleanup of script/server
|
||||||
* Attempt to stabilize federation of attached photos (fix [#3033](https://github.com/diaspora/diaspora/issues/3033) [#3940](https://github.com/diaspora/diaspora/pull/3940)
|
* Attempt to stabilize federation of attached photos (fix [#3033](https://github.com/diaspora/diaspora/issues/3033) [#3940](https://github.com/diaspora/diaspora/pull/3940)
|
||||||
* Refactor develop install script [#4111](https://github.com/diaspora/diaspora/pull/4111)
|
* Refactor develop install script [#4111](https://github.com/diaspora/diaspora/pull/4111)
|
||||||
|
* Remove special hacks for supporting Ruby 1.8 [#4113] (https://github.com/diaspora/diaspora/pull/4139)
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,16 +141,9 @@ class PhotosController < ApplicationController
|
||||||
# get file content type
|
# get file content type
|
||||||
att_content_type = (request.content_type.to_s == "") ? "application/octet-stream" : request.content_type.to_s
|
att_content_type = (request.content_type.to_s == "") ? "application/octet-stream" : request.content_type.to_s
|
||||||
# create tempora##l file
|
# create tempora##l file
|
||||||
begin
|
|
||||||
file = Tempfile.new(file_name, {:encoding => 'BINARY'})
|
file = Tempfile.new(file_name, {:encoding => 'BINARY'})
|
||||||
file.print request.raw_post.force_encoding('BINARY')
|
|
||||||
rescue RuntimeError => e
|
|
||||||
raise e unless e.message.include?('cannot generate tempfile')
|
|
||||||
file = Tempfile.new(file_name) # Ruby 1.8 compatibility
|
|
||||||
file.binmode
|
|
||||||
file.print request.raw_post
|
|
||||||
end
|
|
||||||
# put data into this file from raw post request
|
# put data into this file from raw post request
|
||||||
|
file.print request.raw_post.force_encoding('BINARY')
|
||||||
|
|
||||||
# create several required methods for this temporal file
|
# create several required methods for this temporal file
|
||||||
Tempfile.send(:define_method, "content_type") {return att_content_type}
|
Tempfile.send(:define_method, "content_type") {return att_content_type}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ class ActsAsTaggableOn::Tag
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.tag_text_regexp
|
def self.tag_text_regexp
|
||||||
@@tag_text_regexp ||= (RUBY_VERSION.include?('1.9') ? "[[:alnum:]]_-" : "\\w-")
|
@@tag_text_regexp ||= "[[:alnum:]]_-"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.autocomplete(name)
|
def self.autocomplete(name)
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,7 @@
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
require Pathname.new(__FILE__).expand_path.dirname.join('boot')
|
require Pathname.new(__FILE__).expand_path.dirname.join('boot')
|
||||||
|
|
||||||
# Needed for versions of ruby 1.9.2 that were compiled with libyaml.
|
|
||||||
# They use psych by default which doesn't handle having a default set of parameters.
|
|
||||||
# See bug #1120.
|
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
if RUBY_VERSION.include? '1.9'
|
|
||||||
YAML::ENGINE.yamler= 'syck'
|
|
||||||
end
|
|
||||||
|
|
||||||
require 'rails/all'
|
require 'rails/all'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
#see https://github.com/hpricot/hpricot/issues/53
|
|
||||||
if RUBY_VERSION < "1.9"
|
|
||||||
module Builder
|
|
||||||
class XmlBase
|
|
||||||
unless ::String.method_defined?(:encode)
|
|
||||||
def _escape(text)
|
|
||||||
text.to_xs
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -120,13 +120,10 @@ describe Photo do
|
||||||
it 'should save a photo' do
|
it 'should save a photo' do
|
||||||
@photo.unprocessed_image.store! File.open(@fixture_name)
|
@photo.unprocessed_image.store! File.open(@fixture_name)
|
||||||
@photo.save.should == true
|
@photo.save.should == true
|
||||||
begin
|
|
||||||
binary = @photo.unprocessed_image.read.force_encoding('BINARY')
|
binary = @photo.unprocessed_image.read.force_encoding('BINARY')
|
||||||
fixture_binary = File.open(@fixture_name).read.force_encoding('BINARY')
|
fixture_binary = File.read(@fixture_name).force_encoding('BINARY')
|
||||||
rescue NoMethodError # Ruby 1.8 doesn't have force_encoding
|
|
||||||
binary = @photo.unprocessed_image.read
|
|
||||||
fixture_binary = File.open(@fixture_name).read
|
|
||||||
end
|
|
||||||
binary.should == fixture_binary
|
binary.should == fixture_binary
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue