- ruby 1.9.2
- rails 3.2.1
This file contains hidden or 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 :rails_env, :production | |
| set :unicorn_binary, "/usr/bin/unicorn" | |
| set :unicorn_config, "#{current_path}/config/unicorn.rb" | |
| set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
| namespace :deploy do | |
| task :start, :roles => :app, :except => { :no_release => true } do | |
| run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D" | |
| end | |
| task :stop, :roles => :app, :except => { :no_release => true } do |
This file contains hidden or 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
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
This file contains hidden or 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
| ja: | |
| errors: | |
| messages: | |
| not_found: "は見つかりませんでした" | |
| # not_found: "not found" | |
| already_confirmed: "は既に登録済みです" | |
| # already_confirmed: "was already confirmed" | |
| not_locked: "は凍結されていません" | |
| # not_locked: "was not locked" |
This file contains hidden or 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
| http://stackoverflow.com/questions/341143/can-rails-routing-helpers-i-e-mymodel-pathmodel-be-used-in-models | |
| In Rails 3: | |
| Rails.application.routes.url_helpers | |
| Rails 2 | |
| include ActionController::UrlWriter |
This file contains hidden or 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
| # For Sinatra, put this a the top-level Rakefile directly: | |
| namespace :db do | |
| desc "Use model properties to auto-migrate" | |
| task :automigrate => :environment do | |
| Dir[File.expand_path 'app/models/**.rb', File.dirname(__FILE__)].each do |model| | |
| require model | |
| klass = File.basename(model.sub(/\.rb$/,'')).classify.constantize | |
| puts "== Migrating #{klass.name}" | |
| klass.auto_upgrade! | |
| end |
This file contains hidden or 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
| .highlight { background-color: #ffffcc } | |
| .highlight .c { color: #586E75 } /* Comment */ | |
| .highlight .err { color: #93A1A1 } /* Error */ | |
| .highlight .g { color: #93A1A1 } /* Generic */ | |
| .highlight .k { color: #859900 } /* Keyword */ | |
| .highlight .l { color: #93A1A1 } /* Literal */ | |
| .highlight .n { color: #93A1A1 } /* Name */ | |
| .highlight .o { color: #859900 } /* Operator */ | |
| .highlight .x { color: #CB4B16 } /* Other */ | |
| .highlight .p { color: #93A1A1 } /* Punctuation */ |
This file contains hidden or 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
| SPモードメールプロトコル | |
| ------------------------ | |
| < サーバーのレスポンス | |
| > クライアントのリクエスト | |
| --- | |
| < 220 ESMTP Server Ready | |
| > EHLO mail.spmode.ne.jp |
This file contains hidden or 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
| namespace :db do | |
| def local_database?(config, &block) | |
| if config['host'].in?(['127.0.0.1', 'localhost', '192.168.30.1']) || config['host'].blank? | |
| yield | |
| else | |
| $stderr.puts "This task only modifies local databases. #{config['database']} is on a remote host." | |
| end | |
| end | |
| end |
OlderNewer