Skip to main content

Install and run RVM with bundler on Windows (Drupal Omega 4 specific)

Unlike on UNIX based systems, installing and configuring RVM on a Windows machine properly in order to be able to use the new possibilities in Drupal's Omega 4 theme could become a difficult task. But running that process through the cygwin environment makes it possible.

Installing cygwin and required dependencies

Make sure you install the 32-bit version of cygwin, as otherwise you could get errors when trying to compile your ruby when installing it through rvm. So Install cygwin with following packages and their dependencies:
automake, bison, colorgcc, curl, gcc-g++, gcc-core, git, git-completion, git-gui, git-svn, gitk, libreadline7, libtool, libyaml-devel, libyaml0_2, make, mercurial, mingw64-i686-gcc-g++, nano, ncurses, openssh, openssl, openssl-devel, patch, readline, unzip, zlib, zlib-devel, sqlite3, mingw64-x86_64-gcc

Installing RVM

Open cygwin's command prompt and start the installation of RVM with the following command:
curl -L https://get.rvm.io | bash -s stable
This should download and install RVM in your in /home/user01/.rvm/ directory. So far so good. Just type
rvm -v
to ensure that RVM is installed. If you have installed ruby on your Windows machine previously - e.g. through something like Ruby Installer - I recommend to go ahead and uninstall it, as you will be managing your rubies through rvm from now on anyway.
Check that all cygwin requirements for RVM are installed:
Run
rvm requirements
If you need to install additional requirements and sends you an error listing the missing requirements then install those requirements using the cygwin setup.exe again, then run:
rvm requirements
and you should get the message:
Checking requirements for cygwin.
Requirements installation successful.
So now if you type
ruby -v
you should get something like "ruby not found", which we will change very soon.

Installing the ruby for your omega theme

Assuming, that you have a omega subtheme in your drupal installation, you can now navigate in the command line to the root of the subtheme. As soon as you are there RVM should recognize by the contents of the .ruby-version file that it needs to install a specific ruby version for that directory. In my case I get a message like
ruby-1.9.3-p448 is not installed.
To install do: 'rvm install ruby-1.9.3-p448'
So start the installation of the required version of ruby by entering
rvm install ruby-1.9.3-p448
Just press any key to continue if you're asked to install additional requirements. Then the installer should download, extract, configure, compile and install the version of ruby you specified.

Running bundler to install the necessary gems

If all went well you now have rvm and the version of ruby required by omega and you can run
bundle install
at that point, in order to install all gems for your omega theme. You will probably get an error of something like "... stack level too deep (SystemStackError)...". This is a cygwin/ruby issue and a good explanation and solution can be found here. So just run
peflags -X409600 `which ruby`
and now you can repeat
bundle install
This should download and install all gems, specified in the Gemfile file, create the Gemfile.lock just as usual.

Solve errors while running compass watch

At that point you can already run
compass watch
to have your sass files compile according to the settings in the config.rb file. The initial compilation will succeed, but you will probably get an error when you edit and the try to save a sass file of something like ("user01" is obviously my username at this cygwin installation. Yours may be different):
ArgumentError on line ["465"] of /home/user01/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/pathname.rb: different prefix:
...
Run with --trace to see the full backtrace
This is a Windows-file system/compass issue and you can find good information of what is going on here.
The file you should edit in this case is the pathname.rb, which belongs to the fssm gem which was installed specifically for your theme by bundler earlier. It is residing in the /home/user01/.rvm/gems/ruby-1.9.3-p448@omega.new_omega/gems/fssm-0.2.10/lib/fssm directory.
Edit line 26 and append the following code to it
unless path[0, 1] == File::SEPARATOR
so that the full line 26 is reading
array[0] += File::SEPARATOR if path[0, 3] =~ SEPARATOR_PAT unless path[0, 1] == File::SEPARATOR
Now you can try out
compass watch
again and it should work.

https://www.drupal.org/node/2138087

Comments

Popular posts from this blog

Cygwin Install Tutorial

1. Introduction OPEN-R requires a Unix/Linux like environment.   To work with it on Windows, the Cygwin package can be used.  It's based on Linux, and allows Linux programs (for the most part) to work under Windows.    You'll need at least 200 MBytes of free disk space available to download and install Cygwin. 2. Download Installer Download the following Cygwin setup program:   http://www.cygwin.com/setup.exe   (~250 KBytes).   Save it to your desktop, and launch once ready. 3. Cygwin Setup After launching the setup program, you'll see this screen.  Click the  Next  button...      4. Installation Type Select "Install from Internet".   Click the  Next  button... 5. Installation Directory The defaults are recommended.   Cygwin software packages will install to "C:\Cygwin". Click the  Next  button... . ...

Hear a PDF Instead of Reading It...

Hear a PDF Instead of Reading It Did you know you can listen to any PDF instead of reading it? It's possible with Adobe Reader 6.0+. Here's the short cut: CTRL+SHIFT+B : This allows you to hear the entire Document (or, you can use View—>Read Out Loud—>Read to the End of Document ). CTRL+SHIFT+V : This allows you to hear just the page you are viewing (or, you can use View—&GtRead Out Loud—>Read This Page ). If the voice is too fast, adjust the speed by going to Control Panel—>(in search box enter "SPEECH" and then click change text to speech setting)  —>Voice Speed—>Slow . You can listen to any PDF instead of reading with Adobe Reader 7.0 or 6.0, and the short cut is: Ctrl+shift+b - to hear the entire Document Ctrl+shift+v - to hear the page Ctrl+shift+c - to resume Ctrl+shift+e - to stop Open any PDF File and test.... its unbelievable..! 

The 7 Best Chrome Apps of 2014

The 7 Best Chrome Apps of 2014 With a brand new year looming large, it’s time for a quick look back at the rear view mirror before pressing on ahead — and what a view 2014 holds for Chrome fans.  We’ve seen native 64-bit builds of the browser land on both Mac OS X and Windows, savoured the introduction of nifty new features like tab audio indicators, and reaped the benefits of developers getting access to new APIs, design guidelines and features. The past 12 months have also seen a great many changes in the world of Chrome Apps. In this post we look back at some of the very best new and updated Chrome Apps from 2014. Sunrise (New) Sunrise  built up a huge following on iOS, making its arrival on Android and Chrome OS ( in May ) all the more anticipated. Kitted out with all kinds of handy organisational wizardry, support for multiple service providers, including Google Calendar, Outlook, Facebook and Todois...