Remove unnecessary ruby187 hacks
This commit is contained in:
parent
d2c9295389
commit
00a3332013
6 changed files with 9 additions and 36 deletions
|
|
@ -107,6 +107,7 @@ everything is set up.
|
|||
* 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)
|
||||
* 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
|
||||
|
||||
|
|
|
|||
|
|
@ -141,16 +141,9 @@ class PhotosController < ApplicationController
|
|||
# get file content type
|
||||
att_content_type = (request.content_type.to_s == "") ? "application/octet-stream" : request.content_type.to_s
|
||||
# create tempora##l file
|
||||
begin
|
||||
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
|
||||
file = Tempfile.new(file_name, {:encoding => 'BINARY'})
|
||||
# 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
|
||||
Tempfile.send(:define_method, "content_type") {return att_content_type}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
class ActsAsTaggableOn::Tag
|
||||
|
||||
self.include_root_in_json = false
|
||||
|
||||
|
||||
def followed_count
|
||||
@followed_count ||= TagFollowing.where(:tag_id => self.id).count
|
||||
end
|
||||
|
||||
def self.tag_text_regexp
|
||||
@@tag_text_regexp ||= (RUBY_VERSION.include?('1.9') ? "[[:alnum:]]_-" : "\\w-")
|
||||
@@tag_text_regexp ||= "[[:alnum:]]_-"
|
||||
end
|
||||
|
||||
def self.autocomplete(name)
|
||||
|
|
|
|||
|
|
@ -5,13 +5,7 @@
|
|||
require 'pathname'
|
||||
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'
|
||||
if RUBY_VERSION.include? '1.9'
|
||||
YAML::ENGINE.yamler= 'syck'
|
||||
end
|
||||
|
||||
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
|
||||
@photo.unprocessed_image.store! File.open(@fixture_name)
|
||||
@photo.save.should == true
|
||||
begin
|
||||
binary = @photo.unprocessed_image.read.force_encoding('BINARY')
|
||||
fixture_binary = File.open(@fixture_name).read.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 = @photo.unprocessed_image.read.force_encoding('BINARY')
|
||||
fixture_binary = File.read(@fixture_name).force_encoding('BINARY')
|
||||
|
||||
binary.should == fixture_binary
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue