diff --git a/Changelog.md b/Changelog.md index dbfa4a9cb0ef5241ddd3fe906866945929e4c847..b056425f6bea8b16f74408d1dd5de96aa2972bf7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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 diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 186b9643501347b9a04c6d7d7d12c79cbf038eae..f28b8cc9aaaa7bc435915f50402f1154893022b4 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -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} diff --git a/app/models/acts_as_taggable_on/tag.rb b/app/models/acts_as_taggable_on/tag.rb index 70b77f69b4a791826d2f29d4e34d59134c5b452c..4e652ee4de433c985d0fdaecc570952d477e5dec 100644 --- a/app/models/acts_as_taggable_on/tag.rb +++ b/app/models/acts_as_taggable_on/tag.rb @@ -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) diff --git a/config/application.rb b/config/application.rb index 8e1d13759ce32975dd3532b562a8ba732c8b5f59..2f14c8c419ecc93ba8f2d0d1ef368e42af220a8a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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' diff --git a/config/initializers/monkey_patch_to_xs.rb b/config/initializers/monkey_patch_to_xs.rb deleted file mode 100644 index cae9570f84a6e7b155c6694c0c4a824b2f1d0c8d..0000000000000000000000000000000000000000 --- a/config/initializers/monkey_patch_to_xs.rb +++ /dev/null @@ -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 \ No newline at end of file diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index b168e10c0eb0740fa34d9509008c8bfcd44613ae..f9e8d2036a9694ebcf3197cf08e472c2e54d0b0a 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -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