cinch-weatherman 1.0.4 → 1.0.5

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: 5887b5ac74948b0a81ea55a1a21ec3b876ea1e00
4
+ data.tar.gz: 83a86b0fb6e5444eb8814c349598229c44689a45
5
+ SHA512:
6
+ metadata.gz: 3c41fb98aa1b1d2f10fcb331dab583c70421bf4d349211a2925212703d2f6b64c05d58ade4311349798bcb0941433accbb247740f386ddd68428ab915ed5d366
7
+ data.tar.gz: c13abb6865d09d2491f3d23612555065f55812391e8e34cf4e3062aa7959073a9a3809312ed80a5c44874e9308b405018e47ce7caf4f940a59b4d1fa8144340c
@@ -1,4 +1,23 @@
1
1
  language: ruby
2
+ env:
3
+ global:
4
+ - "JRUBY_OPTS=-Xcext.enabled=true"
2
5
  rvm:
3
- - 1.9.2
6
+ - 2.1.0
7
+ - 2.0.0
4
8
  - 1.9.3
9
+ - 1.9.2
10
+ - 1.8.7
11
+ - jruby-18mode
12
+ - jruby-19mode
13
+ - ruby-head
14
+ - jruby-head
15
+ - ree
16
+ matrix:
17
+ allow_failures:
18
+ - rvm: 1.8.7
19
+ - rvm: ree
20
+ - rvm: jruby-18mode
21
+ - rvm: jruby-19mode
22
+ - rvm: jruby-head
23
+ fast_finish: true
@@ -18,13 +18,12 @@ Gem::Specification.new do |gem|
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ['lib']
20
20
 
21
- gem.add_development_dependency 'rake'
22
- gem.add_development_dependency 'rspec'
23
- gem.add_development_dependency 'coveralls'
24
- gem.add_development_dependency 'cinch-test'
25
-
26
- gem.add_dependency 'cinch', '~> 2.0.12'
27
- gem.add_dependency 'weather-underground', '~> 1.1.1'
28
- gem.add_dependency 'time-lord', '~> 1.0.1'
29
- gem.add_dependency 'cinch-cooldown', '~> 1.1.1'
30
- end
21
+ gem.add_development_dependency 'rake', '~> 10'
22
+ gem.add_development_dependency 'rspec', '~> 3'
23
+ gem.add_development_dependency 'coveralls', '~> 0.7'
24
+ gem.add_development_dependency 'cinch-test', '~> 0.1', '>= 0.1.0'
25
+ gem.add_dependency 'cinch', '~> 2'
26
+ gem.add_dependency 'cinch-cooldown', '~> 1.1', '>= 1.1.1'
27
+ gem.add_dependency 'weather-underground', '~> 1.1', '>= 1.1.1'
28
+ gem.add_dependency 'time-lord', '~> 1.0', '>= 1.0.1'
29
+ end
@@ -4,45 +4,53 @@ require 'cinch/cooldown'
4
4
  require 'time-lord'
5
5
  require 'weather-underground'
6
6
 
7
- module Cinch::Plugins
8
- # Cinch Plugin to report weather
9
- class Weatherman
10
- include Cinch::Plugin
11
-
12
- enforce_cooldown
13
-
14
- self.help = 'Use .w <location> to see information on the weather.'
15
-
16
- def initialize(*args)
17
- super
18
- @append = config[:append_forecast] || false
19
- end
20
-
21
- match(/(?:w|weather) (.+)/, method: :weather)
22
- match(/forecast (.+)/, method: :forecast)
23
-
24
- def weather(m, query)
25
- m.reply get_weather(query)
26
- end
27
-
28
- def forecast(m, query)
29
- m.reply get_forecast(query)
30
- end
31
-
32
- private
33
-
34
- def get_weather(query)
35
- weather = Weather.new(query).to_s
36
- weather << " #{Forecast.new(query).append}" if true
37
- weather
38
- rescue ArgumentError
39
- "Sorry, couldn't find #{query}."
40
- end
41
-
42
- def get_forecast(query)
43
- Forecast.new(query).to_s
44
- rescue ArgumentError
45
- "Sorry, couldn't find #{query}."
7
+ module Cinch
8
+ module Plugins
9
+ # Cinch Plugin to report weather
10
+ class Weatherman
11
+ include Cinch::Plugin
12
+
13
+ enforce_cooldown
14
+
15
+ self.help = 'Use .w <location> to see information on the weather.'
16
+
17
+ def initialize(*args)
18
+ super
19
+ @append =
20
+ if config.key?(:append_forecast)
21
+ config[:append_forecast]
22
+ else
23
+ false
24
+ end
25
+ end
26
+
27
+ match(/(?:w|weather) (.+)/, method: :weather)
28
+ match(/forecast (.+)/, method: :forecast)
29
+
30
+ def weather(m, query)
31
+ m.reply get_weather(query)
32
+ end
33
+
34
+ def forecast(m, query)
35
+ m.reply get_forecast(query)
36
+ end
37
+
38
+ private
39
+
40
+ def get_weather(query)
41
+ weather = Weather.new(query).to_s
42
+ weather << " #{Forecast.new(query).append}" if @append
43
+ debug "#{@append.to_s} #{config}"
44
+ weather
45
+ rescue ArgumentError
46
+ "Sorry, couldn't find #{query}."
47
+ end
48
+
49
+ def get_forecast(query)
50
+ Forecast.new(query).to_s
51
+ rescue ArgumentError
52
+ "Sorry, couldn't find #{query}."
53
+ end
46
54
  end
