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:
parent
4362fbfa5d
commit
f4501394b9
1
Rakefile
1
Rakefile
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
require 'rubygems'
|
||||
begin
|
||||
require 'bundler/setup'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
###
|
||||
# EXISTENCE
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'carrierwave/mount'
|
||||
require File.join(File.dirname(__FILE__), '..', '..', 'spec', 'support', 'activerecord')
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
$:.unshift File.expand_path(File.join('..', '..', 'lib'), File.dirname(__FILE__))
|
||||
|
||||
require File.join(File.dirname(__FILE__), 'activerecord')
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'fileutils'
|
||||
require 'active_support/core_ext/object/blank'
|
||||
require 'active_support/core_ext/object/try'
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Compatibility
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'active_record'
|
||||
require 'carrierwave/validations/active_model'
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
|
||||
##
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
|
||||
##
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'pathname'
|
||||
require 'active_support/core_ext/string/multibyte'
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Storage
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Storage
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Storage
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Test
|
||||
|
||||
|
@ -394,4 +392,3 @@ module CarrierWave
|
|||
end # Matchers
|
||||
end # Test
|
||||
end # CarrierWave
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require "carrierwave/uploader/configuration"
|
||||
require "carrierwave/uploader/callbacks"
|
||||
require "carrierwave/uploader/proxy"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
module Callbacks
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
module DefaultUrl
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'open-uri'
|
||||
|
||||
module CarrierWave
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
module ExtensionWhitelist
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
module FileSize
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
module Mountable
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
module Processing
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
module Proxy
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
module Remove
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require "json"
|
||||
require "active_support/core_ext/hash"
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
module Store
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
module Url
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Uploader
|
||||
module Versions
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'carrierwave/utilities/uri'
|
||||
|
||||
module CarrierWave
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module CarrierWave
|
||||
module Utilities
|
||||
module Uri
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'active_model/validator'
|
||||
require 'active_support/concern'
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class <%= class_name %>Uploader < CarrierWave::Uploader::Base
|
||||
|
||||
# Include RMagick or MiniMagick support:
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
require 'carrierwave/orm/activerecord'
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Mount do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Mount do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
require 'support/activerecord'
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::MagicMimeTypes, :filemagic => true do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::MiniMagick do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::RMagick, :rmagick => true do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
begin
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
require 'support/file_utils_helper'
|
||||
require 'tempfile'
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
require 'fog'
|
||||
require 'carrierwave/storage/fog'
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader::Download do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader, filemagic: true do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader, filemagic: true do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader do
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
require 'active_support/json'
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe CarrierWave::Uploader do
|
||||
|
|
Loading…
Reference in New Issue