friends 0.17 → 0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67aca011d40b8ec1f5f92dda50a441dff1363523
4
- data.tar.gz: fdd5c7f7459f4bf28773d4e6c1ef3ab4d462f35e
3
+ metadata.gz: cafcf4ae0c7862e767cfa66d62f82358aa4427dd
4
+ data.tar.gz: ce713e78e33183b58d1dfe8a0a4ee56434bef476
5
5
  SHA512:
6
- metadata.gz: 4d05eff21075277e8bc244c69c4bf506c52b74955ef841d65a0fd23cd883d48af4f0d652ccde694ec453e4460355f542251c891f97ad6fe0986f49b08952e273
7
- data.tar.gz: 8df26c543ce7c25dc6a1c1474914fd170ca973019b27834df33c5003b1900e07f5112a02c96117dd8b4eb7c17fb1f1c3af9e9c8a5e722ce2ee06b9ca883e2e36
6
+ metadata.gz: abe895385b3b8fead89b0d05693b8c8ccce448a3a0af2af65bb0eb0441cc22e4b25d8de0d62b2318572053d5db977ec69dd33b90003017b89bd7349124baa0e1
7
+ data.tar.gz: 26ccbf5fe8b0178a8473ed8c7b541bed990cc9d65644760cd21a642a00a4b840048c1a3cde58e87c619d3ee5554e660342b4fce81bc7a012ea29bdff3c631509
@@ -1,5 +1,25 @@
1
1
  # Change Log
2
2
 