47
55
  end
48
56
  end
@@ -1,24 +1,28 @@
1
1
  # -*- coding: utf-8 -*-
2
- module Cinch::Plugins
3
- class Weatherman
4
- class Forecast
5
- def initialize(location)
6
- @data = WeatherUnderground::Base.new
7
- .SimpleForecast(location).days[1]
8
- fail ArgumentError if @data.nil?
9
- @location = Weather.new(location).location
10
- @forecast = @data.conditions.downcase
11
- @temp_high = @data.high.fahrenheit.round
12
- @temp_low = @data.low.fahrenheit.round
13
- end
2
+ module Cinch
3
+ module Plugins
4
+ class Weatherman
5
+ # Class to manage information on future conditions
6
+ class Forecast
7
+ def initialize(location)
8
+ @data = WeatherUnderground::Base.new.SimpleForecast(location).days[1]
14
9
 
15
- def to_s
16
- "Tommorrow in #{@location}; #{@forecast}, " +
17
- "high of #{@temp_high}F, low of #{@temp_low}F."
18
- end
10
+ fail ArgumentError if @data.nil?
11
+
12
+ @location = Weather.new(location).location
13
+ @forecast = @data.conditions.downcase
14
+ @temp_high = @data.high.fahrenheit.round
15
+ @temp_low = @data.low.fahrenheit.round
16
+ end
17
+
18
+ def to_s
19
+ "Tommorrow in #{@location}; #{@forecast}, " \
20
+ "high of #{@temp_high}F, low of #{@temp_low}F."
21
+ end
19
22
 
20
- def append
21
- to_s.gsub(" in #{@location}", '')
23
+ def append
24
+ to_s.gsub(" in #{@location}", '')
25
+ end
22
26
  end
23
27
  end
24
28
  end
@@ -3,7 +3,7 @@ module Cinch
3
3
  module Plugins
4
4
  # Versioning Info
5
5
  class Weatherman
6
- VERSION = '1.0.4'
6
+ VERSION = '1.0.5'
7
7
  end
8
8
  end
9
9
  end
@@ -1,21 +1,23 @@
1
1
  # -*- coding: utf-8 -*-
2
- module Cinch::Plugins
3
- class Weatherman
4
- class Weather
5
- attr_reader :location
2
+ module Cinch
3
+ module Plugins
4
+ class Weatherman
5
+ # Class to manage information for current conditions
6
+ class Weather
7
+ attr_reader :location
6
8
 
7
- def initialize(location)
8
- @data = WeatherUnderground::Base.new
9
- .CurrentObservations(location)
10
- @location = @data.display_location.first.full
11
- @temp = @data.temp_f
12
- @conditions = @data.weather.downcase
13
- @updated = Time.parse(@data.observation_time).ago.to_words
14
- end
9
+ def initialize(location)
10
+ @data = WeatherUnderground::Base.new.CurrentObservations(location)
11
+ @location = @data.display_location.first.full
12
+ @temp = @data.temp_f
13
+ @conditions = @data.weather.downcase
14
+ @updated = Time.parse(@data.observation_time).ago.to_words
15
+ end
15
16
 
16
- def to_s
17
- "In #{@location} it is #{@conditions} " +
18
- "and #{@temp}F (last updated about #{@updated})."
17
+ def to_s
18
+ "In #{@location} it is #{@conditions} " \
19
+ "and #{@temp}F (last updated about #{@updated})."
20
+ end
19
21
  end
20
22
  end
21
23
  end
@@ -11,40 +11,40 @@ describe Cinch::Plugins::Weatherman do
11
11
  describe 'weather' do
12
12
  it 'should allow users to ask for weather by zip' do
13
13
  msg = make_message(@bot, '!weather 94062')
14
- get_replies(msg).last.text
15
- .should include('In Redwood City, CA it is')
14
+ expect(get_replies(msg).last.text)
15
+ .to include('In Redwood City, CA it is')
16
16
  end
