Skip to content

Commit

Permalink
Merge pull request #4139 from brauliomartinezlm/remove_found_ruby187_…
Browse files Browse the repository at this point in the history
…hack

Remove unnecessary ruby187 hacks
  • Loading branch information
jhass committed May 2, 2013
2 parents d2c9295 + 00a3332 commit 3cd60c3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 36 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 2 additions & 9 deletions app/controllers/photos_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,9 @@ def file_handler(params)
# 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}
Expand Down
4 changes: 2 additions & 2 deletions app/models/acts_as_taggable_on/tag.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 0 additions & 6 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
12 changes: 0 additions & 12 deletions config/initializers/monkey_patch_to_xs.rb

This file was deleted.

11 changes: 4 additions & 7 deletions spec/models/photo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,10 @@ def with_carrierwave_processing(&block)
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

Expand Down

0 comments on commit 3cd60c3

Please sign in to comment.