game_words 0.1.1 → 0.1.2

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: ae89c051ee35ded628c9f624865b1247f9dac743
4
- data.tar.gz: 45e1a6f171011d0354904acaddda0aacecfed9f9
3
+ metadata.gz: e2794ee9416078be8100bb1bd39384d2d1fb96fe
4
+ data.tar.gz: 8894b0b3d386ef138f56f56c05cff8a101207bbd
5
5
  SHA512:
6
- metadata.gz: 78d8ed1da913518e46984ff40e2b0442f27a6c169f77c5d0a79e4cbeac457246647aa705ad42ad8c98829556bf25652e1a752be8ce5c81fa7f6d3798d8c34851
7
- data.tar.gz: bf62576df25df7e876f4e8ecbaa1e61543e5f9c5c267f3e64ab7b541836d4050e80d5bb8279b290546183ced85e76b4f67ffcfcbbfa832c46d22b516f45d6580
6
+ metadata.gz: 9c4171b73ff26ba065fe84dfecea1321dbab37d3ddb48e0dd12e79e0a989dab9bf21e8a350b72523815e61d3009374cbf00d9ac7516c48281343a4ad9c23775c
7
+ data.tar.gz: 54ecfa601ea816ecdfb37ac62867d8609957556aed6b4ade2e9aabdeec177439a58f412e26dd70875a578b2bef63c68820c83e65c1b4951758ecf0448d186ff7
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
- # Gamewords
1
+ # Game Words
2
2
 
3
3
  Find words, phrases, songs, movies, characters, actions and sayings for
4
4
  Pictionary, Catchphrase, Charades or the holidays. Each game has several
5
- categories including difficulty levels. This library returns a list for
6
- some or all categories.
5
+ categories and difficulty levels. This library returns a word list for
6
+ some or all categories (nearly 5,000 in all).
7
+
8
+ A command line interface is provided in addition to the Ruby library
7
9
 
8
10
  ## Installation
9
11
 
@@ -15,39 +17,75 @@ gem 'game_words'
15
17
 
16
18
  And then execute:
17
19
 
18
- > bundle
20
+ ```bash
21
+ $ bundle
22
+ ```
19
23
 
20
24
  Or install it yourself as:
21
25
 
22
- > gem install game_words
26
+ ```bash
27
+ $ gem install game_words
28
+ ```
23
29
 
24
- ## Usage
30
+ ## Command Line Usage
25
31
 
26
- Find a list of games:
32
+ Show all words for a game:
27
33
 
28
- ```ruby
29
- GameWords::Generator.new.games
34
+ ```bash
35
+ $ gamewords charades
30
36
  ```
31
37
 
32
- Find the categories for a game:
33
- ```ruby
34
- gen = GameWords::Generator.new
35
- gen.game_categories 'pictionary'
38
+ Show all words for a specific game category:
39
+
40
+ ```bash
41
+ $ gamewords catchphrase people
42
+ ```
43
+
44
+ Show a list of games:
45
+
46
+ ```bash
47
+ $ gamewords -l
48
+ ```
49
+
50
+ Show a list of categories for a game:
51
+
52
+ ```bash
53
+ $ gamewords -c pictionary
36
54
  ```
37
55
 
38
- Get all words for all categories for a game:
56
+ Show a single random word or phrase:
57
+
58
+ ```bash
59
+ $ gamewords -r holidays newyears
60
+ ```
61
+
62
+ ## Library Usage
63
+
64
+ Show all words for a game:
39
65
 
40
66
  ```ruby
67
+ gen = GameWords::Generator.new
41
68
  gen.words 'catchphrase'
42
69
  ```
43
70
 
44
- Get the words for a game and category:
71
+ Show the words for a specific game category:
45
72
 
46
73
  ```ruby
47
74
  gen.words 'charades', 'hard'
48
75
  ```
49
76
 
50
- Easily generate a random word:
77
+ Show a list of games:
78
+
79
+ ```ruby
80
+ gen.games
81
+ ```
82
+
83
+ Show the categories for a game:
84
+ ```ruby
85
+ gen.game_categories 'pictionary'
86
+ ```
87
+
88
+ Easily show a random word:
51
89
 
52
90
  ```ruby
53
91
  gen.words('pictionary', 'easy').sample
data/bin/gamewords ADDED
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'game_words'
4
+ require 'optparse'
5
+
6
+ ARGV << '-h' if ARGV.empty?
7
+
8
+ options = {}
9
+ optparse = OptionParser.new do|opts|
10
+ opts.banner = 'Usage: gamewords [options] game [category]'
11
+
12
+ options[:list_games] = false
13
+ opts.on( '-l', '--list', 'List games' ) do
14
+ options[:list_games] = true
15
+ end
16
+
17
+ options[:game_category] = nil
18
+ opts.on( '-c', '--categories GAME', 'List categories for a GAME' ) do |game|
19
+ options[:game_category] = game
20
+ end
21
+
22
+ options[:random] = false
23
+ opts.on('-r', '--random', 'Show one random word or phrase for a GAME [CATEGORY]') do
24
+ options[:random] = true
25
+ end
26
+
27
+ opts.on('-v', '--version', 'Show the version') do
28
+ puts "v#{GameWords::VERSION}"
29
+ exit
30
+ end
31
+
32
+ opts.on_tail('-h', '--help', 'Display help screen') do
33
+ puts opts
34
+ exit
35
+ end
36
+ end
37
+
38
+ begin
39
+ optparse.parse!
40
+ rescue OptionParser::ParseError
41
+ puts 'Error parsing arguments. Please run with the -h option'
42
+ end
43
+
44
+ generator = GameWords::Generator.new
45
+
46
+ if options[:list_games]
47
+ puts generator.games
48
+ exit
49
+ end
50
+
51
+ if options[:game_category]
52
+ puts generator.game_categories(options[:game_category])
53
+ exit
54
+ end
55
+
56
+ game = ARGV[0]
57
+ categories = ARGV[1]
58
+ words = generator.words(game, categories)
59
+
60
+ if options[:random]
61
+ puts words.sample
62
+ exit
63
+ end
64
+
65
+ puts words
@@ -1,3 +1,3 @@
1
1
  module GameWords
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: game_words
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Aschenbach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-23 00:00:00.000000000 Z
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -59,7 +59,8 @@ description: |-
59
59
  some or all categories.
60
60
  email:
61
61
  - nick.aschenbach@gmail.com
62
- executables: []
62
+ executables:
63
+ - gamewords
63
64
  extensions: []
64
65
  extra_rdoc_files: []
65
66
  files:
@@ -71,6 +72,7 @@ files:
71
72
  - README.md
72
73
  - Rakefile
73
74
  - assets/game_words/game_words.yaml
75
+ - bin/gamewords
74
76
  - game_words.gemspec
75
77
  - lib/game_words.rb
76
78
  - lib/game_words/version.rb