acts_as_cleo 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -14,6 +14,7 @@ group :development, :test do
14
14
  gem 'ruby-debug19', :require => 'ruby-debug'
15
15
  gem 'fixtures'
16
16
  gem 'sqlite3'
17
+ gem 'database_cleaner'
17
18
  end
18
19
 
19
20
  gem 'happymapper'
data/README.rdoc CHANGED
@@ -19,6 +19,12 @@ To disable auto flushing of indexer queue
19
19
 
20
20
  By default, auto indexer flushing is enabled
21
21
 
22
+ To enable auto processing of the Redis queue append
23
+ auto_enable_queue: true
24
+
25
+ to any environment you wish to have the queue auto added to your ENV['QUEUE']
26
+
27
+
22
28
  === Usage
23
29
 
24
30
  Cleo.find(int) # Find Cleo entry by Cleo native id
@@ -71,9 +77,7 @@ After running bundle install execute the generate script to install acts_as_cleo
71
77
  This generate command will install the following files:
72
78
 
73
79
  === Background Job Processors
74
- * app/jobs/create.rb
75
- * app/jobs/update.rb
76
- * app/jobs/delete.rb
80
+ * app/jobs/cleo_processor.rb
77
81
 
78
82
  === Configuration and Initialization files
79
83
  * config/cleo.yml
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.4.0
data/acts_as_cleo.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "acts_as_cleo"
8
- s.version = "2.3.0"
8
+ s.version = "2.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Robert R. Meyer"]
12
- s.date = "2012-03-27"
12
+ s.date = "2012-03-28"
13
13
  s.description = "LinkedIn Open Source type ahead tool's REST API as a ruby gem. Now with Reddis support."
14
14
  s.email = "Blue.Dog.Archolite@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  "lib/acts_as_cleo/acts_methods.rb",
28
28
  "lib/acts_as_cleo/class_methods.rb",
29
29
  "lib/acts_as_cleo/instance_methods.rb",
30
+ "lib/acts_as_cleo/private_methods.rb",
30
31
  "lib/acts_as_cleo/result.rb",
31
32
  "lib/acts_as_cleo/version.rb",
32
33
  "lib/cleo.rb",
@@ -37,9 +38,9 @@ Gem::Specification.new do |s|
37
38
  "lib/generators/acts_as_cleo/install/templates/cleo.yml",
38
39
  "lib/generators/acts_as_cleo/install/templates/cleo_initalizer.rb",
39
40
  "lib/generators/acts_as_cleo/install/templates/install.rb",
40
- "lib/generators/acts_as_cleo/install/templates/jobs/create.rb",
41
- "lib/generators/acts_as_cleo/install/templates/jobs/delete.rb",
42
- "lib/generators/acts_as_cleo/install/templates/jobs/update.rb",
41
+ "lib/generators/acts_as_cleo/install/templates/jobs/cleo_processor.rb",
42
+ "lib/generators/acts_as_cleo/install/templates/update.rb",
43
+ "lib/generators/acts_as_cleo/update/update_generator.rb",
43
44
  "test/config/cleo.yml",
44
45
  "test/data/xml/cleo/element.xml",
45
46
  "test/data/xml/cleo/elements.xml",
@@ -52,17 +53,13 @@ Gem::Specification.new do |s|
52
53
  "test/db/migrate/005_create_authors.rb",
53
54
  "test/db/migrate/006_create_postings.rb",
54
55
  "test/db/migrate/007_cleo_table.rb",
55
- "test/db/test.db",
56
56
  "test/fixtures/authors.yml",
57
57
  "test/fixtures/books.yml",
58
58
  "test/fixtures/categories.yml",
59
59
  "test/fixtures/electronics.yml",
60
60
  "test/fixtures/movies.yml",
61
61
  "test/helper.rb",
62
- "test/models/author.rb",
63
62
  "test/models/book.rb",
64
- "test/models/category.rb",
65
- "test/models/electronic.rb",
66
63
  "test/models/movie.rb",
67
64
  "test/test_install_generator.rb",
68
65
  "test/unit/test_active_record_callback_hooks.rb",
@@ -94,6 +91,7 @@ Gem::Specification.new do |s|
94
91
  s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
95
92
  s.add_development_dependency(%q<fixtures>, [">= 0"])
96
93
  s.add_development_dependency(%q<sqlite3>, [">= 0"])
94
+ s.add_development_dependency(%q<database_cleaner>, [">= 0"])
97
95
  else
