la_maquina 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/Gemfile +5 -0
  4. data/Gemfile.lock +20 -1
  5. data/README.md +7 -7
  6. data/lib/la_maquina/dependency_map/base.rb +19 -0
  7. data/lib/la_maquina/dependency_map/constant_map.rb +13 -0
  8. data/lib/la_maquina/dependency_map/yaml_map.rb +15 -0
  9. data/lib/la_maquina/dependency_map.rb +7 -0
  10. data/lib/la_maquina/engine.rb +39 -0
  11. data/lib/la_maquina/error_notifier/base.rb +1 -1
  12. data/lib/la_maquina/{volante.rb → notifier.rb} +10 -8
  13. data/lib/la_maquina/piston/base.rb +2 -2
  14. data/lib/la_maquina/piston/cache_piston.rb +18 -15
  15. data/lib/la_maquina/piston/sunspot_piston.rb +22 -0
  16. data/lib/la_maquina/piston.rb +3 -2
  17. data/lib/la_maquina/version.rb +1 -1
  18. data/lib/la_maquina.rb +3 -2
  19. data/test/dummy/app/models/admin.rb +7 -3
  20. data/test/dummy/app/models/admin_trait.rb +3 -3
  21. data/test/dummy/app/models/admin_trait_modifier.rb +3 -3
  22. data/test/dummy/app/models/guest.rb +2 -2
  23. data/test/dummy/app/models/guest_trait.rb +3 -3
  24. data/test/dummy/app/models/guest_trait_modifier.rb +2 -3
  25. data/test/dummy/app/models/property.rb +2 -3
  26. data/test/dummy/app/models/standalone.rb +2 -2
  27. data/test/dummy/config/database.yml +6 -4
  28. data/test/dummy/config/initializers/la_maquina.rb +8 -2
  29. data/test/dummy/config/la_maquina/dependency_maps/bad_map.yml +1 -0
  30. data/test/dummy/config/la_maquina/dependency_maps/sunspot_piston.yml +1 -0
  31. data/test/dummy/config/sunspot.yml +5 -0
  32. data/test/dummy/db/schema.rb +0 -1
  33. data/test/dummy/db/test.sqlite3 +0 -0
  34. data/test/dummy/lib/dummy_comm_object.rb +1 -1
  35. data/test/dummy/lib/exploding_comm_object.rb +1 -1
  36. data/test/dummy/lib/exploding_piston.rb +5 -0
  37. data/test/dummy/lib/extended_sunspot_piston.rb +13 -0
  38. data/test/dummy/lib/primitive_piston.rb +5 -0
  39. data/test/dummy/lib/test_notifier.rb +2 -2
  40. data/test/dummy/log/development.log +34 -0
  41. data/test/unit/dependency_maps/yamp_map_test.rb +26 -0
  42. data/test/unit/engine_test.rb +32 -0
  43. data/test/unit/error_notifier_test.rb +21 -0
  44. data/test/{la_maquina_test.rb → unit/la_maquina_test.rb} +12 -0
  45. data/test/unit/notifier_test.rb +123 -0
  46. data/test/unit/piston_test.rb +10 -0
  47. data/test/unit/pistons/cache_piston_test.rb +26 -0
  48. data/test/unit/pistons/sunspot_piston_test.rb +25 -0
  49. metadata +39 -12
  50. data/lib/la_maquina/ciguenal.rb +0 -27
  51. data/test/ciguenal_test.rb +0 -30
  52. data/test/dummy/lib/test_piston.rb +0 -5
  53. data/test/volante_test.rb +0 -136
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ce3d8574213b0db902e504ad4b66e30e0961951
4
- data.tar.gz: 258fec304013d1b468633d04c4cbc4f3408522a5
3
+ metadata.gz: e3e37589f3930b79eecc19e0743e9b6b1fcf1d9f
4
+ data.tar.gz: c332e847878318ab3db7c764f7f19738b41d2338
5
5
  SHA512:
6
- metadata.gz: 18fbd41257b6fa9a3e423887fa2a0c345b1e51e5d0bd4de656abdd69430215f508060a54696fdebc2318e06ab9845e12f68a5b0749e814456c4b4323aa208864
7
- data.tar.gz: 37f9ca36e459a12e4bdf199381af7eb8b007f38a9a5e2a5a62a52ffa35d54256c42addd9bcfedbcb6998b4a27d459d94d56a0ebc00a79c52818ff0de0fdb83b7
6
+ metadata.gz: 22aad45ed90d3542aedb927e47399297c0369fd17fcf6b786958704a75a62c1382832f99525987c477856c24f595e95c1ee9ad2b2bbc6a094a4e70c0ff0885ab
7
+ data.tar.gz: ae9ddc8d32213ca73d940d3eea5abb1dce9e984f4423be28bf4750d432c0d4a03d53e5b4db7f8f9bc6b5b5adfce687e44873dba279735036b7b883a872fa54a0
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  coverage/
2
- test/dummy/log/*
2
+ test/dummy/log/*
3
+ test/dummy/solr/*
data/Gemfile CHANGED
@@ -18,5 +18,10 @@ gem "rails", rails
18
18
  gem "redis"
19
19
  gem "redis-namespace"
20
20
 
21
+ # solr
22
+ gem 'sunspot_rails'
23
+ gem 'sunspot_solr' # optional pre-packaged Solr distribution for use in development
24
+ gem 'progress_bar'
25
+
21
26
  gem 'test_after_commit', :group => :test
22
27
  gem 'simplecov', :group => :test
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- la_maquina (0.0.2)
4
+ la_maquina (0.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -47,6 +47,7 @@ GEM
47
47
  erubis (2.7.0)
48
48
  globalid (0.3.3)
49
49
  activesupport (>= 4.1.0)
50
+ highline (1.6.21)
50
51
  hike (1.2.3)
51
52
  i18n (0.7.0)
52
53
  json (1.8.2)
@@ -60,6 +61,11 @@ GEM
60
61
  multi_json (1.10.1)
61
62
  nokogiri (1.6.6.2)
62
63
  mini_portile (~> 0.6.0)
64
+ options (2.3.2)
65
+ pr_geohash (1.0.0)
66
+ progress_bar (1.0.3)
67
+ highline (~> 1.6.1)
68
+ options (~> 2.3.0)
63
69
  rack (1.6.0)
64
70
  rack-test (0.6.3)
65
71
  rack (>= 1.0)
@@ -91,6 +97,8 @@ GEM
91
97
  redis (3.2.1)
92
98
  redis-namespace (1.5.1)
93
99
  redis (~> 3.0, >= 3.0.4)
100
+ rsolr (1.0.12)
101
+ builder (>= 2.1.2)
94
102
  simplecov (0.9.1)
95
103
  docile (~> 1.1.0)
96
104
  multi_json (~> 1.0)
@@ -106,6 +114,14 @@ GEM
106
114
  activesupport (>= 3.0)
107
115
  sprockets (>= 2.8, < 4.0)
108
116
  sqlite3 (1.3.10)
117
+ sunspot (2.2.0)
118
+ pr_geohash (~> 1.0)
119
+ rsolr (~> 1.0.7)
120
+ sunspot_rails (2.2.0)
121
+ nokogiri
122
+ rails (>= 3)
123
+ sunspot (= 2.2.0)
124
+ sunspot_solr (2.2.0)
109
125
  test_after_commit (0.4.0)
110
126
  activerecord (>= 3.2)
111
127
  thor (0.19.1)
@@ -120,10 +136,13 @@ PLATFORMS
120
136
  DEPENDENCIES
121
137
  bundler (~> 1.6)
122
138
  la_maquina!
139
+ progress_bar
123
140
  rails (>= 4.2.0)
124
141
  rake
125
142
  redis
126
143
  redis-namespace
127
144
  simplecov
128
145
  sqlite3
146
+ sunspot_rails
147
+ sunspot_solr
129
148
  test_after_commit
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # La Maquina
2
2
 
3
- TODO: Write a gem description
3
+ Model graph traversal
4
4
 
5
5
  ## Installation
6
6
 
@@ -22,7 +22,7 @@ Or install it yourself as:
22
22
 
23
23
  ### Pistons
24
24
 
25
- Once the `Ciguenal` is called it fires the `Piston`s, the behavior of which is entirely up to you.
25
+ Once the `Engine` is called it fires the `Piston`s, the behavior of which is entirely up to you.
26
26
 
27
27
  So, let's say, we have a couple objects that look like:
28
28
 
@@ -41,8 +41,8 @@ end
41
41
  class Machete < ActiveRecord::Base
42
42
  belongs_to :danny_trejo
43
43
 
44
- include LaMaquina::Volante
45
- notifies :danny_trejo
44
+ include LaMaquina::Notifier
45
+ notifies_about :danny_trejo
46
46
  end
47
47
  ```
48
48
  and we want to let `DannyTrejo` know when his `Machete` has been updated so that we can reindex him.
@@ -52,8 +52,8 @@ and we want to let `DannyTrejo` know when his `Machete` has been updated so that
52
52
  ```ruby
53
53
  class SunspotPiston < LaMaquina::Piston::Base
54
54
  class << self
55
- def fire!(klass = "", id = nil)
56
- indexed_class.find(id).index!
55
+ def fire!( notified_class, id, notifier_class = "" )
56
+ indexed_class(notified_class).find(id).index!
57
57
  end
58
58
 
59
59
  private
@@ -76,7 +76,7 @@ For example, if you're using the CachePiston and need to set up Redis, here's ho
76
76
 
77
77
  ```ruby
78
78
  LaMaquina::Piston::CachePiston.redis = Redis::Namespace.new(:cache_piston, redis: Redis.new)
79
- LaMaquina::Ciguenal.install LaMaquina::Piston::CachePiston, TestPiston
79
+ LaMaquina::Engine.install LaMaquina::Piston::CachePiston, TestPiston
80
80
  LaMaquina.error_notifier = LaMaquina::ErrorNotifier::HoneybadgerNotifier
81
81
  ```
82
82
  #### ErrorNotifier
@@ -0,0 +1,19 @@
1
+ module LaMaquina
2
+ module DependencyMap
3
+ class Base
4
+ def initialize( path = nil )
5
+ if path
6
+ self.map = YAML.load_file(path).with_indifferent_access
7
+ end
8
+ end
9
+
10
+ def mapping_for(*args)
11
+ raise "A dependency map has to implement 'mapping_for'"
12
+ end
13
+
14
+ protected
15
+
16
+ attr_accessor :map
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ module LaMaquina
2
+ module DependencyMap
3
+ class ConstantMap < LaMaquina::DependencyMap::Base
4
+
5
+ def mapping_for(notified_class, id)
6
+ notified_class.camelize.constantize
7
+ rescue => e
8
+ LaMaquina.error_notifier.notify( e,
9
+ missing_class: notified_class )
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module LaMaquina
2
+ module DependencyMap
3
+ class YamlMap < LaMaquina::DependencyMap::Base
4
+ def mapping_for(*args)
5
+ submap = map
6
+ args.each do |key|
7
+ submap = submap[key]
8
+ end
9
+ submap
10
+ rescue => e
11
+ LaMaquina.error_notifier.notify( e )
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ module LaMaquina
2
+ module DependencyMap
3
+ autoload :Base, 'la_maquina/dependency_map/base'
4
+ autoload :ConstantMap, 'la_maquina/dependency_map/constant_map'
5
+ autoload :YamlMap, 'la_maquina/dependency_map/yaml_map'
6
+ end
7
+ end
@@ -0,0 +1,39 @@
1
+ module LaMaquina
2
+ class Engine
3
+
4
+ class << self
5
+ protected
6
+
7
+ attr_accessor :pistons
8
+ end
9
+ self.pistons = []
10
+
11
+ class << self
12
+
13
+ def notify!( notified_class, id, notifier_class = "" )
14
+ pistons.each do |piston|
15
+ begin
16
+ # We can't thread this because Rails executes this code before the commit somehow.
17
+ # What. yeah. I don't know either.
18
+
19
+ # Thread.new{
20
+ piston.fire! notified_class, id, notifier_class
21
+ # }.join
22
+ rescue => e
23
+ LaMaquina.error_notifier.notify( e,
24
+ misfiring_piston: piston,
25
+ notified_class: notified_class,
26
+ notified_id: id,
27
+ notifier_class: notifier_class )
28
+ end
29
+ end
30
+ end
31
+
32
+ def install(*attrs)
33
+ attrs.each do |piston|
34
+ self.pistons << piston
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -3,7 +3,7 @@ module LaMaquina
3
3
  class Base
4
4
 
5
5
  def self.notify(error, details = {})
6
- throw "There's no ErrorNotifier set or id doesn't implement `notify` as it should."
6
+ raise "There's no ErrorNotifier set or id doesn't implement `notify` as it should."
7
7
  end
8
8
 
9
9
  end
@@ -1,5 +1,5 @@
1
1
  module LaMaquina
2
- module Volante
2
+ module Notifier
3
3
  extend ActiveSupport::Concern
4
4
  include ActiveRecord::Callbacks
5
5
 
@@ -13,7 +13,7 @@ module LaMaquina
13
13
 
14
14
 
15
15
  class << self
16
- def notifies(object, opts = {})
16
+ def notifies_about(object, opts = {})
17
17
  notified_objects << {:object => object, :options => opts}
18
18
  end
19
19
  end
@@ -32,18 +32,20 @@ module LaMaquina
32
32
  klass = notified_klass( object, options )
33
33
  id = notified_id( object, options )
34
34
 
35
+ notifier_class = LaMaquina.format_object_name(self)
36
+
35
37
  begin
36
38
  if comm_object
37
- comm_object.notify(:notified_class => klass, :notified_id => id, :notifier_class => LaMaquina.format_object_name(self))
39
+ comm_object.notify(:notified_class => klass, :notified_id => id, :notifier_class => notifier_class)
38
40
  else
39
- LaMaquina::Ciguenal.notify!(klass, id)
41
+ LaMaquina::Engine.notify! klass, id, notifier_class
40
42
  end
41
43
  rescue => e
42
44
  LaMaquina.error_notifier.notify( e,
43
- :notified_class => klass,
44
- :notified_id => id,
45
- :notifier_class => LaMaquina.format_object_name(self),
46
- :notifier_id => self.id)
45
+ notified_class: klass,
46
+ notified_id: id,
47
+ notifier_class: notifier_class,
48
+ notifier_id: self.id)
47
49
  end
48
50
  end
49
51
  end
@@ -2,8 +2,8 @@ module LaMaquina
2
2
  module Piston
3
3
  class Base
4
4
 
5
- def self.fire!(klass = "", id = nil)
6
- throw "A piston has to implement 'fire!'"
5
+ def self.fire!( notified_class, id, notifier_class = "" )
6
+ raise "A piston has to implement 'fire!'"
7
7
  end
8
8
 
9
9
  end
@@ -4,32 +4,35 @@ module LaMaquina
4
4
  class << self
5
5
  attr_accessor :redis
6
6
 
7
- def fire!(klass = "", id = nil)
8
-
9
- updated_at = SecureRandom.uuid()
10
- redis_key_string = redis_key klass, id
11
- # make a class var with a default
12
-
13
- cache_key = "#{redis_key_string}/#{updated_at}"
14
- redis.set redis_key_string, cache_key
15
-
16
- cache_key
7
+ def fire!( notified_class, id, notifier_class = "" )
8
+ update_cache notified_class, id
17
9
  end
18
10
 
19
- def cache_key(klass, id)
11
+ def cache_key(notified_class, id)
20
12
 
21
- redis_key_string = redis_key klass, id
13
+ key = redis_key notified_class, id
22
14
 
23
- key = redis.get redis_key_string
15
+ cache_key = redis.get key
24
16
  # key found
25
- return key if key
17
+ return cache_key if cache_key
26
18
 
27
19
  # there's no key; we can't very well rerun nil for cache_key. Let's make a new entry
28
- touch_cache klass, id
20
+ update_cache notified_class, id
29
21
  end
30
22
 
31
23
  protected
32
24
 
25
+ def update_cache( notified_class, id)
26
+ uuid = SecureRandom.uuid()
27
+ key = redis_key notified_class, id
28
+ # make a class var with a default
29
+
30
+ cache_key = "#{key}/#{uuid}"
31
+ redis.set key, cache_key
32
+
33
+ cache_key
34
+ end
35
+
33
36
  def redis_key(klass, id)
34
37
  "#{klass}/#{id}"
35
38
  end
@@ -0,0 +1,22 @@
1
+ module LaMaquina
2
+ module Piston
3
+ class SunspotPiston < LaMaquina::Piston::Base
4
+
5
+ class << self
6
+ def fire!( notified_class, id, notifier_class = "" )
7
+ target_class = map.mapping_for notified_class, id
8
+ target = target_class.find(id)
9
+ target.solr_index!
10
+ rescue => e
11
+ LaMaquina.error_notifier.notify( e,
12
+ notified_class: klass,
13
+ notified_id: id,
14
+ notifier_class: notifier_class )
15
+ end
16
+
17
+ attr_accessor :map
18
+ end
19
+ self.map = LaMaquina::DependencyMap::ConstantMap.new
20
+ end
21
+ end
22
+ end
@@ -1,6 +1,7 @@
1
1
  module LaMaquina
2
2
  module Piston
3
- autoload :Base, 'la_maquina/piston/base'
4
- autoload :CachePiston, 'la_maquina/piston/cache_piston'
3
+ autoload :Base, 'la_maquina/piston/base'
4
+ autoload :CachePiston, 'la_maquina/piston/cache_piston'
5
+ autoload :SunspotPiston, 'la_maquina/piston/sunspot_piston'
5
6
  end
6
7
  end
@@ -1,3 +1,3 @@
1
1
  module LaMaquina
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/la_maquina.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  require "la_maquina/version"
2
2
 
3
3
  module LaMaquina
4
- autoload :Ciguenal, 'la_maquina/ciguenal'
4
+ autoload :DependencyMap, 'la_maquina/dependency_map'
5
+ autoload :Engine, 'la_maquina/engine'
5
6
  autoload :ErrorNotifier, 'la_maquina/error_notifier'
6
7
  autoload :Piston, 'la_maquina/piston'
7
- autoload :Volante, 'la_maquina/volante'
8
+ autoload :Notifier, 'la_maquina/notifier'
8
9
 
9
10
  mattr_accessor :error_notifier
10
11
  error_notifier ||= LaMaquina::ErrorNotifier::Base
@@ -4,8 +4,12 @@ class Admin < ActiveRecord::Base
4
4
 
5
5
  has_many :properties, :as => :user
6
6
 
7
- include LaMaquina::Volante
8
- notifies :self
7
+ searchable do
8
+ text :name
9
+ end
9
10
 
10
- notifies :self, :using => ::DummyCommObject
11
+ include LaMaquina::Notifier
12
+ notifies_about :self
13
+
14
+ notifies_about :self, using: ::DummyCommObject
11
15
  end
@@ -2,8 +2,8 @@ class AdminTrait < ActiveRecord::Base
2
2
  belongs_to :user, :class_name => "Admin"
3
3
  belongs_to :thing, :class_name => "Trait"
4
4
 
5
- include LaMaquina::Volante
5
+ include LaMaquina::Notifier
6
6
 
7
- notifies :user, :class => Admin
8
- notifies :thing, :class_name => "Trait"
7
+ notifies_about :user, :class => Admin
8
+ notifies_about :thing, :class_name => "Trait"
9
9
  end
@@ -1,8 +1,8 @@
1
1
  class AdminTraitModifier < ActiveRecord::Base
2
2
  belongs_to :admin_trait
3
3
 
4
- include LaMaquina::Volante
4
+ include LaMaquina::Notifier
5
5
 
6
- notifies :user, :through => :admin_trait, :class_name => "Admin"
7
- notifies :thing, :through => :admin_trait, :class => Trait
6
+ notifies_about :user, :through => :admin_trait, :class_name => "Admin"
7
+ notifies_about :thing, :through => :admin_trait, :class => Trait
8
8
  end
@@ -4,7 +4,7 @@ class Guest < ActiveRecord::Base
4
4
 
5
5
  has_many :properties, :as => :user
6
6
 
7
- include LaMaquina::Volante
7
+ include LaMaquina::Notifier
8
8
 
9
- notifies :self
9
+ notifies_about :self
10
10
  end
@@ -2,8 +2,8 @@ class GuestTrait < ActiveRecord::Base
2
2
  belongs_to :guest
3
3
  belongs_to :trait
4
4
 
5
- include LaMaquina::Volante
5
+ include LaMaquina::Notifier
6
6
 
7
- notifies :guest
8
- notifies :trait
7
+ notifies_about :guest
8
+ notifies_about :trait
9
9
  end
@@ -1,8 +1,7 @@
1
1
  class GuestTraitModifier < ActiveRecord::Base
2
2
  belongs_to :guest_trait
3
3
 
4
- include LaMaquina::Volante
4
+ include LaMaquina::Notifier
5
5
 
6
-
7
- notifies :guest, :through => :guest_trait
6
+ notifies_about :guest, :through => :guest_trait
8
7
  end
@@ -1,8 +1,7 @@
1
1
  class Property < ActiveRecord::Base
2
2
  belongs_to :user, :polymorphic => true
3
3
 
4
- include LaMaquina::Volante
4
+ include LaMaquina::Notifier
5
5
 
6
-
7
- notifies :user, :polymorphic => true
6
+ notifies_about :user, :polymorphic => true
8
7
  end
@@ -1,5 +1,5 @@
1
1
  class Standalone < ActiveRecord::Base
2
- include LaMaquina::Volante
2
+ include LaMaquina::Notifier
3
3
 
4
- notifies :self, :comm_object => ::ExplodingCommObject
4
+ notifies_about :self, using: ::ExplodingCommObject
5
5
  end
@@ -17,10 +17,12 @@ development:
17
17
  # re-generated from your development database when you run "rake".
18
18
  # Do not set this db to the same as development or production.
19
19
  test:
20
- adapter: sqlite3
21
- database: ":memory:"
22
- pool: 5
23
- timeout: 5000
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+ # adapter: sqlite3
23
+ # database: ":memory:"
24
+ # pool: 5
25
+ # timeout: 5000
24
26
 
25
27
  production:
26
28
  <<: *default
@@ -1,3 +1,9 @@
1
1
  LaMaquina::Piston::CachePiston.redis = Redis::Namespace.new(:cache_piston, redis: Redis.new)
2
- LaMaquina::Ciguenal.install LaMaquina::Piston::CachePiston, TestPiston
3
- LaMaquina.error_notifier = LaMaquina::ErrorNotifier::TestNotifier
2
+ ExtendedSunspotPiston.yaml_map = LaMaquina::DependencyMap::YamlMap.new( Rails.root + 'config/la_maquina/dependency_maps/sunspot_piston.yml' )
3
+
4
+ LaMaquina::Engine.install LaMaquina::Piston::CachePiston,
5
+ LaMaquina::Piston::SunspotPiston,
6
+ PrimitivePiston,
7
+ ExtendedSunspotPiston
8
+
9
+ LaMaquina.error_notifier = TestNotifier
@@ -0,0 +1,5 @@
1
+ test:
2
+ solr:
3
+ hostname: localhost
4
+ port: 8980
5
+ log_level: OFF
@@ -12,5 +12,4 @@
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
14
  ActiveRecord::Schema.define(version: 0) do
15
-
16
15
  end
Binary file
@@ -1,5 +1,5 @@
1
1
  class DummyCommObject
2
- def self.notify! params
2
+ def self.notify params
3
3
  $dummy_params = params
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  class ExplodingCommObject
2
- def self.notify! params
2
+ def self.notify params
3
3
  raise "oh noes!"
4
4
  end
5
5
  end
@@ -0,0 +1,5 @@
1
+ class ExplodingPiston < LaMaquina::Piston::Base
2
+ def self.fire!( notified_class, id, notifier_class = "" )
3
+ raise "NOPE! LOL"
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ class ExtendedSunspotPiston < LaMaquina::Piston::SunspotPiston
2
+ class << self
3
+ def fire!( notified_class, id, notifier_class = "" )
4
+ if yaml_map.mapping_for notified_class
5
+ super
6
+ $last_reindexed = notified_class
7
+ end
8
+ end
9
+
10
+ attr_accessor :yaml_map
11
+ end
12
+ self.map = LaMaquina::DependencyMap::ConstantMap.new
13
+ end
@@ -0,0 +1,5 @@
1
+ class PrimitivePiston < LaMaquina::Piston::Base
2
+ def self.fire!( notified_class, id, notifier_class = "" )
3
+ $fire_message = "#{notified_class}/#{id}"
4
+ end
5
+ end
@@ -1,6 +1,6 @@
1
1
  class TestNotifier < LaMaquina::ErrorNotifier::Base
2
2
  def self.notify(error, details = {})
3
- $error = error
4
- $details = details
3
+ $error = error
4
+ $deets = details
5
5
  end
6
6
  end