[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

`active_gem_with_options': undefined method `activate'

Daniel Sánchez

6/2/2007 9:19:00 PM

i have some problems with this
tengo algunos problemas con esto
==============================================================================
Launched AGI Script /var/lib/asterisk/agi-bin/comprobar-festivos.rb
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:66:in `active_gem_with_options':
undefined method `activate' for Gem:Module (NoMethodError)
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:59:in `require'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:75
from /var/lib/asterisk/agi-bin/comprobar-festivos.rb:17:in
`require'
from /var/lib/asterisk/agi-bin/comprobar-festivos.rb:17
-- AGI Script comprobar-festivos.rb completed, returning 0
==============================================================================

this is my script
este es mi script
==============================================================================
#!/usr/bin/env ruby


# AGI para consulta de festivos en un calendario ICalendar ubicado en
nuestro sistema de archivos.
# Licencia GPL.
# Por I�±aki Baz <ibc@irontec.com>
# Irontec: http://www.i...
# Blog Voz-ip: http://blog....



# Variables:
categoria_festivo = "Festivo"
archivo_calendario = "/var/www/webdav/Spain32Holidays.ics"


require 'rubygems'
require 'icalendar'
require 'date'
require_gem 'ruby-agi'


# Creamos un objeto AGI:
agi = AGI.new

# Calendario ICS:
cal_file = File.open(archivo_calendario)

# Parseamos el fichero:
cals = Icalendar.parse(cal_file)

# "cals" es en realidad un array pues pueden haber varios calendarios en
un fichero ICS. Nos quedamos con el primero (que es el �ºnico):
cal = cals.first

# Fecha de hoy:
hoy = Date.today

# Para hacer pruebas podemos forzar la fecha de hoy:
#hoy = Date.new(2006,11,8)


# Comprobamos si es s�¡bado o domingo:
# S�¡bado = 6
# Domingo = 0
if hoy.wday == 6 || hoy.wday == 0
agi.noop("Es fin de semana, colgamos")
# Reproducimos la grabaci�³n:
agi.stream_file("hoy-es-fin-de-semana")
agi.hangup()
exit
end


# Comprobamos los eventos del d�­a de hoy:
cal.events.each do |event|
inicio = Date.new(event.dtstart.year, event.dtstart.month,
event.dtstart.day)
if event.dtend
fin = Date.new(event.dtend.year, event.dtend.month, event.dtend.day)
else
fin = inicio
end

# Comparamos con "hoy + 1" porque si un evento dura un d�­a significa
que finaliza el d�­a siguiente:
if inicio <= hoy && fin >= hoy + 1
event.categories.each do |categoria|
if categoria == categoria_festivo
agi.noop("Hoy es festivo, colgamos")
# Reproducimos la grabaci�³n:
agi.stream_file("hoy-es-festivo")
agi.hangup()
exit
end
end
end
end
================================================================================
I don't know what to do
no se que hacer..

--
Posted via http://www.ruby-....