Cucumber-chef with rbenv

Info on rbenv
http://dan.carley.co/blog/2012/02/07/rbenv-and-bundler/


install: –no-rdoc –no-ri
update: –no-rdoc –no-ri

view raw

.gemrc

hosted with ❤ by GitHub


# deinstall rvm (if installed)
$ rvm implode
# remove ruby packages
apt-get update
apt-cache search libruby
# example remove ruby
sudo apt-get –purge remove libruby1.8 libruby1.9.1 ruby ruby1.8 ruby1.8-dev ruby1.9.1
# needed packages (further on)
sudo apt-get install build-essential \
libreadline-dev \
libssl-dev \
zlib1g-dev \
libxslt-dev \
libxml2-dev
# install rbenv
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
# set PATH
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
# load PATH
source ~/.bashrc
# open new shell
exec $SHELL -l
# plugins: https://github.com/sstephenson/rbenv/wiki/Plugins
# remove plugin "carsomyr/rbenv-bundler" if previous installed.
rm -rf ~/.rbenv/plugins/bundler
# install plugin: rbenv-update plugin
git clone https://github.com/rkh/rbenv-update.git ~/.rbenv/plugins/rbenv-update
rbenv update
# install plugin: ruby-build
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
# install plugin: rbenv-gem-rehash
git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
# list all available versions:
$ rbenv install -l
# install ruby version
$ rbenv install 1.9.3-p448
$ rbenv rehash
$ rbenv shell 1.9.3-p448
$ rbenv global 1.9.3-p448
$ rbenv rehash
# show rbenv versions
$ rbenv versions
$ ruby -v
# do NOT use sudo for gem install
# update RubyGems system
$ gem update –system
# list gems installed
$ gem query –local
# update existing gems (if you are upgrading)
$ gem update
$ rbenv rehash
# bundler
$ gem install bundler
# install binstubs plugin
$ git clone https://github.com/ianheggie/rbenv-binstubs.git ~/.rbenv/plugins/rbenv-binstubs
# binstubs usage; (not needed in this tutorial).
$ cd application-directory
$ bundle install –binstubs .bundle/bin
# berkshelf
$ gem install berkshelf
# foodcritic
$ gem install foodcritic
# chef
$ gem install chef
# pry
$ gem install pry
# if fails with doc error
#gem install pry –no-rdoc –no-ri
# cucumber-chef
$ gem install cucumber-chef

view raw

fast-rbenv.sh

hosted with ❤ by GitHub

Code Review – ideas

What this post is about (and what not):

is not Develoment Guide, ill create an other document about Continuous integration, Testing, version control (which you already have, else you dont have anything to review, or you wont have), etc.

is not a Coding Standard, because there are already good tools which can format your code according to definable standards, this document does not apply the usual Coding Standard.

In that case it should actually called Code Design Standard, while this is not a standard
ill keep it under Code Review, because most ideas come from code review.

Code Design

Which concepts are important in code design:

  • Consistency
  • Maintainability
  • Readability
  • Re-usability
  • Security

These concepts are closely connected:
without consistency and readability, it should be hard to design your code to be maintainable.


lets start with some of the ideas;


Names

  • Only a developer who understands the system as a whole can create a name that “fits” within this system.
  • If the name is appropriate everything fits together naturally, relationships are clear, meaning is derivable, and reasoning from common human expectations works as expected.

Variable names

  • Names should be concise, but also descriptive.  (typeless is not the same as meaningless).
  • PHP has typeless variables, hungarian notation is not quite usefull.
  • Avoid reassigning a variable with an other meaning (unless the name describes this beforehand)

Method / Function Names

  • Usually a method / function performs an action, so the name should describe this: CheckForErrors() instead of ErrorCheck(),
  • Do not do real work in constructors: only initialize variables only and/or do actions that can’t fail.