Uninstalling Ruby to go to an older version - ruby-on-rails

I'm trying to learn Ruby On Rails, and found I can't really use Ruby 2.2.2 because Nokogiri doesn't support it on Windows yet.
How do I roll back Ruby to an older version so I can develop on an older framework while I wait for Nokogiri to come up with a product for Windows and Ruby 2.2.2?
What is the best way to uninstall it so I don't have bits hanging around that might cause issues?
This is in response to my question: "Error installing "nokogiri" in a Ruby on Rails application?"

Linux users: please remember that not everyone is interested in switching their OS, running 2 machines, trying to figure out dual boot, or dealing with virtual machines dragging down a host. While Linux is a great environment for software development, people, like the OP, just looking to try their hand at something (like ruby/rails) should not immediately be told to switch to something completely unfamiliar which might not even adequately support their normal day to day activities.
Since I am not a believer in making anyone leave an environment they are comfortable with (especially since you stated "learning". Why would you want to make an additional investment just to try something out?) and because I did not want my comment to get over looked as it will help with your issue, I have decided to post this as an "answer".
Mac and Other *nix based OS's have the ability to install rvm (Yes I know there are more but rvm is my personal choice and a community favorite) which allows you to manage different versions of ruby on the same OS.
While rvm is not available for Windows there is a small application called uru which will get you as close from a windows standpoint.
Installing a version manager means that you do not need to uninstall or rollback anything you can simply install a new/old ruby version side by side the current versions you have and switch between them fairly easily from command line.
While uru does not have all the fancy features that other applications like rvm possess (by design). It contains the important ones (primarily in your case switching ruby versions). The CLI is very simple and straight forward. Examples of uru Usage
Also: Please note I work in an Windows centric Office and have developed more than a few fully functional rails applications on a windows machine. Yes there are some headaches when dealing with native extensions and know that you will always be slightly behind the leading edge for ruby and rails but it is completely possible and feasible to build enterprise level web applications completely in a Windows environment without ever installing Linux at all. (Note I do use dedicated Linux machines for non development web servers)

Go to your control panel and find the ruby or rails installer. Uninstall it. Go to your file explorer and make sure the folder is gone.
Now go to http://rubyinstaller.org/downloads/ and pick an older version. Follow that process just like the first time you installed ruby. Then go get nokogiri and whatever other gems you like and enjoy.
I had the exact same issue when trying to some gems(stanford core nlp & treat) to work that relied on JVM that was 32bit instead of 64 like the version of ruby I was running so I reverted to 1.9.3.
I'm also in the avoiding moving to OSX or linux camp so I feel your pain man.
Let me know if this works and good luck!

Related

Rails/Ruby pain - How to check if gem is UNIX/UNIX-like based?

Is there any way to see if a gem is only supported on UNIX/UNIX-like systems?
Are there any gem that can "screen" all gems and see if there is any trouble using it with Windows.
Short answer: No.
To be honest, Windows is a second-class citizen in the Ruby world. Mostly this is because where Linux, BSD, OS X, and virtually every other POSIX-based system will agree on one thing, Windows will go and do something completely different.
Even a gem that's intended to work with Windows may break occasionally due to an oversight of the developer. Most gem authors do not have a continuous integration server that runs against Windows and depend on bug reports from users.
Supporting Windows is difficult not only because of API differences, but because of the nature of the Windows ecosystem where access to a command-line compiler is not to be taken for granted like it is on other systems. This means any gem that's not pure Ruby can be a challenge to install, especially if it has other dependencies that are tricky to get working in Windows.
The only way to know for sure is to try and install the gems and see if they work.

Developing a Rails app in Netbeans/JRuby but deploying to Ruby (C)

