Bower integration with your Rails 4 app

First take a look to this post making a basic NodeJS installation on Ubuntu. You will need npm and bower installed.

If you want more details about this process take a look to this post.

Configure Bower to place libraries in our vendor directory’.bowerrc’:

 "directory": "vendor/assets/components"

Asset pipeline should know where to locate these libraries in order to process them. so write in your ‘config/application.rb’:

config.assets.paths << Rails.root.join('vendor', 'assets', 'components')

With `bower init` you would create ‘bower.json’ file which should have the following aspect:

  name: 'BowerAndRails',
  version: '0.0.1',
  authors: [
    'Syl <>'
  description: 'Tutorial about Bower and Rails',
  license: 'MIT',
  homepage: '',
  ignore: [
  "dependencies": {
    "intl-tel-input": "~6.0.6"

With the command `bower install` all dependencies will be installed at ‘vendor/assets/components’.

After that you can import the files in your assets. At ‘application.js’:

//= require intl-tel-input
//= require intl-tel-input/lib/libphonenumber/build/utils

At ‘application.sass’:

@import intl-tel-input/src/css/intlTelInput
  background-image: url('intl-tel-input/build/img/flags.png')

On `rails s` assets will be taken from bower components.

Integrating in Capistrano flow

Add `gem ‘capistrano-bower’` to your Gemfile. And call the library from your Capfile: `require ‘capistrano/bower’`.

Then you can call the action in deploy command. At `config/deploy.rb` :

namespace :deploy do
  before :compile_assets, 'bower:install'


Basic NodeJS installation for Ubuntu

NodeJS installation for Ubuntu 14.04

Some packages needed for binary builds:

sudo apt-get update
sudo apt-get install build-essential libssl-dev

First install NVM (Node Version Manager) for your OS. Mine is Ubuntu so:

curl | sh

Now install node last version (today is v0.12.0):

nvm install -s v0.12.0
nvm alias default v0.12.0

This will take a while because you are compiling sources (-s option)

Installing Bower

Bower allows you to install and manage the dependencies of a lot of JS libraries found in its marketplace:

npm install -g bower

Why fixed-price does not work for Web Projects

Since I became a Freelancer Web Developer, I established that the Mission in my Strategic plan was “to provide high Quality customized web apps to my customers”. Just notice that the main word is QUALITY.

The best approach I know to explain the concept of Quality in a Web Project is the Broken Iron Triangle:

  • Scope: are features and functionality expected
  • Resources: Cost
  • Schedule: time to implement these features



Here explains how a project is broken when you fix this three features. And how Agile methodologies (with sprints and communication) maintain the triangle flexible in order to have successful experiences.

“In many ways, we really need to question the ethics of “fixed-price” IT projects.” Scott W. Ambler. All project risks are moved from the Customer to Developer. Driving to a bad experience for at least one side of this relationship.

In my opinion, you could fix costs if you can fix Scope (features) from the beginning. But this never happens because:

  • Features are often subjective or poorly defined. i.e.: While Developer is thinking in a button to remove a message, Owner is thinking on Drag&Drop feature compatible with mobiles.
  • New features appears in the process of development
  • Feature can be underestimate or overestimate. Depends on the quality of code under the hood, the developed libraries or if you have to make it from scratch.

Sometimes the Owner (customer) gives you a set of features, and ask for an ‘estimation’. Where you fix features, cost (fix price) and number of hours that this will take. You are frozen the triangle!! . Under this ‘estimation’ document starts a Developer/Customer relationship which will finish in a failing project.

Scope is never fixed from the beginning (never), this makes impossible fix cost/time without an impact in the QUALITY of the project.

I cannot deliver poor Quality projects, due to my business strategy. This is the reason why I do not work fixed-price, instead, I work on hourly basis (N hours worked, N hours paid).

When a Customer asks me for an “estimation” (cost, fixed-price), I send a plan: features and time to implement them. And I warn them that ‘this is not a budget, it is just a work plan for your project, and schedule could vary’.