Skip to content

Commit

Permalink
feat: support rails 4
Browse files Browse the repository at this point in the history
  • Loading branch information
TamarinEA committed Dec 14, 2016
1 parent fca99fa commit 019562a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.bundle/
/.yardoc
/.idea/
/Gemfile.lock
/_yardoc/
/coverage/
Expand Down
12 changes: 12 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@ end
appraise 'rails3.2' do
gem 'rails', '~> 3.2.0'
end

appraise 'rails4.0' do
gem 'rails', '~> 4.0.0'
end

appraise 'rails4.1' do
gem 'rails', '~> 4.1.0'
end

appraise 'rails4.2' do
gem 'rails', '~> 4.2.0'
end
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
source 'https://rubygems.org'

gemspec

if RUBY_VERSION < '2'
gem 'mime-types', '< 3.0'
gem 'json', '< 2.0'
end
6 changes: 5 additions & 1 deletion lib/slaver/pools_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ def initialize_pool(config_name)
def create_connection_pool(config_name)
config = ::ActiveRecord::Base.configurations[config_name]
config.symbolize_keys!
spec = ActiveRecord::Base::ConnectionSpecification.new(config, "#{config[:adapter]}_connection")
if ActiveRecord::VERSION::MAJOR < 4
spec = ActiveRecord::Base::ConnectionSpecification.new(config, "#{config[:adapter]}_connection")
else
spec = ActiveRecord::ConnectionAdapters::ConnectionSpecification.new(config, "#{config[:adapter]}_connection")
end

ActiveRecord::ConnectionAdapters::ConnectionPool.new(spec)
end
Expand Down
6 changes: 3 additions & 3 deletions slaver.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_runtime_dependency 'activerecord', '~> 3.1'
spec.add_runtime_dependency 'activesupport', '~> 3.1'
spec.add_runtime_dependency 'activerecord', '>= 3.1.0', '< 5.0'
spec.add_runtime_dependency 'activesupport', '>= 3.1.0', '< 5.0'

spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '~> 3.3'
spec.add_development_dependency 'rspec-rails'
spec.add_development_dependency 'combustion', '~> 0.5'
spec.add_development_dependency 'combustion', '>= 0.5.0', '< 0.5.5'
spec.add_development_dependency 'appraisal'
spec.add_development_dependency 'pry-debugger'
spec.add_development_dependency 'shoulda-matchers', '< 3.0.0'
Expand Down

0 comments on commit 019562a

Please sign in to comment.