Running Bundler on Windows - permission denied on /dev/null - ruby

I'm trying to set up a Ruby dev environment on Windows. So far it's fairly "vanilla", that is, it pretty much only consists of Ruby (1.9.1), Bundler (1.3.5) and a few random gems.
Now, whenever I try to run Bundler, I get the following exception:
C:/Ruby19/lib/ruby/1.9.1/rubygems/user_interaction.rb:544:in `initialize': Permission denied - /dev/null (Errno::EACCES)
Checking the source code, I found that Bundler determines that you're running Windows by trying to access /dev/null and then rescuing Errno::ENOENT ("No such file or directory"). I tried patching it to also rescue Errno:EACCES ("Permission denied"), and voila - it seems to run just fine.
I tried running the shell in elevated mode, but it still threw Errno:EACCES.
My question is simply this: Am I missing something? Or is this a bug in Bundler?
(for reference, I'm running on Windows 8)

/dev/null is a special file and is typically used for disposing of unwanted output streams of a process, or as a convenient empty file for input streams in *nix operating systems. It's not there in Windows.
If bundler is not checking on which operating system it's trying to use /dev/null then surely it's a problem at their end. To get things working without moving much you can use Cygwin.

I'm running on Windows 7.
I'v observed the issue "Errno:EACCES ("Permission denied")" for c:/dev/null
The directory c:/dev created (no "null" file) and problem resolved.

Related

Installing Shoes on Ubuntu 12.04: cannot find rubygems.rb

I'm trying to install Shoes on Ubuntu 12.04 64-bit and currently have Ruby 1.9.3 and 2.0.0 installed, with 1.9.3 as the default. I tried several different methods, running several different scripts, but nothing seems to be successful. I haven't gotten any error messages; The scripts just install a lot of libraries and then seem to build Shoes, and, though I now have a shoes directory full of files, when I try to execute /dist/shoes I get this error:
me#me-Studio-1735:~/shoes$ ./dist/shoes
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in `<compiled>'
uninitialized constant Encoding::UTF_7
These are the the steps I've taken, in order:
I downloaded the Shoes3 .run file from the official website, but when I tried to execute it, I get this output:
Verifying archive integrity... All good.
Uncompressing Shoes..................................................................................................................................................................................................................................................................................................................
./shoes-3.1.0.run: 1: eval: ./shoes: not found
I then attempted to follow the instructions for installing on Ubuntu; I ran the script they linked to, which took about 20 minutes, but afterwards I couldn't find the red-shoes directory: It didn't exist. All I got to show for it was a /tmp/shoes_build/ directory with a "chruby opt ruby-1.9.3-p392 ruby-build" directory listing.
Then I tried running the script from that same website listed directly on the site, not linked to. No Shoes. Lots of things were installed, but when I tried to execute /dist/shoes, I got the same error.
Finally, I tried executing the commands listed on the Spiral of Hope site listed under 'SUCCESS: Ubuntu?'. Again, it runs and installs lots of libraries, but Shoes isn't functional. It is neither a recognized command when typing shoes, nor can I execute anything successfully.
I don't know what else to do. I'm no Linux buff, I just have a knowledge of basic Bash commands, and I recently installed Ubuntu, so I haven't done any weird custom installs or anything. Can anyone tell me what I'm doing wrong, and how to do it right?

running windows service in ruby on windows 7

I am using this gem:
win32-service (0.7.2 x86-mingw32)
The gem has a demo_daemon.rb and a demo_daemon_ctl.rb in the example directory.
I have tried to run the example as a service using both ruby 1.8.7 and 1.9.3 and I get the error below.
The daemon tries to write to a log file, but it never reaches a point where the log file gets written. Even if I put a log write on startup of the script nothing gets written.
My machine is 64 bit.
Any ideas on what I can try or what could be the issue?
C:/Ruby193/lib/ruby/gems/1.9.1/gems/win32-service-0.7.2-x86-mingw32/lib/win32/se
rvice.rb:760:in `start': The service did not respond to the start or control req
uest in a timely fashion. (Win32::Service::Error)
from demo_daemon_ctl.rb:75:in `<main>'
I think you need use a service wrapper such as srvany . Here is the Microsoft's guide. Use full path for both ruby and the script in the "Application" parameter. And if something goes wrong under 64bit system, just put the srvany.exe in both windows/system32 and windows/sysWow64 folder.

My rvm install script works and apparently uses rvm correctly but a new/reloaded bash fails with a syntax error