3
+ ## [v0.18](https://github.com/JacobEvelyn/friends/tree/v0.18) (2016-05-02)
4
+ [Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.17...v0.18)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - Improve documentation [\#92](https://github.com/JacobEvelyn/friends/issues/92)
9
+ - Have a way to correct mistakes? [\#91](https://github.com/JacobEvelyn/friends/issues/91)
10
+ - Allow friends to be found with first name and last name initial [\#87](https://github.com/JacobEvelyn/friends/issues/87)
11
+
12
+ **Fixed bugs:**
13
+
14
+ - Nicknames including first names should match over first name [\#111](https://github.com/JacobEvelyn/friends/issues/111)
15
+
16
+ **Merged pull requests:**
17
+
18
+ - Match friends with first name and last name initial [\#114](https://github.com/JacobEvelyn/friends/pull/114) ([JacobEvelyn](https://github.com/JacobEvelyn))
19
+ - Give nicknames matching precedence over first names [\#113](https://github.com/JacobEvelyn/friends/pull/113) ([JacobEvelyn](https://github.com/JacobEvelyn))
20
+ - Add `friends edit` command [\#112](https://github.com/JacobEvelyn/friends/pull/112) ([JacobEvelyn](https://github.com/JacobEvelyn))
21
+ - Organize documentation in README [\#110](https://github.com/JacobEvelyn/friends/pull/110) ([JacobEvelyn](https://github.com/JacobEvelyn))
22
+
3
23
  ## [v0.17](https://github.com/JacobEvelyn/friends/tree/v0.17) (2016-03-28)
4
24
  [Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.16...v0.17)
5
25
 
@@ -62,7 +82,7 @@
62
82
  **Merged pull requests:**
63
83
 
64
84
  - Improve handling of double-names and names within names [\#81](https://github.com/JacobEvelyn/friends/pull/81) ([JacobEvelyn](https://github.com/JacobEvelyn))
65
- - Update RuboCop and fix many offenses [\#79](https://github.com/JacobEvelyn/friends/pull/79) ([bloomyminded](https://github.com/bloomyminded))
85
+ - Update RuboCop and fix many offenses [\#79](https://github.com/JacobEvelyn/friends/pull/79) ([codyjroberts](https://github.com/codyjroberts))
66
86
 
67
87
  ## [v0.12](https://github.com/JacobEvelyn/friends/tree/v0.12) (2016-01-16)
68
88
  [Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.11...v0.12)
@@ -75,7 +95,7 @@
75
95
  **Merged pull requests:**
76
96
 
77
97
  - Update README and CONTRIBUTING docs. Closes \#76 [\#77](https://github.com/JacobEvelyn/friends/pull/77) ([JacobEvelyn](https://github.com/JacobEvelyn))
78
- - Add rename friend [\#75](https://github.com/JacobEvelyn/friends/pull/75) ([bloomyminded](https://github.com/bloomyminded))
98
+ - Add rename friend [\#75](https://github.com/JacobEvelyn/friends/pull/75) ([codyjroberts](https://github.com/codyjroberts))
79
99
 
80
100
  ## [v0.11](https://github.com/JacobEvelyn/friends/tree/v0.11) (2016-01-13)
81
101
  [Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.10...v0.11)
data/README.md CHANGED
@@ -5,25 +5,66 @@
5
5
  Spend time with the people you care about. Introvert-tested.
6
6
  Extrovert-approved.
7
7
 
8
- ### What is it?
9
-
10
- **Friends** is both a Ruby library and a command-line interface that
8
+ ## Table of Contents
9
+
10
+ - [Overview](#overview)
11
+ - [Installation](#installation)
12
+ - [Usage](#usage)
13
+ - [Core concepts](#core-concepts)
14
+ - [Global flags](#global-flags)
15
+ - [Syncing across multiple machines](#syncing-across-multiple-machines)
16
+ - [Command reference](#command-reference)
17
+ - [`add`](#add)
18
+ - [`add activity`](#add-activity)
19
+ - [`add friend`](#add-friend)
20
+ - [`add location`](#add-location)
21
+ - [`add nickname`](#add-nickname)
22
+ - [`clean`](#clean)
23
+ - [`graph`](#graph)
24
+ - [`help`](#help)
25
+ - [`list`](#list)
26
+ - [`list activities`](#list-activities)
27
+ - [`list favorites`](#list-favorites)
28
+ - [`list friends`](#list-friends)
29
+ - [`list locations`](#list-locations)
30
+ - [`remove nickname`](#remove-nickname)
31
+ - [`rename`](#rename)
32
+ - [`rename friend`](#rename-friend)
33
+ - [`rename location`](#rename-location)
34
+ - [`set location`](#set)
35
+ - [`stats`](#stats)
36
+ - [`suggest`](#suggest)
37
+ - [`update`](#update)
38
+ - [Other documentation](#other-documentation)
39
+ - [Contributing (it's encouraged!)](#contributing-its-encouraged)
40
+ - [Code of Conduct](#code-of-conduct)
41
+ - [License](#license)
42
+
43
+ ----
44
+
45
+ ## Overview
46
+
47
+ `friends` is both a Ruby library and a command-line interface that
11
48
  allows you to keep track of your relationships with the people you
12
49
  care about.
13
50
 
14
- ### Why use it?
51
+ `friends` gives you:
52
+ - More organization around staying in touch with friends and
53
+ family.
54
+ - A way to track the ebbs and flows of your relationships over
55
+ time.
56
+ - Suggestions for who to call or hang out with when you have free
57
+ time, whether it's fifteen minutes or an entire weekend.
58
+ - A low-cost way to record and remember big moments in your life.
59
+
60
+ Its philosophy emphasizes:
15
61
 
16
- 1. **Friends** gives you:
17
- - More organization around staying in touch with friends and
18
- family.
19
- - A way to track the ebbs and flows of your relationships over
20
- time.
21
- - Suggestions for who to call or hang out with when you have free
22
- time, whether it's fifteen minutes or an entire weekend.
23
- - A low-cost way to record and remember big moments in your life.
24
- 2. **Friends** stores its data in a human-readable `friends.md`
25
- Markdown file. No proprietary formats here!
26
- 3. **Friends** is open-source and very open to new ideas. Contribute!
62
+ - **Simplicity**—it should be quick and easy to use.
63
+ - **Transparency**—all data is stored in a human-readable Markdown file. No
64
+ proprietary formats here! And in addition to being open-source, `friends` is
65
+ very much open to new ideas. Contribute!
66
+ - **Intelligence**—specify dates with English phrases like "yesterday." Specify
67
+ friends with their first names, even when you're friends with many *Joanne*s. `friends` will figure it out.
27
68
 
28
69
  ## Installation
29
70
 
@@ -31,240 +72,443 @@ care about.
31
72
  $ gem install friends
32
73
  ```
33
74
 
34
- ## Usage*
75
+ Easy, huh?
35
76
 
36
- *Note that the command-line output is colored, which this README cannot show.
77
+ ## Usage
78
+
79
+ ### Core concepts
80
+
81
+ `friends` is structured around several different types of things:
37
82
 
38
- ### Basic commands:
83
+ - **Activities**: The things you do. Each activity has a date associated with
84
+ it.
85
+ - **Friends**: The people you do *activities* with. Each friend has a name and,
86
+ optionally, one or several nicknames.
87
+ - **Locations**: The places in which *activities* happen.
39
88
 
40
- ##### Add a friend:
89
+ The `friends.md` Markdown file that stores all of your data contains:
90
+
91
+ - an alphabetical list of all locations:
92
+
93
+ ```markdown
94
+ ### Locations:
95
+ - Atlantis
96
+ - Marie's Diner
97
+ - Paris
41
98
  ```
42
- $ friends add friend "Grace Hopper"
43
- Friend added: "Grace Hopper"
99
+
100
+ - an alphabetical list of all friends and their nicknames and locations:
101
+
102
+ ```markdown
103
+ ### Friends:
104
+ - George Washington Carver
105
+ - Grace Hopper (a.k.a. The Admiral a.k.a. Amazing Grace) [Paris]
106
+ - Marie Curie [Atlantis]
107
+ ```
108
+
109
+ - and an ordered list of all activities:
110
+
111
+ ```markdown
112
+ ### Activities:
113
+ - 2015-11-01: **Grace Hopper** and I went to _Marie's Diner_. George had to cancel at the last minute.
114
+ - 2015-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**.
115
+ - 2014-12-31: Celebrated the new year in _Paris_ with **Marie Curie**.
116
+ - 2014-11-15: Talked to **George Washington Carver** on the phone for an hour.
117
+ ```
118
+
119
+ See the example
120
+ [`friends.md`](https://github.com/JacobEvelyn/friends/blob/master/friends.md)
121
+ file for more information.
122
+
123
+ ### Global flags
124
+
125
+ `friends` supports several global flags that can be used on any command when
126
+ specified before the name of the command, like: `friends [flags] [command]`.
127
+
128
+ These flags are:
129
+
130
+ - `--debug`: Debug error messages with a full backtrace.
131
+ - `--filename`: Set the location of the friends file to use (default: ./friends.md)
132
+
133
+ ```bash
134
+ $ friends --filename ./test/tmp/friends.md clean
135
+ File cleaned: "./test/tmp/friends.md"
136
+ ```
137
+
138
+ - `--quiet`: Quiet output messages.
139
+
140
+ ```bash
141
+ $ friends --quiet add activity "Went rollerskating with George."
142
+ $ # No output!
143
+ ```
144
+
145
+ In addition, these flags may be used without any command:
146
+
147
+ - `--help`: Show the help menu. This is equivalent to `friends help`.
148
+ Help menus are available for all levels of commands:
149
+
150
+ ```bash
151
+ $ friends --help
152
+ ```
153
+
154
+ ```bash
155
+ $ friends list --help
44
156
  ```
45
- ##### Record an activity with a friend:
157
+
158
+ ```bash
159
+ $ friends list activities --help
46
160
  ```
161
+
162
+ - `--version`: Show the `friends` program version.
163
+
164
+ ### Syncing across multiple machines
165
+
166
+ Wouldn't it be nice to be able to use `friends` across all of your
167
+ devices? Hooray, you can! Just put the `friends.md` file in your
168
+ Dropbox/Box Sync/Google Drive/whatever folder and use the
169
+ `--filename` flag. You can even set up a Bash/Zsh/whatever alias to
170
+ do this for you, like so:
171
+
172
+ ```bash
173
+ alias friends="friends --filename '~/Dropbox/friends.md'"
174
+ ```
175
+
176
+ ### Command reference*
177
+
178
+ *Note that the command-line output is colored, which this README cannot show.
179
+
180
+ #### `add`
181
+
182
+ ##### `add activity`
183
+
184
+ ```bash
47
185
  $ friends add activity "Got lunch with Grace and George."
48
186
  Activity added: "2015-01-04: Got lunch with Grace Hopper and George Washington Carver."
49
187
  ```
188
+
50
189
  `friends` will **automatically** figure out which "Grace" and "George" you're referring to, *even if you're friends with lots of different Graces and Georges*.
51
190
 
52
- You can of course specify a date for the activity:
191
+ Nicknames will be used to match friends in activities,
192
+ just like formal names:
193
+
194
+ ```bash
195
+ $ friends add activity "Invented debugging with The Admiral."
196
+ Activity added: "2016-01-06: Invented debugging with Grace Hopper."
197
+ ```
198
+
199
+ You can also use the first initial of a last name instead of the whole thing.
200
+ `friends` will figure out what to do with those pesky periods (if you include
201
+ them) based on whether you're in the middle of a sentence or not:
202
+
203
+ ```bash
204
+ $ friends add activity "Got lunch with Earnest H and Earnest S. in the park. Man, I like Earnest H. but really love Earnest S."
205
+ Activity added: "2016-05-01: Got lunch with Earnest Hemingway and Earnest Shackleton in the park. Man, I like Earnest Hemingway but really love Earnest Shackleton."
206
+ ```
207
+
208
+ And locations will be matched as well:
209
+
210
+ ```bash
211
+ $ friends add activity "Went swimming near atlantis with George."
212
+ Activity added: "2016-01-06: Went swimming near Atlantis with George Washington Carver."
53
213
  ```
214
+
215
+ You can of course specify a date for the activity:
216
+
217
+ ```bash
54
218
  $ friends add activity "Yesterday: Celebrated the new year with Marie."
55
219
  Activity added: "2014-12-31: Celebrated the new year with Marie Curie."
56
220
  ```
221
+
57
222
  Or get an **interactive prompt** by just typing `friends add activity`, with or without a date specified:
58
- ```
223
+
224
+ ```bash
59
225
  $ friends add activity 2015-11-01
60
226
  2015-11-01: <type description here>
61
227
  ```
228
+
62
229
  **Natural-language dates** work just fine:
63
- ```
230
+
231
+ ```bash
64
232
  $ friends add activity 'last Monday'
65
233
  2016-03-07: <type description here>
66
234
  ```
235
+
67
236
  You can escape the names of friends you don't want `friends` to match with a backslash:
68
- ```
237
+
238
+ ```bash
69
239
  $ friends add activity "2015-11-01: Grace and I went to \Marie's Diner. \George had to cancel at the last minute."
70
240
  Activity added: "2015-11-01: Grace Hopper and I went to Marie's Diner. George had to cancel at the last minute."
71
241
  ```
72
- ##### Set a friend's nicknames:
242
+
243
+ ##### `add friend`
244
+
245
+ ```bash
246
+ $ friends add friend "Grace Hopper"
247
+ Friend added: "Grace Hopper"
248
+ ```
249
+
250
+ ##### `add location`
251
+
252
+ ```
253
+ $ friends add location Atlantis
254
+ Location added: "Atlantis"
73
255
  ```
256
+
257
+ ##### `add nickname`
258
+
259
+ ```bash
74
260
  $ friends add nickname "Grace Hopper" "The Admiral"
75
261
  Nickname added: "Grace Hopper (a.k.a. The Admiral)
76
262
  $ friends add nickname "Grace Hopper" "Amazing Grace"
77
263
  Nickname added: "Grace Hopper (a.k.a. The Admiral a.k.a. Amazing Grace)"
78
264
  ```
79
- Nicknames will be used to match friends in activities,
80
- just like formal names:
81
- ```
82
- $ friends add activity "Invented debugging with Amazing Grace.""
83
- Activity added: "2016-01-06: Invented debugging with Amazing Grace Hopper."
84
- ```
85
- And they can be removed as well:
86
- ```
87
- $ friends remove nickname "Grace Hopper" "The Admiral"
88
- Nickname removed: "Grace Hopper (a.k.a. Amazing Grace)"
89
- ```
90
- ##### Set a friend's location:
91
- ```
92
- $ friends set location Marie Paris
93
- Marie Curie's location set to: Paris
94
- ```
95
- ##### Change a friend's name:
96
- ```
97
- $ friends rename friend "Grace Hopper" "Grace Brewster Murray Hopper"
98
- Name changed: "Grace Brewster Murray Hopper (a.k.a. Amazing Grace)"
99
- ```
100
- ##### Change the name of a location:
101
- ```
102
- $ friends rename location Paris "Paris, France"
103
- Location renamed: "Paris, France"
104
- ```
105
- ##### Suggest a friend to do something with:
265
+
266
+ #### `clean`
267
+
268
+ Reads and re-writes the `friends.md` file:
269
+
270
+ ```bash
271
+ $ friends clean
272
+ File cleaned: "./friends.md"
106
273
  ```
107
- $ friends suggest
108
- Distant friend: Marie Curie
109
- Moderate friend: Grace Hopper
110
- Close friend: George Washington Carver
274
+
275
+ This command is useful after manual editing of the file, for re-ordering its
276
+ contents.
277
+
278
+ #### `edit`
279
+
280
+ Allows you to manually edit the file:
281
+
282
+ ```bash
283
+ $ friends edit
284
+ Opening "./friends.md" in vim
111
285
  ```
112
- Or only suggest friends in a specific location:
286
+
287
+ The file is opened with the command specified by the `$EDITOR` environment
288
+ variable, falling back to `vim` if it is not set:
289
+
290
+ ```bash
291
+ $ export EDITOR=atom
292
+ $ friends edit
293
+ Opening "./friends.md" in atom
113
294
  ```
114
- $ friends suggest --in Paris
115
- Distant friend: Marie Curie
295
+
296
+ #### `graph`
297
+
298
+ Graphs (in color!) your relationship with a given friend over time:
299
+
300
+ ```bash
301
+ $ friends graph George
302
+ Nov 2014 |█
303
+ Dec 2014 |
304
+ Jan 2015 |█████
305
+ Feb 2015 |███
116
306
  ```
117
- ##### Add a location for your friends and activities:
307
+
308
+ Or just graph all of your activities:
309
+
310
+ ```bash
311
+ $ friends graph
312
+ Nov 2014 |███
313
+ Dec 2014 |██
314
+ Jan 2015 |███████
315
+ Feb 2015 |█████
118
316
  ```
119
- $ friends add location Atlantis
120
- Location added: "Atlantis"
317
+
318
+ #### `help`
319
+
320
+ Displays a help menu. This is equivalent to `friends --help`.
321
+
322
+ ```bash
323
+ $ friends help
324
+ NAME
325
+ friends - Spend time with the people you care about. Introvert-tested. Extrovert-approved.
326
+
327
+ SYNOPSIS
328
+ friends [global options] command [command options] [arguments...]
329
+
330
+ ...
121
331
  ```
122
- ##### And locations will be matched as well:
332
+
333
+ Help menus are available for all levels of commands:
334
+
335
+ ```bash
336
+ $ friends help
123
337
  ```
124
- $ friends add activity "Went swimming near atlantis with George."
125
- Activity added: "2016-01-06: Went swimming near Atlantis with George Washington Carver."
338
+
339
+ ```bash
340
+ $ friends help list
126
341
  ```
127
- ##### List the activities you've recorded:
342
+
343
+ ```bash
344
+ $ friends help list activities
128
345
  ```
346
+
347
+ #### `list`
348
+
349
+ ##### `list activities`
350
+
351
+ Lists recent activities:
352
+
353
+ ```bash
129
354
  $ friends list activities
130
355
  2015-01-04: Got lunch with Grace Hopper and George Washington Carver.
131
356
  2014-12-31: Celebrated the new year with Marie Curie in New York City.
132
357
  2014-11-15: Talked to George Washington Carver on the phone for an hour.
133
358
  ```
134
- Or only list the activities you did with a certain friend:
359
+
360
+ You can adjust how many activities are shown:
361
+
362
+ ```bash
363
+ $ friends list activities --limit 2
364
+ 2015-01-04: Got lunch with Grace Hopper and George Washington Carver.
365
+ 2014-12-31: Celebrated the new year with Marie Curie in New York City.
135
366
  ```
367
+
368
+ Or only list the activities you did with a certain friend:
369
+
370
+ ```bash
136
371
  $ friends list activities --with "George"
137
372
  2015-01-04: Got lunch with Grace Hopper and George Washington Carver.
138
373
  2014-11-15: Talked to George Washington Carver on the phone for an hour.
139
-
140
374
  ```
375
+
141
376
  Or filter your activities by location:
142
- ```
377
+
378
+ ```bash
143
379
  $ friends list activities --in "New York"
144
380
  2014-12-31: Celebrated the new year with Marie Curie in New York City.
145
381
  ```
146
- ##### Find your favorite friends:
147
- ```
382
+
383
+ ##### `list favorites`
384
+
385
+ Lists your "favorite" friends (by total number of activities):
386
+
387
+ ```bash
148
388
  $ friends list favorites
149
389
  Your favorite friends:
150
390
  1. George Washington Carver (2 activities)
151
391
  2. Grace Hopper (1)
152
392
  3. Marie Curie (1)
153
393
  ```
154
- Or get a specific number of favorites:
155
- ```
394
+
395
+ You can specify a number of favorites to show:
396
+
397
+ ```bash
156
398
  $ friends list favorites --limit 2
157
399
  Your favorite friends:
158
400
  1. George Washington Carver (2 activities)
159
401
  2. Grace Hopper (1)
160
402
  ```
161
- ##### Graph (in color!) your relationship with a friend over time:
162
- ```
163
- $ friends graph George
164
- Nov 2014 |█
165
- Dec 2014 |
166
- Jan 2015 |█████
167
- Feb 2015 |███
168
- ```
169
- ##### Or just graph all of your activities:
170
- ```
171
- $ friends graph
172
- Nov 2014 |███
173
- Dec 2014 |██
174
- Jan 2015 |███████
175
- Feb 2015 |█████
176
- ```
177
- ##### Or just check out your lifetime stats:
178
- ```
179
- $ friends stats
180
- Total activities: 4
181
- Total friends: 3
182
- Total time elapsed: 5 days
183
- ```
184
- ##### List all of your friends:
185
- ```
403
+
404
+ ##### `list friends`
405
+
406
+ Lists all of your friends:
407
+
408
+ ```bash
186
409
  $ friends list friends
187
410
  George Washington Carver
188
411
  Grace Hopper
189
412
  Marie Curie
190
413
  ```
191
- Or list only the friends in a specific location:
192
- ```
414
+
415
+ You can filter your friends by location:
416
+
417
+ ```bash
193
418
  $ friends list friends --in Paris
194
419
  Marie Curie
195
420
  ```
196
- ##### List the locations you've added:
421
+
422
+ ##### `list locations`
423
+
424
+ Lists all of the locations you've added:
425
+
197
426
  ```
198
427
  $ friends list locations
199
428
  Atlantis
200
429
  New York City
201
430
  Paris
202
431
  ```
203
- ##### Update to the latest version:
204
- ```
205
- $ friends update
206
- Updated to friends 0.3
207
- ```
208
- ### Global options:
209
432
 
210
- ##### --quiet
433
+ #### `remove nickname`
211
434
 
212
- Quiet output messages:
213
- ```
214
- $ friends --quiet add activity "Went rollerskating with George."
215
- $ # No output!
435
+ Removes a specific nickname from a friend:
436
+
437
+ ```bash
438
+ $ friends remove nickname "Grace Hopper" "The Admiral"
439
+ Nickname removed: "Grace Hopper (a.k.a. Amazing Grace)"
216
440
  ```
217
441
 
218
- ##### --filename
442
+ #### `rename`
219
443
 
220
- Change the location/name of the `friends.md` file:
221
- ```
222
- $ friends --filename ./test/tmp/friends.md clean
223
- File cleaned: "./test/tmp/friends.md"
444
+ ##### `rename friend`
445
+
446
+ ```bash
447
+ $ friends rename friend "Grace Hopper" "Grace Brewster Murray Hopper"
448
+ Name changed: "Grace Brewster Murray Hopper (a.k.a. Amazing Grace)"
224
449
  ```
225
450
 
226
- ##### --clean
451
+ ##### `rename location`
227
452
 
228
- Force cleaning of the `friends.md` file, even if the command does not
229
- normally write to the file.
230
- ```
231
- $ friends --clean list friends
232
- George Washington Carver
233
- Grace Hopper
234
- Marie Curie
235
- File cleaned: "./friends.md"
453
+ ```bash
454
+ $ friends rename location Paris "Paris, France"
455
+ Location renamed: "Paris, France"
236
456
  ```
237
457
 
238
- ### Advanced usage:
458
+ #### `set location`
459
+
460
+ Sets a friend's location:
239
461
 
240
- Wouldn't it be nice to be able to use **Friends** across all of your
241
- devices? Hooray, you can! Just put the `friends.md` file in your
242
- Dropbox/Box Sync/Google Drive/whatever folder and use the
243
- `--filename` flag. You can even set up a Bash/Zsh/whatever alias to
244
- do this for you, like so:
245
462
  ```bash
246
- alias friends="friends --filename '~/Dropbox/friends.md'"
463
+ $ friends set location Marie Paris
464
+ Marie Curie's location set to: Paris
247
465
  ```
248
466
 
249
- ### Help:
467
+ #### `stats`
250
468
 
251
- Help menus are available for all levels of commands:
252
- ```
253
- $ friends --help
469
+ Gives you your lifetime usage stats:
470
+
471
+ ```bash
472
+ $ friends stats
473
+ Total activities: 4
474
+ Total friends: 3
475
+ Total time elapsed: 5 days
254
476
  ```
477
+
478
+ #### `suggest`
479
+
480
+ Gives you suggestions of up to three random friends to do something with, based
481
+ on how often you've done things with them in the past:
482
+
483
+ ```bash
484
+ $ friends suggest
485
+ Distant friend: Marie Curie
486
+ Moderate friend: Grace Hopper
487
+ Close friend: George Washington Carver
255
488
  ```
256
- $ friends list --help
489
+
490
+ You can request suggestions of friends in a specific location:
491
+
492
+ ```bash
493
+ $ friends suggest --in Paris
494
+ Distant friend: Marie Curie
257
495
  ```
496
+
497
+ #### `update`
498
+
499
+ Updates `friends` to the latest version on RubyGems:
500
+
258
501
  ```
259
- $ friends list activities --help
502
+ $ friends update
503
+ Updated to friends 0.17
260
504
  ```
261
505
 
262
- ## Documentation
506
+ ## Other documentation
263
507
 
264
- In case you're *really* interested, we have
265
- [documentation](http://www.rubydoc.info/github/JacobEvelyn/friends).
508
+ In case you're *really* interested, we have documentation on
509
+ [RubyDoc](http://www.rubydoc.info/github/JacobEvelyn/friends).
266
510
 
267
- ## Contributing
511
+ ## Contributing (it's encouraged!)
268
512
 
269
513
  If you have an idea,
270
514
  [make a GitHub Issue](https://github.com/JacobEvelyn/friends/issues/new)!
@@ -7,7 +7,8 @@ These are steps for the maintainer to take to release a new version of this gem.
7
7
  2. Commit the change (`git add -A && git commit -m 'Bump to vX.X'`).
8
8
  3. Add a tag (`git tag -am "vX.X" vX.X`).
9
9
  4. `git push && git push --tags`
10
- 5. `github_changelog_generator && git add -A && git commit -m 'Update CHANGELOG for vX.X'`
11
- 6. `git push`
12
- 7. `gem build friends.gemspec && gem push *.gem && rm *.gem`
13
- 8. Celebrate!
10
+ 5. `CHANGELOG_GITHUB_TOKEN=... github_changelog_generator`
11
+ 6. `git add -A && git commit -m 'Update CHANGELOG for vX.X'`
12
+ 7. `git push`
13
+ 8. `gem build friends.gemspec && gem push *.gem && rm *.gem`
14
+ 9. Celebrate!
@@ -34,9 +34,8 @@ switch [:debug],
34
34
  desc "Updates the `friends` program"
35
35
  command :update do |update|
36
36
  update.action do
37
- search = `gem search friends`
38
37
  # rubocop:disable Lint/AssignmentInCondition
39
- if match = search.match(/^friends\s\(([^\)]+)\)$/)
38
+ if match = `gem search friends`.match(/^friends\s\(([^\)]+)\)$/)
40
39
  # rubocop:enable Lint/AssignmentInCondition
41
40
  remote_version = match[1]
42
41
  if Semverse::Version.coerce(remote_version) >
@@ -56,6 +55,17 @@ command :update do |update|
56
55
  end
57
56
  end
58
57
 
58
+ desc "Opens the `friends.md` file in $EDITOR for manual editing"
59
+ command :edit do |edit|
60
+ edit.action do |global_options|
61
+ editor = ENV["EDITOR"] || "vim"
62
+ filename = global_options[:filename]
63
+
64
+ puts "Opening \"#{filename}\" in #{editor}" unless global_options[:quiet]
65
+ Kernel.exec "#{editor} #{filename}"
66
+ end
67
+ end
68
+
59
69
  desc "Lists friends, activities, and locations"
60
70
  command :list do |list|
61
71
  list.desc "List all friends"
data/friends.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  ### Friends:
8
8
  - George Washington Carver
9
- - Grace Hopper (a.k.a. The Admiral) [Paris]
9
+ - Grace Hopper (a.k.a. The Admiral a.k.a. Amazing Grace) [Paris]
10
10
  - Marie Curie [Atlantis]
11
11
 
12
12
  ### Locations:
@@ -101,7 +101,28 @@ module Friends
101
101
 
102
102
  # Create the list of regexes and return it.
103
103
  chunks = name.split(Regexp.new(splitter))
104
- [chunks, [chunks.first], *@nicknames.map { |n| [n] }].map do |words|
104
+
105
+ # We check nicknames before first names because nicknames may contain
106
+ # first names, as in "Amazing Grace" being a nickname for Grace Hopper.
107
+ [
108
+ chunks,
109
+ *@nicknames.map { |n| [n] },
110
+
111
+ # Match a first name followed by a last name initial, period, and then
112
+ # (via lookahead) spacing followed by a lowercase letter. This matches
113
+ # the "Jake E." part of something like "Jake E. and I went skiing." This
114
+ # allows us to correctly count the period as part of the name when it's
115
+ # in the middle of a sentence.
116
+ [chunks.first, "#{chunks.last[0]}\.(?=#{splitter}(?-i)[a-z])"],
117
+
118
+ # If the above doesn't match, we check for just the first name and then
119
+ # a last name initial. This matches the "Jake E" part of something like
120
+ # "I went skiing with Jake E." This allows us to correctly exclude the
121
+ # period from the name when it's at the end of a sentence.
122
+ [chunks.first, chunks.last[0]],
123
+
124
+ [chunks.first]
125
+ ].map do |words|
105
126
  Friends::RegexBuilder.regex(words.join(splitter))
106
127
  end
107
128
  end
@@ -21,17 +21,22 @@ module Friends
21
21
  NO_LEADING_ALPHABETICALS = "(?<![A-z])".freeze
22
22
  NO_TRAILING_ALPHABETICALS = "(?![A-z])".freeze
23
23
 
24
+ # We ignore case within the regex as opposed to globally to allow consumers
25
+ # of this API the ability to pass in strings that turn off this modifier
26
+ # with the "(?-i)" string.
27
+ IGNORE_CASE = "(?i)".freeze
28
+
24
29
  def self.regex(str)
25
30
  Regexp.new(
26
31
  NO_LEADING_BACKSLASH +
27
32
  NO_LEADING_ASTERISKS +
28
33
  NO_LEADING_UNDERSCORES +
29
34
  NO_LEADING_ALPHABETICALS +
35
+ IGNORE_CASE +
30
36
  str +
31
37
  NO_TRAILING_ALPHABETICALS +
32
38
  NO_TRAILING_UNDERSCORES +
33
- NO_TRAILING_ASTERISKS,
34
- Regexp::IGNORECASE
39
+ NO_TRAILING_ASTERISKS
35
40
  )
36
41
  end
37
42
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Friends
3
- VERSION = "0.17".freeze
3
+ VERSION = "0.18".freeze
4
4
  end
@@ -173,6 +173,78 @@ describe Friends::Activity do
173
173
  end
174
174
  end
175
175
 
176
+ describe "when description has nicknames" do
177
+ let(:description) { "Lunch with Lizzy and Johnny." }
178
+ it "matches friends" do
179
+ friend1.add_nickname("Lizzy")
180
+ friend2.add_nickname("Johnny")
181
+ subject
182
+ activity.description.
183
+ must_equal "Lunch with **#{friend1.name}** and **#{friend2.name}**."
184
+ end
185
+ end
186
+
187
+ describe "when discription has nicknames which contain first names" do
188
+ let(:nickname1) { "Awesome #{friend1.name}" }
189
+ let(:nickname2) { "Long #{friend2.name} Silver" }
190
+ let(:description) { "Lunch with #{nickname1} and #{nickname2}." }
191
+ it "matches friends" do
192
+ friend1.add_nickname(nickname1)
193
+ friend2.add_nickname(nickname2)
194
+ subject
195
+ activity.description.
196
+ must_equal "Lunch with **#{friend1.name}** and **#{friend2.name}**."
197
+ end
198
+ end
199
+
200
+ describe 'when description ends with "<first name> <last name initial>"' do
201
+ let(:description) { "Lunch with John C" }
202
+ it "matches the friend" do
203
+ subject
204
+ activity.description.
205
+ must_equal "Lunch with **#{friend2.name}**"
206
+ end
207
+ end
208
+
209
+ describe 'when description ends with "<first name> <last name initial>".' do
210
+ let(:description) { "Lunch with John C." }
211
+ it "matches the friend and keeps the period" do
212
+ subject
213
+ activity.description.
214
+ must_equal "Lunch with **#{friend2.name}**."
215
+ end
216
+ end
217
+
218
+ describe "when description has \"<first name> <last name initial>\" in "\
219
+ "the middle of a sentence" do
220
+ let(:description) { "Lunch with John C in the park." }
221
+ it "matches the friend" do
222
+ subject
223
+ activity.description.
224
+ must_equal "Lunch with **#{friend2.name}** in the park."
225
+ end
226
+ end
227
+
228
+ describe "when description has \"<first name> <last name initial>.\" in "\
229
+ "the middle of a sentence" do
230
+ let(:description) { "Lunch with John C. in the park." }
231
+ it "matches the friend and swallows the period" do
232
+ subject
233
+ activity.description.
234
+ must_equal "Lunch with **#{friend2.name}** in the park."
235
+ end
236
+ end
237
+
238
+ describe "when description has \"<first name> <last name initial>\". at "\
239
+ "the end of a sentence" do
240
+ let(:description) { "Lunch with John C. It was great!" }
241
+ it "matches the friend and keeps the period" do
242
+ subject
243
+ activity.description.
244
+ must_equal "Lunch with **#{friend2.name}**. It was great!"
245
+ end
246
+ end
247
+
176
248
  describe "when names are not entered case-sensitively" do
177
249
  let(:description) { "Lunch with elizabeth cady stanton." }
178
250
  it "matches friends" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: friends
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.17'
4
+ version: '0.18'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Evelyn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-28 00:00:00.000000000 Z
11
+ date: 2016-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic