Command 'rake test' is not working - ruby-on-rails

I use Windows 7 (because I'm so lasy for installing Linux), and Ruby on Rails like a framework that I learn. I tried to write a command rake test in terminal, but
I get an error:
rake aborted!
Errno::EACCES: Permission denied # unlink_internal
What it means? How to solve that problem and continue my studying?

Try running the below command
rake db:migrate RAILS_ENV=test
before running
rake test

Related

rake db:migrate fails in db:structure:dump with no error output

I currently changed my ActiveRecord schema format to :sql and when migrating (rake db:migrate), I get the following error with no real explanation as to what is wrong:
$ bundle exec rake db:migrate
rake aborted!
Error dumping database
Tasks: TOP => db:structure:dump
(See full trace by running task with --trace)
I'm using Rails 4.2.4 and PostgreSQL 9.4.
After following the debug trail in the Rails code, I finally discovered the error.
The pg_dump command is being executed in activerecord/lib/active_record/tasks/postgresql_database_tasks.rb#54. After printing the output of the command execution with $?, I realized it was returning a 127 exit code, which means that the command was not found.
It turns out that the pg_dump command was not in my executable PATH.
I simply added it by creating a symbolic link and it all worked fine:
ln -s /opt/local/lib/postgresql94/bin/pg_dump /usr/local/bin
NOTE: I also found out that the issue of not printing out the error has already been fixed in Rails 4.2.5

Ruby on Rails Rake assets:precompile error - Command failed with status (1) - CScript Error: Execution of the Windows Script Host failed

Okay so time after time we've all seen question about Rake assets:precompile error. I've tried multiple methods, I looked at the following SO question Ruby on Rails Rake assets:precompile error and tried multiple methods of even doing the following: config.assets.compile = true and then running rake assets:precompile --trace RAILS_ENV=production. However I noticed that when I tried to do the following:
rake assets:precompile RAILS_ENV=production I got the following error:
rake aborted!
CScript Error: Execution of the Windows Script Host failed. (0x800A0007)
C:\Users\home\Desktop>cd MIUK_Portal
C:\Users\home\Desktop\MIUK_Portal>rake assets:precompile
RAILS_ENV=production C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe
C:/RailsInstaller/Ruby1.9.3/bin/rake assets:precompile:all
RAILS_ENV=production RAILS_GROUPS=assets rake aborted! 795: unexpected
token at
'C:\Users\home\AppData\Local\Temp\execjs20121221-5484-1atk9yx.js(2, 3)
Microsoft JScript runtime error: Out of memory
' (in
C:/Users/home/Desktop/MIUK_Portal/app/assets/javascripts/application.js)
Tasks: TOP => assets:precompile:primary (See full trace by running
task with --trace) rake aborted! Command failed with status (1):
[C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe C...]
Tasks: TOP => assets:precompile (See full trace by running task with
--trace)
Has anyone encountered this issue? How do you overcome this?
Update
Okay apparently from looking at the error it clearly is stating that
:\Users\home\AppData\Local\Temp\execjs20121221-5484-1atk9yx.js(2, 3)
Microsoft JScript runtime error: Out of memory
So I'm now wondering how to resolve this? Any ideas? Further to this I noticed that someone did encounter the similar issue: CS Script issue but this was unresolved:
So I am asking if anyone out there has had the same issue.
This was what I did, and it worked for me. I installed node.js first in my system, and then ran the following command bundle exec rake assets:precompile.
I was able to solve this issue by transferring the project into a Linux environment (Ubuntu) and running the bundle exec rake assets:precompile. It appeared to work, I believe this sort of issue is something to do with windows. If starting any kind of development to do with RoR stick to Linux.

Rake aborted! uninitialized constant knowit

I am standing up a new Ubuntu server running MySQL. I have Capistrano set up on my development server and am trying to deploy:cold after running deploy:setup. After the deploy script tries to run
executing "cd /home/adm1n/www/knowit/releases/20121112152400 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
I keep getting this message:
Rake Aborted!
uninitialized constant knowit
Tasks: TOP => environment
Any idea where this constant would be defined? This project is almost entirely new (rails new app Blah). Any suggestions on how I should attempt to troubleshoot this? Thx.
I'm running:
Rake 0.9.2.2
Ruby 1.9.3p194
Capistrano 2.13.5
Bundler 1.1.5
Rails 3.2.8
rvm 1.15.7
UPDATE: knowit is the name of my app. So there apparently there is something not initializing. Not sure where how to troubleshoot this.
UPDATE: Here is my routes.rb file (very basic)
Knowit::Application.routes.draw do
match ':controller(/:action(/:id))(.:format)'
end

Rake gems:install says "could not find table", rake db:migrate says "required gems missing"

I just cloned a github repo on a fresh Ubuntu machine, running sqlite3 for all environments. rake db:create says development.sqlite3 already exists. rake db:migrate says I'm missing a bunch of required gems and should run rake gems:install. rake gems:install, of course, says it Could not find table 'studies', which sounds to me like something rake db:migrate should fix.
I looked around the net and while lots of people have gotten 'could not find table' errors, they all got them from rake db:migrate, not rake gems:install. I'm suspecting it's an application-specific error, but still, any ideas would be appreciated.
PS: Ruby 1.8.7, Rails 2.3.8.
You can always install separate gems with gem install -r <gem name> or gem install -v=<gem version> -r <gem name> command, not using rake.
Is this a Rails 3 app? If so, you should run:
bundle install
Rails 3 uses Bundler instead of the rake tasks to manage gems. http://gembundler.com/
Did you try running with the trace option? Might help pin down the failing gem:
rake -t gems:install

Rake Gems Install Error

I am getting the following error when trying to install gems:
Mohammad-Azams-MacBook-Pro:awesomecats azamsharp$ sudo rake gems:install
Password:
(in /Projects/awesomecats)
rake aborted!
Don't know how to build task 'gems:install'
(See full trace by running task with --trace)
Mohammad-Azams-MacBook-Pro:awesomecats azamsharp$
If the task isn't listed in the output of rake -T then it isn't defined and you can't run it.
Rails 3 removed this task in favor of using Gemfile and bundler as the official gem installation procedure as gems:install was often tricky to get working properly.

Resources