98
96
  s.add_dependency(%q<happymapper>, [">= 0"])
99
97
  s.add_dependency(%q<rails>, [">= 3.1.0"])
@@ -106,6 +104,7 @@ Gem::Specification.new do |s|
106
104
  s.add_dependency(%q<ruby-debug19>, [">= 0"])
107
105
  s.add_dependency(%q<fixtures>, [">= 0"])
108
106
  s.add_dependency(%q<sqlite3>, [">= 0"])
107
+ s.add_dependency(%q<database_cleaner>, [">= 0"])
109
108
  end
110
109
  else
111
110
  s.add_dependency(%q<happymapper>, [">= 0"])
@@ -119,6 +118,7 @@ Gem::Specification.new do |s|
119
118
  s.add_dependency(%q<ruby-debug19>, [">= 0"])
120
119
  s.add_dependency(%q<fixtures>, [">= 0"])
121
120
  s.add_dependency(%q<sqlite3>, [">= 0"])
121
+ s.add_dependency(%q<database_cleaner>, [">= 0"])
122
122
  end
123
123
  end
124
124
 
@@ -2,30 +2,19 @@ module ActsAsCleo
2
2
  module InstanceMethods
3
3
  # callback hooks to keep cleo insync with data
4
4
  def create_cleo
5
- set_cleo_id
6
- if Cleo::Server.async?
7
- Resque.enqueue(Cleo::ResqueCreate, record_type.classify, self.id)
8
- else
9
- Cleo.create(self)
10
- end
5
+ Cleo.create(self)
11
6
  end
12
7
 
13
8
  def update_cleo
14
- if Cleo::Server.async?
15
- Resque.enqueue(Cleo::ResqueUpdate, record_type.classify, self.id)
16
- else
17
- Cleo.update(self)
18
- end
9
+ Cleo.update(self)
19
10
  end
20
11
 
21
12
  def remove_from_cleo
22
- if Cleo::Server.async?
23
- Resque.enqueue(Cleo::ResqueDelete, record_type.classify, self.id)
24
- else
25
- Cleo.delete(self.cleo_id)
26
- cr = cleo_reference
27
- cr.delete
28
- end
13
+ cr = cleo_reference
14
+ current_cleo_id = self.cleo_id
15
+ cr.delete
16
+
17
+ Cleo.delete(current_cleo_id)
29
18
  end
30
19
 
31
20
  def set_cleo_id
@@ -53,7 +42,7 @@ module ActsAsCleo
53
42
 
54
43
  cr.term = cr.term.compact.reject(&:blank?)
55
44
 
56
- set_cleo_id if self.cleo_id.nil?
45
+ set_cleo_id if self.cleo_id.nil? && !self.id.nil?
57
46
  cr.id = self.cleo_id
58
47
 
59
48
  cr.name = self.send(self.cleo_config[:name]).to_s.downcase
@@ -0,0 +1,6 @@
1
+ module ActsAsCleo
2
+ module PrivateMethods
3
+
4
+
5
+ end
6
+ end
data/lib/cleo.rb CHANGED
@@ -1,23 +1,22 @@
1
1
  module Cleo
2
2
  @@net_http = nil
3
3
 
4
- def self.net_http
5
- @@net_http unless @@net_http.blank?
6
- uri = URI.parse(Cleo::Server.url)
7
-
8
- @@net_http = Net::HTTP.new(uri.host, uri.port)
9
- end
10
-
11
- def self.get(uri)
12
- response = net_http.request(Net::HTTP::Get.new(uri.request_uri))
13
-
14
- return response if good_response_code?(response)
4
+ #define delete, update, create dynamically in order to set up reddis backed calls if enabled
5
+ #Cleo.update(obj) will respect async settings
6
+ %w{delete update create}.each do |mn|
7
+ define_singleton_method(mn.to_s) do |obj|
8
+ if Cleo::Server.async?
9
+ Resque.enqueue(Cleo::ResqueCreate, mn, obj.record_type.classify, obj.id)
10
+ else
11
+ Cleo.send("execute_#{mn}".to_sym, obj)
12
+ end
13
+ end
15
14
  end
16
15
 
17
16
  def self.find(id)
18
17
  #query by element/id to get from cleo fast
19
18
  uri = URI.parse(Cleo::Server.url + "#{id}")
20
- response = self.get(uri)
19
+ response = get(uri)
21
20
 
22
21
  return nil if response.body.blank?
