SOLID Design Principles
Agile Software Development - Bob Martin Book is based on developing in Java/C… some interpretation for ruby.
Single Responsibility Open Closed - open for extension … closed for modification Liskov Substition
# These commands will help you setup the Rails test environment without problems | |
# | |
# MAKE SURE YOU HAVE VIRTUAL BOX INSTALLED http://www.virtualbox.org/wiki/Downloads | |
# | |
# Copy paste all of following commands in your normal terminal and the following things will happen: | |
# - rails_test_box dir is created | |
# - rails master branch is checkout in the dir rails | |
# - A Gemfile is created and all the gems to run the virtualbox are installed using bundler | |
# - The rails vagrant box is downloaded and added to your vagrant boxes | |
# - A Vagrantfile is created for vagrant |
This is an example of using RVM's Project .rvmrc file | |
to have it automatically bootstrap your environment, including bundler. | |
This could be further expanded to do anything you require :) | |
The important thing to remember is that the purpose of these files is | |
to allow you to very easily have your 'project context' (aka 'environment') | |
loaded automatically for you when you enter the project in the shell (cd). | |
You can generate the .rvmrc file below by running: |
# create rvmrc file | |
create_file ".rvmrc", "rvm gemset use #{app_name} --create" | |
gem "haml-rails" | |
gem "sass" | |
# hpricot and ruby_parser required by haml | |
gem "hpricot", :group => :development | |
gem "ruby_parser", :group => :development | |
gem "nifty-generators" | |
gem "simple_form" |
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
if [[ -n "$PS1" ]]; then | |
# don't put duplicate lines in the history. See bash(1) for more options | |
# ... or force ignoredups and ignorespace | |
HISTCONTROL=ignoredups:ignorespace |
Problem: I learned how to run RSpec to test classes and modules in my gem. But, if I wanted to test my gem as if it were already included in a Rails app, I couldn't find much info about it online.
I usually do unit tests with RSpec, and I test the whole stack with Cucumber. So here we will just setup Cucumber to run the Rails app that you embed in your gem.
Before we begin:
MyGem
and my_gem
below refer to the name of the gem we are creating. Replace this with your own name.Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.
cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/
--colour | |
-I app |
I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.
I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...