VersionEye API : Dependency stable

At the last DevCamp in KA I had some good discussion about the VersionEye API. That’s why I enhanced it a little bit. I just introduced a new attribute to the project dependencies. The “stable” attribute. If this is true than that means that the newest version is stable, otherwise the newest version is unstable.Continue reading “VersionEye API : Dependency stable”

Remove 1 Document from ElasticSearch Index via Tire

It is possible to remove 1 single document from an existing ElasticSearch Index! I am using the Ruby GEM Tire to deal with the ElasticSearch Server. This is the command to delete an existing document: Tire.index( <INDEX_NAME> ).remove( <DOCUMENT_TYPE> , DOCUMENT_ID ) Worked fine for me 🙂

Parsing a CSV in Ruby

Parsing is CSV file in Ruby is very easy. Check out this code: require “csv” csv_file_path = “ABSOLUTE_PATH_TO_YOUR_CSV_FILE” file = File.open(csv_file_path, “r:ISO-8859-1”) csv = CSV.parse file That’s it. This is how you get the first row: csv.first This is how you get the first column of the first row: csv.first.first And this is how youContinue reading “Parsing a CSV in Ruby”

How to get a list of all licenses for your Software Project

Through the new VersionEye API you can get a list of all licenses for your software project. VersionEye now supports 7 different package managers. In this example I will use a Ruby Gemfile to demonstrate how easy it is to get the license list. First of all you need to signup at VersionEye to get yourContinue reading “How to get a list of all licenses for your Software Project”

Ruby on Rails + MySQL on CloudControl

CloudControl is a pretty cool StartUp from Berlin. It is a PaaS Solution like Heroku.  CloudControl is hosting on AWS in Ireland. They are more flexible than Heroku. Beside the number of web processes you can choose how much RAM each instance should have. This is a cool features what you don’t get on Heroku.Continue reading “Ruby on Rails + MySQL on CloudControl”

Getting a list of all Licenses in a Project

In a regular project you are using a handfull Software Libraries. Every Library in your project can use a different license. To get a list of all licenses which are used in your project can be difficult. You can double check the license for every single library in your project manually. But that is timeContinue reading “Getting a list of all Licenses in a Project”

Capistrano + Rails + Unicorn + NGinx + RVM

Capistrano is a ruby based deployment tool which executes commands in parallel on multiple remote machines, via the SSH protocol. With Capistrano you can deploy your application on N server with one single command from your dev machine. You don’t need to login via SSH to your server. If you don’t deploy your app onContinue reading “Capistrano + Rails + Unicorn + NGinx + RVM”

Ruby on Rails + ElasticSearch

This is a tutorial how to use ElasticSearch with Ruby on Rails. ElasticSearch is a distributed RESTful Search Engine build on top of Apache Lucene. Sure! You can use your SQL database for search. But that is usually slow and you will not get very good search results. With ElasticSearch you can deliver a fuzzyContinue reading “Ruby on Rails + ElasticSearch”

Installing native pg gem on Mountain Lion

I tried to install the native pg gem on Mac OS X Mountain Lion (10.8.2): gem install pg and got this exception: Building native extensions. This could take a while… ERROR: Error installing pg: ERROR: Failed to build gem native extension. /Users/robertreiz/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb checking for pg_config… yes Using config values from /usr/bin/pg_config checking for libpq-fe.h…Continue reading “Installing native pg gem on Mountain Lion”

Reset Postgres DB on Heroku

In a Rails application you can you this tasks on localhost to reset the database. rake db:drop rake db:create rake db:migrate And that will delete the db schema, create a new one and run all migrations to create the tables. This is awesome! But if try to run this on heroku: heroku run rake db:dropContinue reading “Reset Postgres DB on Heroku”

CSS broke Heroku Deployment

Today I did a “git push heroku master” do deploy an application. And than suddenly I got a big exception and the build failed. The funny thing is that CSS is the root of the problem. This CSS line here broke the deployment: height: inherit important!; Indeed it should be: height: inherit !important; Heroku is very sensible 🙂

3 Rake commands

Not for me. The 3 most important Rake commands in a Ruby on Rails application are: rake db:drop rake db:create rake db:migrate First command drops the database. Second command creates the database. Third command runs all migrations and creates basically the schema. This is incredible useful.

through mapping causes rspec error

by executing this command: rails generate rspec:install I got this error message. ~.rvm/gems/ruby-1.9.3-p194@ms/gems/activerecord-3.2.8/lib/active_record/dynamic_matchers.rb:50:in `method_missing’: undefined local variable or method `consultant_id’ for #<Class:0x007fdb93a08bd0> (NameError) the problem was that in one of the models I used :through => consultant_id As soon I resolved this option it worked. Strange!

Rails Migration column_change

I just created a rails migration for one of my tables. Wanted to change the type of a column from string to integer. My migration looked like that: Unfortunately it didn’t worked out. I got this Exception: PG::Error: ERROR: column “title_id” cannot be cast to type integer : ALTER TABLE “consultants” ALTER COLUMN “title_id” TYPEContinue reading “Rails Migration column_change”

Seamless Deployment with Heroku

By default there is no seamless deployment on Heroku. That means, if you do a git push, your app gets deployed and there is a little downtime. That’s just because how Heroku works. At first they kill your running dynos, then they build the new app, deploy it on new dynos and finally boot upContinue reading “Seamless Deployment with Heroku”