Heroku cedar can't run RUBY - ruby-on-rails

No matter what "heroku run ..." I do I always get the following error:
/usr/bin/env: ruby1.9.1: No such file or directory
as follows:
user#box:~/path$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.7070
/usr/bin/env: ruby1.9.1: No such file or directory
Here is the version:
user#box:~/path$ heroku run ruby -v
Running `ruby -v` attached to terminal... up, run.8039
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]
Here is my Gemfile
source 'https://rubygems.org'
gem 'rails', '4.0.0'
ruby "1.9.3"
gem 'rails_12factor'
gem 'pg'
group :production do
gem 'therubyracer-heroku', '0.8.1.pre3'
end
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end

Try this on your Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'bootstrap-sass', '2.1'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'jquery-rails', '2.0.2'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
gem 'guard-rspec', '1.2.1'
gem 'guard-spork', '1.2.0'
gem 'childprocess', '0.3.6'
gem 'spork', '0.9.2'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '4.1.0'
gem 'cucumber-rails', '1.2.1', :require => false
gem 'database_cleaner', '0.7.0'
# gem 'launchy', '2.1.0'
# gem 'rb-fsevent', '0.9.1', :require => false
# gem 'growl', '1.0.3'
end
group :production do
gem 'pg', '0.12.2'
end

Related

Rails-Admin icon broken

I'm using Rails-Admin for the dashboard of Rails app. But on dashboard, the icons are all same - white square.
Screenshot for Broken Icons:
Here is the gemfile
source 'http://rubygems.org'
gem 'rails', '4.1.1'
gem 'slim-rails', '~> 2.1.0'
gem 'devise', '~> 3.2.4'
gem 'devise-i18n'
gem 'configatron', '2.13.0'
gem 'navigation_link_to', '0.0.2'
gem 'cyrax', '0.7.4'
gem 'dotenv-rails'
gem 'simple_form', '3.0.2'
# emails styles
gem 'roadie', '2.4.3'
# assets
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '~> 2.5.0'
gem 'coffee-rails', '~> 4.0.1'
gem 'therubyracer', platforms: :ruby, require: 'v8'
gem 'droidcss'
gem 'jquery-rails'
gem 'bootstrap-sass'
# unicorn
gem 'unicorn'
gem 'jbuilder'
# mongo
gem 'mongoid', '~> 4.0.0'
gem 'mongoid-grid_fs'
gem 'fog', '~> 1.27', require: 'fog/aws/storage'
gem 'carrierwave-mongoid', require: 'carrierwave/mongoid'
gem 'mongoid-geospatial'
# gem 'rmagick', require: false
gem 'mini_magick'
gem 'carrierwave-video'
gem 'public_activity'
gem 'mongoid_slug'
gem 'mongoid_search'
gem 'mongoid_paranoia', github: 'simi/mongoid_paranoia'
# aerospike
gem 'aerospike'
# documentation
gem 'apipie-rails', github: 'Apipie/apipie-rails'
gem 'maruku'
# other gems
gem 'inherited_resources'
gem 'rails_admin', github: 'sferik/rails_admin'
gem 'enumerize'
gem 'sidekiq'
gem 'pundit'
# ios gem
gem 'houston'
gem 'whenever'
# gem 'quartz', github: 'jeizsm/quartz'
gem 'twilio-ruby'
# mixpanel
gem 'mixpanel-ruby'
group :development do
gem 'capistrano', '2.15.5', require: false
gem 'capistrano-sidekiq', github: 'seuros/capistrano-sidekiq'
gem 'letter_opener'
gem 'quiet_assets', '1.0.2'
gem 'thin', '1.6.2'
gem 'guard-rubocop'
end
group :test do
gem 'spring-commands-rspec'
gem 'database_cleaner', '1.2.0'
gem 'factory_girl_rails', '4.4.1'
gem 'capybara', '2.3.0'
gem 'email_spec', '1.5.0'
gem 'turnip', '1.2.1'
end
group :test, :development do
gem 'mocha', '1.0.0', require: 'mocha/api'
gem 'spring'
gem 'rspec-rails', '~> 3.0.0'
gem 'guard-rspec', require: false
gem 'shoulda', '3.5.0'
gem 'byebug'
gem 'pry-byebug'
gem 'pry-rails'
end
Is there any mistake while using the rails admin or other gems?
Any suggestion would be helpful!
I think you need to use font-awesome gem. I had the same issue before.
Rails admin uses an old version of fontawesome. Download the zip file here: http://fortawesome.github.io/Font-Awesome/3.2.1/assets/font-awesome.zip
Then put the following files into the /public/assets directory of your rails project, from the /font directory in the zip file:
fontawesome-webfont.eot
fontawesome-webfont.svg
fontawesome-webfont.ttf
fontawesome-webfont.woff
FontAwesome.otf

rails generate cucumber:install fails with "Could not load generator"

