The Atlantic and Githib

Mr. Meyer writes:

For the uninitiated: Github helps programmers (and teams of programmers) keep track of different versions of code, an important task when hundreds of people might be editing the same code base or piece of software. It can compare two different code snippets and tell you what the differences between them are, and who made those changes. It can tell you how all the changes in a project compare to each other. And it can, in the service of that one, huge, change-tracking feature, do a ton of other things too.* The New Yorker published an online introduction to the service earlier this month.

So, Github is a singular phenomenon in the world of code.

Excuse me, Mr. Meyer, but version control has been around since the days I was coding in DOS, 25 years ago.  Did you fail to do a simple search on wikipedia for version controls systems?

 

 

Building and Running Catarse Natively in Windows

Success!

Here are my raw notes on how this was accomplished.

As per my previous posts, use RailsInstaller to install Ruby on Rails for Windows.  Catarse requires Ruby 1.9.3, so make sure you download that version of RailsInstaller.

Then, from my previous post:

  1. Download Catarse
  2. Confiure database.yml
  3. If you haven’t installed PostgreSql, do so, including pgadmin3 (I have a post somewhere about that too.)

Now for the fun stuff.

Bundle Install

Bundle install will fail for a variety of reasons.

Installing Curb

From here: http://jes.al/2012/10/installing-curb-gem-on-windows-7/

You are reading this probably because you might have encountered an error like this on Windows:

Installing curb (0.7.18) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

Here’s how to fix it (Note: This is assuming you have successfully installed RailsInstaller or similar.)

1) Download libcurl (under the “Win32 – Generic” section) and extract the contents to C:\ At the time of writing 7.27.0 was the latest. If you download a different version, don’t forget to the update the paths below.

2) Add C:\curl-7.27.0-devel-mingw32\bin to your Windows path

3) Run:

gem install curb --version 0.7.18 --platform=ruby -- -- --with-curl-lib="C:/curl-7.27.0-devel-mingw32/bin" --with-curl-include="C:/curl-7.27.0-devel-mingw32/include"

By the way, those multiple dashes are not a mistake! That’s the only way I could get it to work. You can change the version to meet your needs. I had another gem which was specifically dependent on version 0.7.18 so I choose that in particular.

What I Did

The actual download file was:

http://curl.haxx.se/gknw.net/7.31.0/dist-w32/curl-7.31.0-devel-mingw32.zip

Setting the path to the unzipped folder :

  • right-click on my computer, select Properties
  • select advanced system settings
  • select the Advanced tab
  • click on the button “Environment Variables” (near the bottom)
  • edit the path

