I am currently in the process of setting up my first Mongodb, Rails 4 environment and need to configure the gem before running bundle install. Here is my gem file.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
# User mongoid for database.
gem 'mongoid', github: 'mongoid/mongoid'
# 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'
# 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', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :test do
gem 'cucumber-rails', :require => false
gem 'capybara'
#database_cleaner is not required, but highly recommended
gem 'database_cleaner'
end
It seems Mongo wont install as I cannot find the Mongo:Config file.
The config file is generated by running the following command:
rails g mongoid:config
Please read the mongoid documentation, it is quite good.
Related
I have used the installer from rubyinstaller.org. But I get this error afterwards
Could not find gem 'turbolinks (~> 5) x86-mingw32' in any of the gem sources listed in your Gemfile.
I have tried some of the advices in the threats with a similar error, but no luck. Can someone guide in the right direction?
My gemfile:
source 'https://rubygems.org'
git_source(:github) do |repo_name| repo_name =
"#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git" end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.3'
# Use sqlite3 as the database for Active Record gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
# Use Puma as the app server gem 'puma', '~> 3.7'
# Use SCSS for stylesheets gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported \runtimes
# gem 'therubyracer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' gem
'turbolinks-source', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do # Call 'byebug' anywhere in the code to
stop execution and get a debugger console gem 'byebug', platforms:
[:mri, :mingw, :x64_mingw] # Adds support for Capybara system
testing and selenium driver gem 'capybara', '~> 2.13' gem
'selenium-webdriver' end
group :development do # Access an IRB console on exception pages or
by using <%= console %> anywhere in the code. gem 'web-console', '>=
3.3.0' end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
I made an application using jruby but I want to get it to work on a different computer which only has ruby installed.
It won't let me just change the gemfile from jruby to ruby, so how can I change it to run based on ruby?
This is my gemfile using jruby:
source 'https://rubygems.org'
ruby '2.2.2', :engine => 'jruby', :engine_version => '9.0.0.0'
gem 'cowsay'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use postgresql as the database for Active Record
gem 'activerecord-jdbcpostgresql-adapter'
gem 'rails_12factor', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# 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'
# 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
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
gem 'puma'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
change this:
ruby '2.2.2', :engine => 'jruby', :engine_version => '9.0.0.0'
to:
ruby '2.2.2'
and change:
gem 'activerecord-jdbcpostgresql-adapter'
to:
gem 'pg'
You probably need to update you database.yml also. You didn't paste it here, so I can't be sure. Just lookup the pg gem to see what you need to configure your conetions to.
no need to actually change much stuff as suggested in the other answer.
in the Gemfile specify platform qualifiers for MRI/JRuby specific gems :
# ruby '2.2.2', :engine => 'jruby', :engine_version => '9.0.0.0'
# ...
gem 'rails', '4.1.8'
# ...
gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby
gem 'pg', platform: :mri
if you're not using anything AR-JDBC specific in database.yml (e.g. url: jdbc:postrgresql:...) than the same configuration with work on JRuby as well as C-Ruby
New to jruby. I am getting error when trying to run
jruby -S bundle exec rake assets:precompile
Bundler could not find compatible versions for gem "json":
In snapshot (Gemfile.lock):
json (1.8.1)
In Gemfile:
carrierwave (>= 0) ruby depends on
json (>= 1.7) ruby
I have tried removing Gemfile.lock and run "jruby -S bundle install", did not help.
I am using jruby 1.7.3 and ruby 1.8.7 on a Mac. I have successfully run precompile before and have not made any changes to the Gemfile.
My Gemfile (has not been changed since last Oct., used to work):
source 'https://rubygems.org'
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'activerecord-jdbcmysql-adapter'
gem 'jruby-openssl'
gem 'mini_magick'
gem 'carrierwave'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'bourbon'
#gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyrhino'
gem 'uglifier', '>= 1.0.3'
end
gem 'uuidtools'
gem 'amazon-ses-mailer'
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
Thanks
This looks like a bundler issue. Update Bundler to 1.5.2 and trying again:
jruby -S gem install bundler
I am carrying out some development of a Ruby on Rails app between a Windows machine and linux machine. Not ideal but Ruby on Windows has improved a lot. Anyway i read that you can implement an IF statement so for example I have implemented this
source 'https://rubygems.org'
if RUBY_PLATFORM =~ /win32/
gem 'rails', '3.2.3'
gem 'sqlite3'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'nokogiri'
gem 'httparty'
gem 'devise'
else
gem 'rails', '3.2.3'
gem 'sqlite3', '1.3.6'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
gem 'less-rails'
gem 'uglifier', '>= 1.0.3'
gem 'execjs'
gem 'therubyracer', '0.10.2'
end
gem 'jquery-rails'
gem 'nokogiri'
gem 'httparty'
gem 'devise'
end
So this morning I merged my linux branch into the master branch (windows) and now i get the message
Could not find the less-rails in any of the sources
So it seems as if the IF statement has not worked or there is an issue with my bootstrap.css.less file in assets as I use this in my linux branch
How can i get this to work, so either have less working on both platforms or get windows to ignore the less gem
has anyone got around this before
UPDATE
Ok so i have found that if I specify
:platform => :ruby
after the less-rails gem it ignores it (though I had to add to execjs and rubyracer aswell) due to js runtime conflicts.. So question still remains as to what is wrong with my IF/ELSE statement
Thanks
Have you rebuilt the bundle lock file?
Try this on your Windows machine:
bundle install
bundle update
To learn about bundle, Gemfile, Gemfile.lock, and why you need to rebuild the lock when you switch platforms: http://gembundler.com/rationale.html
I did gem mysql2. This is how my GemFile looks like:
source 'https://rubygems.org'
gem 'rails', '3.2.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'mysql2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platform => :ruby
gem 'activerecord-mysql2-adapter'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
This is my configuration file:
development:
adapter: mysql2
encoding: utf8
database: qac_db
pool: 5
username: root
password:
socket: /tmp/mysql.sock
Where am I going wrong?
Delete the line gem 'activerecord-mysql2-adapter'. Then run bundle install.
For what it's worth, I deleted my database.yml, and recreated it, then everything started working. No idea why, permissions problem perhaps?