Remove UTF-8 magic comments from all the Ruby files

Ruby 2 made UTF-8 the default encoding, which make magic comments
omissible.
This commit is contained in:
Mehdi Lahmam 2016-01-02 16:38:59 +01:00
parent 4362fbfa5d
commit f4501394b9
73 changed files with 14 additions and 160 deletions

View File

@ -1,4 +1,3 @@
# encoding: UTF-8
require 'rubygems'
begin
require 'bundler/setup'

View File

@ -1,5 +1,3 @@
# encoding: utf-8
Given /^an activerecord class that uses the '([^\']*)' table$/ do |name|
@mountee_klass = Class.new(ActiveRecord::Base)
@mountee_klass.table_name = name
@ -19,4 +17,4 @@ end
When /^I delete the active record$/ do
@instance.destroy
end
end

View File

@ -1,5 +1,3 @@
# encoding: utf-8
Given /^the file '(.*?)' is cached file at '(.*?)'$/ do |file, cached|
FileUtils.mkdir_p(File.dirname(file_path(cached)))
FileUtils.cp(file_path(file), file_path(cached))
@ -11,4 +9,4 @@ end
When /^I retrieve the cache name '(.*?)' from the cache$/ do |name|
@uploader.retrieve_from_cache!(name)
end
end

View File

@ -1,5 +1,3 @@
# encoding: utf-8
Given /^a datamapper class that has a '([^\']*)' column$/ do |column|
@mountee_klass = Class.new do
include DataMapper::Resource

View File

@ -1,5 +1,3 @@
# encoding: utf-8
###
# EXISTENCE

View File

@ -1,5 +1,3 @@
# encoding: utf-8
Given /^an uploader class that uses the '(.*?)' storage$/ do |kind|
@klass = Class.new(CarrierWave::Uploader::Base)
@klass.storage = kind.to_sym

View File

@ -1,5 +1,3 @@
# encoding: utf-8
When /^I assign the file '([^\']*)' to the '([^\']*)' column$/ do |path, column|
@instance.send("#{column}=", File.open(file_path(path)))
end

View File

@ -1,5 +1,3 @@
# encoding: utf-8
Given /^the file '(.*?)' is stored at '(.*?)'$/ do |file, stored|
FileUtils.mkdir_p(File.dirname(file_path(stored)))
FileUtils.cp(file_path(file), file_path(stored))

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'carrierwave/mount'
require File.join(File.dirname(__FILE__), '..', '..', 'spec', 'support', 'activerecord')

View File

@ -1,5 +1,3 @@
# encoding: utf-8
$:.unshift File.expand_path(File.join('..', '..', 'lib'), File.dirname(__FILE__))
require File.join(File.dirname(__FILE__), 'activerecord')

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'fileutils'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/object/try'

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Compatibility

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
##
@ -182,7 +180,7 @@ module CarrierWave
def #{column}_identifier
_mounter(:#{column}).read_identifiers[0]
end
def store_previous_changes_for_#{column}
@_previous_changes_for_#{column} = changes[_mounter(:#{column}).serialization_column]
end
@ -332,7 +330,7 @@ module CarrierWave
def #{column}_identifiers
_mounter(:#{column}).read_identifiers
end
def store_previous_changes_for_#{column}
@_previous_changes_for_#{column} = changes[_mounter(:#{column}).serialization_column]
end

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'active_record'
require 'carrierwave/validations/active_model'

View File

@ -1,9 +1,7 @@
# encoding: utf-8
module CarrierWave
##
# This module simplifies the use of ruby-filemagic gem to intelligently
# and correctly guess and set the content-type of a file. If you want
# and correctly guess and set the content-type of a file. If you want
# to use this, you'll need to require this file:
#
# require 'carrierwave/processing/magic_mime_types'

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
##

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
##

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'pathname'
require 'active_support/core_ext/string/multibyte'

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Storage

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Storage

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Storage

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Test
@ -394,4 +392,3 @@ module CarrierWave
end # Matchers
end # Test
end # CarrierWave

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require "carrierwave/uploader/configuration"
require "carrierwave/uploader/callbacks"
require "carrierwave/uploader/proxy"

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
class FormNotMultipart < UploadError
@ -7,13 +5,13 @@ module CarrierWave
"You tried to assign a String or a Pathname to an uploader, for security reasons, this is not allowed.\n\n If this is a file upload, please check that your upload form is multipart encoded."
end
end
class CacheCounter
@@counter = 0
def self.increment
@@counter += 1
end
end
end
##
@ -25,8 +23,8 @@ module CarrierWave
#
def self.generate_cache_id
[Time.now.utc.to_i,
Process.pid,
'%04d' % (CarrierWave::CacheCounter.increment % 1000),
Process.pid,
'%04d' % (CarrierWave::CacheCounter.increment % 1000),
'%04d' % rand(9999)
].map(&:to_s).join('-')
end

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader
module Callbacks

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader
module DefaultUrl

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'open-uri'
module CarrierWave

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader
module ExtensionWhitelist

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader
module FileSize

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader
module Mountable

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader
module Processing

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader
module Proxy

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader
module Remove

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require "json"
require "active_support/core_ext/hash"

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader
module Store

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader
module Url

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Uploader
module Versions

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'carrierwave/utilities/uri'
module CarrierWave

View File

@ -1,5 +1,3 @@
# encoding: utf-8
module CarrierWave
module Utilities
module Uri

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'active_model/validator'
require 'active_support/concern'

View File

@ -1,5 +1,3 @@
# encoding: utf-8
class <%= class_name %>Uploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
require 'carrierwave/orm/activerecord'

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Mount do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Mount do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
require 'support/activerecord'

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::MagicMimeTypes, :filemagic => true do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::MiniMagick do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::RMagick, :rmagick => true do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
begin

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'rubygems'
require 'bundler/setup'

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
require 'support/file_utils_helper'
require 'tempfile'

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
require 'fog'
require 'carrierwave/storage/fog'

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do
@ -268,7 +266,7 @@ describe CarrierWave::Uploader do
expect(@uploader.filename).to be_nil
expect(@uploader.cache_name).to be_nil
end
it "should support old format of cache_id (without counter) for backwards compartibility" do
@uploader.retrieve_from_cache!('1369894322-345-2255/test.jpeg')
expect(@uploader.url).to eq('/uploads/tmp/1369894322-345-2255/test.jpeg')
@ -314,19 +312,19 @@ describe CarrierWave::Uploader do
end
end
end
describe '.generate_cache_id' do
it 'should generate dir name based on UTC time' do
Timecop.freeze(Time.at(1369896000)) do
expect(CarrierWave.generate_cache_id).to match(/\A1369896000-\d+-\d+-\d+\Z/)
end
end
it 'should generate dir name with a counter substring' do
@counter = CarrierWave.generate_cache_id.split('-')[2].to_i
expect(CarrierWave.generate_cache_id.split('-')[2].to_i).to eq(@counter + 1)
end
it 'should generate dir name with constant length even when counter has big value' do
@length = CarrierWave.generate_cache_id.length
allow(CarrierWave::CacheCounter).to receive(:increment).and_return(1234567890)

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader::Download do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader, filemagic: true do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader, filemagic: true do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do
@ -66,4 +64,4 @@ describe CarrierWave::Uploader do
expect(@uploader_overridden.fog_public).to be_eql(false)
end
end
end
end

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
require 'active_support/json'

View File

@ -1,5 +1,3 @@
# encoding: utf-8
require 'spec_helper'
describe CarrierWave::Uploader do