The command I used (this is all one line:

gem install curb –version 0.8.4 –platform=ruby — — –with-curl-lib=”C:/curl-7.31.0devel-mingw32/bin” –with-curl-include=”C:/curl-7.31.0-devel-mingw32/include”

Gemfile Fixes

Remove from Gemfile in the production group the line “gem ‘unicorn'”

Remove from Gemfile.lock references to kgio and unicorn

Add to Gemfile’s development group:

gem ‘thin’

Replace:

gem ‘rmagick’

with:

gem ‘rmagick-win32’

libv8

All the instructions that I found for getting libv8 to install failed except for the instructions related to getting therubyracer_for_windows to install, which are:

From there: https://github.com/hiranpeiris/therubyracer_for_windows

followed the instructions (the ruby folder I used was: C:\RailsInstaller\Ruby1.9.3\bin)

This seems to have fixed the dependency issue on libv8!

RMagick

I was actually successful with this but none-the-less I ditched it later.  Here’s how I installed RMagick:

Follow the instructions here: http://stackoverflow.com/questions/4873276/i-cant-install-rmagick-gem-on-windows

Prerequisites:
Ruby > 1.8.6
DevKit (any version)
No other ImageMagick installation or PATH entry

Step 1: Installing ImageMagick:

Download ImageMagick: http://imagemagick.spd.co.il/binaries/ImageMagick-6.8.0-3-Q16-windows-dll.exe

Install ImageMagick:
*Important: The installation path should NOT contain any spaces.
Ideally select “C:\ImageMagick″

Please make sure to select the below options:

Add application directory to your path system
Install development headers and libraries for C and C++

Step 2: Installing rmagick:

Use the following command to install rmagick gem:

gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/lib --with-opt
-include=c:/ImageMagick/include

or:

gem install rmagick –version=2.12.2 –platform=ruby — –with-opt-lib=c:/ImageMagick/lib –with-opt-include=c:/ImageMagick/include

But It Doesn’t Work

No worries, we still needed to install the ImageMagick application, so continue along with this:

http://stackoverflow.com/questions/808657/unable-to-install-rmagick-in-windows-machine

  1. Uninstall any Image Magick or RMagick gem from before.
  2. Download rmagick-win32 for windows that has the gem and the ImageMagick installer from http://rubyforge.org/frs/download.php/64917/RMagick-2.12.0-ImageMagick-6.5.6-8-Q8.zip
  3. Unzip the rmagick-win32 zip file that you downloaded above.
  4. Install the ImageMagick from the installer that came in the zip i.e. run the ImageMagick-6.5.6-8-Q8-windows-dll.exe. This will install ImageMagick for you.
  5. Install the rmagic gem that came in the zip i.e. rmagick-2.12.0-x86-mswin32.gem.

This actually worked!

Make sure the Gemfile reads:

gem ‘rmagick’, ‘2.12.0’, :platforms => :mswin

But it STILL Doesn’t Work!

Well, the gem did install, but when I ran “build install”, I got the error “cannot load such file RMagick” in uploader.rb, which I didn’t pursue further.

mini-magick

Happily, carrierwave also supports mini-magick, (and besides, I read a post the RMagick is no longer supported) sooo…

gem ‘mini-magick’

but version 3.6.0 blows up (see http://stackoverflow.com/questions/16677634/watir-gem-install-error-due-to-mini-magick-file-w-special-characters)

so, we need:

gem ‘mini_magick’, ‘3.5.0’

You know, it actually amazes me that anything in this environment can be successfully built, given how fragile these builds seem to be!

Of course, this leaves me wondering, what the heck the file Vagrantfile is all about, and the references here:

# Image handling
chef.add_recipe “imagemagick”
chef.add_recipe “imagemagick::devel”
chef.add_recipe “imagemagick::rmagick”

ok:

Vagrant allows you to run your Rails application and all of its dependencies in a portable, sharable environment. Use for development, set it up as a staging server, or experiment with a production setup.

So, I’m just going to replace this with:

chef.add_recipe “min_imagick”

jasmine.rake

Delete it (it’s in lib\tasks).

rake db:migrate

At this point, bundle install should finish without any errors.  Now, what about the database?  Well, there are problems here too:

problem while using OauthProvider model:
‘PG::Error: ERROR: relation “oauth_providers” does not exist
LINE 5: WHERE a.attrelid = ‘”oauth_providers”‘::regclas…
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = ‘”oauth_providers”‘::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum

No association found for name ‘unsubscribes’. Has it been defined yet?

Given that this appears to be an issue starting with an empty database: https://github.com/catarse/catarse/issues/145

I am copying my existing database from Ubuntu to Windows. I had originally created that database from the danielweinmann github version, the did a migrate from that version of the database.

Yes, this is something of a cheat, having already gotten a database installed from the my previous erroneous attempt using the danielweinmann github version of catarse.  I guess it was useful for something!

Also note though:

For rake db:migrate to work (after you’ve gotten the old DB installed), you’ll need to put your PostgreSql bin path into the PATH env variable, as there is now a pg_dump call being made.

Run It!

Are we done?  No!

libcurl dll’s

the program can’t start because libcurl.dll is missing from your computer

Copy all the dll’s from the curl-7.31.0-devel-mingw3 folder into the railsinstaller\Ruby1.9.3\bin folder. Don’t replace files that already exist!

No, adding the curl… folder to your PATH var doesn’t work.

That’s IT!

Just to prove it, here’s a screenshot with RubyMine in the foreground showing the server log:

catarseYay!