I'm using Netbeans and JRuby to develop a Rails web application.
But for deployment, I will be using Heroku.
Since Heroku uses the Ruby-C implementation, I was wondering my use of JRuby can cause problems? Is this approach a safe thing to do?
You can develop in NetBeans and use C-Ruby (aka MRI Ruby). Just install Ruby separately, go to Ruby Platforms, and select it. I highly recommend you install a separate Ruby anyway, whether or not it is MRI Ruby, because if you use the built-in NetBeans version of JRuby (which is often not the latest) and then upgrade NetBeans, you'll lose all the gems you've installed. Installing Ruby/JRuby outside of NetBeans helps you to better manage the versions and gems.
Now to answer your questions: Likely you will not encounter problems with basic Rails applications. If you ever have the need to use non-native libraries you may run into issues. Some gems (e.g. Nokogiri) have a C version and a Java version so you'd be OK, but if you wanted to use a plugin that relied on RMagick, for example, you'd struggle, as you'd probably go a different route if you were developing and deploying with JRuby.
Bottom line: I wouldn't recommend it. I'd recommend using the same platform for both. But you can use MRI Ruby in NetBeans.
funny thing: I stumbled in your question while looking for a tool chain to do it the other way round (developing in MRI Ruby, deploying with JRuby). Of course you can not use any Java classes and internals, but this for sure is obvious to you. According to my results thus far you shouldn't encounter any process structural issues, because MRI Ruby adheres to the shared nothing principle whereas your requests in the development app share the VM at least. Maybe to be shure you should hae a look at http://kenai.com/projects/jruby/pages/DifferencesBetweenMriAndJruby and read it in a reverse sense, especially the "Native Endian is Big Endian" paragraph when un-/packing Strings or Arrays.
You will save yourself a lot of trouble if you develop on the same platform as you deploy. This goes for OS as well, especially Windows then deploying on Linux, less so with OSX, but still sometimes an issue. You will be troubleshooting on your deployment system and that just isn't the same as catching something as you code it in development. I recently started using JRuby for a project and there are quite a few differences and different gems altogether in some cases.
As for loosing installed gems etc. take a look at using Bundle while you are at it, that will also save you some trouble down the line with gem versions out of sync.

How to start with Ruby on Rails on Mac OS X Snow Leopard? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Is there any good tutorial on how to get things installed and working on Mac OS X Snow Leopard? Also which tools do you use? TextMate? Or something else?
I am trying my first steps with RoR after years of ASP.NET development on Windows platform but I am getting curious to learn other things as well to become a better developer.
The ruby AND rubygems on snow leopard is sufficient. So to get started:
$ sudo gem install rails
$ rails my_first_project
$ cd my_first_project
$ ./script/server
:-)
Dan Benjamin has some great instructions over at Hivelogic for compiling and installing 64-bit Ruby, RubyGems and Rails on Snow Leopard. They get installed in /usr/local so they don't affect the versions that come with Mac OS X.
TextMate works great for Rails development—DHH helped to develop it—but most recently I've switched over to using Vim.
The good news is that it's pretty straight forward on a Mac as it comes pre-installed with Ruby, so there's not much work to do. Here's a post related to installing it:
One-Click install for Ruby/Rails/SQLite?
As for coming from an ASP.NET background - if you're talking about a WebForms background, then you're in for pain and death and crying over your keyboard. It's quite a big switch moving from that, I would know. I quit my previous job because I was sick of WebForms. I now work in RoR for a development team. It's most delightful.
As for tools, I use Eclipse with RadRails at the moment, although I don't rate RadRails to be honest and I just use the standard Eclipse features primarily. As for getting it running, RoR comes with some awesome command-line tools. Just browse to the project directory then run script/server from the command line and hey presto, it'll fire up the instance and you can browser to http://localhost:3000 to have a view.
Also, as it's interpreted you can see your changes instantaneously - even schema changes.
You'll also need to get your head around Active Record, as that's an important part of it all.
Start with the Rails guides though, they're very, very good.
You can give a look at this book that can help you in the transition.
Also if you are used to Visual Studio you can give a try to RubyMine which is not free but quite cheap and gives you a full IDE for ruby on rails.
To install ruby versions on OSX snow leopard I suggest you follow this railscast.
RVM (Ruby Version Manager) will help you install more ruby and rails versions on your machine.
I would suggest looking into MacPorts or Homebrew for package management. This allwos you to easily install stuff like MySQL and PostgreSQL etc. Also i strongly suggest using [RVM]/http://rvm.beginrescueend.com/) to manage different versions of ruby. Note that this does affect your bundled Ruby in OSX.
The basic setup for me usually is to install RVM, install ruby 1.8.6, 1.8.7, 1.9.1 and 1.9.2 (need all of these in my work :>) and then install the relevant gems for the Ruby version in eed to use. Thats pretty much it.
And i use RubyMine as my main tool, its well worth it's price.
i think the book Ruby mine is a good option, i tried it looking into answers here. i was quite familiar with visual studio and it has it integrated . i think if you have the experience of working in visual studio thats the best thing you should prefer for ruby on rails development.
The only thing, that i needed, after i bought a Mac - is to install Aptana RadRails
After that, everything was up and running.
My favorite features in Aptana are:
dynamic hinting, as i type console commands, like "db:fixtures:load"
server logs, console commands, project explorer are sitting in right places (that i choose) in one window. No windows-clutter on the screen.
highlighting of all occurences for local variable, that was clicked by mouse
browser-like navigation. For example, hold "cmd" key and hover "orders" in "has_many :orders" string ... you will be navigated to "Order" model. This feature works with many items, like classes, functions, modules etc.
Currently, i have Aptana 2.04. Aptana 3, that will be released soon, will do everything even better.
Before writing something to views, i create HTML-makeup first.
I have a separated folder, especially for HTML-makekup. It contains HTML-page, that looks, like completed web-site, with all the HTML structure, that should be. I find this more effective, while playing with jQuery and CSS, because i don't need to wait for webrick (or other) server's response every time, i change CSS-property value.
I use TextMate with my favorite "Pastels on Dark" theme for HTML and JavaScript editing. It looks amazing, and so, i enjoying, what i do every day :)
I use CSSEdit for editing CSS, because:
it has Dreamweaver-like CSS editing UI, without writing the code manually
it has autocompletion, when you are going to edit something by hands
it has good style navigator, that acts like outline view
Good luck!

