2012-03-12 102 views
0

林格式Capistrano的配置文件的位置

例如

/

..application/

....部署/ deploy.rb

....部署/ production.rb

..configs(ETC)

我理解默認爲config /部署/ production.rb 這dosent按照我的應用說起來,所以是無論如何要定義使用哪條路徑?

Capfile:

負載 '部署' 如果的respond_to?(:命名空間)#CAP2微分

負荷 '應用/部署/部署' #刪除此行跳過加載任何默認任務

回答

0

我只使用一個文件:config/deploy.rb與多個任務。如果您不使用它,請忽略RVM業務。就像這樣:

task :staging do 
    set :rails_env, 'staging' 
    role :app, "staging.example.com" 
    role :web, "staging.example.com" 
    role :db, "staging.example.com", :primary => true 
end 

task :production do 
    set :rails_env, 'production' 
    set :branch, 'master' 
    # RVM integration as specified at https://rvm.beginrescueend.com/integration/capistrano/ 
    $:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path. 
    require "rvm/capistrano" 
    set :rvm_ruby_string, '[email protected]' 
    set :rvm_type, :user 

    role :app, "prod.example.com" 
    role :web, "prod.example.com" 
    role :db, "prod.example.com", :primary => true 
end 

然後部署具有cap staging deploycap production deploy

+0

這是更好的方法,但我不能讓它工作 但在命令行中,我得到以下 '$帽生產部署:安裝 *執行'生產「 觸發開始回調'部署:安裝」 *執行'多級:確保' 沒有指定階段。請指定以下其中一項:生產,審查,分期(例如'cap production deploy:setup') $ cap staging deploy:setup *正在執行'staging' 觸發'deploy:setup'的啓動回調* *正在執行'multistage:ensure ' 沒有指定階段。請指定以下其中一項:製作,審覈,分期(例如'cap production deploy:setup')' – 2012-03-13 11:40:15