rifle 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/rifle.rb CHANGED
@@ -2,36 +2,10 @@ require 'json'
2
2
  require 'set'
3
3
  require 'redis'
4
4
  require 'text'
5
+ require_relative 'rifle/settings'
5
6
  require_relative 'rifle/rifle_resque'
6
7
 
7
8
  module Rifle
8
-
9
- class Settings
10
- attr_accessor :ignored_words, :min_word_length, :redis, :server
11
-
12
- def ignored_words
13
- @ignored_words ||= ["the", "and", "you", "that"]
14
- end
15
-
16
- def min_word_length
17
- @min_word_length ||= 3
18
- end
19
-
20
- def server
21
- @server ||= 'http://localhost:3000'
22
- end
23
-
24
- def redis
25
- @redis ||= Redis.new
26
- end
27
- end
28
-
29
- @@settings = Settings.new
30
-
31
- def self.settings
32
- @@settings
33
- end
34
-
35
9
  def self.store(urn, hash)
36
10
  Processor.new.index_resource(urn, hash)
37
11
  end
@@ -1,10 +1,11 @@
1
1
  gem 'resque'
2
2
  gem 'rest-client'
3
+ require_relative 'settings'
3
4
 
4
5
  # This simple resque job pings the search server with a payload.
5
6
 
6
7
  class RifleResque
7
- @queue = :rifle
8
+ @queue = Rifle.settings.resque_queue
8
9
 
9
10
  def initialize(urn, payload)
10
11
  @urn = urn
@@ -0,0 +1,32 @@
1
+ module Rifle
2
+
3
+ class Settings
4
+ attr_accessor :ignored_words, :min_word_length, :redis, :server, :resque_queue
5
+
6
+ def ignored_words
7
+ @ignored_words ||= ["the", "and", "you", "that"]
8
+ end
9
+
10
+ def min_word_length
11
+ @min_word_length ||= 3
12
+ end
13
+
14
+ def server
15
+ @server ||= 'http://localhost:3000'
16
+ end
17
+
18
+ def resque_queue
19
+ @resque_queue ||= :rifle
20
+ end
21
+
22
+ def redis
23
+ @redis ||= Redis.new
24
+ end
25
+ end
26
+
27
+ @@settings = Settings.new
28
+
29
+ def self.settings
30
+ @@settings
31
+ end
32
+ end
data/lib/rifle/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rifle
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rifle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -117,6 +117,7 @@ files:
117
117
  - app/controllers/application_controller.rb
118
118
  - app/controllers/searches_controller.rb
119
119
  - lib/rifle/engine.rb
120
+ - lib/rifle/settings.rb
120
121
  - lib/rifle/version.rb
121
122
  - lib/rifle/rifle_resque.rb
122
123
  - lib/rifle.rb