How can I create an all-in-one installer for Ruby on Rails application deployment on Windows?

I'm in the process of deploying a rails application to Windows machines. I do all of my development with OS X and Linux, but the final app will actually run on Windows machines.
That said, my client is looking for an all-in-one Apache(I had to talk him out of IIS)+Rails+Application deployment/installer. He wants to hand all of his (Windows-based) clients an install CD for their respective servers (they all want their own setup).
Is there anything like this in existence? I realize Capistrano exists but that requires a great deal of setup on the hosts (especially for Windows) beforehand and it's not very feasible in this particular case.
In the past I've used InnoSetup (http://www.jrsoftware.org/isinfo.php) for creating installers, but I'm not sure that's going to work in this case.
If you guys have any input, suggestions, or highly persuasive client techniques (to talk them all out of Windows =P) it would be most appreciated.
Best.
Try with RubyStack:
BitNami RubyStack is an installer that greatly simplifies the installation of Ruby on Rails and its runtime dependencies. It includes ready-to-run versions of Ruby, Rails, MySQL and Subversion as well as a number of third-party libraries like FiveRuns TuneUp. RubyStack is distributed for free under the Apache 2.0 license and has been packaged using BitRock's multiplatform installer.
http://bitnami.org/stack/rubystack
I'd look into using jruby with glassfish. Make sure the users have java and it should be good to go.
RubyStack is the closest thing to what you're after, although you might need to tailer the install a bit and remove some unwanted baggage. I don't know of any other Windows projects for a production environment (InstantRails is designed for development).
Maybe you can make InstantRails meet your needs.
Ruby and thus Ruby on Rails is a fairly notorious deployment on Windows even in the best of circumstances, moreso when the setup is out or your hands like that. I don't mean to admonish, but this definitely speaks to matching development and deployment enviroment (I once ran into similar problems when I found out that the Java enviroment we were deploying to was a good half-a-decade out of date).
As I don't have enough Ruby-on-Windows experience to fairly weigh in on the matter, I'd say either LiveCD's or CygWin deployments may be worth looking at (Always good to broaden people's view on alternate Operating Systems, right?).
Have you considered building a single version that runs in a VM?
For this particular problem, I'd go with a traditional Windows installer package like NSIS.
When I had a client with a Windows-only IT department, though, I found they were much more amenable to an XServer than a linux server. I don't generally think of OS X as a server OS, but it actually worked really well. I tried for linux first, and when they shot it down, I suggested OS X and they jumped at it.
It helped, I think, that they already supported some Mac laptops.
Good luck!
As other posters have suggested, RubyStack should be a good option. It is free and you can always use it to run your own 'post install' scripts to customize it for what you want. If you want a supported stack or addition/modifications to RubyStack you can get commercial support from BitRock We have done so for several Rails based companies that wanted a local version, including for the guys over at GitHub