17
17
 
18
18
  it 'should allow users to ask for weather by city, state' do
19
19
  msg = make_message(@bot, '!weather redwood city, ca')
20
- get_replies(msg).last.text
21
- .should include('In Redwood City, CA it is')
20
+ expect(get_replies(msg).last.text)
21
+ .to include('In Redwood City, CA it is')
22
22
  end
23
23
 
24
24
  it 'should return temps' do
25
25
  msg = make_message(@bot, '!weather redwood city, ca')
26
- get_replies(msg).last.text
27
- .should match(/\d+F/)
26
+ expect(get_replies(msg).last.text)
27
+ .to match(/\d+F/)
28
28
  end
29
29
 
30
30
  it 'should allow users to ask for weather by airport code' do
31
31
  msg = make_message(@bot, '!weather SFO')
32
- get_replies(msg).last.text
33
- .should include('In San Francisco International, CA it is')
32
+ expect(get_replies(msg).last.text)
33
+ .to include('In San Francisco International, CA it is')
34
34
  end
35
35
 
36
36
  it 'should return an error when location not found' do
37
37
  msg = make_message(@bot, '!weather 34')
38
- get_replies(msg).last.text
39
- .should include('Sorry, couldn\'t find 34.')
38
+ expect(get_replies(msg).last.text)
39
+ .to include('Sorry, couldn\'t find 34.')
40
40
  end
41
41
 
42
42
  it 'should allow users to append forecasts' do
43
43
  bot = make_bot(Cinch::Plugins::Weatherman, { append_forecast: true })
44
- msg = make_message(@bot, '!weather 94062')
45
- message = get_replies(msg).first.text
46
- message.should include('In Redwood City, CA it is')
47
- message.should include('Tommorrow;')
44
+ msg = make_message(bot, '!weather 94062')
45
+ message = get_replies(msg).last.text
46
+ expect(message).to include('In Redwood City, CA it is')
47
+ expect(message).to include('Tommorrow;')
48
48
  end
49
49
 
50
50
  end
@@ -52,32 +52,32 @@ describe Cinch::Plugins::Weatherman do
52
52
  describe 'forecast' do
53
53
  it 'should allow users to ask for forecast by zip' do
54
54
  msg = make_message(@bot, '!forecast 94062')
55
- get_replies(msg).last.text
56
- .should include('Tommorrow in Redwood City, CA;')
55
+ expect(get_replies(msg).last.text)
56
+ .to include('Tommorrow in Redwood City, CA;')
57
57
  end
58
58
 
59
59
  it 'should allow users to ask for forecast by city, state' do
60
60
  msg = make_message(@bot, '!forecast redwood city, ca')
61
- get_replies(msg).last.text
62
- .should include('Tommorrow in Redwood City, CA;')
61
+ expect(get_replies(msg).last.text)
62
+ .to include('Tommorrow in Redwood City, CA;')
63
63
  end
64
64
 
65
65
  it 'should allow users to ask for forecast by airport code' do
66
66
  msg = make_message(@bot, '!forecast SFO')
67
- get_replies(msg).last.text
68
- .should include('Tommorrow in San Francisco International, CA;')
67
+ expect(get_replies(msg).last.text)
68
+ .to include('Tommorrow in San Francisco International, CA;')
69
69
  end
70
70
 
71
71
  it 'should return an error when location not found' do
72
72
  msg = make_message(@bot, '!forecast 34')
73
- get_replies(msg).last.text
74
- .should include('Sorry, couldn\'t find 34.')
73
+ expect(get_replies(msg).last.text)
74
+ .to include('Sorry, couldn\'t find 34.')
75
75
  end
76
76
 
77
77
  it 'should return temps' do
78
78
  msg = make_message(@bot, '!weather redwood city, ca')
79
- get_replies(msg).last.text
80
- .should match(/\d+F/)
79
+ expect(get_replies(msg).last.text)
80
+ .to match(/\d+F/)
81
81
  end
82
82
  end
83
83
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cinch-weatherman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
5
- prerelease:
4
+ version: 1.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brian Haberer
@@ -10,136 +9,144 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2014-02-28 00:00:00.000000000 Z
12
+ date: 2014-08-04 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rake
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - ~>
21
19
  - !ruby/object:Gem::Version
22
- version: '0'
20
+ version: '10'
23
21
  type: :development
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ! '>='
25
+ - - ~>
29
26
  - !ruby/object:Gem::Version
30
- version: '0'
27
+ version: '10'
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: rspec
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
- - - ! '>='
32
+ - - ~>
37
33
  - !ruby/object:Gem::Version
38
- version: '0'
34
+ version: '3'
39
35
  type: :development
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
- - - ! '>='
39
+ - - ~>
45
40
  - !ruby/object:Gem::Version
