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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Njg2ODIxYjczMjk3ZGZiZjliNTdkZjg5ZjBkYjMwYTkxZGE2ZmU0MQ==
4
+ NTljMTNlNzcxYzQ4Y2Y1NmZmNjRiMmZmNWZmNDU0YTE1ZDkxYmM5NQ==
5
5
  data.tar.gz: !binary |-
6
- YzA1YzczOTg5YjUyNjYxNmQzNzQxODdkMDM3ZGM0YmVlZDI2YjVkZA==
6
+ OTc3NDEwOTIyOGI1YjJjN2ZjZjU4YzZhMTZkOTg1NGY2YTA1Mzk2Zg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjJiNDJkNzEzYmJmY2NiM2FhNTU3MDFmNzVlNDJiM2ZiZjA3N2NjMGJiYmEy
10
- M2MxYzg3N2I3MGU1OTI2MjQ3NzU0NzA1ZGUxNzcyYmRlOWJhZTUxZjQ5YmI4
11
- MzZjYTM1OGZhYTMzNTY3NjQ0MTBjMTcxMzk3YjMyNDVlYTI4ZmI=
9
+ ZWFjODZlNGRmMDRjNDliNWUwNjBhZjEwNDFjZGYzYjVmODZkZjYzMjQ4NDdi
10
+ ZjliNzI1NTA1YTdhYTg4NTZjNDNjY2Q3M2RlZmNkMjAyMThjNmRiMjQyMGFk
11
+ N2VhMmVkNDU4ODU4OWM1NDhkMTEzYWYyOTZhNTMxMTJmM2FhN2U=
12
12
  data.tar.gz: !binary |-
13
- MWM0MTNjMGJhYmMyNTA2ZTk0NjNhZTVjMmUzMTc2OTgzNDc1YWEzNWVlMzdj
14
- OTBiYWM0NWY2NGJiOWEyYjdjNmE5MDM5OWVhMmI5MmNiNWY0Y2IyNTc0MTMz
15
- NTc3MmFlY2MzZDMyNWM5YjIyOWM0Y2VhMmMyZjRjN2VmNDZjNGU=
13
+ YjJiZDYxNWE1YzM3ZTBhMmI2YmIxMTAyZTAyZWYyNTJmNzFiZDdjM2VlMDU3
14
+ NzlkZjc2MTQ5MjFhYWZmNGI1MjhlZmY5NWI1ZjljYjk0ZDU0YmRkMjc1NDlk
15
+ YTZjMzM4MWM1MDRmNjVjYjgwYmI4OGRhMTNiNzEwNmI3ZGEyNDc=
data/CHANGES CHANGED
@@ -3,3 +3,7 @@
3
3
  == Version 1.0.0
4
4
 
5
5
  * Initial release.
6
+
7
+ == Version 1.0.1
8
+
9
+ * Bug fixes.
data/README.md CHANGED
@@ -18,7 +18,13 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
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
- MeteoCLI.start ARGV
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(' ')}"]
@@ -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 quote "plainsboro, nj"
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
- puts report(response, units).join(' ')
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
@@ -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} #{pressure_unit}
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
@@ -1,3 +1,3 @@
1
1
  module Meteo
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meteo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Shvets