23
22
 
@@ -26,13 +25,12 @@ module Cleo
26
25
 
27
26
  def self.query(query_param)
28
27
  uri = URI.parse(Cleo::Server.url + "search?query=#{CGI::escape query_param}")
29
- response = self.get(uri)
28
+ response = get(uri)
30
29
 
31
30
  Cleo::Result.parse(response.body, :single => false)
32
31
  end
33
32
 
34
-
35
- def self.update(obj)
33
+ def self.execute_update(obj)
36
34
  obj = obj.to_cleo_result unless obj.is_a?(Cleo::Result)
37
35
 
38
36
  uri = URI.parse Cleo::Server.url + "#{obj.id}"
@@ -45,8 +43,11 @@ module Cleo
45
43
  return good_response_code?(response)
46
44
  end
47
45
 
48
- def self.delete(obj_or_id)
46
+
47
+ def self.execute_delete(obj_or_id)
48
+
49
49
  cleo_id = nil
50
+
50
51
  if obj_or_id.is_a?(Cleo::Result)
51
52
  cleo_id = obj_or_id.id
52
53
  elsif obj_or_id.is_a?(Fixnum)
@@ -63,7 +64,7 @@ module Cleo
63
64
  return good_response_code?(response)
64
65
  end
65
66
 
66
- def self.create(obj)
67
+ def self.execute_create(obj)
67
68
  obj = obj.to_cleo_result unless obj.is_a?(Cleo::Result)
68
69
 
69
70
  uri = URI.parse Cleo::Server.url + "_"
@@ -77,6 +78,20 @@ module Cleo
77
78
  return good_response_code?(response)
78
79
  end
79
80
 
81
+ private
82
+ def self.net_http
83
+ @@net_http unless @@net_http.blank?
84
+ uri = URI.parse(Cleo::Server.url)
85
+
86
+ @@net_http = Net::HTTP.new(uri.host, uri.port)
87
+ end
88
+
89
+ def self.get(uri)
90
+ response = net_http.request(Net::HTTP::Get.new(uri.request_uri))
91
+
92
+ return response if good_response_code?(response)
93
+ end
94
+
80
95
  private
81
96
  def self.flush
82
97
  uri = URI.parse Cleo::Server.url + "flush"
data/lib/cleo/server.rb CHANGED
@@ -19,8 +19,10 @@ module Cleo
19
19
  @@configuration[:auto_flush] = new_config.has_key?(:auto_flush) ? new_config[:auto_flush] : true
20
20
  @@configuration[:queue] = new_config.has_key?(:queue) ? new_config[:queue] : "cleo"
21
21
 
22
- env = ENV['QUEUE'] || ''
23
- ENV['QUEUE'] = (env.split(',') << @@configuration[:queue]).uniq.join(',')
22
+ if new_config.has_key?(:auto_enable_queue) && new_config[:auto_enable_queue]
23
+ env = ENV['QUEUE'] || ''
24
+ ENV['QUEUE'] = (env.split(',') << @@configuration[:queue]).uniq.join(',')
25
+ end
24
26
  end
25
27
 
26
28
  def self.load_configuration
@@ -16,12 +16,11 @@ module ActsAsCleo
16
16
  copy_file 'cleo_initalizer.rb', 'config/initalizers/cleo_initalizer.rb'
17
17
 
18
18
  #Resque workers
19
- %w{update create delete}.each do |life|
20
- copy_file "jobs/#{life}.rb", "app/jobs/#{life}.rb"
21
- end
19
+ copy_file "jobs/cleo_processor.rb", "app/jobs/cleo_processor.rb"
22
20
 
23
21
  #create migration
24
22
  migration_template 'install.rb', 'db/migrate/install_acts_as_cleo.rb'
23
+ migration_template 'update.rb', 'db/migrate/update_acts_as_cleo.rb'
25
24
  end
26
25
 
27
26
  def self.next_migration_number(dirname)
@@ -3,9 +3,11 @@ development:
3
3
  url: "http://localhost:8080/cleo-primer/"
4
4
  run_async: true
5
5
  queue: "cleo"
6
+ auto_enable_queue: true
6
7
 
7
8
  test:
8
9
  url: "http://localhost:8080/cleo-primer/"
10
+ auto_enable_queue: true
9
11
 
10
12
  production:
11
13
  url: "http://localhost:8080/cleo-primer/"
@@ -1,6 +1,6 @@
1
1
  class <%= migration_class_name %> < ActiveRecord::Migration
