meteo 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGES +4 -0
- data/README.md +7 -1
- data/bin/meteo +22 -1
- data/lib/meteo/meteo_cli.rb +8 -3
- data/lib/meteo/reporter.rb +1 -1
- data/lib/meteo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTljMTNlNzcxYzQ4Y2Y1NmZmNjRiMmZmNWZmNDU0YTE1ZDkxYmM5NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTc3NDEwOTIyOGI1YjJjN2ZjZjU4YzZhMTZkOTg1NGY2YTA1Mzk2Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWFjODZlNGRmMDRjNDliNWUwNjBhZjEwNDFjZGYzYjVmODZkZjYzMjQ4NDdi
|
10
|
+
ZjliNzI1NTA1YTdhYTg4NTZjNDNjY2Q3M2RlZmNkMjAyMThjNmRiMjQyMGFk
|
11
|
+
N2VhMmVkNDU4ODU4OWM1NDhkMTEzYWYyOTZhNTMxMTJmM2FhN2U=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjJiZDYxNWE1YzM3ZTBhMmI2YmIxMTAyZTAyZWYyNTJmNzFiZDdjM2VlMDU3
|
14
|
+
NzlkZjc2MTQ5MjFhYWZmNGI1MjhlZmY5NWI1ZjljYjk0ZDU0YmRkMjc1NDlk
|
15
|
+
YTZjMzM4MWM1MDRmNjVjYjgwYmI4OGRhMTNiNzEwNmI3ZGEyNDc=
|
data/CHANGES
CHANGED
data/README.md
CHANGED
@@ -18,7 +18,13 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
$ meteo Plainsboro, NJ
|
22
|
+
$ meteo Moscow, RU --units=metric
|
23
|
+
|
24
|
+
## Note
|
25
|
+
|
26
|
+
This gem was inspired by another GitHub project, [AnsiWeather] (https://github.com/fcambus/ansiweather),
|
27
|
+
written in shell.
|
22
28
|
|
23
29
|
## Contributing
|
24
30
|
|
data/bin/meteo
CHANGED
@@ -4,4 +4,25 @@ $:.unshift(File::join(File::dirname(File::dirname(__FILE__)), "lib"))
|
|
4
4
|
|
5
5
|
require 'meteo/meteo_cli'
|
6
6
|
|
7
|
-
|
7
|
+
params = []
|
8
|
+
|
9
|
+
units = "imperial"
|
10
|
+
|
11
|
+
index = 0
|
12
|
+
|
13
|
+
while index < ARGV.size do
|
14
|
+
param = ARGV[index]
|
15
|
+
|
16
|
+
if param =~ /--units=/ or param =~ /-u=/
|
17
|
+
units = ARGV[index][ARGV[index].index("=")+1..-1]
|
18
|
+
elsif param =~ /--units/ or param =~ /-u/
|
19
|
+
units = ARGV[index+1]
|
20
|
+
index = index + 1
|
21
|
+
else
|
22
|
+
params << param
|
23
|
+
end
|
24
|
+
|
25
|
+
index = index + 1
|
26
|
+
end
|
27
|
+
|
28
|
+
MeteoCLI.start ["quote", "--units=#{units}", "#{params.join(' ')}"]
|
data/lib/meteo/meteo_cli.rb
CHANGED
@@ -13,9 +13,10 @@ class MeteoCLI < Thor
|
|
13
13
|
You can optionally specify a second parameter, which will print
|
14
14
|
out a from message as well.
|
15
15
|
|
16
|
-
> $ meteo
|
16
|
+
> $ meteo Plainsboro, NJ
|
17
|
+
> $ meteo Moscow, RU --units=metric
|
17
18
|
LONGDESC
|
18
|
-
option :units
|
19
|
+
option :units, :aliases => "-u"
|
19
20
|
def quote(location)
|
20
21
|
units = options[:units] ? options[:units] : "imperial"
|
21
22
|
|
@@ -23,7 +24,11 @@ class MeteoCLI < Thor
|
|
23
24
|
|
24
25
|
response = JSON.parse(service.quote(location, units))
|
25
26
|
|
26
|
-
|
27
|
+
if response["message"]
|
28
|
+
puts response["message"]
|
29
|
+
else
|
30
|
+
puts report(response, units).join(' ')
|
31
|
+
end
|
27
32
|
end
|
28
33
|
|
29
34
|
end
|
data/lib/meteo/reporter.rb
CHANGED
@@ -52,7 +52,7 @@ module Reporter
|
|
52
52
|
#{text}Temperature #{data}#{temperature}#{scale}
|
53
53
|
#{text}Humidity #{data}#{humidity}%
|
54
54
|
#{text}Wind #{data}#{wind}#{speed_unit}
|
55
|
-
#{text}Pressure #{data}#{pressure}
|
55
|
+
#{text}Pressure #{data}#{pressure}#{pressure_unit}
|
56
56
|
#{text}Sunrise #{data}#{Time.at(sunrise).strftime('%I:%M:%S%p')}
|
57
57
|
#{text}Sunset #{data}#{Time.at(sunset).strftime('%I:%M:%S%p')}#{stop}
|
58
58
|
)
|
data/lib/meteo/version.rb
CHANGED