countries_cli 0.1.2 → 0.1.3

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: 2050fe1a4e0b494c19b10d3e3012b08252655184
4
- data.tar.gz: 792c7edd5c30702b5245cb9d957e693d3e2da4e3
3
+ metadata.gz: 0e4fe91fa1cc1758dd9f5b65556abd1f33d98598
4
+ data.tar.gz: a3324a90bdd6b57b933aa9e063b21d3f2b91d636
5
5
  SHA512:
6
- metadata.gz: 862c49ca41e6b71373083ce373bdc49f134f510da29bd744d663838f39b07d92bee34eace557cccddf9ebb07c7d0e4996806b26cdfaf965b066b459d74065c43
7
- data.tar.gz: 61a056599c7ba808fbc4cd4ad40dda52e92b2d912b973f9608f6bf25b8e5364abaecbeec758bcf2b80a554ed56c4cca727e1e23be27f7b8c36470285b5d2f086
6
+ metadata.gz: 65c06e1f51f62f5def5f7a9672ba88557f68baa6b123d18af094803fb3eced80293b0613e121ff866eb90174a35e965462019276560f63c69b11c2a023db91bd
7
+ data.tar.gz: 426c9b77df96057edf66b65ba3c36188c37d698f42183a5e3a7a32a646741c6534fd3f184b558fa3d039d946420d42ccfffdb33707623d4aa8acea08a186cf74
data/Country.gemspec CHANGED
@@ -39,7 +39,6 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "bundler", "~> 1.17"
40
40
  spec.add_development_dependency "rake", "~> 10.0"
41
41
  spec.add_development_dependency "rspec", "~> 3.0"
42
- spec.add_development_dependency "pry"
43
42
  spec.add_development_dependency "gem-release"
44
43
 
45
44
  end