Ruby On Rails with Windows Vista - Best Setup? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
What do you think is the best set-up for RoR in a Win Vista environment? I've tried the radrails eclipse plug-in, and it just seemed too bulky for me, I've also started to just use Textpad and the command line, but I'm used to having somewhat of an IDE to work with.
I don't know about "best", because that's a subjective question, but I can tell you what setup I use and recommend:
Editor: E Text Editor
TextMate seems to be the editor of choice for Rails on Mac. E Text Editor is essentially TextMate for Windows. Its bundles are broadly compatible with TextMate's including the Rails 2 bundle which is included with the basic install.
Alternatively, if you're into the whole Visual Studio ecosystem, then Ruby in Steel PE might be a better bet. It's a really nice all-in-one package that actually comes with (a stripped-down version of) Visual Studio now.
Environment: VirtualBox running Ubuntu Server
Deploying a Rails app can be a pain at the best of times; deploying a Rails app from a Windows environment onto a *nix server is even worse. Plus, running Rails apps on Windows is slow. Running your tests is slow. So I use VirtualBox to host a VM on my Windows machine that mirrors my target deployment environment as closely as possible. In my case I run Ubuntu Server because there are a really nice set of step-by-step tutorials for getting up-and-running with a full Ubuntu-based Rails stack on the SliceHost wiki.
Here are the benefits of developing using a VM:
I map a network drive to the VM so that I can edit the code on it directly from Windows using E Text Editor. The VM acts and feels just like a command line window. So you don't feel like you're in a completely alien environment.
It runs Rails and other Ruby scripts (like tests) faster than running it natively in Windows
Everything is contained and snapshottable, so I can experiment and generally play around without worrying about breaking anything. If something does break, I just roll back to a previous good state.
It uses hardly any RAM. It will typically use less that 100MB (it's currently using ~43MB, but I don't have a Rails app spun-up). Contrast this with, say, Firefox which will typically be hogging >200MB and you realize that running a Linux-based VM like this is amazingly efficient.
I can move my environment between machines
I have much more robust deployment workflow
I can limit the VM to have exactly the same amount of RAM as the server I'll be hosting on. E.g., if I'm to be using a SliceHost 256MB slice, I would limit the RAM to 256MB.
I can build a seperate environment for different hosts. If I wanted to host on Joyent, for example, I could build an Open Solaris VM
Gems and other binaries won't need recompiling for your target environment
It's "a good thing"™ to get to grips with the environment your Rails app is likely to be running on. Seeing as most, if not all, commercial Rails hosts run some sort of *nix derivative, you're going to want to be comfortable with the *nix environment.
e-texteditor seems to be growing as the editor of choice for rails development on ruby. Too bad it isn't free.
Aside from that, the RailsOnWindows guide works fine. And Sqlite is by far your best choice for development: RailsWithSqlite
NetBeans is definitely recommended if you like IDEs. It has a lot of Ruby features and there's a Ruby only download.
There probably isn't a definitive "right" answer - it's going to depend on how you like to develop.
However, it's interesting to note that most of the "name" Rails folk seem to use Textmate on their Macs. So a fairly powerful editor rather than an IDE. I suspect this is at least in part because of the fairly strong TDD bias within the Rails community - not so much debugging being necessary because they're working in small test-driven steps. That's the theory anyway.
The closest analog to Textmate in Windows seems to be e. It costs, but a fairly trivial amount (pocket-money, if we're honest). There's a 30-day free evaluation available too.
I've used Scite for much of my Ruby/Rails work, don't discard it just because it's the "default" - there's a reason why it was chosen for inclusion.
As for IDEs, I couldn't get anything to work in Eclipse, NetBeans seems quite good and I tried the beta of Sapphire in Steel, also pretty slick. I just don't seem to want to work in an IDE; the opposite of how I feel about working in C#, strangely enough.
Are you just looking for an IDE, or a full stack (IDE, source control, database, web server)?
If just an IDE, I would recommend NetBeans or RadRails. Both have syntax highlighting, code help, support for Rails projects, code completion, and basically everything else you would expect to find in a full-featured IDE. Both are also completely free. Of course, both suffer from the "bulky" problem that you identify.
If a full stack, I would recommend Subversion, MySql, and Mongrel. These three are all very simple and well-supported in Windows.
Seconded for e-texteditor. I use it daily and it's great (although not without it's share of BUGS).
For the rails side of things though, I'd actually suggest a virtual machine running linux.
Ubuntu works well, the only caveat is that you have to install rubygems manually, as it does not adhere to the great debian filesystem naming ideology :-(
I suggest this because if you want to do "advanced" things, such as installing ImageMagick/RMagick, or memcached, or a number of other plugins which require native C libraries, it becomes very painful very quickly if you're on windows.
A second reason is that unless you are very atypical, your production server will likely be running linux too. It's good practice to have your development environment match your deployment environment as closely as possible, to help you find and fix bugs earlier and more easily, and avoid fixing bugs that won't affect your production site (like windows specific ones)
Microsoft Virtual PC and VMWare both have free options, which work well, and are plenty fast, so this is not a problem.
Instant Rails is a good way to get started quick.
I can verify that it works well on Vista.
I suggest you install Ruby first.
Then install Rails.
Then download Aptana and install it.
After that you can install RadRails from Aptana's start page.
Please refer to "Aptana Radrails: An Ide for Rails Development" published by Packt publishing when using RadRails.
You might want to take a look at this:
http://www.sapphiresteel.com/
There's a free personal edition too
(Updated: Assuming that you already have Visual Studio Full Fat Edition)
I am one of the contributors to Rubystack is a free, all-in-one installer for Windows that installs Apache, MySQL, Ruby, Rails and all other third-party libraries typically used on a development environment (such as Imagemagick). You may want to give it a try
RubyMine 3-4 + (RubyInstaller, DevKit for building gems, Postgres, msys git)
works perfect for me on Windows 7 as a development platform.
Well, except the problem that ruby is very SLOW with rails on windows.

Resources