Accidentally uninstall rspec - ruby-on-rails

Trying to reinstall RSpec, and I can't seem to re-add its command to my bin folder.
Mac-Users-MacBook-Pro:bin macuser$ rspec
-bash: /usr/bin/rspec: No such file or directory
>> which rspec
#> returns nothing.
I tried sudo gem install rspec --prerelease a dozen times, bundle install , and nothing seems to give.
What am I missing?

Hey Trip, I'm pretty sure the command is spec and not rspec.
Edit
Ok, so, I took another look, you are right the rspec command is included in rspec2...
So, here is a Gemfile I have which properly installs rspec w/ bundle install
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'mysql'
group :development, :test do
gem "rspec-rails", ">= 2.0.0.beta.17"
end
In my case, I'm using rvm & it is installed to:
/Users/me/.rvm/gems/ree-1.8.7-head#<my gemset>/bin/rspec

I went ahead and uninstalled all of rspec2.
Then instead of sudo gem install rspec --prerelease, I did sudo gem install rspec-rails --prerelease which worked.
Then I followed the explicit directions to delete certain files that were floating around in previous beta releases. Everything is copacetic.

Related

is there any specific generator i need to install so that devise can work in ruby on rails?

I have been trying to add the device gem in my rails app so I added
gem 'devise' to my gem file and i ran
bundle install
but when i'm trying to run
rails generate devise:install
I'm getting this error:
Could not find generator 'devise:install'. Maybe you meant 'assets', 'generator' or 'coffee:assets'
what should i do to make it install?
The better way to add gem is going to https://rubygems.org and search specify gem
for your situation you should add gem 'devise', '~> 4.7', '>= 4.7.1' to your Gemfile, then go back to console type bundle install
is it maybe just error you wrote "bunBle install", you should use 'bundle install' also check result after you run this command if everything is okay and run this command to be sure devise is installed 'gem list --local devise'

My "rails server" command not working properly and terminating unexpectedly

Whenever i run my rails server command on my command prompt it gives me the following error:
Since i am new to the Rails, I don't know much about it.
Guide me with the solution if possible..
I am using rails 5 on windows OS
Specified 'mysql2' for database adapter, but the gem is not loaded. Add gem 'mysql2' to your Gemfile
As your error says please add mysql2 in your Gemfile
# Gemfile
gem 'mysql2'
Also make sure you have mysql installed
The answer to your question is in the error message. You're using mysql2 as your database adaptor, but the gem isn't available.
add:
gem 'mysql2'
to your gemfile, then run bundle update from your project folder to install the missing gem.
You need to add
gem 'mysql'
in your Gemfile.
If its added then run command bundle install to install it. And check whether its installed successfully or not then restart server.
Also check your gem version with your Rails version.

Error when installing devise- i am a novice

I have installed rails and am running Git Bash and am on Windows 7 64 bit, i have installed gemfile and updated and this is my first use of ruby! I am following the instrustions from devise's github: https://github.com/plataformatec/devise . I am probably being very stupid but when i run gem 'devise' and this error occurs:
ERROR: while executing gem... <Gem::commandlinerror> unknown command /devise
Any help would be greatly appreciated
i think you are not installing gem properly.
gem install command is gem install devise
or perhaps you should add the gem to your Gemfile like this
gem "devise"
and then run this command in your terminal
bundle install
If you are running gem 'devise' then it won't work because its not a valid command.
You should give
gem install devise
or
Include gem 'devise' in Gemfile and run bundle install

Unable to install Doorkeeper-MongoDB

I have a fresh installation of rails 4 with MongoMapper. Now i'm trying to install doorkeeper on my rails instance.
I added the "gem 'doorkeeper-mongodb'" line in my Gemfile. Then I ran 'bundle install'. And I got the following error :
Could not find gem 'doorkeeper-mongodb (>= 0) ruby' in any of the gem sources listed in your Gemfile or available on this machine.
Also, I tried to install it using the gem install command but it doesn't work either.
I'm on Mac OS X.
The line to put in the Gemfile is
gem 'doorkeeper-mongodb', github: 'doorkeeper-gem/doorkeeper-mongodb'
I tried checking the gems in https://rubygems.org and could not find doorkeeper-mongodb.
And then googled out, and found that if you want to install gems from github source, then the right way seems like this following:
gem 'doorkeeper-mongodb', :git => 'git://github.com/doorkeeper-gem/doorkeeper-mongodb.git'
Or you can also download the source from github, and install it from local.

rails generate rspec:install gives no error, but manpage

OS: Linux Debian Wheezy
Rails version: 3.2.0
I want to configure RSpec to work with Rails.
I'm using this instruction: https://github.com/rspec/rspec-rails ('Installation' section).
When I try:
rails generate rspec:install
after successfully performing all the things described in the manual before,
I get:
Usage: rails new APP_PATH [options]
etc.
How to resolve this?
IMHO Relevant part of my Gemfile:
gem 'rails', '3.2.0'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '~> 2.0'
end
(I'm new to Rails and using M. Hartl manual to learn.)
(What I have tried already:
changing Rails version (4.0.0, then to 3.2.0);
changing rspec version (initially 2.8.0, then to ~> 2.0);
a few times 'bundle update', 'bundle install' and 'bundle update rspec-rails';
installing 'rspec' and 'rspec-rails' using 'gem install';
This is because when you install gem install rails after June 25, 2013 - it will install the rails 4. When you following the course, Hartl asks you to copy his Gemfile located in his GitHub repo which actually refers to Rails '3.2.14'.
To solve this problem, create a gemset using RVM.
rvm gemset create sample_app
rvm gemset use sample_app
Then create a Gemfile inside an empty folder.
mkdir sample
touch Gemfile
Copy the content form the Hartl's (Gemfile)[https://raw.github.com/railstutorial/sample_app_2nd_ed/master/Gemfile] to the Gemfile you just now created and run,
bundle install
Once all gems are installed, simply go outside the folder and delete it.
cd .. && rm -rf sample
Now create a new Rails project and skip the auto bundle install.
rails new sample --skip-unit-test --skip-bundle
Once Rails generated the files, go inside the folder and replace the Gemfile contents again with Hart's Gemfile.
Now run bundle install
Finally you can create the RVM file that will automatically switch to the project gemset.
rvm --create --ruby-version use ruby-2.0.0#sample-app
ruby-2.0.0 refers to my system's active Ruby version. You'll need to replace this accordingly.
This should work fine. Let me know if you have any further help.
Cheers!

Resources