2013-05-07 77 views
2

我使用的軌道,並試圖利用Capistrano的到BlueHost的部署它構建一個示例應用程序。 但我不這樣做。我跟着這個http://vasil-y.com/2012/08/21/rails-capistrano-git-bluehost/參數錯誤,同時通過Capistrano的應用程序部署軌BLUEHOST

提到的說明這是我的配置/ deploy.rb的內容:

require 'bundler/capistrano' 

set :application, "rails_scaffold" 

# BlueHost SSH user 
set :user, "username" 

# App Domain 
set :domain, "example.com" 

# We don't need sudo on BlueHost 
set :use_sudo, false 

# git is our SCM 
set :scm, :git 

# master is our default git branch 
set :branch, "master" 

# Use local git repository 
set :repository, "#{domain}:/home/#{user}/rails_apps/#{application}" 
set :local_repository, "." 

# Checkout, compress and send a local copy 
set deploy_via, :copy 
set deploy_to, "/home/#{user}/rails_apps/#{application}" 

# We have all components of the app on the same server 
server domain, :app, :web, :db, :primary => true 

namespace :deploy do 
    task :start do ; end 
    task :stop do ; end 

    # Touch tmp/restart.txt to tell Phusion Passenger about new version 
    task :restart, :roles => :app, :except => { :no_release => true } do 
    run "touch #{File.join(current_path, 'tmp', 'restart.txt')}" 
    end 
end 

# Clean-up old releases 
after "deploy:restart", "deploy:cleanup" 

但是當我運行帽部署:安裝命令,我收到以下錯誤:

/home/swaroop/.rvm/gems/ruby-1.9.3-p362/gems/capistrano-2.14.2/lib/capistrano/configuration/variables.rb:22:in `set': invalid variable `/u/apps/rails_scaffold' (variables must begin with an underscore, or a lower-case letter) (ArgumentError) 

報告說,應用程序的名稱必須以下劃線或小寫字母開頭。我的應用程序名稱看起來像是有效的。 我在這裏做錯了什麼?

謝謝

回答

2

一對夫婦的set電話已經論據不是符號:

set deploy_via, :copy 
set deploy_to, "/home/#{user}/rails_apps/#{application}" 

這些應該是:

set :deploy_via, :copy 
set :deploy_to, "/home/#{user}/rails_apps/#{application}" 

deploy_viadeploy_to之前,請注意冒號)

你可以看到爲什麼它可能看起來與您:application變量,如果我們考察什麼是包含:deploy_to行發生的事情:它首先調用deploy_to方法(因爲你缺少冒號,它看起來像一個方法調用)和deploy_to違約到"/u/apps/#{application}"Capistrano source code

_cset(:deploy_to) { "/u/apps/#{application}" } 

所以真的,你的代碼是有效試圖嘗試運行此:

set "/u/apps/#{application}", "/home/#{user}/rails_apps/#{application}" 

"/u/apps/#{application}"不Capistrano的一個有效的變量名。將冒號添加到這些行應該修復它。

+1

謝謝你的回覆。肯定會試試這個。 – swaroopsm 2013-05-07 13:26:49

相關問題