macを買って、今すぐherokuでruby1.9.3 + rails3.2しよう!


mac1heroku使RailsmacherokudeployLion


macmac(mac)mac


()

f:id:naoto5959:20120304134035p:plain

iTerm2


iterm2

f:id:naoto5959:20120304134043p:plain
Downloadcurrent version

f:id:naoto5959:20120304134051p:plain

command line tools for xcode


xcodeApple Developer

XcodeCommand Line Tools for XcodeHDD使7GB

homebrew


homebrew

Homebrew The missing package manager for OS X

Password
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

zsh


便
brew install zsh
curl https://raw.github.com/gist/1970184/d7adf527117edd583de7b55141f8d7377a3b6cf6/.zshrc > ~/.zshrc


cat ~/.zshrc
export LANG=ja_JP.UTF-8

# homebrewを優先
export PATH=~/bin:/usr/local/bin:$PATH

source ~/.zshrc


sudo sh -c "echo /usr/local/bin/zsh >> /etc/shells"
chsh -s /usr/local/bin/zsh

git


git
brew install git
git config --global user.name "your name"
git config --global user.email "youraddress@example.com"

automake


automake
brew install automake

rvm


Rubyrvm
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

PATH
vim ~/.zshrc


# rvm
 -s "$HOME/.rvm/scripts/rvm"  && . "$HOME/.rvm/scripts/rvm"


curl https://raw.github.com/gist/1970184/0c2cf14cbc696ceffcfc7b3c5cdeec84158e614e/.zshrc > .zshrc
source ~/.zshrc

ruby1.9.3



rvm list known|grep 1.9.3
[ruby-]1.9.3-preview1
[ruby-]1.9.3-rc1
[ruby-]1.9.3-p0
[ruby-]1.9.3[-p125]
[ruby-]1.9.3-head

heroku1.9.3-p0使1.9.3-p02012341.9.3-p1252012421.9.3-p125

f:id:naoto5959:20120304134106p:plain
rvm install 1.9.3-p125 --with-gcc=clang
rvm use 1.9.3-p125 --default

heroku


heroku"Sign Up"

f:id:naoto5959:20120304134055p:plain
heroku使

f:id:naoto5959:20120304134058p:plain
URLheroku

f:id:naoto5959:20120304134102p:plain

ssh-keygen -b 2048

rvm gemset

rvm --create 1.9.3-p125@heroku-sample
gem install heroku --no-ri --no-rdoc

heroku login

heroku login


rails3.2.2heroku


rails
gem install rails --version 3.2.2 --no-ri --no-rdoc

mysqlrspectest-d mysql-T
rails new heroku-sample
cd heroku-sample

gitgit使Git
git init
git add -A
git commit -m'init'

gem
curl https://raw.github.com/gist/1970532/376b6a26ed936ac43cad0b17a64512f5c0216a50/Gemifile > Gemfile
rm -f Gemfile.lock
bundle install --without production
git add -A
git commit -m 'Update Gemfile'

herokuPostgreSQL使pgdevelopment使
source 'https://rubygems.org'

gem 'rails', '3.2.2'
gem 'jquery-rails'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

group :test, :development do
  gem 'sqlite3'
  gem 'heroku'
end

group :production do
  gem 'pg'
  gem 'thin'
end


heroku
heroku create --stack cedar

Ruby1.9.3使heroku-labs使
heroku plugins:install http://github.com/heroku/heroku-labs.git
heroku labs:enable user_env_compile
heroku config:add RUBY_VERSION=ruby-1.9.3-p125

herokudeploy
git push heroku master

yes
Are you sure you want to continue connecting (yes/no)?

ruby1.9.3
Using RUBY_VERSION: ruby-1.9.3-p125


heroku open

scaffold

index.html
rm -f public/index.html
git add -A
git commit -m'Delete default index.html'

scaffold
rails g scaffold bookmark name:string url:string
rake db:migrate
sed -i -e "s/  # root :to => 'welcome#index'/  root :to => 'bookmarks#index'/" config/routes.rb
git commit -m 'rails g scaffold bookmark'

deploymigration
heroku maintenance:on

migration
git push heroku master

herokumigration
heroku run rake db:migrate


heroku maintenance:off
heroku open

herokuruby1.9.3 + rails3.2 便

herokurails3.1

stackcedar


heroku create --stack cedar

assets:precompile


Ruby on Rails Guides: Asset Pipelineherokudeploy使gemassets precomile
config/application.rb


config.assets.initialize_on_precompile = false


echo config/application.rb |xargs perl -p -i -e 's/ end/ #for heroku\n config.assets.initialize_on_precompile = false\n end/'
git add -A
git commit -Add config.assets.initialize_on_precompile to false'
git push heroku master

therubyracer






http://quiet-dawn-3034.herokuapp.com/


twitter bootstrap rails使3