Skip to content

Commit d491242

Browse files
sagebombdblock
authored andcommitted
Add ruby version checking in Gemfile to install needed gems versions (#234)
1 parent ad19bf9 commit d491242

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* [#219](https://github.com/ruby-grape/grape-entity/pull/219): Fix: double pass options in serializable_hash - [@sbatykov](https://github.com/sbatykov).
66
* [#226](https://github.com/ruby-grape/grape-entity/pull/226): Added fetch method to fetch from opts_hash - [@alanjcfs](https://github.com/alanjcfs).
77
* [#232](https://github.com/ruby-grape/grape-entity/pull/232), [#213](https://github.com/ruby-grape/grape-entity/issues/213): Added `#kind_of?` and `#is_a?` to `OutputBuilder` to get an exact class of an `output` object - [@avyy](https://github.com/avyy).
8+
* [#234](https://github.com/ruby-grape/grape-entity/pull/234), [#233](https://github.com/ruby-grape/grape-entity/issues/233): Added ruby version checking in `Gemfile` to install needed gems versions for supporting old rubies too - [@avyy](https://github.com/avyy).
89
* Your contribution here.
910

1011
0.5.1 (2016-4-4)

Gemfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@ source 'http://rubygems.org'
22

33
gemspec
44

5+
current_ruby_version = Gem::Version.new(RUBY_VERSION)
6+
7+
if Gem::Requirement.new('>= 2.2.2').satisfied_by? current_ruby_version
8+
gem 'activesupport', '~> 5.0'
9+
gem 'rack', '~> 2.0', group: [:development, :test]
10+
else
11+
gem 'activesupport', '~> 4.0'
12+
gem 'rack', '< 2', group: [:development, :test]
13+
end
14+
15+
if Gem::Requirement.new('~> 2.0').satisfied_by? current_ruby_version
16+
gem 'json', '~> 2.0', group: [:development, :test]
17+
else
18+
gem 'json', '< 2', group: [:development, :test]
19+
end
20+
521
group :development do
622
gem 'pry'
723
gem 'guard'
@@ -13,9 +29,7 @@ end
1329

1430
group :development, :test do
1531
gem 'rake'
16-
gem 'json', '~> 1.8.3'
1732
gem 'rspec'
18-
gem 'rack', '~> 1.6.4'
1933
gem 'rack-test', '~> 0.6.2', require: 'rack/test'
2034
gem 'rubocop', '0.31.0'
2135
end

grape-entity.gemspec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ Gem::Specification.new do |s|
1414

1515
s.rubyforge_project = 'grape-entity'
1616

17-
s.add_runtime_dependency 'activesupport', '< 5'
1817
s.add_runtime_dependency 'multi_json', '>= 1.3.2'
1918

20-
s.add_development_dependency 'rake'
2119
s.add_development_dependency 'maruku'
2220
s.add_development_dependency 'yard'
2321
s.add_development_dependency 'rspec', '~> 2.9'

0 commit comments

Comments
 (0)