I tried to install Cucumber, but rails g cucumber:install shows an error in the terminal:
[WARNING] Could not load generator "generators/cucumber/install/install_generator". Error: uninitialized constant Cucumber::Generators::InstallBase::Config.
Here is the part of my Gemfile with cucumber-rails:
group :test do
gem 'faker'
gem 'capybara'
gem 'guard-rspec'
gem 'cucumber-rails', :require => false
gem 'database_cleaner'
gem 'selenium-webdriver'
gem 'gherkin'
gem "launchy", "~> 2.1.2"
end
Here's my entire Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes gem 'therubyracer', platforms: :ruby
gem 'devise'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'therubyracer'
gem 'cancan'
gem 'roo'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'bcrypt-ruby', :require => 'bcrypt'
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
# Use Unicorn as the app server
# gem 'unicorn'
gem 'birthday'
gem 'pry-nav'
gem 'unread'
gem 'week_of_month'
gem 'city-state'
gem 'carmen-rails'
gem "nested_form"
gem 'prawn'
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'
gem 'prawn-table', '~> 0.1.0'
gem 'rails_12factor', group: :production
gem 'whenever', require: false
gem 'simplecov', :require => false, :group => :test
#Image uploading
gem 'carrierwave'
gem 'carrierwave-dropbox'
gem 'client_side_validations'
#Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'bootstrap-datepicker-rails', :require => 'bootstrap-datepicker-rails',
:git => 'git://github.com/Nerian/bootstrap-datepicker-rails.git'
gem 'fullcalendar-rails'
gem 'simple_form'
gem 'momentjs-rails'
gem 'google-api-client'
gem 'omniauth'
gem 'omniauth-google-oauth2', :git => 'https://github.com/zquestz/omniauth-google-oauth2.git'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
#gem "rspec-rails"
gem 'factory_girl_rails'
end
group :test do
gem 'faker'
gem 'capybara'
gem 'guard-rspec'
gem 'cucumber-rails', :require => false
gem 'database_cleaner'
gem 'selenium-webdriver'
gem 'gherkin'
gem "launchy", "~> 2.1.2"
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
gem 'will_paginate'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'bootstrap-sass', '~> 3.3.5'
gem 'bootstrap-timepicker-rails-addon', :require => 'bootstrap-timepicker-rails-addon',
:git => 'git://github.com/ywjno/bootstrap-timepicker-rails-addon.git'
It's possible that spring is started and is unable to load the generator. Try
DISABLE_SPRING=1 rails g cucumber:install

cap production deploy ruby on rails

I tried to deploy the ruby on rails project from a github folder. However, I got such an error when I run cap production deploy
/home/deploy/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
'require': cannot load such file -- capistrano/cli (LoadError) from /home/deploy/.rbenv/
versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in 'require'
from /usr/bin/cap:3:in '<main>'
I have deploy.rb starting with:
# config valid only for Capistrano 3.1
lock '3.1.0'
And I installed Capistrano v.3.1 with the following command-line:
gem install capistrano -v 3.1.0
Anybody has ideas why I still got an error?
Attached Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.1.0'
# Frontend
gem 'simple_form'
gem 'nested_form', github: 'ryanb/nested_form'
gem 'turbolinks'
gem 'bootstrap-sass', '~> 3.2.0'
gem 'kaminari'
# Javascript
gem 'gon'
gem 'angularjs-rails'
gem 'selectize-rails'
gem 'js-routes'
# Backend
gem 'pg'
gem 'mongoid', github: 'mongoid/mongoid'
gem 'mongoid_geospatial'
gem "active_model_serializers"
gem 'devise'
gem 'state_machine'
gem "rolify"
gem "pundit"
gem 'enumerize'
gem 'simple-rss'
gem 'tweetstream'
gem 'swagger-docs', path: "vendor/gems/swagger-docs-0.1.5"
gem 'wkhtmltopdf-binary'
gem 'wicked_pdf'
gem 'paper_trail', '~> 3.0.3'
# Temporary
gem 'faker'
gem 'factory_girl_rails'
# Asset gems
gem 'haml-rails'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'sass-rails', '~> 4.0.3'
gem 'compass-rails'
group :development do
gem 'spring' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'switch_user'
gem 'better_errors'
gem 'binding_of_caller'
gem 'sextant'
gem 'guard-livereload', require: false
gem 'capistrano', '~> 3.1.0'
gem 'capistrano-bundler', '~> 1.1.2'
gem 'capistrano-rails', '~> 1.1.1'
gem 'capistrano-rbenv', github: "capistrano/rbenv"
end
group :test do
gem 'rspec-rails'
gem 'spring-commands-rspec'
gem 'guard-rspec'
gem 'fuubar'
gem 'capybara'
gem 'capybara-webkit'
gem 'capybara-email'
gem 'capybara-screenshot'
gem 'database_cleaner'
end
group :test, :darwin do
gem 'rb-fsevent'# if `uname` =~ /Darwin/
end
group :development, :test do
gem 'pry-rails'
gem 'pry-remote'
end
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
Thanks!

