rails4_upgrade 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +5 -0
- data/lib/rails4_upgrade.rb +8 -0
- data/lib/rails4_upgrade/formatters.rb +1 -0
- data/lib/rails4_upgrade/formatters/incompatible_gems_formatter.rb +35 -0
- data/lib/rails4_upgrade/gem.rb +19 -0
- data/lib/rails4_upgrade/gem_dependency.rb +20 -0
- data/lib/rails4_upgrade/gemfile.rb +32 -0
- data/lib/rails4_upgrade/incompatibility.rb +10 -0
- data/lib/rails4_upgrade/incompatible_gems.rb +34 -0
- data/lib/rails4_upgrade/railtie.rb +7 -0
- data/lib/rails4_upgrade/tasks/upgrade.rake +11 -0
- data/lib/rails4_upgrade/version.rb +3 -0
- data/rails4_upgrade.gemspec +26 -0
- data/spec/fixtures/gemfiles/Gemfile_with_devise.lock +95 -0
- data/spec/fixtures/gemfiles/Gemfile_with_ransack.lock +92 -0
- data/spec/gemfile_spec.rb +34 -0
- data/spec/incompatible_gems_spec.rb +55 -0
- data/spec/spec_helper.rb +14 -0
- metadata +155 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Andy Lindeman
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# rails4\_upgrade [![Build Status](https://secure.travis-ci.org/alindeman/rails4_upgrade.png?branch=master)](http://travis-ci.org/alindeman/rails4_upgrade)
|
2
|
+
|
3
|
+
Helps you more easily upgrade to Rails 4. A work in progress, I'm simply
|
4
|
+
shipping something of a minimum viable product to attract others to
|
5
|
+
contribute.
|
6
|
+
|
7
|
+
Inspired by [rails_upgrade](https://github.com/rails/rails_upgrade) which
|
8
|
+
helped upgrade applications from Rails 2 to Rails 3.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Upgrade to Ruby 1.9.3 if your application does not already use it. Rails 4
|
13
|
+
requires Ruby 1.9.3, and `rails4_upgrade` uses 1.9-only syntax and semantics.
|
14
|
+
|
15
|
+
Add to `Gemfile`:
|
16
|
+
|
17
|
+
gem 'rails4_upgrade', github: 'alindeman/rails4_upgrade'
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
List gems that would currently prevent you from upgrading to Rails 4:
|
22
|
+
|
23
|
+
rake rails4:check_gems
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
I'm open to accepting pull requests that improve the functionality of the gem.
|
28
|
+
|
29
|
+
If there's an upgrade procedure that can be automated or semi-automated, let's
|
30
|
+
discuss it. Open an
|
31
|
+
[issue](https://github.com/alindeman/rails4_upgrade/issues).
|
32
|
+
|
33
|
+
Ideas:
|
34
|
+
|
35
|
+
* Recommending versions of gems that may be compatible with Rails 4
|
36
|
+
* Removing deprecated configuration options
|
37
|
+
* Adding newly required or recommended configuration options
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "rails4_upgrade/formatters/incompatible_gems_formatter"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Rails4Upgrade
|
2
|
+
module Formatters
|
3
|
+
class IncompatibleGemsFormatter
|
4
|
+
def initialize(incompatible_gems)
|
5
|
+
@incompatible_gems = incompatible_gems
|
6
|
+
end
|
7
|
+
|
8
|
+
def output(stream = STDOUT)
|
9
|
+
incompatibilities = @incompatible_gems.incompatibilities
|
10
|
+
if incompatibilities.empty?
|
11
|
+
stream.puts colorize(:success, "No gem incompatibilities found")
|
12
|
+
else
|
13
|
+
incompatibilities.each do |incompatibility|
|
14
|
+
stream.puts colorize(:failure, "#{human_readable_dependency_path(incompatibility.path)} depends on #{incompatibility.dependency.name} #{incompatibility.dependency.requirement}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def human_readable_dependency_path(path)
|
22
|
+
path.map { |dependency| "#{dependency.name} #{dependency.version}" }.join(" -> ")
|
23
|
+
end
|
24
|
+
|
25
|
+
def colorize(tag, string)
|
26
|
+
case tag
|
27
|
+
when :failure
|
28
|
+
"\e[31m#{string}\e[0m"
|
29
|
+
when :success
|
30
|
+
"\e[35m#{string}\e[0m"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "set"
|
2
|
+
require "rails4_upgrade/incompatibility"
|
3
|
+
|
4
|
+
module Rails4Upgrade
|
5
|
+
class Gem < Struct.new(:name, :version, :dependencies)
|
6
|
+
RAILS_GEMS = Set.new(
|
7
|
+
%w(actionmailer actionpack activemodel activerecord activesupport railties rails)
|
8
|
+
).freeze
|
9
|
+
|
10
|
+
def initialize(name, version, dependencies)
|
11
|
+
version = version.is_a?(::Gem::Version) ? version : ::Gem::Version.new(version)
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def rails?
|
16
|
+
RAILS_GEMS.include?(name)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Rails4Upgrade
|
2
|
+
class GemDependency < Struct.new(:name, :requirement)
|
3
|
+
RAILS_GEMS = Set.new(
|
4
|
+
%w(actionmailer actionpack activemodel activerecord activesupport railties rails)
|
5
|
+
).freeze
|
6
|
+
|
7
|
+
def initialize(name, requirement)
|
8
|
+
requirement = requirement.is_a?(::Gem::Requirement) ? requirement : ::Gem::Requirement.new(requirement)
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
def rails?
|
13
|
+
RAILS_GEMS.include?(name)
|
14
|
+
end
|
15
|
+
|
16
|
+
def satisfied_by_rails4?
|
17
|
+
requirement.satisfied_by?(::Gem::Version.new("4.0.0"))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "set"
|
2
|
+
require "rails4_upgrade/gem_dependency"
|
3
|
+
require "rails4_upgrade/gem"
|
4
|
+
|
5
|
+
module Rails4Upgrade
|
6
|
+
class Gemfile
|
7
|
+
def initialize(lockfile_io)
|
8
|
+
@lockfile = Bundler::LockfileParser.new(lockfile_io.read)
|
9
|
+
|
10
|
+
@gems = Hash[@lockfile.specs.map { |spec|
|
11
|
+
[
|
12
|
+
spec.name,
|
13
|
+
Gem.new(
|
14
|
+
spec.name,
|
15
|
+
spec.version,
|
16
|
+
spec.dependencies.map { |dependency| GemDependency.new(dependency.name, dependency.requirement) }
|
17
|
+
)
|
18
|
+
]
|
19
|
+
}]
|
20
|
+
end
|
21
|
+
|
22
|
+
def dependencies
|
23
|
+
@dependencies ||= @lockfile.dependencies.map { |dependency|
|
24
|
+
self[dependency.name]
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def [](gem_name)
|
29
|
+
@gems[gem_name]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Rails4Upgrade
|
2
|
+
GemIncompatibility = Struct.new(:dependency, :path)
|
3
|
+
|
4
|
+
class IncompatibleGems
|
5
|
+
def initialize(gemfile)
|
6
|
+
@gemfile = gemfile
|
7
|
+
end
|
8
|
+
|
9
|
+
def incompatibilities
|
10
|
+
@gemfile.dependencies.reject(&:rails?).inject([]) { |incompatibilities, dependency|
|
11
|
+
incompatibilities.concat(incompatibilities_for(dependency))
|
12
|
+
incompatibilities
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def incompatibilities_for(gem, dependency_path = [])
|
19
|
+
dependency_path += [gem]
|
20
|
+
|
21
|
+
gem.dependencies.inject([]) do |incompatibilities, dependency|
|
22
|
+
if dependency.rails?
|
23
|
+
if !dependency.satisfied_by_rails4?
|
24
|
+
incompatibilities << GemIncompatibility.new(dependency, dependency_path)
|
25
|
+
end
|
26
|
+
elsif gem = @gemfile[dependency.name]
|
27
|
+
incompatibilities.concat(incompatibilities_for(gem, dependency_path))
|
28
|
+
end
|
29
|
+
|
30
|
+
incompatibilities
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
namespace :rails4 do
|
2
|
+
desc "Check for gem incompatibilities with Rails 4"
|
3
|
+
task :check_gems do
|
4
|
+
gemfile_path = File.join(".", "Gemfile.lock")
|
5
|
+
gemfile = Rails4Upgrade::Gemfile.new(File.open(gemfile_path))
|
6
|
+
incompatibile_gems = Rails4Upgrade::IncompatibleGems.new(gemfile)
|
7
|
+
|
8
|
+
formatter = Rails4Upgrade::Formatters::IncompatibleGemsFormatter.new(incompatibile_gems)
|
9
|
+
formatter.output
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rails4_upgrade/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "rails4_upgrade"
|
8
|
+
gem.version = Rails4Upgrade::VERSION
|
9
|
+
gem.authors = ["Andy Lindeman"]
|
10
|
+
gem.email = ["alindeman@gmail.com"]
|
11
|
+
gem.description = %q{Upgrade assistant for transitioning applications from Rails 3 to Rails 4}
|
12
|
+
gem.summary = %q{Upgrade assistant for transitioning applications from Rails 3 to Rails 4}
|
13
|
+
gem.homepage = "http://www.upgradingtorails4.com/"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency "bundler", ">=1.2.2"
|
21
|
+
|
22
|
+
gem.add_development_dependency "rake", "~>10.0.0"
|
23
|
+
gem.add_development_dependency "rspec", "~>2.12.0"
|
24
|
+
gem.add_development_dependency "vcr", "~>2.3.0"
|
25
|
+
gem.add_development_dependency "webmock", "~>1.8.0"
|
26
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (3.2.8)
|
5
|
+
actionpack (= 3.2.8)
|
6
|
+
mail (~> 2.4.4)
|
7
|
+
actionpack (3.2.8)
|
8
|
+
activemodel (= 3.2.8)
|
9
|
+
activesupport (= 3.2.8)
|
10
|
+
builder (~> 3.0.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
journey (~> 1.0.4)
|
13
|
+
rack (~> 1.4.0)
|
14
|
+
rack-cache (~> 1.2)
|
15
|
+
rack-test (~> 0.6.1)
|
16
|
+
sprockets (~> 2.1.3)
|
17
|
+
activemodel (3.2.8)
|
18
|
+
activesupport (= 3.2.8)
|
19
|
+
builder (~> 3.0.0)
|
20
|
+
activerecord (3.2.8)
|
21
|
+
activemodel (= 3.2.8)
|
22
|
+
activesupport (= 3.2.8)
|
23
|
+
arel (~> 3.0.2)
|
24
|
+
tzinfo (~> 0.3.29)
|
25
|
+
activeresource (3.2.8)
|
26
|
+
activemodel (= 3.2.8)
|
27
|
+
activesupport (= 3.2.8)
|
28
|
+
activesupport (3.2.8)
|
29
|
+
i18n (~> 0.6)
|
30
|
+
multi_json (~> 1.0)
|
31
|
+
arel (3.0.2)
|
32
|
+
bcrypt-ruby (3.0.1)
|
33
|
+
builder (3.0.4)
|
34
|
+
devise (2.1.2)
|
35
|
+
bcrypt-ruby (~> 3.0)
|
36
|
+
orm_adapter (~> 0.1)
|
37
|
+
railties (~> 3.1)
|
38
|
+
warden (~> 1.2.1)
|
39
|
+
erubis (2.7.0)
|
40
|
+
hike (1.2.1)
|
41
|
+
i18n (0.6.1)
|
42
|
+
journey (1.0.4)
|
43
|
+
json (1.7.5)
|
44
|
+
mail (2.4.4)
|
45
|
+
i18n (>= 0.4.0)
|
46
|
+
mime-types (~> 1.16)
|
47
|
+
treetop (~> 1.4.8)
|
48
|
+
mime-types (1.19)
|
49
|
+
multi_json (1.3.7)
|
50
|
+
orm_adapter (0.4.0)
|
51
|
+
polyglot (0.3.3)
|
52
|
+
rack (1.4.1)
|
53
|
+
rack-cache (1.2)
|
54
|
+
rack (>= 0.4)
|
55
|
+
rack-ssl (1.3.2)
|
56
|
+
rack
|
57
|
+
rack-test (0.6.2)
|
58
|
+
rack (>= 1.0)
|
59
|
+
rails (3.2.8)
|
60
|
+
actionmailer (= 3.2.8)
|
61
|
+
actionpack (= 3.2.8)
|
62
|
+
activerecord (= 3.2.8)
|
63
|
+
activeresource (= 3.2.8)
|
64
|
+
activesupport (= 3.2.8)
|
65
|
+
bundler (~> 1.0)
|
66
|
+
railties (= 3.2.8)
|
67
|
+
railties (3.2.8)
|
68
|
+
actionpack (= 3.2.8)
|
69
|
+
activesupport (= 3.2.8)
|
70
|
+
rack-ssl (~> 1.3.2)
|
71
|
+
rake (>= 0.8.7)
|
72
|
+
rdoc (~> 3.4)
|
73
|
+
thor (>= 0.14.6, < 2.0)
|
74
|
+
rake (10.0.1)
|
75
|
+
rdoc (3.12)
|
76
|
+
json (~> 1.4)
|
77
|
+
sprockets (2.1.3)
|
78
|
+
hike (~> 1.2)
|
79
|
+
rack (~> 1.0)
|
80
|
+
tilt (~> 1.1, != 1.3.0)
|
81
|
+
thor (0.16.0)
|
82
|
+
tilt (1.3.3)
|
83
|
+
treetop (1.4.12)
|
84
|
+
polyglot
|
85
|
+
polyglot (>= 0.3.1)
|
86
|
+
tzinfo (0.3.35)
|
87
|
+
warden (1.2.1)
|
88
|
+
rack (>= 1.0)
|
89
|
+
|
90
|
+
PLATFORMS
|
91
|
+
ruby
|
92
|
+
|
93
|
+
DEPENDENCIES
|
94
|
+
devise
|
95
|
+
rails (= 3.2.8)
|
@@ -0,0 +1,92 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (3.2.8)
|
5
|
+
actionpack (= 3.2.8)
|
6
|
+
mail (~> 2.4.4)
|
7
|
+
actionpack (3.2.8)
|
8
|
+
activemodel (= 3.2.8)
|
9
|
+
activesupport (= 3.2.8)
|
10
|
+
builder (~> 3.0.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
journey (~> 1.0.4)
|
13
|
+
rack (~> 1.4.0)
|
14
|
+
rack-cache (~> 1.2)
|
15
|
+
rack-test (~> 0.6.1)
|
16
|
+
sprockets (~> 2.1.3)
|
17
|
+
activemodel (3.2.8)
|
18
|
+
activesupport (= 3.2.8)
|
19
|
+
builder (~> 3.0.0)
|
20
|
+
activerecord (3.2.8)
|
21
|
+
activemodel (= 3.2.8)
|
22
|
+
activesupport (= 3.2.8)
|
23
|
+
arel (~> 3.0.2)
|
24
|
+
tzinfo (~> 0.3.29)
|
25
|
+
activeresource (3.2.8)
|
26
|
+
activemodel (= 3.2.8)
|
27
|
+
activesupport (= 3.2.8)
|
28
|
+
activesupport (3.2.8)
|
29
|
+
i18n (~> 0.6)
|
30
|
+
multi_json (~> 1.0)
|
31
|
+
arel (3.0.2)
|
32
|
+
builder (3.0.4)
|
33
|
+
erubis (2.7.0)
|
34
|
+
hike (1.2.1)
|
35
|
+
i18n (0.6.1)
|
36
|
+
journey (1.0.4)
|
37
|
+
json (1.7.5)
|
38
|
+
mail (2.4.4)
|
39
|
+
i18n (>= 0.4.0)
|
40
|
+
mime-types (~> 1.16)
|
41
|
+
treetop (~> 1.4.8)
|
42
|
+
mime-types (1.19)
|
43
|
+
multi_json (1.3.7)
|
44
|
+
polyamorous (0.5.0)
|
45
|
+
activerecord (~> 3.0)
|
46
|
+
polyglot (0.3.3)
|
47
|
+
rack (1.4.1)
|
48
|
+
rack-cache (1.2)
|
49
|
+
rack (>= 0.4)
|
50
|
+
rack-ssl (1.3.2)
|
51
|
+
rack
|
52
|
+
rack-test (0.6.2)
|
53
|
+
rack (>= 1.0)
|
54
|
+
rails (3.2.8)
|
55
|
+
actionmailer (= 3.2.8)
|
56
|
+
actionpack (= 3.2.8)
|
57
|
+
activerecord (= 3.2.8)
|
58
|
+
activeresource (= 3.2.8)
|
59
|
+
activesupport (= 3.2.8)
|
60
|
+
bundler (~> 1.0)
|
61
|
+
railties (= 3.2.8)
|
62
|
+
railties (3.2.8)
|
63
|
+
actionpack (= 3.2.8)
|
64
|
+
activesupport (= 3.2.8)
|
65
|
+
rack-ssl (~> 1.3.2)
|
66
|
+
rake (>= 0.8.7)
|
67
|
+
rdoc (~> 3.4)
|
68
|
+
thor (>= 0.14.6, < 2.0)
|
69
|
+
rake (10.0.1)
|
70
|
+
ransack (0.7.0)
|
71
|
+
actionpack (~> 3.0)
|
72
|
+
activerecord (~> 3.0)
|
73
|
+
polyamorous (~> 0.5.0)
|
74
|
+
rdoc (3.12)
|
75
|
+
json (~> 1.4)
|
76
|
+
sprockets (2.1.3)
|
77
|
+
hike (~> 1.2)
|
78
|
+
rack (~> 1.0)
|
79
|
+
tilt (~> 1.1, != 1.3.0)
|
80
|
+
thor (0.16.0)
|
81
|
+
tilt (1.3.3)
|
82
|
+
treetop (1.4.12)
|
83
|
+
polyglot
|
84
|
+
polyglot (>= 0.3.1)
|
85
|
+
tzinfo (0.3.35)
|
86
|
+
|
87
|
+
PLATFORMS
|
88
|
+
ruby
|
89
|
+
|
90
|
+
DEPENDENCIES
|
91
|
+
rails (= 3.2.8)
|
92
|
+
ransack
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Rails4Upgrade
|
4
|
+
describe Gemfile do
|
5
|
+
let(:gemfile_path) { File.join(File.dirname(__FILE__), "fixtures", "gemfiles", "Gemfile_with_devise.lock") }
|
6
|
+
let(:gemfile) { Rails4Upgrade::Gemfile.new(File.open(gemfile_path)) }
|
7
|
+
|
8
|
+
it "lists the direct dependencies" do
|
9
|
+
devise = gemfile.dependencies[0]
|
10
|
+
expect(devise.name).to eq("devise")
|
11
|
+
expect(devise.version).to eq(::Gem::Version.new("2.1.2"))
|
12
|
+
|
13
|
+
rails = gemfile.dependencies[1]
|
14
|
+
expect(rails.name).to eq("rails")
|
15
|
+
expect(rails.version).to eq(::Gem::Version.new("3.2.8"))
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns the specific details about a given gem" do
|
19
|
+
bcrypt = gemfile["bcrypt-ruby"]
|
20
|
+
expect(bcrypt.name).to eq("bcrypt-ruby")
|
21
|
+
expect(bcrypt.version).to eq(::Gem::Version.new("3.0.1"))
|
22
|
+
end
|
23
|
+
|
24
|
+
it "lists the dependencies of a given gem" do
|
25
|
+
devise = gemfile["devise"]
|
26
|
+
expect(devise.dependencies).to match_array([
|
27
|
+
GemDependency.new("bcrypt-ruby", "~> 3.0"),
|
28
|
+
GemDependency.new("orm_adapter", "~> 0.1"),
|
29
|
+
GemDependency.new("railties", "~> 3.1"),
|
30
|
+
GemDependency.new("warden", "~> 1.2.1")
|
31
|
+
])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Rails4Upgrade
|
4
|
+
describe IncompatibleGems do
|
5
|
+
context "with Devise, a gem that depends on Rails ~> 3.2" do
|
6
|
+
let(:gemfile_path) { File.join(File.dirname(__FILE__), "fixtures", "gemfiles", "Gemfile_with_devise.lock") }
|
7
|
+
let(:gemfile) { Rails4Upgrade::Gemfile.new(File.open(gemfile_path)) }
|
8
|
+
subject(:incompatible_gems) { IncompatibleGems.new(gemfile) }
|
9
|
+
|
10
|
+
it "lists incompatibilities" do
|
11
|
+
incompatibilities = incompatible_gems.incompatibilities
|
12
|
+
|
13
|
+
expect(incompatibilities.size).to eq(1)
|
14
|
+
expect(incompatibilities[0].dependency).to eq(GemDependency.new("railties", "~> 3.1"))
|
15
|
+
|
16
|
+
expect(incompatibilities[0].path.size).to eq(1)
|
17
|
+
expect(incompatibilities[0].path[0].name).to eq("devise")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "with Ransack, a gem with multi-level dependencies on Rails ~> 3.0" do
|
22
|
+
let(:gemfile_path) { File.join(File.dirname(__FILE__), "fixtures", "gemfiles", "Gemfile_with_ransack.lock") }
|
23
|
+
let(:gemfile) { Rails4Upgrade::Gemfile.new(File.open(gemfile_path)) }
|
24
|
+
subject(:incompatible_gems) { IncompatibleGems.new(gemfile) }
|
25
|
+
|
26
|
+
it "lists incompatibilities" do
|
27
|
+
incompatibilities = incompatible_gems.incompatibilities
|
28
|
+
|
29
|
+
expect(incompatibilities.size).to eq(3)
|
30
|
+
expect(incompatibilities[2].dependency).to eq(GemDependency.new("activerecord", "~> 3.0"))
|
31
|
+
end
|
32
|
+
|
33
|
+
it "list incompatibilies from ransack itself" do
|
34
|
+
incompatibilities = incompatible_gems.incompatibilities
|
35
|
+
|
36
|
+
expect(incompatibilities[0].dependency).to eq(GemDependency.new("actionpack", "~> 3.0"))
|
37
|
+
expect(incompatibilities[0].path.size).to eq(1)
|
38
|
+
expect(incompatibilities[0].path[0].name).to eq("ransack")
|
39
|
+
|
40
|
+
expect(incompatibilities[1].dependency).to eq(GemDependency.new("activerecord", "~> 3.0"))
|
41
|
+
expect(incompatibilities[1].path.size).to eq(1)
|
42
|
+
expect(incompatibilities[1].path[0].name).to eq("ransack")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "lists incompatibilities from polyamorous, which ransack depends on" do
|
46
|
+
incompatibilities = incompatible_gems.incompatibilities
|
47
|
+
|
48
|
+
expect(incompatibilities[2].dependency).to eq(GemDependency.new("activerecord", "~> 3.0"))
|
49
|
+
expect(incompatibilities[2].path.size).to eq(2)
|
50
|
+
expect(incompatibilities[2].path[0].name).to eq("ransack")
|
51
|
+
expect(incompatibilities[2].path[1].name).to eq("polyamorous")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "vcr"
|
2
|
+
require_relative "../lib/rails4_upgrade"
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
6
|
+
config.run_all_when_everything_filtered = true
|
7
|
+
config.filter_run :focus
|
8
|
+
config.order = 'random'
|
9
|
+
end
|
10
|
+
|
11
|
+
VCR.configure do |c|
|
12
|
+
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
13
|
+
c.hook_into :webmock
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails4_upgrade
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Andy Lindeman
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.2.2
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.2.2
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 10.0.0
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 10.0.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.12.0
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.12.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: vcr
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.3.0
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.3.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: webmock
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.8.0
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.8.0
|
94
|
+
description: Upgrade assistant for transitioning applications from Rails 3 to Rails
|
95
|
+
4
|
96
|
+
email:
|
97
|
+
- alindeman@gmail.com
|
98
|
+
executables: []
|
99
|
+
extensions: []
|
100
|
+
extra_rdoc_files: []
|
101
|
+
files:
|
102
|
+
- .gitignore
|
103
|
+
- .rspec
|
104
|
+
- .travis.yml
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE.txt
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- lib/rails4_upgrade.rb
|
110
|
+
- lib/rails4_upgrade/formatters.rb
|
111
|
+
- lib/rails4_upgrade/formatters/incompatible_gems_formatter.rb
|
112
|
+
- lib/rails4_upgrade/gem.rb
|
113
|
+
- lib/rails4_upgrade/gem_dependency.rb
|
114
|
+
- lib/rails4_upgrade/gemfile.rb
|
115
|
+
- lib/rails4_upgrade/incompatibility.rb
|
116
|
+
- lib/rails4_upgrade/incompatible_gems.rb
|
117
|
+
- lib/rails4_upgrade/railtie.rb
|
118
|
+
- lib/rails4_upgrade/tasks/upgrade.rake
|
119
|
+
- lib/rails4_upgrade/version.rb
|
120
|
+
- rails4_upgrade.gemspec
|
121
|
+
- spec/fixtures/gemfiles/Gemfile_with_devise.lock
|
122
|
+
- spec/fixtures/gemfiles/Gemfile_with_ransack.lock
|
123
|
+
- spec/gemfile_spec.rb
|
124
|
+
- spec/incompatible_gems_spec.rb
|
125
|
+
- spec/spec_helper.rb
|
126
|
+
homepage: http://www.upgradingtorails4.com/
|
127
|
+
licenses: []
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
requirements: []
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 1.8.24
|
147
|
+
signing_key:
|
148
|
+
specification_version: 3
|
149
|
+
summary: Upgrade assistant for transitioning applications from Rails 3 to Rails 4
|
150
|
+
test_files:
|
151
|
+
- spec/fixtures/gemfiles/Gemfile_with_devise.lock
|
152
|
+
- spec/fixtures/gemfiles/Gemfile_with_ransack.lock
|
153
|
+
- spec/gemfile_spec.rb
|
154
|
+
- spec/incompatible_gems_spec.rb
|
155
|
+
- spec/spec_helper.rb
|