I've got a Rakefile with the following contents:
namespace :geo_data do
desc 'Imports geo data to Heroku'
task :heroku_import => :environment do
system "heroku pg:psql DATABASE -c 'DELETE FROM <table name>' -a <heroku app name>"
# some more stuff...
end
end
Whenever I run rake geo_data:heroku_import
, it'll crash on my Heroku command with this error:
Your Ruby version is 1.9.3, but your Gemfile specified 2.2.2
However, if I run the Heroku command - heroku pg:psql DATABASE -c 'DELETE FROM <table name>' -a <heroku app name>
- directly from the command line in a terminal window, it works fine.
So it would appear that the system
command is using a different version of Ruby.
Interestingly, as far as I can tell, I don't even have 1.9.3
installed on my machine. This is the output from rvm list
:
rvm rubies
ruby-2.0.0-p598 [ x86_64 ]
ruby-2.2.0 [ x86_64 ]
=* ruby-2.2.2 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Based on that output, I don't have 1.9.3
installed and 2.2.2
is set as my current and default Ruby version.
Am I correct in determining that system
is using a different version of Ruby, or is there something else I'm missing? And if it is using a different version, how can I make it use 2.2.2
(or preferably whatever my default is currently set to)?
UPDATE
This is the contents of my Gemfile:
source 'https://rubygems.org'
ruby '2.2.2'
gem 'rails', '4.2.3'
gem 'rails-api'
gem 'spring', :group => :development
gem 'pg'
gem 'stripe'
gem 'jsonapi-resources', '0.7.0'
gem 'rails_api_auth'
gem 'rack-cors', require: 'rack/cors'
gem 'activerecord-postgis-adapter'
gem 'rgeo-geojson'
gem 'geocoder'
gem 'activerecord-import'
gem 'sidekiq'
gem 'unicorn'
group :development, :test do
gem 'rspec-rails'
gem 'forgery'
gem 'foreman'
end
group :development do
gem 'pry-rails'
end