9 Replies - 1954 Views - Last Post: 12 December 2011 - 10:00 AM Rate Topic: -----

#1 Duckington  Icon User is offline

  • D.I.C Addict

Reputation: 170
  • View blog
  • Posts: 608
  • Joined: 12-October 09

Development server fpr Ruby?

Posted 10 December 2011 - 12:57 PM

Hi,

I'm trying to start learning Ruby, and I'd like to set up a simple development server on my PC so I can start making and testing things.

Now, I come from a php background, in which I've always just downloaded WAMP to develop on my computer, which installs everything for you.

I've tried following various instructions on how to setup a development server for Ruby, using lots of terminal commands which seem to be getting me nowhere.

Could anyone advise me on a simple step by step: How to setup a home development server for Ruby?


If I do it on Windows I already have Apache and MySQL installed.

I did try using my Linux Mint partition for installing Ruby, but so far it's only suceeded in confusing me, as I don't really understand terminal commands at the best of times. :/

Any tips or advice would be appreciated.

Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: Development server fpr Ruby?

#2 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2144
  • View blog
  • Posts: 3,295
  • Joined: 21-June 11

Re: Development server fpr Ruby?

Posted 10 December 2011 - 01:02 PM

Just use whichever one comes with your web framework of choice. E.g. if you're using Rails, just use rails server. There's no need to install a separate web server for development (deployment is another matter of course).
Was This Post Helpful? 0
  • +
  • -

#3 Duckington  Icon User is offline

  • D.I.C Addict

Reputation: 170
  • View blog
  • Posts: 608
  • Joined: 12-October 09

Re: Development server fpr Ruby?

Posted 10 December 2011 - 01:06 PM

I haven't downloaded any framework at the moment. I'm just using the Ruby plugin within Netbeans to play around with.
Was This Post Helpful? 0
  • +
  • -

#4 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2144
  • View blog
  • Posts: 3,295
  • Joined: 21-June 11

Re: Development server fpr Ruby?

Posted 10 December 2011 - 01:13 PM

You definitely should use a web framework. Without one you'll have a very hard time developing web applications.

