Saturday, 6 June 2015

Full Stack for ruby Framework

For the few people following the old RailsBuntu

Note that The book has now changed its name to:
 "Full stack for Ruby Framework"

I started to write this book few years ago, and at the time I was mainly concentrating on Ubuntu. But other times I worked over different flavours of Linux. Therefore the content of the book is not any more specific to Ubuntu but to all Linuxes.

It is also hard to find time to focus on writing so the first is still not ready, but moving towards its goal.

Monday, 3 March 2014

Spread The word for the Hackerjobs.co.uk

When doing contracting it seems very difficult to find jobs without the helps of the recruitment agencies . Sadly for us and our potential employers they eat a portion of our hard labour. For some agencies it can be well deserved, but one thing that I think a bit excessive is that if they send our CV to one company with some kind of exclusive right on our behalf for up  1or 2 years.
Although this agreement is between the agencies and our potential employer, this can sometimes play against us.

One way to change this, would be to go through site like HackerJobs but the problem with this is that not a lot of people knows it, and therefore some employers may say that it doesn't bring good  selection of candidate. Probably due to the fact that the site is still not well known?
So let s spread the word ... It may set us free...

Thursday, 20 February 2014

Create Rails 4 application and use RVM


First, although I already blog few year ago about installing RVM, my blog needs to be updated with latest RVM set-up. The new command lines for the installation of RVM (tested on Ubuntu 13.10):

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc


Install ruby and gems 

rvm install 2.1.0
rvm use  --default 2.1.0
ruby -v


note the path of ruby and the associated gemset
.rvm/gems/ruby-2.1.0@global
This would be useful later on to know which rvm ruby "ruby-2.1.0" and rvm gemset "global" we are using so we can load them automatically every time we access the project directory.
 rvm list
rvm rubies

ree-1.8.7-2011.03 [ i686 ]
ruby-1.9.2-p320 [ i686 ]
ruby-1.9.3-p484 [ i686 ]
  • ruby-2.0.0-p353 [ i686 ]
 => ruby-2.1.0 [ i686 ] # => - current # =* - current && default # * - default


then add  rails gems and create new application called "jobsearch"
 rvm gemset list
 echo "gem: --no-ri --no-rdoc" > ~/.gemrc
 gem install rails 
 rails new jobsearch cd jobsearch
 bundle
Note: the --no-rdoc and the --no-ri will save you time especially on production server where the documentation is not really require.

Create the rvmrc file so that your directory switch automatically to the right ruby and gemset

 rvm --create --rvmrc ruby-2.1.0@global
The file .rvmrc is created and now every time that you go to the project directory of your application the right ruby and gems are loaded
$ cd ..
$ cd jobsearch/
You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to [.]ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /home/user/dev/jobsearch/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
********************************************************************************

  • NOTICE *
********************************************************************************
  • RVM has encountered a new or modified .rvmrc file in the current directory, *
  • this is a shell script and therefore may contain any shell commands. *
  • *
  • Examine the contents of this file carefully to be sure the contents are *
  • safe before trusting it! *
  • Do you wish to trust '/home/user/dev/jobsearch/.rvmrc'? *
  • Choose v[iew] below to view the contents *
********************************************************************************
y[es], n[o], v[iew], c[ancel]> y



Add this line in the end of .rvmrc to display the selected gem

------------------------------
if $- == *i* # check for interactive shells
then
echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
else
echo "Using: $GEM_HOME" # don't use colors in interactive shells
fi
------------------------------

$ cd jobsearch/
You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to [.]ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /home/user/dev/jobsearch/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
*********************************************************************************
* NOTICE                                                                                                           *
*********************************************************************************
* RVM has encountered a new or modified .rvmrc file in the current directory, this is a shell script and           *
* therefore may contain any shell commands.                                                                        *
*                                                                                                                  *
* Examine the contents of this file carefully to be sure the contents are safe before trusting it!                 *
* Do you wish to trust '/home/user/dev/jobsearch/.rvmrc'?                                                        *
* Choose v[iew] below to view the contents                                                                         *
*********************************************************************************
y[es], n[o], v[iew], c[ancel]> y
Using:
/home/user/.rvm/gems/ruby-2.1.0@global


You are now ready to run the basic application:

bundle exec rails s

=> Booting WEBrick=> Rails 4.0.3 application starting in development on http://0.0.0.0:3000=> Run `rails server -h` for more startup options=> Ctrl-C to shutdown server[2014-02-20 00:06:26] INFO  WEBrick 1.3.1[2014-02-20 00:06:26] INFO  ruby 2.1.0 (2013-12-25) [i686-linux][2014-02-20 00:06:26] INFO  WEBrick::HTTPServer#start: pid=17659 port=3000

The Benefit of RVM


RVM is a great tool when you want to test different rubies or if you have several applications on a single server, as you can use any combination of rubies and gemsets all on a single machine without any problem.

Friday, 22 June 2012

Railsbuntu

Been a long time since I wrote a post....

I am now sending myself into a new adventure : Writing a technical book RailsBuntu .

This will be done base on an agile context (thanks to leanpub.com), where the readers can interact with me, and maybe some will join me as it s going along.

But first let me tell you that the book is not yet available and published, I have a lot of work to do to put my notes all together in order to make it readable, and it is taking more time than I thought.

I may release chapter by chapter and depending of the feedback than I got I may divert a little from the line that I have chosen.

Please feel free to comment and let me know if there is a point that you would like to see.

The target of the book is Rails on Rails on a Ubuntu Server. So I will first look at the admin side of the server to get the web platform ready and then add rails examples needed for particular aspect such emailing, ajax example, html layout etc...

A section on troubleshooting may be useful, where I can put problems that I(or you) have encounter during my coding experience.

Wish me luck and be patient with me (I also have a full time job)