Appogee

Agile, open source, web application design and development

  • Home
    • 0
      3 Apr 2011

      Decent Authentication

      • Edit
      • Delete
      • Tags
      • Autopost

      Decent Authentication is a small Rails app illustrating authentication from scratch, without using authentication gems or plugins.  This is basically a reproduction of Ryan Bates' screencast Authentication from Scratch with the addition of my capybara and RSpec tests.

      • views
    • 33
      24 Oct 2010

      Ruby on Rails Development on Ubuntu 10.10 with Git, Vim, and RVM

      • Edit
      • Delete
      • Tags
      • Autopost

      So I’m just off a fresh install of Ubuntu 10.10 and I thought I might as well document the process of how I setup my Rails development environment. I’m still learning RVM best practices so constructive criticism is welcome. So here goes…

      Ruby

      # Install ruby, etc.
      sudo apt-get install irb libopenssl-ruby libreadline-ruby rdoc ri ruby ruby-dev build-essential bison openssl libreadline5 libreadline-dev curl zlib1g zlib1g-dev libssl-dev libxml2-dev

      Vim & GVim

      # Install vim and gvim
      sudo apt-get install vim vim-gnome

      GIT

      # Install git and gitg repo viewer
      sudo apt-get install git git-doc gitg
      
      # Set name and email in gitconfig
      git config --global user.name "John Doe"
      git config --global user.email johndoe@example.com
      
      # Configure default git text editor
      git config --global core.editor "gvim --nofork"
      
      # Configure status colors
      git config --global color.diff auto
      git config --global color.status auto
      git config --global color.branch auto
      git config --global color.status.changed yellow
      git config --global color.status.added green
      git config --global color.status.untracked red
      
      # Verify git settings
      git config --list
      
      # Generate SSH keys (provide a good passphrase when asked)
      ssh-keygen -t rsa -C "johndoe@example.com"
      
      # Add git aliases
      echo "alias gb='git branch'" >> ~/.bashrc
      echo "alias gc='git commit -v'" >> ~/.bashrc
      echo "alias gca='git commit -a -v'" >> ~/.bashrc
      echo "alias gco='git checkout'" >> ~/.bashrc
      echo "alias gd='git diff'" >> ~/.bashrc
      echo "alias gdc='git diff --cached'" >> ~/.bashrc
      echo "alias gdh='git diff HEAD'" >> ~/.bashrc
      echo "alias gp='git push'" >> ~/.bashrc
      echo "alias gl='git pull'" >> ~/.bashrc
      echo "alias gpr='git pull --rebase'" >> ~/.bashrc
      echo "alias gst='git status'" >> ~/.bashrc
      echo "alias gap='git add -p'" >> ~/.bashrc
      echo "alias glg='git log --pretty=oneline --abbrev-commit'" >> ~/.bashrc
      
      # Setup git bash completion
      cd ~/
      git clone git://git.kernel.org/pub/scm/git/git.git
      mv git/contrib/completion/git-completion.bash ~/.git-completion.sh
      rm -rf ~/git
      echo "export GIT_PS1_SHOWDIRTYSTATE=1" >> ~/.bashrc
      echo "export GIT_PS1_SHOWSTASHSTATE=1" >> ~/.bashrc
      echo "source ~/.git-completion.sh" >> ~/.bashrc
      
      # Add git info to PS1 (append this to your ~/.bashrc file, not commented)
      # PS1='[\[\033[1;34m\]\u\[\033[0m\]@\h \W$(__git_ps1 "(%s)")]\$ '

      RubyGems

      # Download and install RubyGems
      cd ~/
      wget http://production.cf.rubygems.org/rubygems/rubygems-1.5.2.tgz
      tar xzf rubygems-1.5.2.tgz
      cd rubygems-1.5.2
      sudo ruby setup.rb
      
      # Link gem command to 1.8 version
      sudo update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.8 1
      
      # Turn off rdoc generation when installing/updating gems
      echo "install: --no-ri --no-rdoc" >> ~/.gemrc
      echo "update: --no-ri --no-rdoc" >> ~/.gemrc

      RVM

      # RVM install
      bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
      
      # Load RVM into shell
      echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
      
      # RVM bash completion complete
      echo '[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion' >> ~/.bashrc
      
      # One-time source of RVM
      source ~/.rvm/scripts/rvm
      
      # Verify RVM installation
      rvm -v
      
      # Install latest stable 1.8.7 release
      rvm install 1.8.7
      
      # Set default ruby
      rvm --default 1.8.7
      
      # Install more rubies
      rvm install ree
      rvm install 1.9.2

      At this point, you should have everything “installed”. From here, it’s more of a preference on how you want to use rvm. Since I work with both Rails2.3 and Rails3, I like to create a rails2 gemset and a rails3 gemset from which I can create new projects from. After new projects are created, I create the project rvmrc file to then build from.

      RVM Gemsets

      # Create some rails specific gemsets
      rvm gemset create rails2
      rvm gemset create rails3
      
      # Switch to ruby 1.8.7-p334 with gemset rails2
      rvm 1.8.7-p334@rails2
      
      # Install rails 2.3.11
      gem install rails -v=2.3.11; gem install ruby-debug
      
      # Switch to ruby 1.8.7-p334 with gemset rails3
      rvm 1.8.7-p334@rails3
      
      # Install rails 3
      gem install rails ruby-debug
      
      # Create project specific .rvmrc
      cd ~/projects
      echo "rvm --create use 'ruby-1.8.7-p334@example_app'" > ~/projects/example_app/.rvmrc

      Databases

      # Install sqlite and deps
      sudo apt-get install libsqlite3-0 libsqlite3-dev sqlite3
      gem install sqlite3-ruby
      
      # Install mysql and deps
      sudo apt-get install mysql-client mysql-server libmysqlclient-dev
      gem install mysql
      
      # Install postgresql and deps
      sudo apt-get install postgresql libpq-dev
      gem install pg

      RDoc

      Build a custom rdoc package and download it for use locally

      # Download rdoc's to use locally
      http://railsapi.com
      • views
    • 0
      5 Apr 2010

      Lean Software Development

      • Edit
      • Delete
      • Tags
      • Autopost
      Nice article on implementing a Lean Software Development process. Of the seven principles outlined, I like these three the best:
      • Eliminate Waste - get rid of anything that does not add value to the final product
      • Build Quality In - automate testing so that you have a strong base for preventing defects
      • Defer Commitment - "positive procrastination"; wait until you absolutely cannot wait any longer to make irreversible decisions, in which you've given yourself the most time for gathering facts, resulting in better decisions
      The other four principles include:
      • Create Knowledge - the fact that complete requirements are seldom known in the beginning means that you accumulate and record knowledge as the project ages so that you ensure the final product is in line with customer expectations
      • Deliver Fast - fast delivery in short iterations for effective custom feedback
      • Respect People - let people do their job the best way they know how and don't micro-manage
      • Optimize the Whole - don't cherry pick processes to optimize
      • views
    • 6
      19 Jan 2010

      TicketMule

      • Edit
      • Delete
      • Tags
      • Autopost

      In my first serious attempt at scratching the surface of Ruby on Rails, I've uploaded the source to my first app called TicketMule. It's more or less a help desk/support ticket application geared toward intranet use.  I modeled the concept after another application one of my former employers used to track support calls.  The idea is that support requests come in from an external source (email, phone, etc.) and somebody enters that information into the application in the form of a ticket and the team of support staff handles the rest.  Definitely not a novel concept but it makes for a web app that has many possibilities. In developing the app, I tried to keep up with current best practices and principles of the "Rails way".  I definitely tried to think in terms of DRY and convention over configuration.  I also reviewed my dev log to make sure db activity was as streamlined as possible. TicketMule is definitely not a finished product (as test code is a glaring hole I've got to cover) but at the very least, you can peruse the source for examples of how I used some of the popular gems included in TicketMule.

      Screenshots at OpenSourceRails

      Source at GitHub

      • views
    • Search

    • Links

      • Hacker News
      • Riding Rails
      • Thoughtbot
      • Railscasts
      • Rails Dispatch
      • Rails Guides
      • Rails Tutorial
      • Ruby-Doc
      • RubyFlow
      • RubyInside
    • Archive

      • 2011 (1)
        • April (1)
      • 2010 (3)
        • October (1)
        • April (1)
        • January (1)
    • Obox Design
  • Appogee


    26895 Views
  • Get Updates

    Subscribe via RSS