I wrote this script https://gist.github.com/1313611 to ease my installs for rvm. The whole script simply installs rvm, installs 1.9.2, rails and creates a default gemset. All of that works and I can verify that inside the .rvm folder. However after installing a I get:
bash: ~/.rvm/scripts/rvm: line 14: syntax error near unexpected token `do'
bash: ~/.rvm/scripts/rvm: line 14: ` do'
I've also tried using curl -sB. I'm guessing it has to do with my environment but can't seem to figure out the problem (obviously, ha).
Thanks for any input
CLARIFICATION: I'm on an Fedora 14 Desktop - I have it working with no edits to my script on a shared hosting account at Dreamhost.
Not sure it helps (planning to dig into a bit more) but the computer it fails on is managed by the school which means the Home dir I install to is on NFS. Another environment oddity is that the default shell (ypchsh won't let me change yet [working with boss to change]) is tcsh, but I always run bash when I open a terminal. I'm thinking this last bit is a problem.
BLAST - Apparently there was a script being loaded that is basically a universal bashrc for our school where someone set and alias to 'for' because it had something to do with fortran.
So I just copied that rc to my directory to fix up that alias and now reference that file rather than the universal rc.
Well we learned something today - when in this much doubt check all aliases.

Error with Compass polling on windows 7

I am attempting to work locally on a PHP application which I cloned from the Git repository my partner and I use.
He uses a Mac, and until now I have been working on the app in a virtual Ubuntu Linux environment. Both environments have been able to use Compass polling with the same file structure and files.
On Windows 7, I run Compass commands from Cygwin, and this is the command I use to have Compass poll from the root directory of the app (C:/wamp/www/application):
compass watch --trace src/Application/ApplicationBundle/Resources/compass/
When I then make a change to a .scss file, I receive the following error:
ArgumentError on line 716 of /usr/lib/ruby/1.8/pathname.rb: different prefix: "/
/cygdrivecwampwwwlimelightsrclimelightlimelightbundleresourcescompasssrcpartials
_object.scss" and "/cygdrive/c/wamp/www/limelight/src/limelight/limelightbundle/
resources/compass/src"
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:81:in 'split_path'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:69:in 'run_callback'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:55:in 'callback_action'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:35:in 'update'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:39:in 'modified'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:37:in 'each'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:37:in 'modified'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:18:in 'refresh'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:17:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:17:in 'each'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:17:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:15:in 'loop'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:15:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/monitor.rb:26:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm.rb:20:in 'monitor'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/commands/watch_project.rb:86:in 'perform'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/commands/base.rb:18:in 'execute'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/commands/project_base.rb:19:in 'execute'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/exec/sub_command_ui.rb:43:in 'perform!'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/exec/sub_command_ui.rb:15:in 'run!'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/bin/compass:25
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/bin/compass:39:in 'call'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/bin/compass:39
/usr/bin/compass:19:in 'load'
/usr/bin/compass:19
All I've been able to find through searching is that it may have something to do with the fact that Windows capitalizes its drive names, although the lack of slashes in the returned path makes me think the problem may be elsewhere.
Does anyone know why I might receive this error in Windows, but not other platforms?
NOTE: I have found a work-around involving installing ruby (and compass) through Windows' command prompt rather than Cygwin, and that should work fine for now. Still, if anyone has ideas, I'm still curious as to what the problem could be.
According to this commit, this is a problem caused by a compass dependency called FSSM. It is used to monitor file changes in compass. A workaround is described in this comment.
It seems that FSSM detects that ruby is running inside a Windows box, and treats paths in the Windows' way (C:\blabla). Commenting out the line 26 of the file <fssm_gem_path>/lib/fssm/pathname.rb makes compass watch work as expected. You can also add
unless path[0, 1] == File::SEPARATOR
to the end of line 26 to make it work.
I thought I'd just provide a little more info to help people find the pathname.rb file.
On the cygwin prompt type:
gem env
This (unsurprisingly) brings up a load of info about your Ruby Gems installtion. Look for the line which specifies the INSTALLATION DIRECTORY. Mine was:
/usr/lib/ruby/gems/1.8
Now in Windows Explorer navigate to this location but substitute "usr" for your cygwin installation directory. Therefore the above path becomes:
C:\cygwin\lib\ruby\gems\1.8
Once in this location drill down until you come across the fssm gem directory.
Within this [fssm] directory go into:
/lib/fssm/
...and there you should find the pathname.rb file.
Edit it as above and all is well. I hope this helps.
See here for a possible fix:
http://rails.webintellix.com/2010/05/27/error-in-ruby-relative_path_from-call-on-windows/
I was running into this same error with a slightly different setup. My project folder was on a network drive (ruby and sass/compass installed locally), and every time I made a change to a .scss file compass watch would crash with similar errors to the OP. I solved the issue by mapping my network drive instead of accessing it directly via the network (right clicked on My Computer and choose map network drive so I could access my remote drive at A:).
Now, instead of doing 'compass watch //SERVERNAME/My_Project' (I'm using Git Bash), I do 'compass watch a/My_Project' and compass stopped crashing.
Hope that helps someone else.
Using Cygwin, re install a compass dev release (such as 0.13+). Works for me with Compass 0.13.alpha.4 (Markab)
To do so:
gem uninstall compass
gem install compass --pre --no-rdoc --no-ri

Ruby on cygwin - Permission denied

I am trying to run gcc from a ruby script and it gives me an error which says Permission denied.
It works fine when running it right from the commandline and that makes me clueless why it won't work from ruby.
I can call other commands like "ls" from within Ruby.
I also tried setting the file permissions of gcc to 777 as well as making my user-account the owner of that file.
Here is my shell output:
Administrator#dominicgraec8aa ~
$ gcc
gcc: no input files
Administrator#dominicgraec8aa ~
$ irb
irb(main):001:0> `gcc`
Errno::EACCES: Permission denied - gcc
from (irb):1:in ``'
from (irb):1
irb(main):002:0> `ls`
=> ""
I hope anyone has an idea on this.
From my experience it doesn't matter what path separator you use in Ruby on Windows as they both should work (and as they both work on the command line as well). When working with two different environments (Native Windows and Cygwin) it is good to make sure that you know which version you are running, since they are not necessarily compatible with each other.
I've had no problems running the native Windows versions of the Ruby toolchain, even using Pik too (like RVM for Windows), and I find it much simpler than having to manage two environments.

Resources