2
2
  def self.up
3
- create_table :cleo_references do
3
+ create_table :references do
4
4
  t.timestamps
5
5
  t.string :record_type
6
6
  t.integer :record_id
@@ -8,6 +8,6 @@ class <%= migration_class_name %> < ActiveRecord::Migration
8
8
  end
9
9
 
10
10
  def down
11
- drop_table :cleo_references
11
+ drop_table :references
12
12
  end
13
13
  end
@@ -0,0 +1,17 @@
1
+ module Cleo
2
+ module Processor
3
+ @queue = Cleo::Server.queue
4
+
5
+ def self.perform(operation, klass, klass_id)
6
+ on_me = Kernel.const_get(klass).find(klass_id)
7
+ case operation.downcase
8
+ when "create"
9
+ Cleo.execute_create(on_me)
10
+ when "update"
11
+ Cleo.execute_update(on_me)
12
+ when "delete"
13
+ Cleo.execute_delete(on_me)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ class <%= migration_class_name %> < ActiveRecord::Migration
2
+ def up
3
+ add_index :references, :record_type, :unique => false
4
+ end
5
+
6
+ def down
7
+ remove_index :references, :column => :record_type
8
+ end
9
+ end
@@ -0,0 +1,34 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+ require 'active_record'
4
+ require 'rails/generators/active_record'
5
+
6
+ module ActsAsCleo
7
+ class UpdateGenerator < Rails::Generators::Base
8
+ include Rails::Generators::Migration
9
+
10
+ source_root File.expand_path("../../install/templates", __FILE__)
11
+
12
+ def copy_migration_and_config
13
+ #Resque workers
14
+ %w{update create delete}.each do |life|
15
+ remove_file "app/jobs/#{life}.rb"
16
+ end
17
+
18
+ #new general processor
19
+ copy_file "jobs/cleo_processor.rb", "app/jobs/cleo_processor.rb"
20
+
21
+ #create migration
22
+ migration_template 'update.rb', 'db/migrate/update_acts_as_cleo.rb'
23
+ end
24
+
25
+ def self.next_migration_number(dirname)
26
+ next_migration_number = current_migration_number(dirname) + 1
27
+ if ActiveRecord::Base.timestamped_migrations
28
+ [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
29
+ else
30
+ "%.3d" % next_migration_number
31
+ end
32
+ end
33
+ end
34
+ end
@@ -4,5 +4,5 @@ ActiveRecord::Base.logger = Logger.new("debug.log")
4
4
  ActiveRecord::Base.establish_connection(
5
5
  :adapter => "sqlite3",
6
6
  :encoding => "utf8",
7
- :database => File.join(File.dirname(File.expand_path(__FILE__)), '..', 'test.db')
7
+ :database => File.join(File.dirname(File.expand_path(__FILE__)), '..', 'testing_db.sqlite')
8
8
  )
data/test/helper.rb CHANGED
@@ -22,6 +22,7 @@ end
22
22
  require 'test/unit'
23
23
  require 'shoulda'
24
24
 
25
+
25
26
  file_dirname = File.dirname(__FILE__)
26
27
 
27
28
  #Load Lib
@@ -32,6 +33,10 @@ $LOAD_PATH.unshift file_dirname
32
33
  sqlite = File.join(file_dirname, 'db', 'connection', 'sqlite')
33
34
  require sqlite
34
35
 
36
+ #Load Database Cleaner
37
+ require 'database_cleaner'
38
+ DatabaseCleaner[:active_record].strategy = :truncation
39
+
35
40
  # Load Models
36
41
  models_dir = File.join(file_dirname, 'models')
37
42
  Dir[ models_dir + '/*.rb'].each { |m| require m }
@@ -40,4 +45,12 @@ server_config = {:url => "http://localhost:8080/cleo-primer/", :run_async => fal
40
45
  Cleo::Server.configure server_config
41
46
 
42
47
  class Test::Unit::TestCase
48
+ def setup
49
+ DatabaseCleaner.clean
50
+ end
51
+
52
+ def teardown
53
+ Book.destroy_all
54
+ Movie.destroy_all
55
+ end
43
56
  end
@@ -27,7 +27,7 @@ class TestActiveRecordCallbacHooks < Test::Unit::TestCase
27
27
  assert book.save!
28
28
 
29
29
  updated_cleo_record = Cleo.find(book.cleo_id)
30
- assert_equal book.name, updated_cleo_record.name
30
+ assert_equal book.name.downcase, updated_cleo_record.name
31
31
  assert_not_equal cleo_record.name, updated_cleo_record.name
32
32
 
33
33
  assert book.destroy
@@ -7,11 +7,6 @@ class TestCleo < Test::Unit::TestCase
7
7
  @wedge = Cleo::Result.parse(contents, :singluar => true)
8
8
  end
9
9
 
10
- should "get HTTP Connection" do
11
- net = Cleo.net_http
12
- assert_not_equal nil, net
13
- end
14
-
15
10
  should "create then destroy Testing Object " do
16
11
  code = Cleo.create(@wedge)
17
12
  assert code
@@ -26,10 +21,12 @@ class TestCleo < Test::Unit::TestCase
26
21
  should "get google results from qery" do
27
22
  r = Cleo.query("goog")
28
23
  assert_not_nil r
29
- assert_equal 1, r.count
24
+ assert_equal 0, r.count
30
25
  assert_kind_of Array, r
31
26
  end
32
27
 
28
+ =begin
29
+ This is a bad test and require default value to be in Cleo. Baddd test
33
30
  should "fetch the same record by id" do
34
31
  r = Cleo.query("goog").first
35
32
  assert_equal r.id.blank?, false
@@ -39,6 +36,7 @@ class TestCleo < Test::Unit::TestCase
39
36
  assert_equal r.timestamp, i.timestamp
40
37
  assert_equal r.id, i.id
41
38
  end
39
+ =end
42
40
 
43
41
  should "create, update, then destroy, Testing Object" do
44
42
  code = Cleo.create(@wedge)
@@ -11,7 +11,7 @@ class TestModelToCleo < Test::Unit::TestCase
11
11
  cb = b.as_cleo
12
12
  end
13
13
 
14
- assert_equal cb.name, b.name
14
+ assert_equal cb.name, b.name.downcase
15
15
  assert_equal cb.score, b.cleo_score
16
16
  assert_equal 2, cb.terms.count
17
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_cleo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-27 00:00:00.000000000Z
12
+ date: 2012-03-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: happymapper
16
- requirement: &70133419389440 !ruby/object:Gem::Requirement
16
+ requirement: &70142890255380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70133419389440
24
+ version_requirements: *70142890255380
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rails
27
- requirement: &70133419388960 !ruby/object:Gem::Requirement
27
+ requirement: &70142890254900 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70133419388960
35
+ version_requirements: *70142890254900
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: resque
38
- requirement: &70133419388480 !ruby/object:Gem::Requirement
38
+ requirement: &70142890254420 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70133419388480
46
+ version_requirements: *70142890254420
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: shoulda
49
- requirement: &70133419388000 !ruby/object:Gem::Requirement
49
+ requirement: &70142890253940 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70133419388000
57
+ version_requirements: *70142890253940
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rdoc
60
- requirement: &70133419387520 !ruby/object:Gem::Requirement
60
+ requirement: &70142890253460 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '3.12'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70133419387520
68
+ version_requirements: *70142890253460
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &70133419387040 !ruby/object:Gem::Requirement
71
+ requirement: &70142890252980 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70133419387040
79
+ version_requirements: *70142890252980
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: jeweler
82
- requirement: &70133419386560 !ruby/object:Gem::Requirement
82
+ requirement: &70142890252500 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 1.8.3
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70133419386560
90
+ version_requirements: *70142890252500
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: simplecov
93
- requirement: &70133419386080 !ruby/object:Gem::Requirement
93
+ requirement: &70142890252020 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70133419386080
101
+ version_requirements: *70142890252020
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: ruby-debug19
104
- requirement: &70133419385600 !ruby/object:Gem::Requirement
104
+ requirement: &70142890251540 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70133419385600
112
+ version_requirements: *70142890251540
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: fixtures
115
- requirement: &70133419385120 !ruby/object:Gem::Requirement
115
+ requirement: &70142890251060 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70133419385120
123
+ version_requirements: *70142890251060
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: sqlite3
126
- requirement: &70133419384640 !ruby/object:Gem::Requirement
126
+ requirement: &70142890250580 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,7 +131,18 @@ dependencies:
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *70133419384640
134
+ version_requirements: *70142890250580
135
+ - !ruby/object:Gem::Dependency
136
+ name: database_cleaner
137
+ requirement: &70142890250100 !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ type: :development
144
+ prerelease: false
145
+ version_requirements: *70142890250100
135
146
  description: LinkedIn Open Source type ahead tool's REST API as a ruby gem. Now with
136
147
  Reddis support.
137
148
  email: Blue.Dog.Archolite@gmail.com
@@ -151,6 +162,7 @@ files:
151
162
  - lib/acts_as_cleo/acts_methods.rb
152
163
  - lib/acts_as_cleo/class_methods.rb
153
164
  - lib/acts_as_cleo/instance_methods.rb
165
+ - lib/acts_as_cleo/private_methods.rb
154
166
  - lib/acts_as_cleo/result.rb
155
167
  - lib/acts_as_cleo/version.rb
156
168
  - lib/cleo.rb
@@ -161,9 +173,9 @@ files:
161
173
  - lib/generators/acts_as_cleo/install/templates/cleo.yml
162
174
  - lib/generators/acts_as_cleo/install/templates/cleo_initalizer.rb
163
175
  - lib/generators/acts_as_cleo/install/templates/install.rb
164
- - lib/generators/acts_as_cleo/install/templates/jobs/create.rb
165
- - lib/generators/acts_as_cleo/install/templates/jobs/delete.rb
166
- - lib/generators/acts_as_cleo/install/templates/jobs/update.rb
176
+ - lib/generators/acts_as_cleo/install/templates/jobs/cleo_processor.rb
177
+ - lib/generators/acts_as_cleo/install/templates/update.rb
178
+ - lib/generators/acts_as_cleo/update/update_generator.rb
167
179
  - test/config/cleo.yml
168
180
  - test/data/xml/cleo/element.xml
169
181
  - test/data/xml/cleo/elements.xml
@@ -176,17 +188,13 @@ files:
176
188
  - test/db/migrate/005_create_authors.rb
177
189
  - test/db/migrate/006_create_postings.rb
178
190
  - test/db/migrate/007_cleo_table.rb
179
- - test/db/test.db
180
191
  - test/fixtures/authors.yml
181
192
  - test/fixtures/books.yml
182
193
  - test/fixtures/categories.yml
183
194
  - test/fixtures/electronics.yml
184
195
  - test/fixtures/movies.yml
185
196
  - test/helper.rb
186
- - test/models/author.rb
187
197
  - test/models/book.rb
188
- - test/models/category.rb
189
- - test/models/electronic.rb
190
198
  - test/models/movie.rb
191
199
  - test/test_install_generator.rb
192
200
  - test/unit/test_active_record_callback_hooks.rb
@@ -1,10 +0,0 @@
1
- module Cleo
2
- module ResqueCreate
3
- @queue = Cleo::Server.queue
4
-
5
- def self.perform(klass, klass_id)
6
- to_create = Kernel.const_get(klass).find(klass_id)
7
- Cleo.create(to_create)
8
- end
9
- end
10
- end
@@ -1,12 +0,0 @@
1
- module Cleo
2
- module ResqueDelete
3
- @queue = Cleo::Server.queue
4
-
5
- def self.perform(klass, klass_id)
6
- to_delete = Kernel.const_get(klass).find(klass_id)
7
- Cleo.delete(to_delete.cleo_id)
8
- cr = Cleo::Reference.find(:first, :conditions => ["record_type = ? and record_id = ?", klass, to_delete.id])
9
- cr.delete
10
- end
11
- end
12
- end
@@ -1,10 +0,0 @@
1
- module Cleo
2
- module ResqueUpdate
3
- @queue = Cleo::Server.queue
4
-
5
- def self.perform(klass, klass_id)
6
- to_update = Kernel.const_get(klass).find(klass_id)
7
- Cleo.update(to_update)
8
- end
9
- end
10
- end
data/test/db/test.db DELETED
Binary file
@@ -1,7 +0,0 @@
1
- # Table fields for 'movies'
2
- # - id
3
- # - name
4
- # - biography
5
-
6
- class Author < ActiveRecord::Base
7
- end
@@ -1,8 +0,0 @@
1
- # Table fields for 'categories'
2
- # - id
3
- # - name
4
-
5
- class Category < ActiveRecord::Base
6
- has_many :books
7
- acts_as_cleo
8
- end
@@ -1,11 +0,0 @@
1
- # Table fields for 'electronics'
2
- # - id
3
- # - name
4
- # - manufacturer
5
- # - features
6
- # - category
7
- # - price
8
-
9
- class Electronic < ActiveRecord::Base
10
- acts_as_cleo
11
- end