data/Gemfile.lock CHANGED
@@ -1,18 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- countries_cli (0.1.2)
4
+ countries_cli (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- coderay (1.1.2)
10
9
  diff-lcs (1.3)
11
10
  gem-release (2.0.1)
12
- method_source (0.9.2)
13
- pry (0.12.2)
14
- coderay (~> 1.1.0)
15
- method_source (~> 0.9.0)
16
11
  rake (10.5.0)
17
12
  rspec (3.8.0)
18
13
  rspec-core (~> 3.8.0)
@@ -35,7 +30,6 @@ DEPENDENCIES
35
30
  bundler (~> 1.17)
36
31
  countries_cli!
37
32
  gem-release
38
- pry
39
33
  rake (~> 10.0)
40
34
  rspec (~> 3.0)
41
35
 
data/README.md CHANGED
@@ -1,43 +1,87 @@
1
- # Country
1
+ # countries_cli
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/Country`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ A CLI of countries based on the REST Countries API. It allows you to look for information on countries based on population, region, currency, subregion, name, capital, and language.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ## Getting Started
6
6
 
7
- ## Installation
7
+ These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
8
8
 
9
- Add this line to your application's Gemfile:
9
+ ### Prerequisites
10
10
 
11
- ```ruby
12
- gem 'Country'
11
+ What things you need to install the software and how to install them
12
+
13
+ ```
14
+ Give examples
13
15
  ```
14
16
 
15
- And then execute:
17
+ ### Installing
16
18
 
17
- $ bundle
19
+ A step by step series of examples that tell you how to get a development env running
18
20
 
19
- Or install it yourself as:
21
+ Say what the step will be
20
22
 
21
- $ gem install Country
23
+ ```
24
+ Give the example
25
+ ```
22
26
 
23
- ## Usage
27
+ And repeat
28
+
29
+ ```
30
+ until finished
31
+ ```
24
32
 
25
- TODO: Write usage instructions here
33
+ End with an example of getting some data out of the system or using it for a little demo
26
34
 
27
- ## Development
35
+ ## Running the tests
36
+
37
+ Explain how to run the automated tests for this system
38
+
39
+ ### Break down into end to end tests
40
+
41
+ Explain what these tests test and why
42
+
43
+ ```
44
+ Give an example
45
+ ```
28
46
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
47
+ ### And coding style tests
30
48
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
49
+ Explain what these tests test and why
50
+
51
+ ```
52
+ Give an example
53
+ ```
54
+
55
+ ## Deployment
56
+
57
+ Add additional notes about how to deploy this on a live system
58
+
59
+ ## Built With
60
+
61
+ * [Dropwizard](http://www.dropwizard.io/1.0.2/docs/) - The web framework used
62
+ * [Maven](https://maven.apache.org/) - Dependency Management
63
+ * [ROME](https://rometools.github.io/rome/) - Used to generate RSS Feeds
32
64
 
33
65
  ## Contributing
34
66
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/Country. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
67
+ Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.
68
+
69
+ ## Versioning
70
+
71
+ We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).
72
+
73
+ ## Authors
74
+
75
+ * **Billie Thompson** - *Initial work* - [PurpleBooth](https://github.com/PurpleBooth)
76
+
77
+ See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
36
78
 
37
79
  ## License
38
80
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
81
+ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
40
82
 
41
- ## Code of Conduct
83
+ ## Acknowledgments
42
84
 
43
- Everyone interacting in the Country project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/Country/blob/master/CODE_OF_CONDUCT.md).
85
+ * Hat tip to anyone whose code was used
86
+ * Inspiration
87
+ * etc
data/lib/Country/cli.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require_relative 'country'
2
- require 'pry'
3
2
  require 'open-uri'
4
3
  require 'json'
5
4
  # CLI Controller
@@ -55,14 +54,14 @@ class Country::CLI
55
54
 
56
55
  def display_options
57
56
  puts "Enter an option (1-12): "
58
- puts "1. All country names"
57
+ puts "1. Display all country names"
59
58
  puts "2. Search country by name"
60
- puts "3. Search countries that start with given letter"
59
+ puts "3. Search country by suffix"
61
60
  puts "4. Search countries with given currency name"
62
61
  puts "5. Search countries with given currency symbol"
63
62
  puts "6. Search countries with given language"
64
63
  puts "7. Search countries with certain population"
65
- puts "8. All countries sorted by population(ascending or descending)"
64
+ puts "8. Display all countries sorted by population(ascending or descending)"
66
65
  puts "9. Search by capital"
67
66
  puts "10. Search by region"
68
67
  puts "11. Search by subregion"
@@ -79,6 +78,7 @@ class Country::CLI
79
78
  country = Country::COUNTRY.search_by_name(input)
80
79
  if country
81
80
  country.info
81
+ puts "\n"
82
82
  else
83
83
  puts "Invalid name. Please list all the countries and choose a name from there."
84
84
  end
@@ -90,6 +90,7 @@ class Country::CLI
90
90
  country = Country::COUNTRY.search_by_suffix(input)
91
91
  if country
92
92
  country.info
93
+ puts "\n"
93
94
  else
94
95
  puts "Country with given suffix not found."
95
96
  end
@@ -141,8 +142,8 @@ class Country::CLI
141
142
  puts "Greater(g) than or lower(l) than?"
142
143
  input = gets.chomp
143
144
 
144
- if input.downcase == "l" || input.downcase == "lower" || input.downcase == "g" || input.downcase == "greater" || input.downcase == "h" || input.downcoase == "higher"
145
- puts "Enter population: "
145
+ if input.downcase == "l" || input.downcase == "lower" || input.downcase == "g" || input.downcase == "greater" || input.downcase == "h" || input.downcase == "higher"
146
+ puts "Enter population (ex: 10000): "
146
147
  population = gets.chomp.to_i
147
148
  countries = Country::COUNTRY.search_all_with_population(input, population)
148
149
  if countries.count > 0
@@ -151,7 +152,7 @@ class Country::CLI
151
152
  puts "\n"
152
153
  end
153
154
  else
154
- puts "No countries with given language were found."
155
+ puts "No countries with the specified population were found."
155
156
  end
156
157
  else
157
158
  puts "Wrong input. Please try again.\n"
@@ -166,6 +167,7 @@ class Country::CLI
166
167
  countries_sorted = Country::COUNTRY.all.sort{|country1, country2| country2.population <=> country1.population}
167
168
  countries_sorted.each do |country|
168
169
  country.info
170
+ puts "\n"
169
171
  end
170
172
  elsif input == "a"
171
173
  countries_sorted = Country::COUNTRY.all.sort{|country1, country2| country1.population <=> country2.population}
@@ -185,6 +187,7 @@ class Country::CLI
185
187
  country = Country::COUNTRY.search_by_capital(input)
186
188
  if country
187
189
  country.info
190
+ puts "\n"
188
191
  else
189
192
  puts "Invalid capital. Please enter a valid capital."
190
193
  end
@@ -6,7 +6,6 @@ class Country::COUNTRY
6
6
 
7
7
  def initialize(attr_hash)
8
8
  attr_hash.each do |attribute, value|
9
- # binding.pry
10
9
  if self.respond_to?(attribute)
11
10
  self.send(("#{attribute}="), value)
12
11
  end
@@ -28,14 +27,13 @@ class Country::COUNTRY
28
27
  end
29
28
 
30
29
  def self.all_country_names
31
- # binding.pry
32
30
  self.all.each_with_index do |country, i|
33
31
  puts "#{i+1}. #{country.name}"
34
32
  end
35
33
  end
36
34
 
37
35
  def self.search_by_name(name)
38
- self.all.detect{|country| country.name == name}
36
+ self.all.detect{|country| country.name.downcase == name.downcase}
39
37
  end
40
38
 
41
39
  def info
@@ -50,7 +48,7 @@ class Country::COUNTRY
50
48
  end
51
49
 
52
50
  def self.search_by_suffix(suffix)
53
- self.all.detect{|country| country.name.match(/^(#{suffix})/)}
51
+ self.all.detect{|country| country.name.downcase.match(/^(#{suffix.downcase})/)}
54
52
  end
55
53
 
56
54
  def self.search_all_with_currency_symbol(currency_symbol)
@@ -1,3 +1,3 @@
1
1
  module Country
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/Country.rb CHANGED
@@ -3,7 +3,6 @@ require_relative "./Country/cli"
3
3
  require_relative "./Country/country"
4
4
  require "open-uri"
5
5
  require "json"
6
- require "pry"
7
6
 
8
7
  module Country
9
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: countries_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenneth Young Castro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-05 00:00:00.000000000 Z
11
+ date: 2019-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.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'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: gem-release
71
57
  requirement: !ruby/object:Gem::Requirement