Skip to content

Commit 309b429

Browse files
committed
Merge pull request #33 from eileencodes/upgrade-to-rails-5
Upgrade to Rails 5
2 parents e571c6a + 8b679b1 commit 309b429

18 files changed

+526
-226
lines changed

.codeclimate.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
engines:
2+
rubocop:
3+
enabled: true
4+
5+
ratings:
6+
paths:
7+
- "**.rb"

.gitignore

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
*.gem
2-
*.rbc
3-
.bundle
4-
.config
5-
.yardoc
1+
.ruby-version
62
Gemfile.lock
7-
InstalledFiles
8-
_yardoc
9-
coverage
10-
doc/
11-
lib/bundler/man
12-
pkg
13-
rdoc
14-
spec/reports
3+
gemfiles/*.lock
4+
pkg/*
155
test/tmp
16-
test/version_tmp
17-
tmp

.rubocop.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
AllCops:
2+
TargetRubyVersion: 2.2
3+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
4+
# to ignore them, so only the ones explicitly set in this file are enabled.
5+
DisabledByDefault: true
6+
7+
# Prefer &&/|| over and/or.
8+
Style/AndOr:
9+
Enabled: true
10+
11+
# Do not use braces for hash literals when they are the last argument of a
12+
# method call.
13+
Style/BracesAroundHashParameters:
14+
Enabled: true
15+
16+
# Align `when` with `case`.
17+
Style/CaseIndentation:
18+
Enabled: true
19+
20+
# Align comments with method definitions.
21+
Style/CommentIndentation:
22+
Enabled: true
23+
24+
# No extra empty lines.
25+
Style/EmptyLines:
26+
Enabled: true
27+
28+
# In a regular class definition, no empty lines around the body.
29+
Style/EmptyLinesAroundClassBody:
30+
Enabled: true
31+
32+
# In a regular module definition, no empty lines around the body.
33+
Style/EmptyLinesAroundModuleBody:
34+
Enabled: true
35+
36+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
37+
Style/HashSyntax:
38+
Enabled: true
39+
40+
# Method definitions after `private` or `protected` isolated calls need one
41+
# extra level of indentation.
42+
Style/IndentationConsistency:
43+
Enabled: true
44+
EnforcedStyle: rails
45+
46+
# Two spaces, no tabs (for indentation).
47+
Style/IndentationWidth:
48+
Enabled: true
49+
50+
Style/SpaceAfterColon:
51+
Enabled: true
52+
53+
Style/SpaceAfterComma:
54+
Enabled: true
55+
56+
Style/SpaceAroundEqualsInParameterDefault:
57+
Enabled: true
58+
59+
Style/SpaceAroundKeyword:
60+
Enabled: true
61+
62+
Style/SpaceAroundOperators:
63+
Enabled: true
64+
65+
Style/SpaceBeforeFirstArg:
66+
Enabled: true
67+
68+
# Defining a method with parameters needs parentheses.
69+
Style/MethodDefParentheses:
70+
Enabled: true
71+
72+
# Use `foo {}` not `foo{}`.
73+
Style/SpaceBeforeBlockBraces:
74+
Enabled: true
75+
76+
# Use `foo { bar }` not `foo {bar}`.
77+
Style/SpaceInsideBlockBraces:
78+
Enabled: true
79+
80+
# Use `{ a: 1 }` not `{a:1}`.
81+
Style/SpaceInsideHashLiteralBraces:
82+
Enabled: true
83+
84+
Style/SpaceInsideParens:
85+
Enabled: true
86+
87+
# Check quotes usage according to lint rule below.
88+
Style/StringLiterals:
89+
Enabled: true
90+
EnforcedStyle: double_quotes
91+
92+
# Detect hard tabs, no hard tabs.
93+
Style/Tab:
94+
Enabled: true
95+
96+
# Blank lines should not have any spaces.
97+
Style/TrailingBlankLines:
98+
Enabled: true
99+
100+
# No trailing whitespace.
101+
Style/TrailingWhitespace:
102+
Enabled: true
103+
104+
# Use quotes for string literals when they are enough.
105+
Style/UnneededPercentQ:
106+
Enabled: true
107+
108+
# Align `end` with the matching keyword or starting expression except for
109+
# assignments, where it should be aligned with the LHS.
110+
Lint/EndAlignment:
111+
Enabled: true
112+
AlignWith: variable
113+
114+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
115+
Lint/RequireParentheses:
116+
Enabled: true

.travis.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,50 @@
11
language: ruby
2+
sudo: false
3+
4+
cache:
5+
bundler: true
6+
27
before_install:
38
- gem install bundler
9+
410
rvm:
511
- 1.9.3
612
- 2.0.0
13+
- 2.1.8
14+
- 2.2.5
15+
- 2.3.1
16+
717
gemfile:
818
- Gemfile
9-
- gemfiles/Gemfile-edge
1019
- gemfiles/Gemfile-4-0-stable
20+
- gemfiles/Gemfile-4-1-stable
21+
- gemfiles/Gemfile-4-2-stable
22+
- gemfiles/Gemfile-5-0-stable
23+
- gemfiles/Gemfile-edge
24+
1125
matrix:
1226
allow_failures:
1327
- gemfile: gemfiles/Gemfile-edge
28+
exclude:
29+
- rvm: 1.9.3
30+
gemfile: Gemfile
31+
- rvm: 2.0.0
32+
gemfile: Gemfile
33+
- rvm: 2.1.8
34+
gemfile: Gemfile
35+
- rvm: 1.9.3
36+
gemfile: gemfiles/Gemfile-5-0-stable
37+
- rvm: 2.0.0
38+
gemfile: gemfiles/Gemfile-5-0-stable
39+
- rvm: 2.1.8
40+
gemfile: gemfiles/Gemfile-5-0-stable
41+
- rvm: 1.9.3
42+
gemfile: gemfiles/Gemfile-edge
43+
- rvm: 2.0.0
44+
gemfile: gemfiles/Gemfile-edge
45+
- rvm: 2.1.8
46+
gemfile: gemfiles/Gemfile-edge
47+
1448
notifications:
1549
email: false
1650
irc:

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
source 'https://rubygems.org'
1+
source "https://rubygems.org"
22

33
gemspec
44

5-
gem 'rails'
5+
gem "rails"

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Installation
88

99
Add this line to your application's Gemfile:
1010

11-
gem 'actionpack-action_caching'
11+
gem "actionpack-action_caching"
1212

1313
And then execute:
1414

@@ -29,7 +29,7 @@ authentication and other restrictions on whether someone is allowed
2929
to execute such action.
3030

3131
class ListsController < ApplicationController
32-
before_filter :authenticate, except: :public
32+
before_action :authenticate, except: :public
3333

3434
caches_page :public
3535
caches_action :index, :show
@@ -54,8 +54,8 @@ Different representations of the same resource, e.g.
5454
`http://david.example.com/lists.xml`
5555
are treated like separate requests and so are cached separately.
5656
Keep in mind when expiring an action cache that
57-
`action: 'lists'` is not the same as
58-
`action: 'list', format: :xml`.
57+
`action: "lists"` is not the same as
58+
`action: "list", format: :xml`.
5959

6060
You can modify the default action cache path by passing a
6161
`:cache_path` option. This will be passed directly to
@@ -72,7 +72,7 @@ interval (in seconds) to schedule expiration of the cached item.
7272
The following example depicts some of the points made above:
7373

7474
class ListsController < ApplicationController
75-
before_filter :authenticate, except: :public
75+
before_action :authenticate, except: :public
7676

7777
caches_page :public
7878

Rakefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env rake
2-
require 'bundler/gem_tasks'
3-
require 'rake/testtask'
2+
require "bundler/gem_tasks"
3+
require "rake/testtask"
44

55
Rake::TestTask.new do |t|
6-
t.libs = ['test']
7-
t.pattern = 'test/**/*_test.rb'
8-
t.ruby_opts = ['-w']
6+
t.libs = ["test"]
7+
t.pattern = "test/**/*_test.rb"
8+
t.ruby_opts = ["-w"]
99
end
1010