46
- version: '0'
41
+ version: '3'
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: coveralls
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
- - - ! '>='
46
+ - - ~>
53
47
  - !ruby/object:Gem::Version
54
- version: '0'
48
+ version: '0.7'
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
- - - ! '>='
53
+ - - ~>
61
54
  - !ruby/object:Gem::Version
62
- version: '0'
55
+ version: '0.7'
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: cinch-test
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: '0.1'
68
63
  - - ! '>='
69
64
  - !ruby/object:Gem::Version
70
- version: '0'
65
+ version: 0.1.0
71
66
  type: :development
72
67
  prerelease: false
73
68
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
69
  requirements:
70
+ - - ~>
71
+ - !ruby/object:Gem::Version
72
+ version: '0.1'
76
73
  - - ! '>='
77
74
  - !ruby/object:Gem::Version
78
- version: '0'
75
+ version: 0.1.0
79
76
  - !ruby/object:Gem::Dependency
80
77
  name: cinch
81
78
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
79
  requirements:
84
80
  - - ~>
85
81
  - !ruby/object:Gem::Version
86
- version: 2.0.12
82
+ version: '2'
87
83
  type: :runtime
88
84
  prerelease: false
89
85
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
86
  requirements:
92
87
  - - ~>
93
88
  - !ruby/object:Gem::Version
94
- version: 2.0.12
89
+ version: '2'
95
90
  - !ruby/object:Gem::Dependency
96
- name: weather-underground
91
+ name: cinch-cooldown
97
92
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
93
  requirements:
100
94
  - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '1.1'
97
+ - - ! '>='
101
98
  - !ruby/object:Gem::Version
102
99
  version: 1.1.1
103
100
  type: :runtime
104
101
  prerelease: false
105
102
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
103
  requirements:
108
104
  - - ~>
105
+ - !ruby/object:Gem::Version
106
+ version: '1.1'
107
+ - - ! '>='
109
108
  - !ruby/object:Gem::Version
110
109
  version: 1.1.1
111
110
  - !ruby/object:Gem::Dependency
112
- name: time-lord
111
+ name: weather-underground
113
112
  requirement: !ruby/object:Gem::Requirement
114
- none: false
115
113
  requirements:
116
114
  - - ~>
117
115
  - !ruby/object:Gem::Version
118
- version: 1.0.1
116
+ version: '1.1'
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: 1.1.1
119
120
  type: :runtime
120
121
  prerelease: false
121
122
  version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
123
  requirements:
124
124
  - - ~>
125
125
  - !ruby/object:Gem::Version
126
- version: 1.0.1
126
+ version: '1.1'
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: 1.1.1
127
130
  - !ruby/object:Gem::Dependency
128
- name: cinch-cooldown
131
+ name: time-lord
129
132
  requirement: !ruby/object:Gem::Requirement
130
- none: false
131
133
  requirements:
132
134
  - - ~>
133
135
  - !ruby/object:Gem::Version
134
- version: 1.1.1
136
+ version: '1.0'
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: 1.0.1
135
140
  type: :runtime
136
141
  prerelease: false
137
142
  version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
143
  requirements:
140
144
  - - ~>
141
145
  - !ruby/object:Gem::Version
142
- version: 1.1.1
146
+ version: '1.0'
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: 1.0.1
143
150
  description: Cinch Plugin to get Weather data using the Weather-Underground gem
144
151
  email:
145
152
  - bhaberer@gmail.com
@@ -164,29 +171,27 @@ files:
164
171
  homepage: https://github.com/canonical-hackers/cinch-weatherman
165
172
  licenses:
166
173
  - MIT
174
+ metadata: {}
167
175
  post_install_message:
168
176
  rdoc_options: []
169
177
  require_paths:
170
178
  - lib
171
179
  required_ruby_version: !ruby/object:Gem::Requirement
172
- none: false
173
180
  requirements:
174
181
  - - ! '>='
175
182
  - !ruby/object:Gem::Version
176
183
  version: '0'
177
184
  required_rubygems_version: !ruby/object:Gem::Requirement
178
- none: false
179
185
  requirements:
180
186
  - - ! '>='
181
187
  - !ruby/object:Gem::Version
182
188
  version: '0'
183
189
  requirements: []
184
190
  rubyforge_project:
185
- rubygems_version: 1.8.25
191
+ rubygems_version: 2.2.2
186
192
  signing_key:
187
- specification_version: 3
193
+ specification_version: 4
188
194
  summary: Cinch Plugin to get Weather data
189
195
  test_files:
190
196
  - spec/cinch-weatherman_spec.rb
191
197
  - spec/spec_helper.rb
192
- has_rdoc: