This is my first Ruby development, I'm following through a book thats teaching me to build a Pinterest clone. Everything was working correctly until I logged into the environment today to pick up where I left off. When I try and run the project, or boot up the server, I'm getting this error.
bash: :command not found
It was working correctly last night when I closed the environment, and I havn't been able to find any information online as to how to fix the problem. Any suggestions would be great. Thanks. Let me know if you need additional code supplied.
Be sure your runner is set to Ruby on Rails and not Shell.
If you installed Rails only via Bundler, then rails will only be accessible if you run bundle exec rails.
A "naked" rails command will only exist if you gem install rails directly without Bundler.
Related
I'm trying to set up CI on my local machine running on Mac. To do so I use Xubuntu virtual machine, Jenkins, and some simple selenium tests. tests on github
I get fresh install of Xubuntu, where I install Jenkins using official manual.
In Jenkins I installed some plugins(git, ruby, rake, rbenv).
In job config I use rbenv wrapper(2.1.0) with ignorance of os versions, also I use this gemlist:
bundler,rake,rspec,selenium-webdriver,capybara
and running that job with
rspec spec
And when I run this job I recieve something like that for every test:
Selenium::WebDriver::Error::WebDriverError:
unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
full output is here
it looks like jenkins user have no access to display to run/see firefox.
Anyone know how to make it work?
We ran into this at work recently and actually opted for Capybara and set the driver to poltergeist. This seemed better than trying to figure out how to run FF on our VM's.
That said, we were able to get a small test suite running by following the instructions here
Answer was not so simple as I think.
The problem is that jenkins service has no access to displays (when it installed via native package). Thats why when I try to start Firefox it's throw me a error. try:
$ sudo su - jenkins && firefox
So it's need access to display to start browser successfully.
This is how I done it:
first of all I used answer form here where I changed to my local user.
Then I installed xvfb plugin to Jenkins, and in my build job preset display to '0' - which is my actual user display. with that option all my tests would run 'headless' but on actual display.
This could be not the best way to solve my problem, but it definitely works for me.
I'm writing a ruby script to start more than one rails server, but I'm running into a few problems:
When I programmatically cd into different projects, their respective .rvmrc files aren't triggered. My projects all use different versions of ruby and have unique gemsets, so I need my script to recognize which environment it's in for everything to work correctly. I tried changing gemsets programmatically, but received this error from rvm:
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
I'm using foreman to start each app, which is great for distilling more than one startup command into a nice and simple foreman start -p $PORT, but I would also like each app's logs to be displayed in their own terminal window, or even better, their own tab. I've seen others achieve things like this through applescript, but is there a better way?
Thank you all for your help. I ended up using consular, which handles scripting in a way that respects different .rvmrc files. Please see this post for more information on my specific solution.
It should be simple as:
rvm . do foreman start -p $PORT
I have gotten the following errors using ruby 1.9.2-p320 with Heroku's Taps-using 'db' commands such as:
heroku db:pull --app my-app
Which produces errors like:
Taps Load Error: no such file to load -- sqlite3
-or-
Taps Load Error: no such file to load -- pg
(And yes, btw, I have all the correct gems, including both postgres--running fine locally--and sqlite3, as well as having uninstalled, re-installed, and updated the taps & heroku gems and including them as well as not including them in my Gemfile. I'm running Rails 3.2.6)
Although there is a known bug that results in a "time zone displacement" error: heroku db:push not working, using taps gem, I have not seen any SO posts that directly address this issue.
Taps is no longer the recommended tool to use when migrating data between postgres instances. Please give heroku-pg-transfer a try instead.
This will only work if you're using one of the production databases or the new Heroku postgres dev or basic plans. If you're still on the older shared database plan I would suggest switching to the new dev plan.
First, find the URL to your db on Heroku:
$ heroku config:get DATABASE_URL
postgres://yada:yada#ec2-107-21-122-141.compute-1.amazonaws.com:5432/123
Then transfer from the heroku db to your local db:
$ heroku plugins:install https://github.com/ddollar/heroku-pg-transfer
$ heroku pg:transfer -t postgres://localhost/dbname -f postgres://yada:yada#ec2.../123
Since the heroku-pg-transfer tool utilizes postgres's native pg_dump facility it is a much more predictable and resilient tool.
I've written more about it here: Using heroku pg:transfer to migrate Postres databases
My solution was to add the taps gem and the sqlite3 gem (even that I don't sqlite anywhere in the app) into the gemfile (under development).
The solution I found, using hints from https://github.com/ricardochimal/taps/issues/92 is detailed here: https://github.com/ricardochimal/taps/issues/92#issuecomment-6486535
The short of it, is that ruby 1.9.2-p320 seems to have been the problem, as far as I can tell. Downgrading to ruby 1.9.2-p290 fixed it for me. This might be related to the ruby 1.9.3 issues spoken about at the above link, not sure.
If you are still hanging in there with Taps, please see this comment at GH, as the poster doshea seems to have looked into it even more thoroughly than I or jfeust have.
I'll also reiterate here that if you don't need Taps, then heroku-pgtransfer is your friend. See Ryan's answer to my question here and his excellent blog post on using the newer tool.
As per #likethesky, you can downgrade. Alternatively, just
~/.rvm/bin/ruby-1.9.2-p320 /usr/bin/heroku db:push
Of course, that necessitates have p320 installed with tap and sqllite3 gems installed as well. Easy enough to put in place.
Trying to debug a new Heroku deployment - seems to be missing a db table. To do this, I'm running heroku run console but I get back :-
Running console attached to terminal... up, run.7
sh: console: not found
under both my Linux and Windows environments
What have I missed to get this working?
[Very late update : this is for a Java Heroku app, not a RoR one, so anything related to rails is a little lost on me]
on Celadon Cedar Stack it is changed to:
$ heroku run bash
$ heroku run bash
then
…#…:/app$ script/rails console
It worked for me. Though the second step is specific to Ruby on Rails – I don’t know the equivalent commands for other platforms and frameworks.
To run rails console, it's just:
heroku run rails console
I'm trying to setup an automated "build" server for my rails projects using Hudson CI. SO far it's able to run specs and do metrics on the code but I have 2 different projects dependent on 2 different versions of ruby. So i'm trying to use RVM to run multiple copies of ruby then switch back and forth in a pre-build step.
I found a couple posts like this one that try and explain how to make this work, but I'm not running a startup script for hudson, it starts on boot which is how it worked out of the box when i installed it via the debian instructions.
The problem seems to be that even though hudson runs under the "hudson" account and that account has rvm installed (and working) when it tries to run a shell based prebuild step to call rvm switch 1.8.7 it fails with the error "rvm: command not found"
Not sure what I'm doing wrong. Hudson is using SH as its shell but i also tried using bash. no luck.
Has anyone gotten this working before in this setup?
edit the "/etc/init.d/hudson" (!) and change the line:
SU=/bin/su
... change to:
SU="/bin/su -"
... and add rvm setup in the /home/hudson/.profile
I had the same symptoms as you.
After a couple of hours of headbanging, check your $HOME environment variable for Hudson (viewable at http://yourserver/hudson/systemInfo).
Under Ubuntu, the Tomcat 6 start script doesn't set $HOME. Somehow, Hudson inherited my $HOME instead!
I added HOME=$CATALINA_HOME to the /etc/init.d/tomcat6 script just under the rest of the ENV declarations, and now it all works. Very annoying issue, to be sure.