Skip to content

@jhbabon /Gemfile
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby development stack presentation
---
BUNDLE_PATH: vendor/bundle
# 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
# 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
$ gem install rake --version 0.3.1 --force
# 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
$ 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
$ 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...
# 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...
# call default task
$ bundle exec rake
# or a explicit task
$ bundle exec rake test
# 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
Something went wrong with that request. Please try again.