barometer 0.6.6 → 0.6.7
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/README.rdoc +1 -1
- data/VERSION.yml +1 -1
- data/barometer.gemspec +2 -2
- data/bin/barometer +2 -2
- data/lib/barometer/weather_services/weather_bug.rb +1 -1
- data/spec/weather_services/weather_bug_spec.rb +1 -1
- data/spec/weather_spec.rb +26 -18
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -15,7 +15,7 @@ this.
|
|
15
15
|
|
16
16
|
== version
|
17
17
|
|
18
|
-
Version 0.6.
|
18
|
+
Version 0.6.7 is the current release of this gem.
|
19
19
|
The gem is available from github (attack-barometer) or rubyforge (barometer).
|
20
20
|
It is fully functional (for five weather service APIs).
|
21
21
|
|
data/VERSION.yml
CHANGED
data/barometer.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{barometer}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mark G"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-10}
|
13
13
|
s.default_executable = %q{barometer}
|
14
14
|
s.description = %q{A multi API consuming weather forecasting superstar.}
|
15
15
|
s.email = %q{barometer@attackcorp.com}
|
data/bin/barometer
CHANGED
@@ -58,7 +58,7 @@ require 'rubygems'
|
|
58
58
|
require 'barometer'
|
59
59
|
|
60
60
|
require 'optparse'
|
61
|
-
require 'rdoc/usage'
|
61
|
+
#require 'rdoc/usage'
|
62
62
|
require 'ostruct'
|
63
63
|
require 'time'
|
64
64
|
require 'date'
|
@@ -66,7 +66,7 @@ require 'yaml'
|
|
66
66
|
|
67
67
|
# file where API keys are stored
|
68
68
|
KEY_FILE = File.expand_path(File.join('~', '.barometer'))
|
69
|
-
BAROMETER_VERSION = '0.6.
|
69
|
+
BAROMETER_VERSION = '0.6.7'
|
70
70
|
|
71
71
|
class App
|
72
72
|
|
@@ -127,7 +127,7 @@ module Barometer
|
|
127
127
|
forecasts = Measurement::ResultArray.new
|
128
128
|
# go through each forecast and create an instance
|
129
129
|
if data && data["aws:forecast"]
|
130
|
-
start_date = Date.
|
130
|
+
start_date = Date.strptime(data['date'], "%m/%d/%Y %H:%M:%S %p")
|
131
131
|
i = 0
|
132
132
|
data["aws:forecast"].each do |forecast|
|
133
133
|
forecast_measurement = Measurement::Result.new
|
@@ -167,7 +167,7 @@ describe "WeatherBug" do
|
|
167
167
|
it "requires a Barometer::Measurement object" do
|
168
168
|
lambda { WeatherService::WeatherBug._measure(nil, @query) }.should raise_error(ArgumentError)
|
169
169
|
lambda { WeatherService::WeatherBug._measure("invalid", @query) }.should raise_error(ArgumentError)
|
170
|
-
|
170
|
+
|
171
171
|
lambda { WeatherService::WeatherBug._measure(@measurement, @query) }.should_not raise_error(ArgumentError)
|
172
172
|
end
|
173
173
|
|
data/spec/weather_spec.rb
CHANGED
@@ -37,16 +37,13 @@ describe "Weather" do
|
|
37
37
|
describe "with measurements" do
|
38
38
|
|
39
39
|
before(:each) do
|
40
|
-
module Barometer
|
41
|
-
class Barometer::Measurement
|
42
|
-
attr_accessor :success
|
43
|
-
end
|
44
|
-
end
|
45
40
|
@weather = Barometer::Weather.new
|
46
41
|
@wunderground = Barometer::Measurement.new(:wunderground)
|
47
|
-
@wunderground.success
|
42
|
+
@wunderground.stub!(:success).and_return(true)
|
43
|
+
@wunderground.stub!(:success?).and_return(true)
|
48
44
|
@yahoo = Barometer::Measurement.new(:yahoo)
|
49
|
-
@yahoo.success
|
45
|
+
@yahoo.stub!(:success).and_return(true)
|
46
|
+
@yahoo.stub!(:success?).and_return(true)
|
50
47
|
@google = Barometer::Measurement.new(:google)
|
51
48
|
@weather.measurements << @wunderground
|
52
49
|
@weather.measurements << @yahoo
|
@@ -84,10 +81,12 @@ describe "Weather" do
|
|
84
81
|
@weather = Barometer::Weather.new
|
85
82
|
@wunderground = Barometer::Measurement.new(:wunderground)
|
86
83
|
@wunderground.current = Barometer::Measurement::Result.new
|
87
|
-
@wunderground.success
|
84
|
+
@wunderground.stub!(:success).and_return(true)
|
85
|
+
@wunderground.stub!(:success?).and_return(true)
|
88
86
|
@yahoo = Barometer::Measurement.new(:yahoo)
|
89
87
|
@yahoo.current = Barometer::Measurement::Result.new
|
90
|
-
@yahoo.success
|
88
|
+
@yahoo.stub!(:success).and_return(true)
|
89
|
+
@yahoo.stub!(:success?).and_return(true)
|
91
90
|
@google = Barometer::Measurement.new(:google)
|
92
91
|
@weather.measurements << @wunderground
|
93
92
|
@weather.measurements << @yahoo
|
@@ -296,7 +295,8 @@ describe "Weather" do
|
|
296
295
|
|
297
296
|
it "returns true if a measurement returns true" do
|
298
297
|
wunderground = Barometer::Measurement.new(:wunderground)
|
299
|
-
wunderground.success
|
298
|
+
wunderground.stub!(:success).and_return(true)
|
299
|
+
wunderground.stub!(:success?).and_return(true)
|
300
300
|
@weather.measurements << wunderground
|
301
301
|
@weather.measurements.each { |m| m.stub!(:windy?).and_return(true) }
|
302
302
|
@weather.windy?.should be_true
|
@@ -304,7 +304,8 @@ describe "Weather" do
|
|
304
304
|
|
305
305
|
it "returns false if a measurement returns false" do
|
306
306
|
wunderground = Barometer::Measurement.new(:wunderground)
|
307
|
-
wunderground.success
|
307
|
+
wunderground.stub!(:success).and_return(true)
|
308
|
+
wunderground.stub!(:success?).and_return(true)
|
308
309
|
@weather.measurements << wunderground
|
309
310
|
@weather.measurements.each { |m| m.stub!(:windy?).and_return(false) }
|
310
311
|
@weather.windy?.should be_false
|
@@ -332,7 +333,8 @@ describe "Weather" do
|
|
332
333
|
|
333
334
|
it "returns true if a measurement returns true" do
|
334
335
|
wunderground = Barometer::Measurement.new(:wunderground)
|
335
|
-
wunderground.success
|
336
|
+
wunderground.stub!(:success).and_return(true)
|
337
|
+
wunderground.stub!(:success?).and_return(true)
|
336
338
|
@weather.measurements << wunderground
|
337
339
|
@weather.measurements.each { |m| m.stub!(:wet?).and_return(true) }
|
338
340
|
@weather.wet?.should be_true
|
@@ -340,7 +342,8 @@ describe "Weather" do
|
|
340
342
|
|
341
343
|
it "returns false if a measurement returns false" do
|
342
344
|
wunderground = Barometer::Measurement.new(:wunderground)
|
343
|
-
wunderground.success
|
345
|
+
wunderground.stub!(:success).and_return(true)
|
346
|
+
wunderground.stub!(:success?).and_return(true)
|
344
347
|
@weather.measurements << wunderground
|
345
348
|
@weather.measurements.each { |m| m.stub!(:wet?).and_return(false) }
|
346
349
|
@weather.wet?.should be_false
|
@@ -368,7 +371,8 @@ describe "Weather" do
|
|
368
371
|
|
369
372
|
it "returns true if a measurement returns true (night is opposite)" do
|
370
373
|
wunderground = Barometer::Measurement.new(:wunderground)
|
371
|
-
wunderground.success
|
374
|
+
wunderground.stub!(:success).and_return(true)
|
375
|
+
wunderground.stub!(:success?).and_return(true)
|
372
376
|
@weather.measurements << wunderground
|
373
377
|
@weather.measurements.each { |m| m.stub!(:day?).and_return(true) }
|
374
378
|
@weather.day?.should be_true
|
@@ -377,7 +381,8 @@ describe "Weather" do
|
|
377
381
|
|
378
382
|
it "returns false if a measurement returns false (night is opposite)" do
|
379
383
|
wunderground = Barometer::Measurement.new(:wunderground)
|
380
|
-
wunderground.success
|
384
|
+
wunderground.stub!(:success).and_return(true)
|
385
|
+
wunderground.stub!(:success?).and_return(true)
|
381
386
|
@weather.measurements << wunderground
|
382
387
|
@weather.measurements.each { |m| m.stub!(:day?).and_return(false) }
|
383
388
|
@weather.day?.should be_false
|
@@ -400,7 +405,8 @@ describe "Weather" do
|
|
400
405
|
|
401
406
|
it "returns true if a measurement returns true" do
|
402
407
|
wunderground = Barometer::Measurement.new(:wunderground)
|
403
|
-
wunderground.success
|
408
|
+
wunderground.stub!(:success).and_return(true)
|
409
|
+
wunderground.stub!(:success?).and_return(true)
|
404
410
|
@weather.measurements << wunderground
|
405
411
|
@weather.measurements.each { |m| m.stub!(:day?).and_return(true) }
|
406
412
|
@weather.measurements.each { |m| m.stub!(:sunny?).and_return(true) }
|
@@ -409,7 +415,8 @@ describe "Weather" do
|
|
409
415
|
|
410
416
|
it "returns false if a measurement returns false" do
|
411
417
|
wunderground = Barometer::Measurement.new(:wunderground)
|
412
|
-
wunderground.success
|
418
|
+
wunderground.stub!(:success).and_return(true)
|
419
|
+
wunderground.stub!(:success?).and_return(true)
|
413
420
|
@weather.measurements << wunderground
|
414
421
|
@weather.measurements.each { |m| m.stub!(:day?).and_return(true) }
|
415
422
|
@weather.measurements.each { |m| m.stub!(:sunny?).and_return(false) }
|
@@ -418,7 +425,8 @@ describe "Weather" do
|
|
418
425
|
|
419
426
|
it "returns false if night time" do
|
420
427
|
wunderground = Barometer::Measurement.new(:wunderground)
|
421
|
-
wunderground.success
|
428
|
+
wunderground.stub!(:success).and_return(true)
|
429
|
+
wunderground.stub!(:success?).and_return(true)
|
422
430
|
@weather.measurements << wunderground
|
423
431
|
@weather.measurements.each { |m| m.stub!(:sunny?).and_return(true) }
|
424
432
|
@weather.measurements.each { |m| m.stub!(:day?).and_return(false) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barometer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark G
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-10 00:00:00 -07:00
|
13
13
|
default_executable: barometer
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|