New upstream version 1.1.0

parent 5deaa22c
......@@ -8,9 +8,12 @@ more/activerecord/spec/db
more/activerecord/spec/public
more/datamapper/spec/public
*.project
spec/fixtures/*_copy.png
spec/test.log
spec/tmp
*.swp
.rvmrc
.idea
.bundle
Gemfile.lock
\ No newline at end of file
Gemfile.lock
gemfiles/*.lock
Style/CollectionMethods:
Description: Preferred collection methods.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
Enabled: true
PreferredMethods:
collect: map
collect!: map!
find: detect
find_all: select
reduce: inject
Style/DotPosition:
Description: Checks the position of the dot in multi-line method calls.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
Enabled: true
EnforcedStyle: trailing
SupportedStyles:
- leading
- trailing
Style/PredicateName:
Description: Check the names of predicate methods.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
Enabled: true
NamePrefix:
- is_
- has_
- have_
NamePrefixBlacklist:
- is_
Exclude:
- spec/**/*
Style/SingleLineMethods:
Description: Avoid single-line methods.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
Enabled: true
AllowIfMethodIsEmpty: true
Style/StringLiterals:
Description: Checks if uses of quotes match the configured preference.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
Enabled: true
EnforcedStyle: double_quotes
SupportedStyles:
- single_quotes
- double_quotes
Style/StringLiteralsInInterpolation:
Description: Checks if uses of quotes inside expressions in interpolated strings
match the configured preference.
Enabled: true
EnforcedStyle: single_quotes
SupportedStyles:
- single_quotes
- double_quotes
Metrics/AbcSize:
Description: A calculated magnitude based on number of assignments, branches, and
conditions.
Enabled: false
Max: 15
Metrics/ClassLength:
Description: Avoid classes longer than 100 lines of code.
Enabled: false
CountComments: false
Max: 100
Metrics/ModuleLength:
CountComments: false
Max: 100
Description: Avoid modules longer than 100 lines of code.
Enabled: false
Metrics/CyclomaticComplexity:
Description: A complexity metric that is strongly correlated to the number of test
cases needed to validate a method.
Enabled: false
Max: 6
Metrics/MethodLength:
Description: Avoid methods longer than 10 lines of code.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
Enabled: false
CountComments: false
Max: 10
Metrics/ParameterLists:
Description: Avoid parameter lists longer than three or four parameters.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
Enabled: false
Max: 5
CountKeywordArgs: true
Metrics/PerceivedComplexity:
Description: A complexity metric geared towards measuring complexity for a human
reader.
Enabled: false
Max: 7
Lint/AssignmentInCondition:
Description: Don't use assignment in conditions.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
Enabled: false
AllowSafeAssignment: true
Lint/EachWithObjectArgument:
Description: Check for immutable argument given to each_with_object.
Enabled: true
Lint/HandleExceptions:
Description: Don't suppress exception.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
Enabled: false
Lint/LiteralInCondition:
Description: Checks of literals used in conditions.
Enabled: false
Lint/LiteralInInterpolation:
Description: Checks for literals used in interpolation.
Enabled: false
Style/InlineComment:
Description: Avoid inline comments.
Enabled: false
Style/AccessorMethodName:
Description: Check the naming of accessor methods for get_/set_.
Enabled: false
Style/Alias:
Description: Use alias_method instead of alias.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
Enabled: false
Style/Documentation:
Description: Document classes and non-namespace modules.
Enabled: false
Style/DoubleNegation:
Description: Checks for uses of double negation (!!).
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
Enabled: false
Style/EachWithObject:
Description: Prefer `each_with_object` over `inject` or `reduce`.
Enabled: false
Style/EmptyLiteral:
Description: Prefer literals to Array.new/Hash.new/String.new.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
Enabled: false
Style/ModuleFunction:
Description: Checks for usage of `extend self` in modules.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
Enabled: false
Style/OneLineConditional:
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
Enabled: false
Style/PerlBackrefs:
Description: Avoid Perl-style regex back references.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
Enabled: false
Style/Send:
Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
may overlap with existing methods.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
Enabled: false
Style/SpecialGlobalVars:
Description: Avoid Perl-style global variables.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
Enabled: false
Style/VariableInterpolation:
Description: Don't interpolate global, instance and class variables directly in
strings.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
Enabled: false
Style/WhenThen:
Description: Use when x then ... for one-line cases.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
Enabled: false
Style/RaiseArgs:
Description: Checks the arguments passed to raise/fail.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
Enabled: false
EnforcedStyle: exploded
SupportedStyles:
- compact
- exploded
Style/SignalException:
Description: Checks for proper usage of fail and raise.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
Enabled: false
EnforcedStyle: semantic
SupportedStyles:
- only_raise
- only_fail
- semantic
Style/SingleLineBlockParams:
Description: Enforces the names of some block params.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
Enabled: false
Methods:
- reduce:
- a
- e
- inject:
- a
- e
Style/GuardClause:
Description: Check for conditionals that can be replaced with guard clauses
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
Enabled: false
MinBodyLength: 1
Style/IfUnlessModifier:
Description: Favor modifier if/unless usage when you have a single-line body.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
Enabled: false
MaxLineLength: 80
Style/OptionHash:
Description: Don't use option hashes when you can use keyword arguments.
Enabled: false
Style/PercentLiteralDelimiters:
Description: Use `%`-literal delimiters consistently
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
Enabled: false
PreferredDelimiters:
"%": "()"
"%i": "()"
"%q": "()"
"%Q": "()"
"%r": "{}"
"%s": "()"
"%w": "()"
"%W": "()"
"%x": "()"
Style/TrailingComma:
Description: Checks for trailing comma in parameter lists and literals.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
Enabled: false
EnforcedStyleForMultiline: no_comma
SupportedStyles:
- comma
- no_comma
before_install:
- gem install bundler
language: ruby
cache: bundler
notifications:
email: false
rvm:
- 2.0
- 2.1
- 2.2.7
- 2.3.4
- 2.4.1
- jruby-9.1.5.0
gemfile:
- Gemfile
- gemfiles/rails-3-2-stable.gemfile
- gemfiles/rails-4-0-stable.gemfile
- gemfiles/rails-4-1-stable.gemfile
- gemfiles/rails-4-0.gemfile
- gemfiles/rails-4-1.gemfile
- gemfiles/rails-4-2.gemfile
- gemfiles/rails-5-0.gemfile
- gemfiles/rails-5-1.gemfile
- gemfiles/rails-master.gemfile
sudo: false
before_install:
- gem update bundler
before_script:
- psql -c 'create database carrierwave_test;' -U postgres
matrix:
include:
- rvm: 2.0
gemfile: gemfiles/rails-4-0.gemfile
- rvm: 2.0
gemfile: gemfiles/rails-4-1.gemfile
- rvm: 2.0
gemfile: gemfiles/rails-4-2.gemfile
- rvm: 2.1
gemfile: gemfiles/rails-4-0.gemfile
- rvm: 2.1
gemfile: gemfiles/rails-4-1.gemfile
- rvm: 2.1
gemfile: gemfiles/rails-4-2.gemfile
- rvm: ruby-head
gemfile: gemfiles/rails-5-1.gemfile
- rvm: ruby-head
gemfile: gemfiles/rails-master.gemfile
- rvm: jruby-head
gemfile: gemfiles/rails-5-1.gemfile
- rvm: jruby-head
gemfile: gemfiles/rails-master.gemfile
exclude:
- rvm: 2.4.1
gemfile: gemfiles/rails-4-0.gemfile
- rvm: 2.4.1
gemfile: gemfiles/rails-4-1.gemfile
- rvm: 2.4.1
gemfile: gemfiles/rails-4-2.gemfile
allow_failures:
- rvm: ruby-head
- rvm: jruby-head
- gemfile: gemfiles/rails-master.gemfile
- rvm: jruby-9.1.5.0
gemfile: gemfiles/rails-5-1.gemfile
fast_finish: true
notifications:
email: false
slack:
secure: Npzanyv/LXLIRlrNs8iTUbZNRhXlP+K2ZpjZoS2UKkr09jYyP1qdf5a//R3Lu7Yat7g2b4qTJGbaZBEMUQSVaJ6UX6quiBJjVWxjxjQ4Ugk8k/yOIAcGEGYPfS6YzRXemRwo9j4uy76cmwlv8cwEuYTSTBRK4XrdYHslX6pKSXM=
addons:
postgresql: "9.3"
This diff is collapsed.
......@@ -3,7 +3,7 @@
CarrierWave thrives on a large number of [contributors](https://github.com/carrierwaveuploader/carrierwave/contributors),
and pull requests are very welcome. Before submitting a pull request, please make sure that your changes are well tested.
First, make sure you have `imagemagick` and `ghostscript` installed.
First, make sure you have `imagemagick` and `ghostscript` installed. You may need `libmagic` as well.
Then, you'll need to install bundler and the gem dependencies:
......@@ -29,9 +29,9 @@ You should now be able to run the remote tests:
REMOTE=true bundle exec rake
Please test with the latest Ruby 1.8.x and 1.9.x versions using RVM if possible.
Please test with the latest Ruby 2.2.x version using RVM if possible.
## Running active record tests
Make sure you have a local MySQL database named `carrierwave_test` with the username
`root` and empty password.
Make sure you have a local PostgreSQL database named `carrierwave_test` with the username
`postgres`
This diff is collapsed.
# encoding: UTF-8
require 'rubygems'
begin
require 'bundler/setup'
......
......@@ -3,44 +3,43 @@ lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
require 'carrierwave/version'
require 'date'
Gem::Specification.new do |s|
s.name = "carrierwave"
s.version = CarrierWave::VERSION
s.authors = ["Jonas Nicklas"]
s.date = Date.today
s.description = "Upload files in your Ruby applications, map them to a range of ORMs, store them on different backends."
s.summary = "Ruby file upload library"
s.email = ["jonas.nicklas@gmail.com"]
s.extra_rdoc_files = ["README.md"]
s.files = Dir.glob("{bin,lib}/**/*") + %w(README.md)
s.files = Dir["{bin,lib}/**/*", "README.md"]
s.homepage = %q{https://github.com/carrierwaveuploader/carrierwave}
s.rdoc_options = ["--main"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{carrierwave}
s.rubygems_version = %q{1.3.5}
s.specification_version = 3
s.licenses = ["MIT"]
s.add_dependency "activesupport", ">= 3.2.0"
s.add_dependency "activemodel", ">= 3.2.0"
s.add_dependency "json", ">= 1.7"
s.add_dependency "mime-types", ">= 1.16"
s.add_dependency "mimemagic", ">= 0.3.0"
s.required_ruby_version = ">= 2.0.0"
s.add_development_dependency "pg"
s.add_development_dependency "rails", ">= 3.2.0"
s.add_development_dependency "cucumber", "~> 1.3.2"
s.add_development_dependency "rspec", "~> 2.13.0"
s.add_development_dependency "sham_rack"
s.add_development_dependency "fog", "~> 1.20.0"
s.add_development_dependency "unf"
s.add_development_dependency "net-ssh", "~> 2.9.0"
s.add_dependency "activesupport", ">= 4.0.0"
s.add_dependency "activemodel", ">= 4.0.0"
s.add_dependency "mime-types", ">= 1.16"
if RUBY_ENGINE == 'jruby'
s.add_development_dependency 'activerecord-jdbcpostgresql-adapter'
else
s.add_development_dependency "pg"
end
s.add_development_dependency "rails", ">= 4.0.0"
s.add_development_dependency "cucumber", "~> 2.3.2"
s.add_development_dependency "rspec", "~> 3.4.0"
s.add_development_dependency "webmock"
s.add_development_dependency "fog", ">= 1.28.0"
s.add_development_dependency "mini_magick", ">= 3.6.0"
s.add_development_dependency "rmagick"
s.add_development_dependency "nokogiri", "~> 1.5.10" # 1.6 requires ruby > 1.8.7
s.add_development_dependency "timecop", "0.6.1" # 0.6.2 requires ruby > 1.8.7
s.add_development_dependency "generator_spec"
if RUBY_ENGINE != 'jruby'
s.add_development_dependency "rmagick"
end
s.add_development_dependency "nokogiri", "~> 1.6.3"
s.add_development_dependency "timecop", "0.7.1"
s.add_development_dependency "generator_spec", ">= 0.9.1"
s.add_development_dependency "pry"
end
# 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
\ No newline at end of file
end
# 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
\ No newline at end of file
end
# encoding: utf-8
Given /^a datamapper class that has a '([^\']*)' column$/ do |column|
@mountee_klass = Class.new do
include DataMapper::Resource
......
When /^I download the file '([^']+)'/ do |url|
unless ENV['REMOTE'] == 'true'
sham_rack_app = ShamRack.at('s3.amazonaws.com').stub
sham_rack_app.register_resource('/Monkey/testfile.txt', 'S3 Remote File', 'text/plain')
stub_request(:get, "s3.amazonaws.com/Monkey/testfile.txt").
to_return(body: "S3 Remote File", headers: { "Content-Type" => "text/plain" })
end
@uploader.download!(url)
unless ENV['REMOTE'] == 'true'
ShamRack.unmount_all
end
end
# encoding: utf-8
###
# EXISTENCE
Then /^there should be a file at '(.*?)'$/ do |file|
File.exist?(file_path(file)).should be_true
File.exist?(file_path(file)).should be_truthy
end
Then /^there should not be a file at '(.*?)'$/ do |file|
File.exist?(file_path(file)).should be_false
File.exist?(file_path(file)).should be_falsey
end
Then /^there should be a file called '(.*?)' somewhere in a subdirectory of '(.*?)'$/ do |file, directory|
Dir.glob(File.join(file_path(directory), '**', file)).any?.should be_true
Dir.glob(File.join(file_path(directory), '**', file)).any?.should be_truthy
end
###
......
# encoding: utf-8
Given /^an uploader class that uses the '(.*?)' storage$/ do |kind|
@klass = Class.new(CarrierWave::Uploader::Base)
@klass.storage = kind.to_sym
......@@ -47,7 +45,7 @@ Given /^that the uploader has the store_dir overridden to '(.*?)'$/ do |store_di
end
Given /^that the version '(.*?)' has the store_dir overridden to '(.*?)'$/ do |version, store_dir|
@klass.versions[version.to_sym][:uploader].class_eval do
@klass.versions[version.to_sym].class_eval do
define_method(:store_dir) do
file_path(store_dir)
end
......
# encoding: utf-8
When /^I assign the file '([^\']*)' to the '([^\']*)' column$/ do |path, column|
@instance.send("#{column}=", File.open(file_path(path)))
end
......
# 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))
......
# encoding: utf-8
require 'carrierwave/mount'
require File.join(File.dirname(__FILE__), '..', '..', 'spec', 'support', 'activerecord')
class TestMigration < ActiveRecord::Migration
class TestMigration < ActiveRecord.version.to_s >= '5.0' ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
def self.up
create_table :users, :force => true do |t|
t.column :avatar, :string
......
# encoding: utf-8
$:.unshift File.expand_path(File.join('..', '..', 'lib'), File.dirname(__FILE__))
require File.join(File.dirname(__FILE__), 'activerecord')
require 'rspec'
require 'carrierwave'
require 'sham_rack'
require "webmock/cucumber"
alias :running :lambda
......
source "https://rubygems.org"
gem "rails", :git => "https://github.com/rails/rails.git", :branch => "3-2-stable"
gem "carrierwave", :path => "../"
gemspec :path => "../"
if RUBY_VERSION <= "1.9.2"
gem "pg", "< 0.18.0"
gem "i18n", "< 0.7"
gem "mime-types", "< 2.0"
gem "mini_magick", "< 4"
gem "fog", "1.3.1"
gem "rack-cache", "< 1.3"
end
source "https://rubygems.org"
gem "rails", :github => "rails/rails", :branch => "4-0-stable"
gem "carrierwave", :path => "../"
gemspec :path => "../"
if RUBY_VERSION <= "1.9.2"
gem "pg", "< 0.18.0"
gem "i18n", "< 0.7"
gem "mime-types", "< 2.0"
gem "mini_magick", "< 4"
gem "fog", "1.3.1"
gem "sprockets", "< 3"
end
source "https://rubygems.org"
gem "rails", "~> 4.0.0"
gem "railties", "~> 4.0.0"
gemspec :path => "../"
source "https://rubygems.org"
gem "rails", :github => "rails/rails", :branch => "4-1-stable"
gem "carrierwave", :path => "../"
gemspec :path => "../"
if RUBY_VERSION <= "1.9.2"
gem "pg", "< 0.18.0"
gem "i18n", "< 0.7"
gem "mime-types", "< 2.0"
gem "mini_magick", "< 4"
gem "fog", "1.3.1"
gem "sprockets", "< 3"
end
source "https://rubygems.org"
gem "rails", "~> 4.1.0"
gemspec :path => "../"
source "https://rubygems.org"
gem "rails", "~> 4.2.0"
gemspec :path => "../"
source "https://rubygems.org"
gem "rails", "~> 5.0.0"
gem "activemodel-serializers-xml"
gem "activerecord-jdbcpostgresql-adapter", github: "jruby/activerecord-jdbc-adapter", branch: "rails-5", platforms: :jruby
gemspec :path => "../"
source "https://rubygems.org"
gem "rails", "~> 5.1.0"
gem "activemodel-serializers-xml"
gem "activerecord-jdbcpostgresql-adapter", github: "jruby/activerecord-jdbc-adapter", branch: "rails-5", platforms: :jruby
gemspec :path => "../"
source "https://rubygems.org"
gem "rails", :github => "rails/rails", :branch => "master"
gem "arel", :github => "rails/arel", :branch => "master"
gem "carrierwave", :path => "../"
gem "rails", github: "rails/rails", branch: "master"
gem "rack", github: "rack/rack", branch: "master"
gem "arel", github: "rails/arel", branch: "master"
gem "sprockets", github: "rails/sprockets", branch: "master"
gem "sprockets-rails", github: "rails/sprockets-rails", branch: "master"
gem "sass-rails", github: "rails/sass-rails"
gem "activemodel-serializers-xml"
gem "activerecord-jdbcpostgresql-adapter", github: "jruby/activerecord-jdbc-adapter", branch: "rails-5", platforms: :jruby
gemspec :path => "../"
# encoding: utf-8
require 'fileutils'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/object/try'
require 'active_support/core_ext/class/attribute'
require 'active_support/concern'
......@@ -9,6 +8,7 @@ module CarrierWave
class << self
attr_accessor :root, :base_path
attr_writer :tmp_path
def configure(&block)
CarrierWave::Uploader::Base.configure(&block)
......@@ -17,6 +17,10 @@ module CarrierWave