whatsa 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6941479b97c3f41bbae524b31c9244f4b990a366
4
- data.tar.gz: 867011ab9e79dc329430a83e1b4ef3b3be952ebc
3
+ metadata.gz: 1993b2561b3445bf9b58411f7febd1f450f61a0b
4
+ data.tar.gz: 213a0acf46b568f07db9d8b05990870212584bcb
5
5
  SHA512:
6
- metadata.gz: c0e01720183c1305f37e5ba0f05fe86a4f32ea6707a1ddb58b9d0f7938901022f9c659dd819e28e85d33c1152dbd95fb6901c4926e1ffc72aa15412022cdf0eb
7
- data.tar.gz: aed002affa7241973f43691d6215de7018ad83ff74c11c0db0c0c9cce859160767008e5fc9c8ecb25b4cb6126858039b60d6349bb70fb32975da7885a312ad3e
6
+ metadata.gz: 0cb9214339408ba6b176ca9910213f6555d2f59f5934ecbc491ac2ff50ebbda735c404114a1c05273eca16d57d4753f6b69c0741826c8e9dd30e3b72293728b2
7
+ data.tar.gz: 02a43daaf63c4c110e79b3fd8947f74106f4f81832bc660efd600a62ce4eb39cd1fd6b08da07d5a80382e35b326d66fde44e8ac0c9a7dc5f8c2a32a4f1103c89
data/README.md CHANGED
@@ -16,6 +16,10 @@ Simple?
16
16
 
17
17
  Simple!
18
18
 
19
+ ### No, but like, _how_ does it do that?
20
+
21
+ You can find a little more information in a blog post I made [here](http://cogsandcurves.com/2016/11/28/so_you_made_a_cli_data_gem_eh/)!
22
+
19
23
  ## Installing Whatsa
20
24
 
21
25
  ```
@@ -1,6 +1,6 @@
1
1
  require 'open-uri'
2
2
  require 'nokogiri'
3
- # require 'pry'
3
+ require 'pry'
4
4
 
5
5
  require_relative '../lib/whatsa/version'
6
6
  require_relative '../lib/whatsa/cli'
data/lib/whatsa/cli.rb CHANGED
@@ -62,7 +62,8 @@ class Whatsa::CLI
62
62
  stripped_title = dmb.title.gsub("(disambiguation)", "").strip
63
63
  puts "Hmmm... #{stripped_title} could mean a few different things:\n"
64
64
  dmb.descriptions.each_with_index do |kvp, i|
65
- puts "#{i + 1}. #{kvp[0].to_s} (#{kvp[1]})"
65
+ desc = kvp[1].empty? ? "" : " - #{kvp[1]}"
66
+ puts "#{i + 1}. #{kvp[0].to_s}" + desc
66
67
  end
67
68
  puts "\nPlease select a choice, either by name or number."
68
69
  end
@@ -101,6 +102,7 @@ class Whatsa::CLI
101
102
 
102
103
  def summarize(text)
103
104
  system("clear")
105
+ return full(text) if text.summary == text.full_text
104
106
  puts word_wrap(text.summary)
105
107
  summary_helpline
106
108
  input = gets_command
@@ -8,11 +8,11 @@ class Whatsa::Section
8
8
  end
9
9
 
10
10
  def summary
11
- self.paragraphs.first
11
+ self.paragraphs.first || "[no displayable information]"
12
12
  end
13
13
 
14
14
  def full_text
15
- self.paragraphs.join("\n\n")
15
+ self.paragraphs.empty? ? "[no displayable information]" : self.paragraphs.join("\n\n")
16
16
  end
17
17
 
18
18
  private
@@ -1,3 +1,3 @@
1
1
  module Whatsa
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
data/whatsa.gemspec CHANGED
@@ -26,5 +26,6 @@ If you're not super satisfied with that bit of information (and you need to know
26
26
  spec.add_development_dependency "bundler", "~> 1.13"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
28
  spec.add_development_dependency "nokogiri"
29
+ spec.add_development_dependency "pry"
29
30
 
30
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whatsa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keegan Leitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-28 00:00:00.000000000 Z
11
+ date: 2016-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: |-
56
70
  Whatsa is a CLI app that allows you to search a word or phrase and receive a quick summary about that subject. It searches your query on Wikipedia and finds the page you're most likely looking for. If you've been somewhat vague, or your search term could refer to multiple things, it will ask you to select from a disambiguation of topics. Usually, however, your term will go straight to an article. Whatsa then gives you the first paragraph of that article (usually a surprisingly decent summary).
57
71