flying-sphinx 0.3.3 → 0.4.0

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.4.0
@@ -1,13 +1,13 @@
1
1
  class FlyingSphinx::API
2
2
  include HTTParty
3
3
 
4
- APIServer = 'http://flying-sphinx.com/heroku'
4
+ APIServer = 'https://flying-sphinx.com/heroku'
5
5
 
6
- attr_reader :api_key, :heroku_id
6
+ attr_reader :api_key, :identifier
7
7
 
8
- def initialize(heroku_id, api_key)
8
+ def initialize(identifier, api_key)
9
9
  @api_key = api_key
10
- @heroku_id = heroku_id
10
+ @identifier = identifier
11
11
  end
12
12
 
13
13
  def get(path, data = {})
@@ -27,7 +27,7 @@ class FlyingSphinx::API
27
27
  def api_options
28
28
  {
29
29
  :api_key => api_key,
30
- :heroku_id => heroku_id
30
+ :identifier => identifier
31
31
  }
32
32
  end
33
33
  end
@@ -1,20 +1,16 @@
1
1
  class FlyingSphinx::Configuration
2
- attr_reader :heroku_id, :api_key, :host, :port, :database_port, :mem_limit
2
+ attr_reader :identifier, :api_key, :host, :port, :database_port, :mem_limit
3
3
 
4
- def initialize(heroku_id = nil, api_key = nil)
5
- @heroku_id = heroku_id || heroku_id_from_env
6
- @api_key = api_key || api_key_from_env
4
+ def initialize(identifier = nil, api_key = nil)
5
+ @identifier = identifier || identifier_from_env
6
+ @api_key = api_key || api_key_from_env
7
7
 
8
8
  set_from_server
9
9
  setup_environment_settings
10
10
  end
11
11
 
12
12
  def api
13
- @api ||= FlyingSphinx::API.new(heroku_id, api_key)
14
- end
15
-
16
- def app_name
17
- @app_name = heroku_id.split('@').first
13
+ @api ||= FlyingSphinx::API.new(identifier, api_key)
18
14
  end
19
15
 
20
16
  def sphinx_configuration
@@ -44,7 +40,7 @@ class FlyingSphinx::Configuration
44
40
  end
45
41
 
46
42
  def base_path
47
- "/mnt/sphinx/flying-sphinx/#{app_name}"
43
+ "/mnt/sphinx/flying-sphinx/#{identifier}"
48
44
  end
49
45
 
50
46
  def log_path
@@ -95,8 +91,8 @@ class FlyingSphinx::Configuration
95
91
  end
96
92
  end
97
93
 
98
- def heroku_id_from_env
99
- ENV['APP_NAME'] + '@heroku.com'
94
+ def identifier_from_env
95
+ ENV['FLYING_SPHINX_IDENTIFIER']
100
96
  end
101
97
 
102
98
  def api_key_from_env
@@ -2,16 +2,16 @@ require 'spec_helper'
2
2
 
3
3
  describe FlyingSphinx::Configuration do
4
4
  describe '#initialize' do
5
- let(:api_server) { 'http://flying-sphinx.com/heroku' }
5
+ let(:api_server) { 'https://flying-sphinx.com/heroku' }
6
6
  let(:api_key) { 'foo-bar-baz' }
7
- let(:heroku_id) { 'app@heroku.com' }
8
- let(:encoded_heroku_id) {
9
- FakeWeb::Utility.encode_unsafe_chars_in_userinfo heroku_id
7
+ let(:identifier) { 'app@heroku.com' }
8
+ let(:encoded_identifier) {
9
+ FakeWeb::Utility.encode_unsafe_chars_in_userinfo identifier
10
10
  }
11
11
 
12
12
  before :each do
13
13
  FakeWeb.register_uri(:get,
14
- "#{api_server}/app?api_key=#{api_key}&heroku_id=#{encoded_heroku_id}",
14
+ "#{api_server}/app?api_key=#{api_key}&identifier=#{encoded_identifier}",
15
15
  :body => JSON.dump(
16
16
  :server => 'foo.bar.com',
17
17
  :port => 9319,
@@ -21,24 +21,24 @@ describe FlyingSphinx::Configuration do
21
21
  end
22
22
 
23
23
  it "requests details from the server with the given API key" do
24
- FlyingSphinx::Configuration.new heroku_id, api_key
24
+ FlyingSphinx::Configuration.new identifier, api_key
25
25
 
26
26
  FakeWeb.should have_requested :get,
27
- "#{api_server}/app?api_key=#{api_key}&heroku_id=#{encoded_heroku_id}"
27
+ "#{api_server}/app?api_key=#{api_key}&identifier=#{encoded_identifier}"
28
28
  end
29
29
 
30
30
  it "sets the host from the server information" do
31
- config = FlyingSphinx::Configuration.new heroku_id, api_key
31
+ config = FlyingSphinx::Configuration.new identifier, api_key
32
32
  config.host.should == 'foo.bar.com'
33
33
  end
34
34
 
35
35
  it "sets the port from the server information" do
36
- config = FlyingSphinx::Configuration.new heroku_id, api_key
36
+ config = FlyingSphinx::Configuration.new identifier, api_key
37
37
  config.port.should == 9319
38
38
  end
39
39
 
40
40
  it "sets the port from the server information" do
41
- config = FlyingSphinx::Configuration.new heroku_id, api_key
41
+ config = FlyingSphinx::Configuration.new identifier, api_key
42
42
  config.database_port.should == 10001
43
43
  end
44
44
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flying-sphinx
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 3
10
- version: 0.3.3
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pat Allan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-13 00:00:00 +11:00
18
+ date: 2011-01-18 00:00:00 +11:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -206,7 +206,7 @@ files:
206
206
  - spec/flying_sphinx/flag_as_deleted_job_spec.rb
207
207
  - spec/flying_sphinx/index_request_spec.rb
208
208
  has_rdoc: true
209
- homepage: http://flying-sphinx.com
209
+ homepage: https://flying-sphinx.com
210
210
  licenses: []
211
211
 
212
212
  post_install_message: