Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Add Rails master appraisals in preparation for Rails 5 #1976

Merged
merged 5 commits into from
Mar 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
rvm:
- 2.1
- 2.2
- 2.2.2

script: "bundle exec rake clean spec cucumber"

gemfile:
- gemfiles/4.2.awsv2.1.gemfile
- gemfiles/4.2.awsv2.0.gemfile
- gemfiles/4.2.awsv2.1.gemfile
- gemfiles/5.0.awsv2.0.gemfile
- gemfiles/5.0.awsv2.1.gemfile

matrix:
fast_finish: true
exclude:
- gemfile: gemfiles/5.0.awsv2.0.gemfile
rvm: 2.0
- gemfile: gemfiles/5.0.awsv2.1.gemfile
rvm: 2.0
- gemfile: gemfiles/5.0.awsv2.0.gemfile
rvm: 2.1
- gemfile: gemfiles/5.0.awsv2.1.gemfile
rvm: 2.1

sudo: false
cache: bundler
14 changes: 12 additions & 2 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
appraise "4.2.awsv2.0" do
gem "rails", "~> 4.2.0"
gem "aws-sdk", "~> 2.0.0"
end

appraise "4.2.awsv2.1" do
gem "rails", "~> 4.2.0"
gem "aws-sdk", "~> 2.1.0"
Expand All @@ -7,11 +12,16 @@ appraise "4.2.awsv2.1" do
end
end

appraise "4.2.awsv2.0" do
gem "rails", "~> 4.2.0"
appraise "5.0.awsv2.0" do
gem "rails", "5.0.0.beta3"
gem "aws-sdk", "~> 2.0.0"

group :development, :test do
gem 'mime-types', '>= 1.16', '< 4'
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to take this combination into account? When is AWS v1 end of life?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about v1 support (this would be another big breaking change deprecation), but I can look into this.


appraise "5.0.awsv2.1" do
gem "rails", "5.0.0.beta3"
gem "aws-sdk", "~> 2.1.0"
end
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Paperclip
=========

## Documentation valid for `master` branch

Please check the documentation for the paperclip version you are using:
https://github.com/thoughtbot/paperclip/releases

---

