1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Put source encoding comment as line for (j)ruby 1.9 compatibility (#3255)

In jruby 1.7.22 (1.9.3p551 compatibility mode), UTF-8 encoding is not properly
detected, because the encoding comment is not on the first line as required in ruby
1.9.

The frozen_string_literal magic comment did not come into existence until ruby 2.3,
and ruby 1.9 does not look past the first line for magic comments.

This results encoding-related syntax errors. Examples:

    SyntaxError: /home/nilbus/ws/rental_express/ROOT/rails/vendor/bundle/jruby/1.9/gems/sidekiq-4.2.6/lib/sidekiq.rb:52: Invalid char `\235' ('') in expression
      def self.❨╯°□°❩╯︵┻━┻
                ^

    SyntaxError: /home/nilbus/ws/rental_express/ROOT/rails/vendor/bundle/jruby/1.9/gems/sidekiq-4.2.6/lib/sidekiq/api.rb:269: Invalid char `\237' ('Ÿ') in expression
        alias_method :💣, :clear
                       ^

This patch should restore compatibility with ruby 1.9 and greater.
This commit is contained in:
Edward Anderson 2016-11-22 23:39:00 -05:00 committed by Mike Perham
parent 1e37c199e8
commit 2f9258e4fe
8 changed files with 8 additions and 8 deletions

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# encoding: utf-8
# frozen_string_literal: true
require 'sidekiq/version'
fail "Sidekiq #{Sidekiq::VERSION} does not support Ruby versions below 2.0.0." if RUBY_PLATFORM != 'java' && RUBY_VERSION < '2.0.0'

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# encoding: utf-8
# frozen_string_literal: true
require 'sidekiq'
module Sidekiq

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# encoding: utf-8
# frozen_string_literal: true
$stdout.sync = true
require 'yaml'

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# encoding: utf-8
# frozen_string_literal: true
require 'sidekiq/manager'
require 'sidekiq/fetch'
require 'sidekiq/scheduled'

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# encoding: utf-8
# frozen_string_literal: true
require 'sidekiq/util'
require 'sidekiq/processor'
require 'sidekiq/fetch'

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# encoding: utf-8
# frozen_string_literal: true
require_relative 'helper'
require 'sidekiq/scheduled'
require 'sidekiq/middleware/server/retry_jobs'

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# encoding: utf-8
# frozen_string_literal: true
require_relative 'helper'
class TestSidekiq < Sidekiq::Test

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# encoding: utf-8
# frozen_string_literal: true
require_relative 'helper'
require 'sidekiq/web'
require 'rack/test'