Skip to content

Instantly share code, notes, and snippets.

View czarneckid's full-sized avatar

David Czarnecki czarneckid

View GitHub Profile
@czarneckid
czarneckid / gist:703565
Created November 17, 2010 16:14
hello-world.rb
p 'Hello World'
dczarnecki-agora:projects dczarnecki$ rails new fixtureapp -d mysql
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
...
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'mysql2'
group :development do
gem 'rails3-generators'
end
dczarnecki-agora:fixtureapp dczarnecki$ rails generate scaffold person first_name:string last_name:string -r factory_girl
invoke active_record
create db/migrate/20101122182716_create_people.rb
create app/models/person.rb
invoke test_unit
create test/unit/person_test.rb
invoke factory_girl
create test/factories/people.rb
route resources :people
invoke scaffold_controller
# Read about factories at http://github.com/thoughtbot/factory_girl
Factory.define :person do |f|
f.first_name "MyString"
f.last_name "MyString"
end
dczarnecki-agora:fixtureapp dczarnecki$ rake db:create:all ; rake db:migrate ; rake
(in /Users/dczarnecki/projects/fixtureapp)
(in /Users/dczarnecki/projects/fixtureapp)
== CreatePeople: migrating ===================================================
-- create_table(:people)
-> 0.1024s
== CreatePeople: migrated (0.1025s) ==========================================
(in /Users/dczarnecki/projects/fixtureapp)
Loaded suite /Users/dczarnecki/.rvm/gems/ruby-1.9.2-head/gems/rake-0.8.7/lib/rake/rake_test_loader
require 'test_helper'
class PeopleControllerTest < ActionController::TestCase
setup do
@person = Factory(:person)
end
...
dczarnecki-agora:fixtureapp dczarnecki$ rake
(in /Users/dczarnecki/projects/fixtureapp)
Loaded suite /Users/dczarnecki/.rvm/gems/ruby-1.9.2-head/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.
Finished in 0.040870 seconds.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
Test run options: --seed 37894
* We have 3 files that are modified in our local git repository, but we only want to stash 2 of those files.
* If we use git stash save, git will save all 3 files in the stash. How can we stash only README and TODO?
fossil:gitstash dczarnecki$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: README