Unlike PHP Ruby wasn't designed primarily as a web development language and it isn't very usable as one without external libraries or frameworks (the same is true for most other languages that aren't PHP of course). It does have the CGI module built-in, but that alone isn't really enough for painless web development. I strongly recommend against not using a framework.

That being said if you do want to develop plain CGI applications using ruby (which again, I strongly discourage), you can just drop your ruby file(s) into the cgi-bin of your Apache installation without having to install anything else.
Was This Post Helpful? 1
  • +
  • -

#5 Duckington  Icon User is offline

  • D.I.C Addict

Reputation: 170
  • View blog
  • Posts: 608
  • Joined: 12-October 09

Re: Development server fpr Ruby?

Posted 11 December 2011 - 11:49 AM

This may be me being stupid, but:

I downloaded Rails from a site called RailsInstaller, which comes with Ruby, Rails and a few other things.

Followed all the instructions, created a new rails demo "> rails new demo" which when I load up the server "> rails s" takes me to the default "Welcome aboard" HTML page on localhost:3000 like it should do.

Then I generate a new controller with "rails g controller welcome index", which created the controller and the view and such.

Then it says to delete the public/index.html file, which I do, and then edit the route file and uncomment "root :to => 'welcome#index'".

But then when I start the server again and go to localhost:3000 I see an error about:

"ActiveRecord::ConnectionNotEstablished"

I'm assuming that's something to do with the database connection? I have tried leaving the database.yml file as it is, and I've also tried changing it to:

# MySQL.  Versions 4.1 and 5.0 are recommended.
#
#
# Be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
  adapter: mysql2
  encoding: utf8
  database: mydb
  pool: 5
  username: root
  password: dev
  socket: /tmp/mysql.sock



But to be honest, I'm quite lost. :/
Was This Post Helpful? 0
  • +
  • -

#6 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2144
  • View blog
  • Posts: 3,295
  • Joined: 21-June 11

Re: Development server fpr Ruby?

Posted 11 December 2011 - 11:57 AM

When using mysql make sure that your MySQL server is running and that all the information (username etc.) is correct. In particular your "socket:" line looks suspicious to me, as that's not a valid path on Windows.

Once you checked all that and the problem still persists, please post the complete error message here.
Was This Post Helpful? 0
  • +
  • -

#7 Duckington  Icon User is offline

  • D.I.C Addict

Reputation: 170
  • View blog
  • Posts: 608
  • Joined: 12-October 09

Re: Development server fpr Ruby?

Posted 11 December 2011 - 12:19 PM

MySQL server was running and I'm pretty certain all the info was correct. But never mind, I think I'm just going to give up with Ruby. Thanks anyway.
Was This Post Helpful? 0
  • +
  • -

#8 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Development server fpr Ruby?

Posted 11 December 2011 - 07:09 PM

View PostDuckington, on 11 December 2011 - 12:19 PM, said:

MySQL server was running and I'm pretty certain all the info was correct. But never mind, I think I'm just going to give up with Ruby. Thanks anyway.


Oh noez! Maybe this can help you?



Part 2 is here
http://www.youtube.c...h?v=KDypMheAxvg


Ruby on Rails is not for the faint of heart. It's an incredibly complicated thing to learn on your own. I'm still struggling with it after almost a year of independent study! The problem with rails is that you need to be very good at memorizing dozens of various conventions in order to program. My memory is terrible so it's taking me an extra long time to get my act together. I'm much better at immersion learning, so I really should have taken up PHP or perhaps python in the first place, but I'm in too deep to give up now =P

Installing it on linux is actually a lot easier than installing on MS, so if you'd like to trouble shoot your linux install, we're here to help (I'm procrastinating learning form_for conventions, atm).
Was This Post Helpful? 0
  • +
  • -

#9 Duckington  Icon User is offline

  • D.I.C Addict

Reputation: 170
  • View blog
  • Posts: 608
  • Joined: 12-October 09

Re: Development server fpr Ruby?

Posted 12 December 2011 - 06:18 AM

View PostNotarySojac, on 12 December 2011 - 02:09 AM, said:

View PostDuckington, on 11 December 2011 - 12:19 PM, said:

MySQL server was running and I'm pretty certain all the info was correct. But never mind, I think I'm just going to give up with Ruby. Thanks anyway.


Oh noez! Maybe this can help you?



Part 2 is here
http://www.youtube.c...h?v=KDypMheAxvg


Ruby on Rails is not for the faint of heart. It's an incredibly complicated thing to learn on your own. I'm still struggling with it after almost a year of independent study! The problem with rails is that you need to be very good at memorizing dozens of various conventions in order to program. My memory is terrible so it's taking me an extra long time to get my act together. I'm much better at immersion learning, so I really should have taken up PHP or perhaps python in the first place, but I'm in too deep to give up now =P

Installing it on linux is actually a lot easier than installing on MS, so if you'd like to trouble shoot your linux install, we're here to help (I'm procrastinating learning form_for conventions, atm).


Thanks, I'll give it a little go next time I'm on my Linux machine. There don't seem to be many Ruby-related jobs around at the moment though, so I think it'll just have to be a little hobby and focus more on languages like C/C++ to enhance the CV.
Was This Post Helpful? 0
  • +
  • -

#10 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Development server fpr Ruby?

Posted 12 December 2011 - 10:00 AM

View PostDuckington, on 12 December 2011 - 06:18 AM, said:

Thanks, I'll give it a little go next time I'm on my Linux machine. There don't seem to be many Ruby-related jobs around at the moment though, so I think it'll just have to be a little hobby and focus more on languages like C/C++ to enhance the CV.


That link was for Windows install (which I discourage with experience). If you want to go for linux again, this might work.

(debian installation of rvm)
$  apt-get update
$  apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf

$  bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

$  echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc

<LOGIN AND OUT OF SSH>

$  rvm pkg install zlib
$  rvm install 1.9.2
$  rvm --default use 1.9.2

$  gem install rails v='3.0.9'



After that, you should get a positive response from
$  rails new my_rails_project



You might need to tweak those package names though since you're on a slightly different distro than me.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1