2011-11-17 28 views
6

布倫丹LIMS指令用於設置sms_fu寶石說運行任Rails的sms_fu錯誤

sms_fu = SMSFu::Client.configure(:delivery => :action_mailer) 

sms_fu = SMSFu::Client.configure(:delivery => :pony, :pony_config => { :via => :sendmail }) 

PONY_CONFIG = { 
:via => :smtp, 
:via_options => { 
:address    => 'smtp.gmail.com', 
:port     => '587', 
:user_name   => 'username', 
:password    => 'password', 
:authentication  => :plain, 
:enable_starttls_auto => true, 
:domain    => "localhost.localdomain" 
}} 
sms_fu = SMSFu::Client.configure(:delivery => :pony, :pony_config => PONY_CONFIG) 

我嘗試的第一個(假設的ActionMailer設置默認情況下,也許那是錯誤的)。然後第二個(安裝小馬和郵寄一些東西,以確保它的工作,這很好)和最後一個。沒有錯誤顯示在上面的安東尼。該指示說在此之後成立,這樣的命令應該工作

sms_fu.deliver("5558675309","at&t","message") 

在所有的設置窗口我得到這個錯誤

NameError: uninitialized constant RAILS_ROOT 
from /Users/name/.rvm/gems/[email protected]/gems/sms_fu-1.1.2/lib/sms_fu/sms_fu.rb:102:in `template_directory' 
from /Users/name/.rvm/gems/[email protected]/gems/sms_fu-1.1.2/lib/sms_fu/sms_fu.rb:55:in `config_yaml' 
from /Users/name/.rvm/gems/[email protected]/gems/sms_fu-1.1.2/lib/sms_fu/sms_fu.rb:65:in `from_address' 
from /Users/name/.rvm/gems/[email protected]/gems/sms_fu-1.1.2/lib/sms_fu/sms_fu.rb:41:in `deliver' 
from (irb):28 
from /Users/name/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/commands/console.rb:45:in `start' 
from /Users/name/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/commands/console.rb:8:in `start' 
from /Users/name/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/commands.rb:40:in `<top (required)>' 
from script/rails:6:in `require' 
from script/rails:6:in `<main>' 

我如何解決這個問題。

P.S.

IM在導軌3

  • 編輯

現在我得到,改變RAILS_ROOT在LIB/sms_fu/sms_fu的102行Rails.root後。 rb(根據Dogbert的回答)

Psych::SyntaxError: couldn't parse YAML at line 7 column 11 
from /Users/name/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:148:in `parse' 
from /Users/name/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:148:in `parse_stream' 
from /Users/name/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:119:in `parse' 
from /Users/name/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:106:in `load' 
from /Users/name/.rvm/gems/[email protected]/gems/sms_fu-1.1.2/lib/sms_fu/sms_fu.rb:55:in `config_yaml' 
from /Users/name/.rvm/gems/[email protected]/gems/sms_fu-1.1.2/lib/sms_fu/sms_fu.rb:65:in `from_address' 
from /Users/name/.rvm/gems/[email protected]/gems/sms_fu-1.1.2/lib/sms_fu/sms_fu.rb:41:in `deliver' 
from (irb):6 
from /Users/name/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/commands/console.rb:45:in `start' 
from /Users/name/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/commands/console.rb:8:in `start' 
from /Users/name/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/commands.rb:40:in `<top (required)>' 
from script/rails:6:in `require' 
from script/rails:6:in `<main>' 

我sms_fu.yml看起來像

config: 
    from_address: [email protected] 

carriers: 
alltel: 
    name: Alltel 
    value: @message.alltel.com 
ameritech: 
    name: Ameritech 
    value: @paging.acswireless.com 
at&t: 
    name: AT&T 
    value: @txt.att.net 
bell-atlantic: 
    name: Bell Atlantic 
    value: @message.bam.com 
bellsouthmobility: 
    name: Bellsouth Mobility 
    value: @blsdcs.net 
blueskyfrog: 
    name: BlueSkyFrog 
    value: @blueskyfrog.com 
boost: 
    name: Boost Mobile 
    value: @myboostmobile.com 
cellularsouth: 
    name: Cellular South 
    value: @csouth1.com 
comcast: 
    name: Comcast PCS 
    value: @comcastpcs.textmsg.com 
cricket: 
    name: Cricket 
    value: @sms.mycricket.com 
kajeet: 
    name: kajeet 
    value: @mobile.kajeet.net 
metropcs: 
    name: Metro PCS 
    value: @mymetropcs.com 
nextel: 
    name: Nextel 
    value: @messaging.nextel.com 
powertel: 
    name: Powertel 
    value: @ptel.net 
pscwireless: 
    name: PSC Wireless 
    value: @sms.pscel.com 
qwest: 
    name: Qwest 
    value: @qwestmp.com 
southernlink: 
    name: Southern Link 
    value: @page.southernlinc.com 
sprint: 
    name: Sprint PCS 
    value: @messaging.sprintpcs.com 
suncom: 
    name: Suncom 
    value: @tms.suncom.com 
t-mobile: 
    name: T-Mobile 
    value: @tmomail.net 
tracfone: 
    name: Tracfone 
    value: @mmst5.tracfone.com 
telus-mobility: 
    name: Telus Mobility 
    value: @msg.telus.com 
virgin: 
    name: Virgin Mobile 
    value: @vmobl.net 
verizon: 
    name: Verizon Wireless 
    value: @vtext.com 
# International Carriers 
aliant-canada: 
    name: Aliant (Canada) 
    value: @chat.wirefree.ca 
beeline-ua: 
    name: Beeline 
    value: @sms.beeline.ua 
bellmobility-canada: 
    name: Bell Mobility (Canada) 
    value: @txt.bell.ca 
bpl-mobile: 
    name: BPL Mobile 
    value: @bplmobile.com 
claro-brazil: 
    name: Claro (Brazil) 
    value: @clarotorpedo.com.br 
claro-nicaragua: 
    name: Claro (Nicaragua) 
    value: @ideasclaro-ca.com 
du-arab-emirates: 
    name: Du (UAE) 
    value: @email2sms.ae 
e-plus-germany: 
    name: E-Plus (Germany) 
    value: @smsmail.eplus.de 
etisalat-arab-emirates: 
    name: Etisalat (UAE) 
    value: @email2sms.ae 
fido-canada: 
    name: Fido 
    value: @fido.ca 
manitobatelecom-canada: 
    name: Manitoba Telecom (Canada) 
    value: @text.mtsmobility.com 
mobinil-egypt: 
    name: Mobinil 
    value: @mobinil.net 
mobistar-belgium: 
    name: Mobistar (Belgium) 
    value: @mobistar.be 
mobitel: 
    name: Mobitel 
    value: @sms.mobitel.lk 
movistar-spain: 
    name: Movistar (Spain) 
    value: @correo.movistar.net 
northerntel-canada: 
    name: NorthernTel (Canada) 
    value: @txt.northerntelmobility.com 
o2-germany: 
    name: o2 (Germany) 
    value: @o2online.de 
o2-uk: 
    name: o2 (UK) 
    value: @mmail.co.uk 
orange-mumbai: 
    name: Orange (Mumbai) 
    value: @orangemail.co.in 
orange-netherlands: 
    name: Orange (Netherlands) 
    value: @sms.orange.nl 
orange-uk: 
    name: Orange (UK) 
    value: @orange.net 
rogers-wireless: 
    name: Rogers Wireless 
    value: @pcs.rogers.com 
rogers-canada: 
    name: Rogers (Canada) 
    value: @pcs.rogers.ca 
sasktel-canada: 
    name: SaskTel (canada) 
    value: @sms.sasktel.ca 
sfr-france: 
    name: SFR (France) 
    value: @sfr.fr 
t-mobile-austria: 
    name: T-Mobile (Austria) 
    value: @sms.t-mobile.at 
t-mobile-germany: 
    name: T-Mobile (Germany) 
    value: @t-d1-sms.de 
t-mobile-germany: 
    name: T-Mobile (Netherlands) 
    value: @gin.nl 
t-mobile-uk: 
    name: T-Mobile (UK) 
    value: @t-mobile.uk.net 
telebec-canada: 
    name: Telebec (Canada) 
    value: @txt.telebecmobilite.com 
telefonica-spain: 
    name: Telefonica (Spain) 
    value: @movistar.net 
telus-canada: 
    name: Telus (Canada) 
    value: @msg.telus.com 
virgin-canada: 
    name: Virgin (Canada) 
    value: @vmobile.ca 
vodafone-germany: 
    name: Vodafone (Germany) 
    value: @vodafone-sms.de 
vodafone-egypt: 
    name: Vodafone (Egypt) 
    value: @vodafone.com.eg 
vodafone-uk: 
    name: Vodafone (UK) 
    value: @sms.vodafone.net 
vodafone-italy: 
    name: Vodafone (Italy) 
    value: @sms.vodafone.it 
vodafone-jp-chuugoku: 
    name: Vodafone (Japan - Chuugoku) 
    value: @n.vodafone.ne.jp 
vodafone-jp-hokkaido: 
    name: Vodafone (Japan - Hokkaido) 
    value: @d.vodafone.ne.jp 
vodafone-jp-hokuriko: 
    name: Vodafone (Japan - Hokuriko) 
    value: @r.vodafone.ne.jp 
vodafone-jp-kansai: 
    name: Vodafone (Japan - Kansai) 
    value: @k.vodafone.ne.jp 
vodafone-jp-osaka: 
    name: Vodafone (Japan - Osaka) 
    value: @k.vodafone.ne.jp 
vodafone-jp-kanto: 
    name: Vodafone (Japan - Kanto) 
    value: @k.vodafone.ne.jp 
vodafone-jp-koushin: 
    name: Vodafone (Japan - Koushin) 
    value: @k.vodafone.ne.jp 
vodafone-jp-tokyo: 
    name: Vodafone (Japan - Tokyo) 
    value: @k.vodafone.ne.jp 
vodafone-jp-kyuushu: 
    name: Vodafone (Japan - Kyuushu) 
    value: @q.vodafone.ne.jp 
vodafone-jp-okinawa: 
    name: Vodafone (Japan - Okinawa) 
    value: @q.vodafone.ne.jp 
vodafone-jp-shikoku: 
    name: Vodafone (Japan - Shikoku) 
    value: @s.vodafone.ne.jp 
vodafone-jp-touhoku: 
    name: Vodafone (Japan - Touhoku) 
    value: @h.vodafone.ne.jp 
vodafone-jp-niigata: 
    name: Vodafone (Japan - Niigata) 
    value: @h.vodafone.ne.jp 
vodafone-jp-toukai: 
    name: Vodafone (Japan - Toukai) 
    value: @h.vodafone.ne.jp 
vodafone-spain: 
    name: Vodafone (Japan - Spain) 
    value: @vodafone.es 

讀通過對正確答案的評論就知道了完整的解決方案

回答

3

這個插件還沒有更新了一段時間。 Rails的過時的RAILS_ROOT贊成Rails.root

你需要從這個文件,行102刪除RAILS_ROOT,並更換Rails.root

directory = defined?(Rails) ? "#{RAILS_ROOT}/config" : "#{File.dirname(__FILE__)}/../../templates" 

directory = defined?(Rails) ? "#{Rails.root}/config" : "#{File.dirname(__FILE__)}/../../templates" 

https://github.com/brendanlim/sms-fu/blob/master/lib/sms_fu/sms_fu.rb#L102

+0

檢查更新的問題 – jack

+0

@jack,你還可以發佈你的'sms_fu.yml'文件嗎? – Dogbert

+0

我貼了它,它需要一段時間,因爲粘貼它不會格式正確,我不得不手動。這是在我的應用程序中的config/sms_fu.yml – jack