communicator 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -14,6 +14,9 @@ tmtags
14
14
  ## VIM
15
15
  *.swp
16
16
 
17
+ ## RubyMine
18
+ .idea
19
+
17
20
  ## PROJECT::GENERAL
18
21
  coverage
19
22
  rdoc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- communicator (0.1.5)
4
+ communicator (0.1.10)
5
5
  activerecord (< 3.0.0)
6
6
  httparty (>= 0.6.1)
7
7
  json (>= 1.4.0)
data/Rakefile CHANGED
@@ -19,7 +19,7 @@ begin
19
19
  gem.add_development_dependency 'rack-test', ">= 0.5.6"
20
20
  gem.add_development_dependency 'bundler', ">= 1.0.0"
21
21
  gem.add_development_dependency 'sqlite3-ruby', ">= 1.3.0"
22
- gem.add_development_dependency 'jeweler', '>= 1.4.0'
22
+ gem.add_development_dependency 'jeweler', '~> 1.4.0'
23
23
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
24
24
  end
25
25
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.9
1
+ 0.1.10
data/communicator.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{communicator}
8
- s.version = "0.1.9"
8
+ s.version = "0.1.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Christoph Olszowka"]
12
- s.date = %q{2010-11-16}
12
+ s.date = %q{2010-11-19}
13
13
  s.description = %q{Data push/pull between apps with local inbound/outbound queue and easy publish/process interface}
14
14
  s.email = %q{christoph at olszowka de}
15
15
  s.extra_rdoc_files = [
@@ -86,7 +86,7 @@ Gem::Specification.new do |s|
86
86
  s.add_development_dependency(%q<rack-test>, [">= 0.5.6"])
87
87
  s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
88
88
  s.add_development_dependency(%q<sqlite3-ruby>, [">= 1.3.0"])
89
- s.add_development_dependency(%q<jeweler>, [">= 1.4.0"])
89
+ s.add_development_dependency(%q<jeweler>, ["~> 1.4.0"])
90
90
  else
91
91
  s.add_dependency(%q<sinatra>, ["~> 1.1.0"])
92
92
  s.add_dependency(%q<activerecord>, ["< 3.0.0"])
@@ -97,7 +97,7 @@ Gem::Specification.new do |s|
97
97
  s.add_dependency(%q<rack-test>, [">= 0.5.6"])
98
98
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
99
99
  s.add_dependency(%q<sqlite3-ruby>, [">= 1.3.0"])
100
- s.add_dependency(%q<jeweler>, [">= 1.4.0"])
100
+ s.add_dependency(%q<jeweler>, ["~> 1.4.0"])
101
101
  end
102
102
  else
103
103
  s.add_dependency(%q<sinatra>, ["~> 1.1.0"])
@@ -109,7 +109,7 @@ Gem::Specification.new do |s|
109
109
  s.add_dependency(%q<rack-test>, [">= 0.5.6"])
110
110
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
111
111
  s.add_dependency(%q<sqlite3-ruby>, [">= 1.3.0"])
112
- s.add_dependency(%q<jeweler>, [">= 1.4.0"])
112
+ s.add_dependency(%q<jeweler>, ["~> 1.4.0"])
113
113
  end
114
114
  end
115
115
 
@@ -48,8 +48,12 @@ module Communicator::ActiveRecordIntegration
48
48
  end
49
49
  self.updated_from_message = true
50
50
  save!
51
+
51
52
  rescue => err
52
53
  Communicator.logger.warn "Failed to process message on #{self.class} ##{id}! Errors: #{self.errors.map{|k,v| "#{k}: #{v}"}.join(", ")}"
54
+ if respond_to?(:report_exception)
55
+ report_exception err, "Validation Errors" => "Errors: #{self.errors.map{|k,v| "#{k}: #{v}"}.join(", ")}", "JSON Input" => input.inspect
56
+ end
53
57
  raise err
54
58
  end
55
59
  end
@@ -18,6 +18,15 @@ class Communicator::InboundMessage < ActiveRecord::Base
18
18
  inbound_msg.save!
19
19
  Communicator.logger.info "Created inbound message from json, local id is #{inbound_msg.id}"
20
20
  inbound_msg
21
+
22
+ rescue => err
23
+ if respond_to?(:report_exception)
24
+ report_exception err, "Validation Errors" => "Errors: #{inbound_msg.errors.map{|k,v| "#{k}: #{v}"}.join(", ")}",
25
+ "Inbound Message Record" => inbound_msg.attributes.inspect,
26
+ "JSON Message" => json_message.inspect
27
+ end
28
+
29
+ raise err
21
30
  end
22
31
 
23
32
  # Expects an already demarshalled collection array containing remote message data, which
@@ -52,8 +61,16 @@ class Communicator::InboundMessage < ActiveRecord::Base
52
61
  self.processed_at = Time.now
53
62
  self.save!
54
63
  Communicator.logger.info "Processed inbound message ##{id} successfully"
64
+
55
65
  rescue => err
56
66
  Communicator.logger.warn "Failed to store inbound message ##{id}! Errors: #{self.errors.map{|k,v| "#{k}: #{v}"}.join(", ")}"
67
+
68
+ if respond_to?(:report_exception)
69
+ report_exception err, "Validation Errors" => "Errors: #{self.errors.map{|k,v| "#{k}: #{v}"}.join(", ")}",
70
+ "Inbound Message" => self.attributes.inspect,
71
+ "JSON Content" => self.message_content.inspect
72
+ end
73
+
57
74
  raise err
58
75
  end
59
76
  end
@@ -17,7 +17,16 @@ namespace :communicator do
17
17
 
18
18
  desc "Runs Communicator::Client.push and Communicator::Client.pull in current Rails.env"
19
19
  task :communicate => :environment do
20
- Communicator::Client.push
21
- Communicator::Client.pull
20
+ begin
21
+ Communicator::Client.push
22
+ rescue => err
23
+ report_exception err, "Status" => "Sync failed while trying to PUSH messages"
24
+ end
25
+
26
+ begin
27
+ Communicator::Client.pull
28
+ rescue => err
29
+ report_exception err, "Status" => "Sync failed while trying to PULL messages"
30
+ end
22
31
  end
23
32
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: communicator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 9
10
- version: 0.1.9
9
+ - 10
10
+ version: 0.1.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Christoph Olszowka
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-16 00:00:00 +01:00
18
+ date: 2010-11-19 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -168,7 +168,7 @@ dependencies:
168
168
  requirement: &id010 !ruby/object:Gem::Requirement
169
169
  none: false
170
170
  requirements:
171
- - - ">="
171
+ - - ~>
172
172
  - !ruby/object:Gem::Version
173
173
  hash: 7
174
174
  segments: