Pulse 1.2.6 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -91,14 +91,14 @@ module Pulse
91
91
  end if @callbacks[name]
92
92
 
93
93
 
94
- begin
95
- @scripts.each do |script|
94
+ @scripts.each do |script|
95
+ begin
96
96
  if script.respond_to? name
97
97
  script.__send__ name, *args
98
98
  end
99
+ rescue => exception
100
+ puts "Script error: #{exception.message} on line #{exception.line + 1} in #{script.path}"
99
101
  end
100
- rescue
101
- puts "Script error #$!"
102
102
  end
103
103
  end
104
104
 
@@ -3,3 +3,9 @@
3
3
  class String
4
4
  alias_method :starts_with?, :start_with?
5
5
  end
6
+
7
+ class Exception
8
+ def line
9
+ backtrace[0].match(/^.*?:(\d+):/)[1].to_i
10
+ end
11
+ end
@@ -3,7 +3,7 @@
3
3
  module Pulse
4
4
  class Script < Module
5
5
 
6
- attr_accessor :name, :author, :version
6
+ attr_accessor :name, :author, :version, :path
7
7
 
8
8
  def initialize path, client
9
9
  @path, @client = path, client
@@ -37,6 +37,8 @@ module Pulse
37
37
  script ? script.cache : nil
38
38
  end
39
39
 
40
+ def script name; @client.scripts.find { |script| script.name == name } end
41
+
40
42
  def has_cache?
41
43
  File.exists? "#{File.expand_path File.dirname $0}/cache/#@name.yml"
42
44
  end
@@ -5,7 +5,7 @@ module Pulse
5
5
  attr_accessor :name, :user, :host, :channel
6
6
 
7
7
  def initialize name
8
- @name = name.sub /[^\w\[\]]+/, ''
8
+ @name = name.sub /^[@|~|\+|%|&]/, ''
9
9
  end
10
10
 
11
11
  def synchronize sender
data/library/pulse.rb CHANGED
@@ -24,7 +24,7 @@ module Pulse
24
24
 
25
25
  class << self
26
26
  def connect options, &block
27
- puts "=> Pulse #{Pulse::Version}"
27
+ puts "=> Pulse #{Version}"
28
28
 
29
29
  Client.new(options).tap do |client|
30
30
  client.instance_eval &block
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 2
8
- - 6
9
- version: 1.2.6
8
+ - 8
9
+ version: 1.2.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mikkel Kroman
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: executables
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-28 00:00:00 +01:00
17
+ date: 2010-12-11 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies: []
20
20