why is my rails server logging everything twice?

my rails server seems like it is logging everything twice, not sure what is going on here, what should I do to investigate this ?
my gemfile
source 'https://rubygems.org'
ruby '2.1.0'
gem 'rails', '4.0.1'
gem 'haml-rails'
gem 'pg', '~> 0.17.1'
gem 'redis'
gem 'redis-namespace'
gem 'thin', '~> 1.6.1'
gem 'rabl'
gem 'underscore-rails'
#assets
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'foundation-rails'
gem 'font-awesome-rails'
#javascript
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 1.2'
gem 'angularjs-rails', '~> 1.2.7'
gem 'ngmin-rails', '~> 0.4.0'
#user auth
gem 'devise', '3.0.0'
gem 'omniauth'
gem 'omniauth-twitter'
gem 'uuidtools'
#misc tools
gem 'twitter'
#heroku
gem 'rails_12factor'
group :development, :test do
gem 'capybara-webkit', github: 'thoughtbot/capybara-webkit', branch: 'master'
gem 'rspec-rails', '~> 2.14.1'
gem 'factory_girl_rails', '4.2.1'
gem 'mocha', '~> 1.0.0'
gem 'pry'
gem 'pry-debugger'
gem 'quiet_assets'
gem 'parallel_tests'
gem 'zeus-parallel_tests'
gem 'guard-rspec'
gem 'rb-fsevent'
end
group :development do
gem 'guard-livereload'
gem 'rack-livereload'
gem 'better_errors'
gem 'terminal-notifier-guard'
end
group :test do
gem 'launchy', '>= 2.1.2'
gem 'capybara', '>= 1.1.3'
gem 'database_cleaner', '~> 1.2.0'
gem 'zeus', :require => false
gem 'shoulda-matchers'
gem 'pdf-inspector'
gem 'selenium-webdriver'
gem "mock_redis", "~> 0.11.0"
end
In my case this was caused by the rails_12factor gem. This gem adds the rails_stdout_logging gem which sends the logs to standard output. This can be useful in a production environment but not in development when Rails already does it by default.
https://github.com/heroku/rails_12factor#rails-4-logging
The solution is to only add this gem in production:
gem 'rails_12factor', group: :production
Have a look at this issue
Try adding the following code to you config/application.rb
if Rails.env.development?
# Don't log to STDOUT, by default rails s will handle it
config.logger = Logger.new('/dev/null')
else
# Don't log to file, sending everything to unicorn file.
config.logger = Logger.new(STDOUT)
end
Do you have your logger set to anything in either config/application.rb or config/environments/development.rb?
If nothing, try adding this line to config/environments/development.rb:
config.logger = Logger.new('/dev/null')
I had success with this in development.rb:
config.logger = ActiveSupport::Logger.new('/dev/null')

Heroku / Rails 4 sqlite3 error on precompile

My Heroku deploy is failing on the Running: rake assets:precompile step with the follow:
Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile.
My Gemfile has 'sqlite3' only in the development group, as you can see:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.1'
gem 'sass-rails', '~> 4.0.0'
gem "compass-rails", "~> 2.0.alpha.0"
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'devise'
gem 'figaro'
gem 'haml-rails'
gem 'sendgrid'
gem 'simple_form'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem "cancan", :git => "git://github.com/ryanb/cancan.git", :branch => "2.0"
gem 'roadie', '2.4.2'
group :development do
gem 'better_errors'
gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx]
gem 'guard-bundler'
gem 'guard-rails'
gem 'guard-rspec'
gem 'guard-livereload'
gem 'html2haml'
gem 'quiet_assets'
gem 'rails_layout'
gem 'rb-fchange', :require=>false
gem 'rb-fsevent', :require=>false
gem 'rb-inotify', :require=>false
gem 'debugger'
end
group :development, :test do
gem 'factory_girl_rails'
gem 'rspec-rails'
gem 'zeus'
gem 'sqlite3'
end
group :test do
gem 'capybara'
gem 'capybara-webkit'
gem 'database_cleaner', '1.0.1'
gem 'email_spec'
end
group :production do
gem 'unicorn'
gem 'passenger'
gem 'rails_12factor'
end
Additionally, I am using the rails_12factor gem and user-env-compile thing... neither helped with the error. I've also added RACK_ENV=production and RAILS_ENV=production config vars to the Heroku environment, to be safe.
Seems like it Heroku is firing up the development environment when precompiling. Any ideas why?
On Heroku, I've never gotten away without having pg in my production group.
group :production do
gem 'pg'
gem 'rails_12factor'
end
Assuming you're using that database in prod, of course.

Resources