[![Build Status](https://secure.travis-ci.org/thoughtbot/paperclip.svg?branch=master)](http://travis-ci.org/thoughtbot/paperclip)
[![Dependency Status](https://gemnasium.com/thoughtbot/paperclip.svg?travis)](https://gemnasium.com/thoughtbot/paperclip)
[![Code Climate](https://codeclimate.com/github/thoughtbot/paperclip.svg)](https://codeclimate.com/github/thoughtbot/paperclip)
Expand Down Expand Up @@ -71,9 +78,8 @@ Requirements

### Ruby and Rails

Paperclip now requires Ruby version **>= 2.0.0** and Rails version **3.2, >= 4.1** (Only if you're going to use Paperclip with Ruby on Rails.)

If you're still on Ruby 1.8.7 or Ruby on Rails 2.3.x, you can still use Paperclip 2.7.x with your project. Also, everything in this README might not apply to your version of Paperclip, and you should read [the README for version 2.7](http://www.rubydoc.info/gems/paperclip/2.7.0) instead.
Paperclip now requires Ruby version **>= 2.1** and Rails version **>= 4.2**
(only if you're going to use Paperclip with Ruby on Rails.)

### Image Processor

Expand All @@ -100,7 +106,7 @@ to install GhostScript. On Mac OS X, you can also install that using Homebrew:

brew install gs

If you're on Ubuntu (or any Debian base Linux distribution), you'll want to run
If you are on Ubuntu (or any Debian base Linux distribution), you'll want to run
the following with apt-get:

sudo apt-get install imagemagick -y
Expand Down Expand Up @@ -153,7 +159,7 @@ Paperclip is distributed as a gem, which is how it should be used in your app.
Include the gem in your Gemfile:

```ruby
gem "paperclip", "~> 4.3"
gem "paperclip", "~> 5.0"
```

Or, if you want to get the latest, you can get master from the main paperclip repository:
Expand Down
6 changes: 3 additions & 3 deletions gemfiles/4.2.awsv2.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

source "https://rubygems.org"

gem "sqlite3", "~> 1.3.8", platforms: :ruby
gem "sqlite3", "~> 1.3.8", :platforms => :ruby
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we keep the Ruby 2 hash syntax?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is autogenerated by Appraisals :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which makes sense for a testing library (thoughtbot/appraisal#105 (comment)). Thanks!

gem "pry"
gem "rails", "~> 4.2.0"
gem "aws-sdk", "~> 2.0.0"

group :development, :test do
gem "activerecord-import"
gem "mime-types", ">= 1.16", "< 4"
gem "mime-types"
gem "builder"
gem "rubocop", :require => false
end

gemspec path: "../"
gemspec :path => "../"
4 changes: 2 additions & 2 deletions gemfiles/4.2.awsv2.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source "https://rubygems.org"

gem "sqlite3", "~> 1.3.8", platforms: :ruby
gem "sqlite3", "~> 1.3.8", :platforms => :ruby
gem "pry"
gem "rails", "~> 4.2.0"
gem "aws-sdk", "~> 2.1.0"
Expand All @@ -14,4 +14,4 @@ group :development, :test do
gem "rubocop", :require => false
end

gemspec path: "../"
gemspec :path => "../"
20 changes: 20 additions & 0 deletions gemfiles/4.2.awsv2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "sqlite3", "~> 1.3.8", :platforms => :ruby
gem "jruby-openssl", :platforms => :jruby
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
gem "rubysl", :platforms => :rbx
gem "racc", :platforms => :rbx
gem "pry"
gem "rails", "~> 4.2.0"
gem "aws-sdk", "~> 2.0"

group :development, :test do
gem "mime-types", "~> 1.16"
gem "builder"
gem "rubocop", :require => false
end

gemspec :path => "../"
17 changes: 17 additions & 0 deletions gemfiles/5.0.awsv2.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "sqlite3", "~> 1.3.8", :platforms => :ruby
gem "pry"
gem "rails", "5.0.0.beta3"
gem "aws-sdk", "~> 2.0.0"

group :development, :test do
gem "activerecord-import"
gem "mime-types", ">= 1.16", "< 4"
gem "builder"
gem "rubocop", :require => false
end

gemspec :path => "../"
17 changes: 17 additions & 0 deletions gemfiles/5.0.awsv2.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "sqlite3", "~> 1.3.8", :platforms => :ruby
gem "pry"
gem "rails", "5.0.0.beta3"
gem "aws-sdk", "~> 2.1.0"

group :development, :test do
gem "activerecord-import"
gem "mime-types"
gem "builder"
gem "rubocop", :require => false
end

gemspec :path => "../"
25 changes: 25 additions & 0 deletions gemfiles/5.0.awsv2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "sqlite3", "~> 1.3.8", :platforms => :ruby
gem "jruby-openssl", :platforms => :jruby
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
gem "rubysl", :platforms => :rbx
gem "racc", :platforms => :rbx
gem "pry"
gem "rails", :github => "rails/rails"
gem "sprockets-rails", :github => "rails/sprockets-rails"
gem "sprockets", :github => "rails/sprockets"
gem "sass-rails", :github => "rails/sass-rails"
gem "arel", :github => "rails/arel"
gem "rack", :github => "rack/rack"
gem "aws-sdk", "~> 2.0"

group :development, :test do
gem "mime-types", "~> 1.16"
gem "builder"
gem "rubocop", :require => false
end

gemspec :path => "../"
2 changes: 1 addition & 1 deletion lib/paperclip/attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def post_process(*style_args) #:nodoc:

instance.run_paperclip_callbacks(:post_process) do
instance.run_paperclip_callbacks(:"#{name}_post_process") do
unless @options[:check_validity_before_processing] && instance.errors.any?
if !@options[:check_validity_before_processing] || !instance.errors.any?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [82/80]

post_process_styles(*style_args)
end
end
Expand Down
14 changes: 8 additions & 6 deletions lib/paperclip/callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def self.included(base)

module Defining
def define_paperclip_callbacks(*callbacks)
define_callbacks(*[callbacks, {:terminator => callback_terminator}].flatten)
define_callbacks(*[callbacks, { terminator: hasta_la_vista_baby }].flatten)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [83/80]

callbacks.each do |callback|
eval <<-end_callbacks
def before_#{callback}(*args, &blk)
Expand All @@ -22,11 +22,13 @@ def after_#{callback}(*args, &blk)

private

def callback_terminator
if ::ActiveSupport::VERSION::STRING >= '4.1'
lambda { |target, result| result == false }
else
'result == false'
def hasta_la_vista_baby
lambda do |_, result|
if result.respond_to?(:call)
result.call == false
else
result == false
end
end
end
end
Expand Down
5 changes: 2 additions & 3 deletions spec/paperclip/validators_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@
assert_raises(RuntimeError){ dummy.valid? }
end

it 'allows you to attach a file that does not violates these validations' do
it 'allows you to attach a file that does not violate these validations' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

dummy = Dummy.new(avatar: File.new(fixture_file('rotated.jpg')))
expect(dummy.errors.keys).to match_array []
expect(dummy.errors.full_messages).to be_empty
assert dummy.valid?
end

end

context "using the helper with a conditional" do
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
config.include Assertions
config.include ModelReconstruction
config.include TestData
config.include Reporting
config.extend VersionHelper
config.mock_framework = :mocha
config.before(:all) do
Expand Down
10 changes: 9 additions & 1 deletion spec/support/model_reconstruction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ def reset_class class_name

klass.reset_column_information
klass.connection_pool.clear_table_cache!(klass.table_name) if klass.connection_pool.respond_to?(:clear_table_cache!)
klass.connection.schema_cache.clear_table_cache!(klass.table_name) if klass.connection.respond_to?(:schema_cache)

if klass.connection.respond_to?(:schema_cache)
if ActiveRecord::VERSION::STRING >= "5.0"
klass.connection.schema_cache.clear_data_source_cache!(klass.table_name)
else
klass.connection.schema_cache.clear_table_cache!(klass.table_name)
end
end

klass
end

Expand Down
11 changes: 11 additions & 0 deletions spec/support/reporting.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Reporting
def silence_stream(stream)
old_stream = stream.dup
stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [86/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

stream.sync = true
yield
ensure
stream.reopen(old_stream)
old_stream.close
end
end