localeapp 0.3.0 → 0.3.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # Version 0.3.1
2
+
3
+ * Handle SocketError so we don't cause errors in client apps when they're not
4
+ connected to the network
5
+ * Fix bug with empty log file (Thanks Robin Mehner)
6
+
1
7
  # Version 0.3.0
2
8
 
3
9
  * Allow symbols for environment names in config file
@@ -5,7 +5,7 @@ Feature: localeapp executable
5
5
  When I run `localeapp help`
6
6
  Then the output should contain:
7
7
  """
8
- usage: localeapp command [command options]
8
+ usage: localeapp [global options] command [command options]
9
9
  """
10
10
 
11
11
  Scenario: Running a command that doesn't exist
@@ -70,6 +70,9 @@ module Localeapp
70
70
  rescue Errno::ECONNREFUSED => error
71
71
  Localeapp.debug("ERROR: Connection Refused")
72
72
  return NonHTTPResponse.new(-1)
73
+ rescue SocketError => error
74
+ Localeapp.debug("ERROR: Socket Error #{error.message}")
75
+ return NonHTTPResponse.new(-1)
73
76
  end
74
77
  end
75
78
 
@@ -19,7 +19,7 @@ module Localeapp
19
19
 
20
20
  def synchronization_data
21
21
  if File.exists?(Localeapp.configuration.synchronization_data_file)
22
- YAML.load_file(Localeapp.configuration.synchronization_data_file)
22
+ YAML.load_file(Localeapp.configuration.synchronization_data_file) || {}
23
23
  else
24
24
  {}
25
25
  end
@@ -1,3 +1,3 @@
1
1
  module Localeapp
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
File without changes
@@ -199,7 +199,14 @@ describe Localeapp::ApiCaller, "#call(object)" do
199
199
  end
200
200
 
201
201
  it "handles ECONNREFUSED" do
202
- RestClient.stub(:send).and_raise(Errno::ECONNREFUSED)
202
+ RestClient::Request.stub(:execute).and_raise(Errno::ECONNREFUSED)
203
+ @api_caller.options[:failure] = :fail
204
+ @object.should_receive(:fail)
205
+ @api_caller.call(@object)
206
+ end
207
+
208
+ it "handles SocketError" do
209
+ RestClient::Request.stub(:execute).and_raise(SocketError)
203
210
  @api_caller.options[:failure] = :fail
204
211
  @object.should_receive(:fail)
205
212
  @api_caller.call(@object)
@@ -24,6 +24,21 @@ describe Localeapp::Poller do
24
24
  end
25
25
  end
26
26
 
27
+ describe "#synchronization_data" do
28
+ before do
29
+ @original_configuration_file = Localeapp.configuration.synchronization_data_file
30
+ Localeapp.configuration.synchronization_data_file = "#{File.dirname(__FILE__)}/../fixtures/empty_log.yml"
31
+ end
32
+
33
+ it "returns an empty hash if there is a yml file that is empty" do
34
+ @poller.synchronization_data.should == {}
35
+ end
36
+
37
+ after do
38
+ Localeapp.configuration.synchronization_data_file = @original_configuration_file
39
+ end
40
+ end
41
+
27
42
  describe "#write_synchronization_data!(polled_at, updated_at)" do
28
43
  it "updates polled_at in the synchronization file" do
29
44
  polled_at = lambda { @poller.synchronization_data[:polled_at] }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localeapp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Christopher Dell
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-11-18 00:00:00 Z
19
+ date: 2011-12-09 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: i18n
@@ -237,6 +237,7 @@ files:
237
237
  - lib/localeapp/version.rb
238
238
  - localeapp.gemspec
239
239
  - run_ci
240
+ - spec/fixtures/empty_log.yml
240
241
  - spec/fixtures/en.yml
241
242
  - spec/fixtures/es.yml
242
243
  - spec/localeapp/api_call_spec.rb
@@ -297,6 +298,7 @@ test_files:
297
298
  - features/step_definitions/cli_steps.rb
298
299
  - features/support/env.rb
299
300
  - features/support/hooks.rb
301
+ - spec/fixtures/empty_log.yml
300
302
  - spec/fixtures/en.yml
301
303
  - spec/fixtures/es.yml
302
304
  - spec/localeapp/api_call_spec.rb