Created
November 23, 2012 11:34
-
-
Save jhbabon/4135230 to your computer and use it in GitHub Desktop.
Ruby development stack presentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
BUNDLE_PATH: vendor/bundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install all gems in ./vendor/bundle | |
$ bundle install --path=vendor/bundle | |
# install gems' binaries in ./bin | |
$ bundle install --binstubs | |
# use the installed bin instead of `bundle exec` | |
$ bin/rake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# Bundler must be in the global load path. | |
require 'bundler' | |
# Require the gems declared in the Gemfile | |
# you can require by groups | |
Bundler.require(:default, :test) | |
# or you can do: | |
# Bundler.setup(:default, :test) | |
# require 'rake' | |
# Use the gems | |
Rake::Task['test'].invoke |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gem install rake --version 0.3.1 --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# Gemfile | |
source 'https://rubygems.org/' | |
gem 'rake' # up to date version | |
gem 'rack', '~> 1.4.1' # pessimistic version | |
gem 'thin', '= 1.5' # exact version | |
group :test do | |
gem 'rspec' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ irb | |
irb(main):001:0> IRB.rc_file | |
=> "/Users/jhbabon/.irbrc" | |
irb(main):002:0> hello = lambda { |p| puts "Hello #{p}" } | |
=> #<Proc:0x007fdc14873398@(irb):22 (lambda)> | |
irb(main):003:0> hello.call('world') | |
Hello world | |
=> nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ bundle exec rails g | |
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: | |
controller | |
generator | |
helper | |
mailer | |
migration | |
model | |
observer | |
responders_controller | |
scaffold | |
ActiveRecord: | |
active_record:devise | |
# and more... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set the Rails environment with an shell env variable | |
$ RAILS_ENV=staging bundle exec rake db:migrate | |
# show all tasks | |
$ bundle exec rake -T | |
rake db:create # Create the database from config/database.yml for the current Rails.env (use db:cr... | |
rake db:drop # Drops the database for the current Rails.env (use db:drop:all to drop all databases) | |
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false). | |
rake log:clear # Truncates all *.log files in log/ to zero bytes | |
rake middleware # Prints out your Rack middleware stack | |
rake notes # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus) | |
rake routes # Print out all defined routes in match | |
# many more... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# call default task | |
$ bundle exec rake | |
# or a explicit task | |
$ bundle exec rake test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# Rakefile | |
# example from: http://rake.rubyforge.org/ | |
task default: [:test] | |
desc "Run all tests" | |
task :test do | |
$stdout.puts "---> Running all tests" | |
ruby "test/unittest.rb" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment