-
-
Notifications
You must be signed in to change notification settings - Fork 242
/
Gemfile
39 lines (30 loc) · 1.15 KB
/
Gemfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
source "https://rubygems.org"
# Specify your gem's dependencies in activerecord-postgis-adapter.gemspec
gemspec
gem "pg", "~> 1.0", platform: :ruby
gem "byebug" if ENV["BYEBUG"]
def activerecord_version
return ENV["AR_VERSION"] if ENV["AR_VERSION"]
require "uri"
require "yaml"
require "net/http"
# read gemspec to get activerecord version spec
# pull all activerecord versions from rubygems
# find the newest version that matches the version from our gemspec
gs = Bundler.load_gemspec("activerecord-postgis-adapter.gemspec")
ar_dep = gs.dependencies.find { |d| d.name == "activerecord" }
uri = URI("https://rubygems.org/api/v1/versions/activerecord.yaml")
res = Net::HTTP.get_response(uri)
versions = YAML.safe_load(res.body)
ver = versions.find { |v| ar_dep.match?("activerecord", v["number"]) }
raise Bundler::GemNotFound, "No matching Activerecord version found for #{ar_dep.requirement}" unless ver
ver["number"]
end
# Need to install for tests
gem "rails", github: "rails/rails", tag: "v#{activerecord_version}"
group :development do
# Gems used by the ActiveRecord test suite
gem "bcrypt"
gem "sqlite3"
gem "msgpack"
end