Skip to content

Commit

Permalink
Adds more ruby versions to Travis (#54)
Browse files Browse the repository at this point in the history
This does not promise that we will support 1.9.3 in all current
or future releases. 1.9.3 is dead and you should upgrade to a
supported Ruby release.

- This PR switches webmock versions depending on your ruby version
  and disables rubocop entirely
- We just ensure that tests are passing in 1.9.3, but cannot guarantee
  everything will work smoothly
  • Loading branch information
captn3m0 committed Jan 16, 2018
1 parent fc110a5 commit 86e7f0d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 12 deletions.
28 changes: 22 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
language: ruby
rvm:
- "2.1.10"
- "2.2.6"
- "2.3.3"
- "2.4.0"
# List is from https://www.ruby-lang.org/en/downloads/branches/
# Merged with whatever is the top of each branch at https://www.ruby-lang.org/en/downloads/releases/
matrix:
include:
- rvm: "1.9.3"
- rvm: "2.0.0"
- rvm: "2.1.10"
- rvm: "2.2.9"
- rvm: "2.3.6"
- rvm: "2.4.2"
- rvm: "2.5.0"
- rvm: "2.5.0"
env: LINT=rubocop
allow_failures:
# These are EOL versions of ruby
- rvm: "1.9.3"
- rvm: "2.0.0"
- rvm: "2.1.10"
before_install: gem update --system
script:
- bundle exec rake test
- bundle exec rake rubocop
- |
if [[ "$LINT" == "rubocop" ]] ; then
bundle exec rake rubocop
fi
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ You can find invoices API documentation at <https://docs.razorpay.com/v1/page/in
5. Push to the branch (`git push origin my-new-feature`)
6. Create a new Pull Request

## Supported Versions

While we support [all currently supported versions of Ruby](https://www.ruby-lang.org/en/downloads/branches/)
only, the code is tested against the following versions:

* 1.9.3
* 2.0.0
* 2.1.10
* 2.2.9
* 2.3.6
* 2.4.2
* 2.5.0

## Release

Steps to follow for a release:
Expand Down
6 changes: 4 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
require 'rake/testtask'
require 'rubocop/rake_task'

# Don't try to run rubocop in 1.9.3
require 'rubocop/rake_task' if RUBY_VERSION >= '2.1.0'

Rake::TestTask.new do |t|
t.libs << 'test'
Expand All @@ -8,7 +10,7 @@ Rake::TestTask.new do |t|
end

desc 'Run tests'
task default: [:test, :rubocop]
task default: [:test]

desc 'Run rubocop'
task :rubocop do
Expand Down
18 changes: 14 additions & 4 deletions razorpay-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,20 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(/^(test|spec|features)/)
spec.require_paths = ['lib']

spec.add_dependency 'httparty', '~> 0.14'

spec.add_development_dependency 'coveralls', '~> 0.8'
spec.add_development_dependency 'minitest', '~> 5.10'
spec.add_development_dependency 'minitest', '~> 5.11'
spec.add_development_dependency 'rake', '~> 12.0'
spec.add_development_dependency 'rubocop', '~> 0.49'
spec.add_development_dependency 'webmock', '~> 2.3'
spec.add_dependency 'httparty', '~> 0.14'

if RUBY_VERSION >= '2.1.0'
# rubocop is only run in the latest ruby build
# so we use the latest version and don't switch to a
# older version for 1.9.3
spec.add_development_dependency 'rubocop', '~> 0.49'
spec.add_development_dependency 'webmock', '~> 3.0'
else
# Webmock 3.0 does not support Ruby 1.9.3
spec.add_development_dependency 'webmock', '~> 2.3'
end
end

0 comments on commit 86e7f0d

Please sign in to comment.