1111
task default: :test

actionpack-action_caching.gemspec

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
# -*- encoding: utf-8 -*-
2-
31
Gem::Specification.new do |gem|
4-
gem.name = 'actionpack-action_caching'
5-
gem.version = '1.1.0'
6-
gem.author = 'David Heinemeier Hansson'
7-
gem.email = '[email protected]'
8-
gem.description = 'Action caching for Action Pack (removed from core in Rails 4.0)'
9-
gem.summary = 'Action caching for Action Pack (removed from core in Rails 4.0)'
10-
gem.homepage = 'https://github.com/rails/actionpack-action_caching'
2+
gem.name = "actionpack-action_caching"
3+
gem.version = "1.1.1"
4+
gem.author = "David Heinemeier Hansson"
5+
gem.email = "[email protected]"
6+
gem.description = "Action caching for Action Pack (removed from core in Rails 4.0)"
7+
gem.summary = "Action caching for Action Pack (removed from core in Rails 4.0)"
8+
gem.homepage = "https://github.com/rails/actionpack-action_caching"
119

10+
gem.required_ruby_version = ">= 1.9.3"
1211
gem.files = `git ls-files`.split($/)
13-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
1413
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15-
gem.require_paths = ['lib']
16-
gem.license = 'MIT'
14+
gem.require_paths = ["lib"]
15+
gem.license = "MIT"
1716

18-
gem.add_dependency 'actionpack', '>= 4.0.0', '< 5.0'
17+
gem.add_dependency "actionpack", ">= 4.0.0", "< 6"
1918

20-
gem.add_development_dependency 'mocha'
21-
gem.add_development_dependency 'activerecord', '>= 4.0.0.beta', '< 5'
19+
gem.add_development_dependency "mocha"
20+
gem.add_development_dependency "activerecord", ">= 4.0.0", "< 6"
2221
end

gemfiles/Gemfile-4-0-stable

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
source 'https://rubygems.org'
1+
source "https://rubygems.org"
22

3-
gemspec path: '..'
3+
gemspec path: ".."
44

5-
gem 'rails', github: 'rails/rails', branch: '4-0-stable'
5+
gem "rails", github: "rails/rails", branch: "4-0-stable"
6+
gem "mime-types", "< 3"

gemfiles/Gemfile-4-1-stable

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source "https://rubygems.org"
2+
3+
gemspec path: ".."
4+
5+
gem "rails", github: "rails/rails", branch: "4-1-stable"
6+
gem "mime-types", "< 3"

0 commit comments

Comments
 (0)