Skip to content

Instantly share code, notes, and snippets.

@krainboltgreene
Created August 29, 2011 13:04
Show Gist options
  • Save krainboltgreene/1178353 to your computer and use it in GitHub Desktop.
Save krainboltgreene/1178353 to your computer and use it in GitHub Desktop.
~/repo/ruby
$ mkdir rails/hacker-uplink && cd rails/hacker-uplink && touch Gemfile

~/repo/ruby/rails/hacker-uplink
$ ls
Gemfile

~/repo/ruby/rails/hacker-uplink
$ git init
Initialized empty Git repository in /Users/krainboltgreene/repo/ruby/rails/hacker-uplink/.git/

~/repo/ruby/rails/hacker-uplink(netstring|~|master*)
$ git flow init
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master]
Branch name for "next release" development: [develop]

How to name your supporting branch prefixes?
Feature branches? [feature/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? [] ver

~/repo/ruby/rails/hacker-uplink(netstring|0m|develop*)
$ git add .

~/repo/ruby/rails/hacker-uplink(netstring|0m|develop*)
$ git commit -asm "Initial commit."
[develop f6b03cb] Initial commit.
 1 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 Gemfile

~/repo/ruby/rails/hacker-uplink(netstring|0m|develop)
$ git flow feature start generating-rails-application
Switched to a new branch 'feature/generating-rails-application'

Summary of actions:
- A new branch 'feature/generating-rails-application' was created, based on 'develop'
- You are now on branch 'feature/generating-rails-application'

Now, start committing on your feature. When done, use:

     git flow feature finish generating-rails-application


~/repo/ruby/rails/hacker-uplink(netstring|0m|feature/generating-rails-application)
$ rvm --create --rvmrc 1.9.2@hacker-uplink

~/repo/ruby/rails/hacker-uplink
$ ls
Gemfile   .rvmrc

~/repo/ruby/rails/hacker-uplink
$ vim Gemfile

~/repo/ruby/rails/hacker-uplink
$ cat Gemfile
source :rubygems

# => Web Framework
gem 'rails', :git => 'https://github.com/rails/rails.git', :branch => '3-1-stable'


# => Framework Extras
gem 'uglifier'
gem 'inherited_resources'
gem 'goalie'


# => Database ORM
gem 'mongoid'


# => ORM Extras
gem 'bson_ext'
gem 'mongoid-eager-loading'


# => Rendering Engines
gem 'slim'
gem 'sass'
gem 'coffee-script'


# => Rendering Extras
gem 'slim-rails', :group => :development
gem 'sass-rails', :group => :development
gem 'jquery-rails', :group => :development
gem 'therubyracer', :require => 'v8'


# => Testing Frameworks
gem 'rspec', :group => [:development, :test]
gem 'steak', :group => [:development, :test]
# gem 'mocha', :group => [:development, :test]
gem 'capybara', :group => [:development, :test]


# => Testing Extras
gem 'rspec-rails', :group => [:development, :test]
gem 'mongoid-rspec', :group => [:development, :test]
gem 'fabrication', :group => [:development, :test]
gem 'forgery', :group => [:development, :test]
gem 'delorean', :group => :test
gem 'database_cleaner', :group => :test
gem 'launchy', :group => :test
gem 'guard', :require => false, :group => :test
gem 'guard-rspec', :require => false, :group => :test
gem 'guard-bundler', :require => false, :group => :test
gem 'guard-pow', :require => false, :group => :test
gem 'rb-fsevent', :require => false, :group => :test
gem 'growl', :require => false, :group => :test

# => Deployment Frameworks
gem 'heroku', :require => false, :group => :development

# => Deployment Extras
gem 'therubyracer-heroku', :group => :production

~/repo/ruby/rails/hacker-uplink
$ bundle
Fetching source index for http://rubygems.org/
Installing rake (0.9.2)
Installing multi_json (1.0.3)
Using activesupport (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Installing bcrypt-ruby (3.0.0) with native extensions
Installing builder (3.0.0)
Installing i18n (0.6.0)
Using activemodel (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Installing erubis (2.7.0)
Installing rack (1.3.2)
Installing rack-cache (1.0.3)
Installing rack-mount (0.8.2)
Installing rack-test (0.6.1)
Installing hike (1.2.1)
Installing tilt (1.3.3)
Installing sprockets (2.0.0.beta.15)
Using actionpack (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Using mime-types (1.16)
Installing polyglot (0.3.2)
Installing treetop (1.4.10)
Installing mail (2.3.0)
Using actionmailer (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Installing arel (2.2.1)
Installing tzinfo (0.3.29)
Using activerecord (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Using activeresource (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Installing addressable (2.2.6)
Installing bson (1.3.1)
Installing bson_ext (1.3.1) with native extensions
Using bundler (1.0.15)
Installing nokogiri (1.5.0) with native extensions
Installing ffi (1.0.9) with native extensions
Installing childprocess (0.2.2)
Using json_pure (1.5.3)
Installing rubyzip (0.9.4)
Installing selenium-webdriver (0.2.2)
Installing xpath (0.1.4)
Installing capybara (1.0.0)
Installing chronic (0.6.2)
Installing coffee-script-source (1.1.2)
Installing execjs (1.2.4)
Installing coffee-script (2.2.0)
Installing database_cleaner (0.6.7)
Installing delorean (1.1.0)
Installing diff-lcs (1.1.3)
Installing fabrication (1.0.1)
Installing forgery (0.3.12)
Installing goalie (0.0.4)
Using growl (1.0.3)
Using thor (0.14.6)
Installing guard (0.5.1)
Installing guard-bundler (0.1.3)
Installing guard-pow (0.1.0)
Installing guard-rspec (0.4.0)
Installing has_scope (0.5.1)
Installing launchy (2.0.5)
Installing rest-client (1.6.7)
Installing term-ansicolor (1.0.6)
Installing heroku (2.5.2)
Installing responders (0.6.4)
Installing inherited_resources (1.2.2)
Installing rack-ssl (1.3.2)
Installing rdoc (3.9.4)
Using railties (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Installing jquery-rails (1.0.12)
Installing libv8 (3.3.10.2)
Installing mongo (1.3.1)
Installing mongoid (2.1.5)
Installing mongoid-eager-loading (0.3.1)
Installing rspec-core (2.6.4)
Installing rspec-expectations (2.6.0)
Installing rspec-mocks (2.6.0)
Installing rspec (2.6.0)
Installing mongoid-rspec (1.4.4)
Using rails (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Installing rb-fsevent (0.4.0) with native extensions
Installing rspec-rails (2.6.1)
Installing sass (3.1.7)
Installing sass-rails (3.1.0.rc.7)
Installing temple (0.3.3)
Installing slim (1.0.0)
Installing slim-rails (0.2.1)
Installing steak (2.0.0)
Installing therubyracer (0.9.4) with native extensions
Installing therubyracer-heroku (0.8.1.pre3) with native extensions
Installing uglifier (1.0.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

~/repo/ruby/rails/hacker-uplink(hacker-uplink|20m|feature/generating-rails-application*)
$ rails
Usage:
  rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]              # Path to the Ruby binary of your choice
                                 # Default: /Users/krainboltgreene/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
  -b, [--builder=BUILDER]        # Path to a application builder (can be a filesystem path or URL)
  -m, [--template=TEMPLATE]      # Path to an application template (can be a filesystem path or URL)
      [--skip-gemfile]           # Don't create a Gemfile
      [--skip-bundle]            # Don't run bundle install
  -G, [--skip-git]               # Skip Git ignores and keeps
  -O, [--skip-active-record]     # Skip Active Record files
  -S, [--skip-sprockets]         # Skip Sprockets files
  -d, [--database=DATABASE]      # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
                                 # Default: sqlite3
  -j, [--javascript=JAVASCRIPT]  # Preconfigure for selected JavaScript library
                                 # Default: jquery
  -J, [--skip-javascript]        # Skip JavaScript files
      [--dev]                    # Setup the application with Gemfile pointing to your Rails checkout
      [--edge]                   # Setup the application with Gemfile pointing to Rails repository
  -T, [--skip-test-unit]         # Skip Test::Unit files
      [--old-style-hash]         # Force using old style hash (:foo => 'bar') on Ruby >= 1.9

Runtime options:
  -f, [--force]    # Overwrite files that already exist
  -p, [--pretend]  # Run but do not make any changes
  -q, [--quiet]    # Supress status output
  -s, [--skip]     # Skip files that already exist

Rails options:
  -h, [--help]     # Show this help message and quit
  -v, [--version]  # Show Rails version number and quit

Description:
    The 'rails new' command creates a new Rails application with a default
    directory structure and configuration at the path you specify.

Example:
    rails new ~/Code/Ruby/weblog

    This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
    See the README in the newly created application to get going.

~/repo/ruby/rails/hacker-uplink(hacker-uplink|21m|feature/generating-rails-application*)
$ be rails new ../hacker-uplink --skip-gemfile --skip-bundle --skip-git --skip-active-record --skip-test-unit --old-style-hash
       exist
      create  README
      create  Rakefile
      create  config.ru
      create  app
      create  app/assets/images/rails.png
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/mailers
      create  app/models
      create  app/views/layouts/application.html.erb
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/secret_token.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  db
      create  db/seeds.rb
      create  doc
      create  doc/README_FOR_APP
      create  lib
      create  lib/tasks
      create  lib/assets
      create  log
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/index.html
      create  public/robots.txt
      create  script
      create  script/rails
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/stylesheets
      create  vendor/plugins

~/repo/ruby/rails/hacker-uplink(hacker-uplink|29m|feature/generating-rails-application*)
$ l
total 72
drwxr-xr-x  19 krainboltgreene  staff    646 Aug 29 03:27 .
drwxr-xr-x  13 krainboltgreene  staff    442 Aug 29 02:41 ..
drwxr-xr-x  13 krainboltgreene  staff    442 Aug 29 03:27 .git
-rw-r--r--   1 krainboltgreene  staff   1562 Aug 29 03:27 .rvmrc
-rw-r--r--   1 krainboltgreene  staff   1552 Aug 29 03:12 Gemfile
-rw-r--r--   1 krainboltgreene  staff   5236 Aug 29 03:18 Gemfile.lock
-rw-r--r--   1 krainboltgreene  staff  10006 Aug 29 03:29 README
-rw-r--r--   1 krainboltgreene  staff    277 Aug 29 03:20 Rakefile
drwxr-xr-x   8 krainboltgreene  staff    272 Aug 29 03:20 app
drwxr-xr-x   9 krainboltgreene  staff    306 Aug 29 03:20 config
-rw-r--r--   1 krainboltgreene  staff    162 Aug 29 03:20 config.ru
drwxr-xr-x   3 krainboltgreene  staff    102 Aug 29 03:20 db
drwxr-xr-x   3 krainboltgreene  staff    102 Aug 29 03:20 doc
drwxr-xr-x   4 krainboltgreene  staff    136 Aug 29 03:20 lib
drwxr-xr-x   2 krainboltgreene  staff     68 Aug 29 03:20 log
drwxr-xr-x   8 krainboltgreene  staff    272 Aug 29 03:20 public
drwxr-xr-x   3 krainboltgreene  staff    102 Aug 29 03:20 script
drwxr-xr-x   3 krainboltgreene  staff    102 Aug 29 03:20 tmp
drwxr-xr-x   4 krainboltgreene  staff    136 Aug 29 03:20 vendor

~/repo/ruby/rails/hacker-uplink(hacker-uplink|49m|feature/generating-rails-application*)
$ git add .

~/repo/ruby/rails/hacker-uplink(hacker-uplink|49m|feature/generating-rails-application*)
$ git commit -asm "Adding in basic rails generated application."
[feature/generating-rails-application 5c4b4d9] Adding in basic rails generated application.
 33 files changed, 1293 insertions(+), 66 deletions(-)
 create mode 100644 .rvmrc
 rewrite Gemfile (87%)
 create mode 100644 Gemfile.lock
 create mode 100644 README
 create mode 100644 Rakefile
 create mode 100644 app/assets/images/rails.png
 create mode 100644 app/assets/javascripts/application.js
 create mode 100644 app/assets/stylesheets/application.css
 create mode 100644 app/controllers/application_controller.rb
 create mode 100644 app/helpers/application_helper.rb
 create mode 100644 app/views/layouts/application.html.erb
 create mode 100644 config.ru
 create mode 100644 config/application.rb
 create mode 100644 config/boot.rb
 create mode 100644 config/environment.rb
 create mode 100644 config/environments/development.rb
 create mode 100644 config/environments/production.rb
 create mode 100644 config/environments/test.rb
 create mode 100644 config/initializers/backtrace_silencers.rb
 create mode 100644 config/initializers/inflections.rb
 create mode 100644 config/initializers/mime_types.rb
 create mode 100644 config/initializers/secret_token.rb
 create mode 100644 config/initializers/session_store.rb
 create mode 100644 config/initializers/wrap_parameters.rb
 create mode 100644 config/locales/en.yml
 create mode 100644 config/routes.rb
 create mode 100644 db/seeds.rb
 create mode 100644 public/404.html
 create mode 100644 public/422.html
 create mode 100644 public/500.html
 create mode 100644 public/favicon.ico
 create mode 100644 public/index.html
 create mode 100644 public/robots.txt
 create mode 100755 script/rails

~/repo/ruby/rails/hacker-uplink(hacker-uplink|0m|feature/generating-rails-application)
$ git flow feature finish generating-rails-application
Switched to branch 'develop'
Updating f6b03cb..5c4b4d9
Fast-forward
 .rvmrc                                     |   47 +++++
 Gemfile                                    |   91 +++++-----
 Gemfile.lock                               |  236 ++++++++++++++++++++++++
 README                                     |  268 ++++++++++++++++++++++++++++
 Rakefile                                   |    7 +
 app/assets/images/rails.png                |  Bin 0 -> 6646 bytes
 app/assets/javascripts/application.js      |    9 +
 app/assets/stylesheets/application.css     |    7 +
 app/controllers/application_controller.rb  |    3 +
 app/helpers/application_helper.rb          |    2 +
 app/views/layouts/application.html.erb     |   14 ++
 config.ru                                  |    4 +
 config/application.rb                      |   51 ++++++
 config/boot.rb                             |    6 +
 config/environment.rb                      |    5 +
 config/environments/development.rb         |   33 ++++
 config/environments/production.rb          |   51 ++++++
 config/environments/test.rb                |   42 +++++
 config/initializers/backtrace_silencers.rb |    7 +
 config/initializers/inflections.rb         |   10 +
 config/initializers/mime_types.rb          |    5 +
 config/initializers/secret_token.rb        |    7 +
 config/initializers/session_store.rb       |    8 +
 config/initializers/wrap_parameters.rb     |   10 +
 config/locales/en.yml                      |    5 +
 config/routes.rb                           |   58 ++++++
 db/seeds.rb                                |    7 +
 public/404.html                            |   26 +++
 public/422.html                            |   26 +++
 public/500.html                            |   26 +++
 public/index.html                          |  241 +++++++++++++++++++++++++
 public/robots.txt                          |    5 +
 script/rails                               |    6 +
 33 files changed, 1275 insertions(+), 48 deletions(-)
 create mode 100644 .rvmrc
 create mode 100644 Gemfile.lock
 create mode 100644 README
 create mode 100644 Rakefile
 create mode 100644 app/assets/images/rails.png
 create mode 100644 app/assets/javascripts/application.js
 create mode 100644 app/assets/stylesheets/application.css
 create mode 100644 app/controllers/application_controller.rb
 create mode 100644 app/helpers/application_helper.rb
 create mode 100644 app/views/layouts/application.html.erb
 create mode 100644 config.ru
 create mode 100644 config/application.rb
 create mode 100644 config/boot.rb
 create mode 100644 config/environment.rb
 create mode 100644 config/environments/development.rb
 create mode 100644 config/environments/production.rb
 create mode 100644 config/environments/test.rb
 create mode 100644 config/initializers/backtrace_silencers.rb
 create mode 100644 config/initializers/inflections.rb
 create mode 100644 config/initializers/mime_types.rb
 create mode 100644 config/initializers/secret_token.rb
 create mode 100644 config/initializers/session_store.rb
 create mode 100644 config/initializers/wrap_parameters.rb
 create mode 100644 config/locales/en.yml
 create mode 100644 config/routes.rb
 create mode 100644 db/seeds.rb
 create mode 100644 public/404.html
 create mode 100644 public/422.html
 create mode 100644 public/500.html
 create mode 100644 public/favicon.ico
 create mode 100644 public/index.html
 create mode 100644 public/robots.txt
 create mode 100755 script/rails
Deleted branch feature/generating-rails-application (was 5c4b4d9).

Summary of actions:
- The feature branch 'feature/generating-rails-application' was merged into 'develop'
- Feature branch 'feature/generating-rails-application' has been removed
- You are now on branch 'develop'

~/repo/ruby/rails/hacker-uplink(hacker-uplink|29m|feature/generating-rails-application*)
$ be rails generate

Mongoid config not found. Create a config file at: config/mongoid.yml
to generate one run: rails generate mongoid:config







Usage: rails generate GENERATOR [args] [options]

General options:
  -h, [--help]     # Print generator's options and usage
  -p, [--pretend]  # Run but do not make any changes
  -f, [--force]    # Overwrite files that already exist
  -s, [--skip]     # Skip files that already exist
  -q, [--quiet]    # Suppress status output

Please choose a generator below.

Rails:
  assets
  controller
  generator
  helper
  inherited_resources_controller
  integration_test
  mailer
  migration
  model
  observer
  performance_test
  plugin
  resource
  responders_controller
  scaffold
  scaffold_controller
  session_migration

ActiveRecord:
  active_record:migration
  active_record:model
  active_record:observer
  active_record:session_migration

Erb:
  erb:controller
  erb:mailer
  erb:scaffold

Fabrication:
  fabrication:cucumber_steps
  fabrication:model

Forgery:
  forgery

Js:
  js:assets

Mongoid:
  mongoid:config

Responders:
  responders:install

Rspec:
  rspec:install

Steak:
  steak:install
  steak:spec

TestUnit:
  test_unit:controller
  test_unit:helper
  test_unit:integration
  test_unit:mailer
  test_unit:model
  test_unit:observer
  test_unit:performance
  test_unit:plugin
  test_unit:scaffold

~/repo/ruby/rails/hacker-uplink(hacker-uplink|1m|develop)
$ git flow feature start mongoid-config-generation
Switched to a new branch 'feature/mongoid-config-generation'

Summary of actions:
- A new branch 'feature/mongoid-config-generation' was created, based on 'develop'
- You are now on branch 'feature/mongoid-config-generation'

Now, start committing on your feature. When done, use:

     git flow feature finish mongoid-config-generation

~/repo/ruby/rails/hacker-uplink(hacker-uplink|2m|feature/mongoid-config-generation)
$ be rails generate mongoid:config

Mongoid config not found. Create a config file at: config/mongoid.yml
to generate one run: rails generate mongoid:config







      create  config/mongoid.yml

~/repo/ruby/rails/hacker-uplink(hacker-uplink|4m|feature/mongoid-config-generation)
$ cat config/mongoid.yml
development:
  host: localhost
  database: hacker_uplink_development

test:
  host: localhost
  database: hacker_uplink_test

# set these environment variables on your prod server
production:
  host: <%= ENV['MONGOID_HOST'] %>
  port: <%= ENV['MONGOID_PORT'] %>
  username: <%= ENV['MONGOID_USERNAME'] %>
  password: <%= ENV['MONGOID_PASSWORD'] %>
  database: <%= ENV['MONGOID_DATABASE'] %>
  # slaves:
  #   - host: slave1.local
  #     port: 27018
  #   - host: slave2.local
  #     port: 27019

~/repo/ruby/rails/hacker-uplink(hacker-uplink|2m|feature/mongoid-config-generation)
$ git add .

~/repo/ruby/rails/hacker-uplink(hacker-uplink|4m|feature/mongoid-config-generation)
$ git commit -asm "Adding the new mongoid config file."
# On branch feature/mongoid-config-generation
nothing to commit (working directory clean)

~/repo/ruby/rails/hacker-uplink(hacker-uplink|4m|feature/mongoid-config-generation)
$ git flow feature finish mongoid-config-generation
Switched to branch 'develop'
Already up-to-date.
Deleted branch feature/mongoid-config-generation (was 5c4b4d9).

Summary of actions:
- The feature branch 'feature/mongoid-config-generation' was merged into 'develop'
- Feature branch 'feature/mongoid-config-generation' has been removed
- You are now on branch 'develop'

~/repo/ruby/rails/hacker-uplink(hacker-uplink|7m|develop*)
$ git flow feature start steake-generator
M README
Switched to a new branch 'feature/steak-generator'

Summary of actions:
- A new branch 'feature/steak-generator' was created, based on 'develop'
- You are now on branch 'feature/steak-generator'

Now, start committing on your feature. When done, use:

     git flow feature finish steake-generator

~/repo/ruby/rails/hacker-uplink(hacker-uplink|8m|feature/steak-generator*)
$ be rails generate steak:install
    generate  rspec:install
      create  .rspec
      create  spec
      create  spec/spec_helper.rb
      create  spec/acceptance
      create  spec/acceptance/acceptance_helper.rb
      create  spec/acceptance/support/helpers.rb
      create  spec/acceptance/support/paths.rb

~/repo/ruby/rails/hacker-uplink(hacker-uplink|10m|feature/steak-generator*)
$ cat spec/spec_helper.rb
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

RSpec.configure do |config|
  # == Mock Framework
  #
  # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
  #
  # config.mock_with :mocha
  # config.mock_with :flexmock
  # config.mock_with :rr
  config.mock_with :rspec

  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  config.fixture_path = "#{::Rails.root}/spec/fixtures"

  # If you're not using ActiveRecord, or you'd prefer not to run each of your
  # examples within a transaction, remove the following line or assign false
  # instead of true.
  config.use_transactional_fixtures = true
end

~/repo/ruby/rails/hacker-uplink(hacker-uplink|8m|feature/steak-generator*)
$ git add .

~/repo/ruby/rails/hacker-uplink(hacker-uplink|11m|feature/steak-generator*)
$ git commit -asm "adding generated files"
[feature/steak-generator ab61b4e] adding generated files
 5 files changed, 360 insertions(+), 1 deletions(-)
 create mode 100644 spec/acceptance/acceptance_helper.rb
 create mode 100644 spec/acceptance/support/helpers.rb
 create mode 100644 spec/acceptance/support/paths.rb
 create mode 100644 spec/spec_helper.rb

~/repo/ruby/rails/hacker-uplink(hacker-uplink|0m|feature/steak-generator)
$ vim spec/spec_helper.rb

~/repo/ruby/rails/hacker-uplink(hacker-uplink|2m|feature/steak-generator*)
$ cat spec/spec_helper.rb
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rails'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

RSpec.configure do |config|
  config.mock_with :rspec

  config.before(:suite) do
    DatabaseCleaner.strategy = :truncation
    DatabaseCleaner.orm = "mongoid"
  end

  config.before(:each) do
    DatabaseCleaner.clean
  end
end

~/repo/ruby/rails/hacker-uplink(hacker-uplink|0m|feature/steak-generator)
$ git add . && git commit -asm "Adding in the capybara require and database_cleaner catches."
# On branch feature/steak-generator
nothing to commit (working directory clean)

~/repo/ruby/rails/hacker-uplink(hacker-uplink|1m|feature/steak-generator)
$ git flow feature finish rspec-generator
Switched to branch 'develop'
Merge made by recursive.
 README                               |  383 +++++++++++++++++++++++++++++++++-
 spec/acceptance/acceptance_helper.rb |    4 +
 spec/acceptance/support/helpers.rb   |    6 +
 spec/acceptance/support/paths.rb     |    9 +
 spec/spec_helper.rb                  |   21 ++
 5 files changed, 422 insertions(+), 1 deletions(-)
 create mode 100644 spec/acceptance/acceptance_helper.rb
 create mode 100644 spec/acceptance/support/helpers.rb
 create mode 100644 spec/acceptance/support/paths.rb
 create mode 100644 spec/spec_helper.rb
Deleted branch feature/steak-generator (was 7ea1404).

Summary of actions:
- The feature branch 'feature/steak-generator' was merged into 'develop'
- Feature branch 'feature/steak-generator' has been removed
- You are now on branch 'develop'

~/repo/ruby/rails/hacker-uplink(hacker-uplink|0m|develop)
$ git flow feature start forgery-generator
Switched to a new branch 'feature/forgery-generator'

Summary of actions:
- A new branch 'feature/forgery-generator' was created, based on 'develop'
- You are now on branch 'feature/forgery-generator'

Now, start committing on your feature. When done, use:

     git flow feature finish forgery-generator

~/repo/ruby/rails/hacker-uplink(hacker-uplink|0m|feature/forgery-generator)
$ be rails generate forgery
Creating directories in /lib/forgery...

~/repo/ruby/rails/hacker-uplink(hacker-uplink|1m|feature/forgery-generator)
$ git flow feature finish forgery-generator
Switched to branch 'develop'
Already up-to-date.
Deleted branch feature/forgery-generator (was 4954ddd).

Summary of actions:
- The feature branch 'feature/forgery-generator' was merged into 'develop'
- Feature branch 'feature/forgery-generator' has been removed
- You are now on branch 'develop'


~/repo/ruby/rails/hacker-uplink(hacker-uplink|3m|develop*)
$ git flow feature start guard-generator
M README
Switched to a new branch 'feature/guard-generator'

Summary of actions:
- A new branch 'feature/guard-generator' was created, based on 'develop'
- You are now on branch 'feature/guard-generator'

Now, start committing on your feature. When done, use:

     git flow feature finish guard-generator

~/repo/ruby/rails/hacker-uplink(hacker-uplink|4m|feature/guard-generator*)
$ guard init
Writing new Guardfile to /Users/krainboltgreene/repo/ruby/rails/hacker-uplink/Guardfile

~/repo/ruby/rails/hacker-uplink(hacker-uplink|4m|feature/guard-generator*)
$ guard init rspec
rspec guard added to Guardfile, feel free to edit it

~/repo/ruby/rails/hacker-uplink(hacker-uplink|4m|feature/guard-generator*)
$ guard init pow
pow guard added to Guardfile, feel free to edit it

~/repo/ruby/rails/hacker-uplink(hacker-uplink|4m|feature/guard-generator*)
$ guard init bundler
bundler guard added to Guardfile, feel free to edit it

~/repo/ruby/rails/hacker-uplink(hacker-uplink|4m|feature/guard-generator*)
$ cat Guardfile
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard 'rspec', :version => 2 do
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch('spec/spec_helper.rb')  { "spec" }

  # Rails example
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
  watch(%r{^lib/(.+)\.rb$})                           { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
  watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
  watch('spec/spec_helper.rb')                        { "spec" }
  watch('config/routes.rb')                           { "spec/routing" }
  watch('app/controllers/application_controller.rb')  { "spec/controllers" }
  # Capybara request specs
  watch(%r{^app/views/(.+)/.*\.(erb|haml)$})          { |m| "spec/requests/#{m[1]}_spec.rb" }
end

guard 'pow' do
  watch('.powrc')
  watch('.powenv')
  watch('.rvmrc')
  watch('Gemfile')
  watch('Gemfile.lock')
  watch('config/application.rb')
  watch('config/environment.rb')
  watch(%r{^config/environments/.*\.rb$})
  watch(%r{^config/initializers/.*\.rb$})
end

guard 'bundler' do
  watch('Gemfile')
  # Uncomment next line if Gemfile contain `gemspec' command
  # watch(/^.+\.gemspec/)
end

~/repo/ruby/rails/hacker-uplink(hacker-uplink|4m|feature/guard-generator*)
$ vim Guardfile

~/repo/ruby/rails/hacker-uplink(hacker-uplink|4m|feature/guard-generator*)
$ cat Guardfile
guard 'bundler' do
  watch('Gemfile')
end

guard 'pow' do
  watch('.powrc')
  watch('.powenv')
  watch('.rvmrc')
  watch('Gemfile')
  watch('Gemfile.lock')
  watch('config/application.rb')
  watch('config/environment.rb')
  watch(%r{^config/environments/.*\.rb$})
  watch(%r{^config/initializers/.*\.rb$})
end

guard 'rspec', :version => 2, :cli => '--color --format nested' do
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch('spec/spec_helper.rb')  { "spec" }

  # Rails example
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
  watch(%r{^lib/(.+)\.rb$})                           { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
  watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
  watch('spec/spec_helper.rb')                        { "spec" }
  watch('config/routes.rb')                           { "spec/routing" }
  watch('app/controllers/application_controller.rb')  { "spec/controllers" }

  # Capybara request specs
  watch(%r{^app/views/(.+)/.*\.(erb|haml)$})          { |m| "spec/requests/#{m[1]}_spec.rb" }
end

~/repo/ruby/rails/hacker-uplink(hacker-uplink|12m|feature/guard-generator*)
$ powder
Your application is now available at http://hacker-uplink.dev/

~/repo/ruby/rails/hacker-uplink(hacker-uplink|13m|feature/guard-generator*)
$ be guard
Guard is now watching at '/Users/krainboltgreene/repo/ruby/rails/hacker-uplink'
Bundle already up-to-date
Pow restarted.
Guard::RSpec is running, with RSpec 2!
Running all specs
No examples found.

Finished in 0.00003 seconds
0 examples, 0 failures
^C
Bye bye...

~/repo/ruby/rails/hacker-uplink(hacker-uplink|14m|feature/guard-generator*)
$ git add . && git commit -asm "Adding the guard file, and the initialization for all the cool guards."
[feature/guard-generator 6a98420] Adding the guard file, and the initialization for all the cool guards.
 2 files changed, 211 insertions(+), 1 deletions(-)
 create mode 100644 Guardfile

~/repo/ruby/rails/hacker-uplink(hacker-uplink|0m|feature/guard-generator)
$ git flow feature finish guard-generator
Switched to branch 'develop'
Merge made by recursive.
 Guardfile |   34 +++++++++++
 README    |  183 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 216 insertions(+), 1 deletions(-)
 create mode 100644 Guardfile
Deleted branch feature/guard-generator (was 69d5480).

Summary of actions:
- The feature branch 'feature/guard-generator' was merged into 'develop'
- Feature branch 'feature/guard-generator' has been removed
- You are now on branch 'develop'

~/repo/ruby/rails/hacker-uplink(hacker-uplink|2m|develop)
$ git flow feature start fabricate-account-model
M README
Switched to a new branch 'feature/fabricate-account-model'

Summary of actions:
- A new branch 'feature/fabricate-account-model' was created, based on 'develop'
- You are now on branch 'feature/fabricate-account-model'

Now, start committing on your feature. When done, use:

     git flow feature finish fabricate-account-model

~/repo/ruby/rails/hacker-uplink(hacker-uplink|0m|feature/fabricate-account-model)
$ be rails generate fabrication:model
Usage:
  rails generate fabrication:model NAME [field:type field:type] [options]

Options:
  [--skip-namespace]       # Skip namespace (affects only isolated applications)
  [--old-style-hash]       # Force using old style hash (:foo => 'bar') on Ruby >= 1.9
  [--dir=DIR]              # The directory where the fabricators should go
                           # Default: spec/fabricators
  [--extension=EXTENSION]  # file extension name
                           # Default: rb

Runtime options:
  -f, [--force]    # Overwrite files that already exist
  -p, [--pretend]  # Run but do not make any changes
  -q, [--quiet]    # Supress status output
  -s, [--skip]     # Skip files that already exist

Description:
    Create fabrication files for model generator.

~/repo/ruby/rails/hacker-uplink(hacker-uplink|0m|feature/fabricate-account-model)
$ be rails generate fabrication:model Account email:string password:string name:string age:integer terms:boolean admin:boolean support:boolean banned:boolean disabled:boolean
      create  spec/fabricators/account_fabricator.rb

~/repo/ruby/rails/hacker-uplink(hacker-uplink|29m|feature/fabricate-account-model*)
$ cat spec/fabricators/account_fabricator.rb
Fabricator(:account) do
  email "MyString"
  password "MyString"
  name "MyString"
  age 1
  terms false
  admin false
  support false
  banned false
  disabled false
end

~/repo/ruby/rails/hacker-uplink(hacker-uplink|29m|feature/fabricate-account-model*)
$ git add . && git commit -asm "Adding in the fabricator scaffold for accounts."
[feature/fabricate-account-model 6ed53ee] Adding in the fabricator scaffold for accounts.
 2 files changed, 71 insertions(+), 51 deletions(-)
 create mode 100644 spec/fabricators/account_fabricator.rb

~/repo/ruby/rails/hacker-uplink(hacker-uplink|29m|feature/fabricate-account-model*)
$ vim spec/fabricators/account_fabricator.rb

~/repo/ruby/rails/hacker-uplink(hacker-uplink|29m|feature/fabricate-account-model*)
$ cat spec/fabricators/account_fabricator.rb
Fabricator(:account) do
  email { Forgery(:internet).email_address }
  password { Forgery(:basic).password(:at_least => 8, :at_most => 256) }
  name { Forgery(:name).full_name }
  age { Forgery(:basic).number(:at_least => 13, :at_most => 80) }
  terms true
  admin false
  support false
  banned false
  disabled false
end

Fabricator(:admin_account, :from => :account) do
  admin true
end

Fabricator(:support_account, :from => :account) do
  support true
end

Fabricator(:banned_account, :from => :account) do
  support true
end

Fabricator(:disabled_account, :from => :account) do
  disabled true
end

~/repo/ruby/rails/hacker-uplink(hacker-uplink|29m|feature/fabricate-account-model*)
$ be rails console
Loading development environment (Rails 3.1.0.rc6)
ruby-1.9.2-p290 :001 > Fabricate(:account)
Fabrication::UnfabricatableError: No class found for 'account'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/fabricator.rb:33:in `schematic_for'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/fabricator.rb:7:in `define'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication.rb:33:in `Fabricator'
  from /Users/krainboltgreene/repo/ruby/rails/hacker-uplink/spec/fabricators/account_fabricator.rb:1:in `<top (required)>'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/activesupport/lib/active_support/dependencies.rb:234:in `load'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/activesupport/lib/active_support/dependencies.rb:234:in `block in load'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/activesupport/lib/active_support/dependencies.rb:223:in `block in load_dependency'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/activesupport/lib/active_support/dependencies.rb:640:in `new_constants_in'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/activesupport/lib/active_support/dependencies.rb:223:in `load_dependency'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/activesupport/lib/active_support/dependencies.rb:234:in `load'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/support.rb:29:in `block (2 levels) in find_definitions'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/support.rb:28:in `each'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/support.rb:28:in `block in find_definitions'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/support.rb:27:in `each'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/support.rb:27:in `find_definitions'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/fabricator.rb:11:in `generate'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication.rb:37:in `Fabricate'
  from (irb):1
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/railties/lib/rails/commands/console.rb:45:in `start'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/railties/lib/rails/commands/console.rb:8:in `start'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/railties/lib/rails/commands.rb:40:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'ruby-1.9.2-p290 :002 > exit

~/repo/ruby/rails/hacker-uplink(hacker-uplink|9m|feature/fabricate-account-model*)
$ be rails generate model
Usage:
  rails generate model NAME [field:type field:type] [options]

Options:
      [--skip-namespace]  # Skip namespace (affects only isolated applications)
      [--old-style-hash]  # Force using old style hash (:foo => 'bar') on Ruby >= 1.9
  -o, --orm=NAME          # Orm to be invoked
                          # Default: mongoid

Mongoid options:
      [--timestamps]           # Indicates when to generate timestamps
      [--parent=PARENT]        # The parent class for the generated model
      [--versioning]           # Enable mongoid versioning
  -t, [--test-framework=NAME]  # Test framework to be invoked
                               # Default: rspec

Rspec options:
  [--fixture]                   # Indicates when to generate fixture
  [--fixture-replacement=NAME]  # Fixture replacement to be invoked

Runtime options:
  -f, [--force]    # Overwrite files that already exist
  -p, [--pretend]  # Run but do not make any changes
  -q, [--quiet]    # Supress status output
  -s, [--skip]     # Skip files that already exist

Description:
    Create rails files for model generator.

~/repo/ruby/rails/hacker-uplink(hacker-uplink|9m|feature/fabricate-account-model*)
$ be rails generate model Account email:string password:string name:string age:integer terms:boolean admin:boolean support:boolean banned:boolean disabled:boolean --timestamps --versioning

      invoke  mongoid
      create    app/models/account.rb
      invoke    rspec
      create      spec/models/account_spec.rb

~/repo/ruby/rails/hacker-uplink(hacker-uplink|11m|feature/fabricate-account-model*)
$ cat app/models/account.rb
class Account
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Versioning
  field :email, :type => String
  field :password, :type => String
  field :name, :type => String
  field :age, :type => Integer
  field :terms, :type => Boolean
  field :admin, :type => Boolean
  field :support, :type => Boolean
  field :banned, :type => Boolean
  field :disabled, :type => Boolean
end

~/repo/ruby/rails/hacker-uplink(hacker-uplink|11m|feature/fabricate-account-model*)
$ vim app/models/account.rb

~/repo/ruby/rails/hacker-uplink(hacker-uplink|13m|feature/fabricate-account-model*)
$ cat app/models/account.rb
class Account
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Paranoia
  include Mongoid::Versioning

  attr_accessor :password_confirmation
  index :email, :unique => true
  max_versions 200

  # => Credentials
  field :email
  field :password
  # embeds_many :credentials

  # => Personal
  field :name
  field :age, :type => Integer
  # embeds_one :location
  # embeds_one :phone
  # embeds_one :avatar

  # => Roles
  field :admin, :type => Boolean
  field :support, :type => Boolean

  # => Extra
  field :terms, :type => Boolean
  field :banned, :type => Boolean
  field :disabled, :type => Boolean

  # => Validations
  validates_presence_of :email
  validates_length_of :email, :within => 7..256
  validates_uniqueness_of :email, :case_sensitive => true
  validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i

  validates_presence_of :password
  validates_length_of :password, :within => 8..256
  validates_confirmation_of :password

  validates_presence_of :name
  validates_format_of :name, :with => /[\w\s\-\,\.]/
  validates_length_of :name, :within => 2..256

  validates_presence_of :age
  validates_numericality_of :age, :greater_than_or_equal_to => 13, :less_than_or_equal_to => 100

  validates_acceptance_of :terms, :accept => true

  before_create :encrypt_password

  def encrypt_password
    self.password = Password.create self.password
  end

  def first_name
    self.name.split(' ').first
  end

  def last_name
    self.name.split(' ').last
  end

end

~/repo/ruby/rails/hacker-uplink(hacker-uplink|14m|feature/fabricate-account-model*)
$ git add . && git commit -asm "Adding account class, fields, validations, and password encryption method"
[feature/fabricate-account-model 3121309] Adding account class, fields, validations, and password encryption method
 3 files changed, 82 insertions(+), 5 deletions(-)
 create mode 100644 app/models/account.rb
 create mode 100644 spec/models/account_spec.rb

~/repo/ruby/rails/hacker-uplink(hacker-uplink|0m|feature/fabricate-account-model)
$ git shortlog
Kurtis Rainbolt-Greene (10):
      Initial commit
      Adding in basic rails generated application.
      adding generated files
      Adding in the capybara require and database_cleaner catches.
      Merge branch 'feature/rspec-generator' into develop
      Adding the guard file, and the initialization for all the cool guards.
      Merge branch 'feature/guard-generator' into develop
      Adding in develop.
      Adding in the fabricator scaffold for accounts.
      Adding account class, fields, validations, and password encryption method

~/repo/ruby/rails/hacker-uplink(hacker-uplink|2m|feature/fabricate-account-model)
$ be rails console
Loading development environment (Rails 3.1.0.rc6)
ruby-1.9.2-p290 :001 > Fabricate(:account)
NameError: uninitialized constant Account::Password
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/rake-0.9.2/lib/rake/ext/module.rb:36:in `const_missing'
  from /Users/krainboltgreene/repo/ruby/rails/hacker-uplink/app/models/account.rb:54:in `encrypt_password'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/activesupport/lib/active_support/callbacks.rb:404:in `_run_create_callbacks'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/activesupport/lib/active_support/callbacks.rb:81:in `run_callbacks'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/mongoid-2.1.5/lib/mongoid/persistence/insertion.rb:25:in `block (2 levels) in prepare'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/activesupport/lib/active_support/callbacks.rb:412:in `_run_save_callbacks'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/activesupport/lib/active_support/callbacks.rb:81:in `run_callbacks'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/mongoid-2.1.5/lib/mongoid/persistence/insertion.rb:24:in `block in prepare'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/mongoid-2.1.5/lib/mongoid/persistence/insertion.rb:22:in `tap'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/mongoid-2.1.5/lib/mongoid/persistence/insertion.rb:22:in `prepare'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/mongoid-2.1.5/lib/mongoid/persistence/operations/insert.rb:26:in `persist'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/mongoid-2.1.5/lib/mongoid/persistence.rb:44:in `insert'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/mongoid-2.1.5/lib/mongoid/persistence.rb:142:in `upsert'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/mongoid-2.1.5/lib/mongoid/persistence.rb:70:in `save!'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/generator/base.rb:68:in `after_generation'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/generator/base.rb:15:in `generate'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/schematic.rb:54:in `block in generate'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/schematic.rb:50:in `instance_eval'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/schematic.rb:50:in `generate'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication/fabricator.rb:13:in `generate'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/gems/fabrication-1.0.1/lib/fabrication.rb:37:in `Fabricate'
  from (irb):1
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/railties/lib/rails/commands/console.rb:45:in `start'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/railties/lib/rails/commands/console.rb:8:in `start'
  from /Users/krainboltgreene/.rvm/gems/ruby-1.9.2-p290@hacker-uplink/bundler/gems/rails-ca26feb54aa7/railties/lib/rails/commands.rb:40:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'ruby-1.9.2-p290 :002 > exit

~/repo/ruby/rails/hacker-uplink(hacker-uplink|32m|feature/fabricate-account-model*)
$ cat Gemfile
source :rubygems

# => Web Framework
gem 'rails', :git => 'https://github.com/rails/rails.git', :branch => '3-1-stable'


# => Framework Extras
gem 'uglifier'
gem 'inherited_resources'
gem 'goalie'


# => Database ORM
gem 'mongoid'


# => ORM Extras
gem 'bson_ext'
gem 'mongoid-eager-loading'


# => Rendering Engines
gem 'slim'
gem 'sass'
gem 'coffee-script'


# => Rendering Extras
gem 'slim-rails', :group => :development
gem 'sass-rails', :group => :development
gem 'jquery-rails', :group => :development
gem 'therubyracer', :require => 'v8'


# => Testing Frameworks
gem 'rspec', :group => [:development, :test]
gem 'steak', :group => [:development, :test]
# gem 'mocha', :group => [:development, :test]
gem 'capybara', :group => [:development, :test]


# => Testing Extras
gem 'rspec-rails', :group => [:development, :test]
gem 'mongoid-rspec', :group => [:development, :test]
gem 'fabrication', :group => [:development, :test]
gem 'forgery', :group => [:development, :test]
gem 'delorean', :group => :test
gem 'database_cleaner', :group => :test
gem 'launchy', :group => :test
gem 'guard', :require => false, :group => :test
gem 'guard-rspec', :require => false, :group => :test
gem 'guard-bundler', :require => false, :group => :test
gem 'guard-pow', :require => false, :group => :test
gem 'rb-fsevent', :require => false, :group => :test
gem 'growl', :require => false, :group => :test


# => Deployment Frameworks
gem 'heroku', :require => false, :group => :development


# => Deployment Extras
gem 'therubyracer-heroku', :group => :production

~/repo/ruby/rails/hacker-uplink(hacker-uplink|35m|feature/fabricate-account-model*)
$ vim Gemfile

~/repo/ruby/rails/hacker-uplink(hacker-uplink|35m|feature/fabricate-account-model*)
$ cat Gemfile
source :rubygems

# => Web Framework
gem 'rails', :git => 'https://github.com/rails/rails.git', :branch => '3-1-stable'


# => Framework Extras
gem 'uglifier'
gem 'inherited_resources'
gem 'goalie'
gem 'bcrypt-ruby', :require => 'bcrypt'


# => Database ORM
gem 'mongoid'


# => ORM Extras
gem 'bson_ext'
gem 'mongoid-eager-loading'


# => Rendering Engines
gem 'slim'
gem 'sass'
gem 'coffee-script'


# => Rendering Extras
gem 'slim-rails', :group => :development
gem 'sass-rails', :group => :development
gem 'jquery-rails', :group => :development
gem 'therubyracer', :require => 'v8'


# => Testing Frameworks
gem 'rspec', :group => [:development, :test]
gem 'steak', :group => [:development, :test]
# gem 'mocha', :group => [:development, :test]
gem 'capybara', :group => [:development, :test]


# => Testing Extras
gem 'rspec-rails', :group => [:development, :test]
gem 'mongoid-rspec', :group => [:development, :test]
gem 'fabrication', :group => [:development, :test]
gem 'forgery', :group => [:development, :test]
gem 'delorean', :group => :test
gem 'database_cleaner', :group => :test
gem 'launchy', :group => :test
gem 'guard', :require => false, :group => :test
gem 'guard-rspec', :require => false, :group => :test
gem 'guard-bundler', :require => false, :group => :test
gem 'guard-pow', :require => false, :group => :test
gem 'rb-fsevent', :require => false, :group => :test
gem 'growl', :require => false, :group => :test


# => Deployment Frameworks
gem 'heroku', :require => false, :group => :development


# => Deployment Extras
gem 'therubyracer-heroku', :group => :production

~/repo/ruby/rails/hacker-uplink(hacker-uplink|35m|feature/fabricate-account-model*)
$ bundle
Using rake (0.9.2)
Using multi_json (1.0.3)
Using activesupport (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Using bcrypt-ruby (3.0.0)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Using erubis (2.7.0)
Using rack (1.3.2)
Using rack-cache (1.0.3)
Using rack-mount (0.8.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.0.0.beta.15)
Using actionpack (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.3.0)
Using actionmailer (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Using arel (2.2.1)
Using tzinfo (0.3.29)
Using activerecord (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Using activeresource (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Using addressable (2.2.6)
Using bson (1.3.1)
Using bson_ext (1.3.1)
Using bundler (1.0.15)
Using nokogiri (1.5.0)
Using ffi (1.0.9)
Using childprocess (0.2.2)
Using json_pure (1.5.3)
Using rubyzip (0.9.4)
Using selenium-webdriver (0.2.2)
Using xpath (0.1.4)
Using capybara (1.0.0)
Using chronic (0.6.2)
Using coffee-script-source (1.1.2)
Using execjs (1.2.4)
Using coffee-script (2.2.0)
Using database_cleaner (0.6.7)
Using delorean (1.1.0)
Using diff-lcs (1.1.3)
Using fabrication (1.0.1)
Using forgery (0.3.12)
Using goalie (0.0.4)
Using growl (1.0.3)
Using thor (0.14.6)
Using guard (0.5.1)
Using guard-bundler (0.1.3)
Using guard-pow (0.1.0)
Using guard-rspec (0.4.0)
Using has_scope (0.5.1)
Using launchy (2.0.5)
Using rest-client (1.6.7)
Using term-ansicolor (1.0.6)
Using heroku (2.5.2)
Using responders (0.6.4)
Using inherited_resources (1.2.2)
Using rack-ssl (1.3.2)
Using rdoc (3.9.4)
Using railties (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Using jquery-rails (1.0.12)
Using libv8 (3.3.10.2)
Using mongo (1.3.1)
Using mongoid (2.1.5)
Using mongoid-eager-loading (0.3.1)
Using rspec-core (2.6.4)
Using rspec-expectations (2.6.0)
Using rspec-mocks (2.6.0)
Using rspec (2.6.0)
Using mongoid-rspec (1.4.4)
Using rails (3.1.0.rc6) from https://github.com/rails/rails.git (at 3-1-stable)
Using rb-fsevent (0.4.0)
Using rspec-rails (2.6.1)
Using sass (3.1.7)
Using sass-rails (3.1.0.rc.7)
Using temple (0.3.3)
Using slim (1.0.0)
Using slim-rails (0.2.1)
Using steak (2.0.0)
Using therubyracer (0.9.4)
Using therubyracer-heroku (0.8.1.pre3)
Using uglifier (1.0.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

~/repo/ruby/rails/hacker-uplink(hacker-uplink|35m|feature/fabricate-account-model*)
$ cat app/models/account.rb
class Account
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Paranoia
  include Mongoid::Versioning

  attr_accessor :password_confirmation
  index :email, :unique => true
  max_versions 200

  # => Credentials
  field :email
  field :password
  # embeds_many :credentials

  # => Personal
  field :name
  field :age, :type => Integer
  # embeds_one :location
  # embeds_one :phone
  # embeds_one :avatar

  # => Roles
  field :admin, :type => Boolean
  field :support, :type => Boolean

  # => Extra
  field :terms, :type => Boolean
  field :banned, :type => Boolean
  field :disabled, :type => Boolean

  # => Validations
  validates_presence_of :email
  validates_length_of :email, :within => 7..256
  validates_uniqueness_of :email, :case_sensitive => true
  validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i

  validates_presence_of :password
  validates_length_of :password, :within => 8..256
  validates_confirmation_of :password

  validates_presence_of :name
  validates_format_of :name, :with => /[\w\s\-\,\.]/
  validates_length_of :name, :within => 2..256

  validates_presence_of :age
  validates_numericality_of :age, :greater_than_or_equal_to => 13, :less_than_or_equal_to => 100

  validates_acceptance_of :terms, :accept => true

  before_create :encrypt_password

  def encrypt_password
    self.password = Password.create self.password
  end

  def first_name
    self.name.split(' ').first
  end

  def last_name
    self.name.split(' ').last
  end

end

~/repo/ruby/rails/hacker-uplink(hacker-uplink|35m|feature/fabricate-account-model*)
$ vim app/models/account.rb

~/repo/ruby/rails/hacker-uplink(hacker-uplink|35m|feature/fabricate-account-model*)
$ cat app/models/account.rb
class Account
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Paranoia
  include Mongoid::Versioning
  include BCrypt

  attr_accessor :password_confirmation
  index :email, :unique => true
  max_versions 200

  # => Credentials
  field :email
  field :password
  # embeds_many :credentials

  # => Personal
  field :name
  field :age, :type => Integer
  # embeds_one :location
  # embeds_one :phone
  # embeds_one :avatar

  # => Roles
  field :admin, :type => Boolean
  field :support, :type => Boolean

  # => Extra
  field :terms, :type => Boolean
  field :banned, :type => Boolean
  field :disabled, :type => Boolean

  # => Validations
  validates_presence_of :email
  validates_length_of :email, :within => 7..256
  validates_uniqueness_of :email, :case_sensitive => true
  validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i

  validates_presence_of :password
  validates_length_of :password, :within => 8..256
  validates_confirmation_of :password

  validates_presence_of :name
  validates_format_of :name, :with => /[\w\s\-\,\.]/
  validates_length_of :name, :within => 2..256

  validates_presence_of :age
  validates_numericality_of :age, :greater_than_or_equal_to => 13, :less_than_or_equal_to => 100

  validates_acceptance_of :terms, :accept => true

  before_create :encrypt_password

  def encrypt_password
    self.password = Password.create self.password
  end

  def first_name
    self.name.split(' ').first
  end

  def last_name
    self.name.split(' ').last
  end

end

~/repo/ruby/rails/hacker-uplink(hacker-uplink|35m|feature/fabricate-account-model*)
$ be rails console
Loading development environment (Rails 3.1.0.rc6)
ruby-1.9.2-p290 :001 > Fabricate(:account)
 => #<Account _id: 4e5b8deea53b22c241000001, _type: nil, created_at: 2011-08-29 13:02:38 UTC, updated_at: 2011-08-29 13:02:38 UTC, deleted_at: nil, version: 1, email: "rgomez@agivu.com", password: "$2a$10$luTy4SYbn6mEaB7tcPSAqOME/EAWTr0/Bid659YE2/QMGmmw8KGYa", name: "Lois Carter", age: 67, admin: false, support: false, terms: true, banned: false, disabled: false> 
ruby-1.9.2-p290 :002 > exit
@Spaceghost
Copy link

If you put jquery-rails in development only then the engine won't be used in production so you won't get jquery, at least when I last checked.

@krainboltgreene
Copy link
Author

Strange, I've had it work before on Heroku.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment