friends 0.47 → 0.48
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 +4 -4
- data/.github/CONTRIBUTING.md +41 -36
- data/.github/FUNDING.yml +4 -0
- data/.github/ISSUE_TEMPLATE.md +1 -6
- data/CHANGELOG.md +17 -10
- data/Gemfile +1 -3
- data/README.md +31 -28
- data/RELEASING.md +1 -1
- data/friends.md +2 -2
- data/lib/friends/commands/edit.rb +2 -2
- data/lib/friends/event.rb +2 -2
- data/lib/friends/introvert.rb +42 -4
- data/lib/friends/version.rb +1 -1
- data/test/add_event_helper.rb +3 -3
- data/test/commands/add/activity_spec.rb +294 -0
- data/test/commands/edit_spec.rb +2 -2
- data/test/commands/graph_spec.rb +4 -4
- data/test/commands/list/activities_spec.rb +55 -25
- data/test/commands/list/favorite/friends_spec.rb +1 -1
- data/test/commands/list/favorite/locations_spec.rb +8 -8
- data/test/commands/list/locations_spec.rb +1 -1
- data/test/commands/rename/friend_spec.rb +2 -2
- data/test/commands/suggest_spec.rb +2 -2
- data/test/helper.rb +4 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0447c3979f63bd070ad83451203382518d615a4128f1180aa673cc2d5bdaa6b
|
4
|
+
data.tar.gz: aff492bcb17479c7ec16e5025bf2ad7f0b59355ef54363ff8c6714c84a87a644
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9121bba689b7b61af0ccc63f93e08e950885ac6d0d47eaf19a28bd826b65a8213e3dad5ee5546416540a03497b1bae0e21dfc8ee1f1243554b8b4700e39ecbba
|
7
|
+
data.tar.gz: ede549f847d3d962b69fd77c15a4c5a1c031cc3d6cc7c92aac29ea7da9fff928573681e3d0f1451611f00dd703ad338be4ee950e197c05ecbf11002a05ef7b34
|
data/.github/CONTRIBUTING.md
CHANGED
@@ -4,29 +4,44 @@ If you're reading this, it means you want to contribute to this project. Hooray!
|
|
4
4
|
|
5
5
|
Here's what to do:
|
6
6
|
|
7
|
-
1.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
2.
|
13
|
-
3.
|
14
|
-
4.
|
15
|
-
|
16
|
-
5.
|
17
|
-
|
18
|
-
6.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
7
|
+
1. If you're looking for a task to work on, check the
|
8
|
+
["up-for-grabs" issues](https://github.com/JacobEvelyn/friends/labels/upforgrabs). If you see something there that catches your
|
9
|
+
eye, leave a comment indicating you'll work on it and
|
10
|
+
it's yours! If you already have something to work on,
|
11
|
+
that's great as well!
|
12
|
+
2. Fork the repository (https://github.com/JacobEvelyn/friends/fork).
|
13
|
+
3. Clone your forked repository.
|
14
|
+
4. From within the repository directory, run
|
15
|
+
`bundle install` to install all dependencies needed for development.
|
16
|
+
5. Create your feature branch
|
17
|
+
(`git checkout -b my-new-feature`).
|
18
|
+
6. Make your changes. Add or modify tests if necessary!
|
19
|
+
- Run tests with `bundle exec rake test`. To run a subset of tests:
|
20
|
+
1. temporarily add this to `friends.gemspec`:
|
21
|
+
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
spec.add_development_dependency "minitest-focus"
|
25
|
+
```
|
26
|
+
2. Re-run `bundle install` to install `minitest-focus`.
|
27
|
+
3. Replace the `it` for the test(s) you want to run with:
|
28
|
+
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
require "minitest/focus" ; focus ; it
|
32
|
+
```
|
33
|
+
4. Run tests as usual with `bundle exec rake test`.
|
34
|
+
5. Don't forget to remove these debugging lines when you're done!
|
35
|
+
- You can run your version of the `friends` script with `bundle exec bin/friends`.
|
36
|
+
- Do your best to conform to existing style and commenting patterns.
|
37
|
+
7. Update the `README.md` as necessary to include your changes.
|
38
|
+
8. Check your changes for code style by running `bundle exec rubocop .` in
|
39
|
+
the repository directory. You may see output indicating that some lines
|
40
|
+
differ from the style guidelines. Change your code so that Rubocop gives
|
41
|
+
no warnings or errors (and don't hesitate to reach out if you don't know how!—this practice is meant to keep the code clean but it shouldn't be
|
42
|
+
scary and it's totally fine to need help!).
|
43
|
+
9. Commit your changes
|
44
|
+
(`git commit -am "Add some feature"`).
|
30
45
|
10. Push your changes to GitHub, and open a pull request.
|
31
46
|
11. Your code will be reviewed and merged as quickly as
|
32
47
|
possible!
|
@@ -45,19 +60,9 @@ If you're a polite, reasonable person you won't have any issues!
|
|
45
60
|
|
46
61
|
## Financial contributions
|
47
62
|
|
48
|
-
`friends` is a volunteer project. If you find it
|
49
|
-
making a small donation (🙏)
|
50
|
-
|
51
|
-
👇 Donate with these buttons! 👇
|
52
|
-
|
53
|
-
[/badge.svg>)](https://opencollective.com/friends#backer) [/badge.svg>)](https://opencollective.com/friends#sponsor)
|
54
|
-
[](https://www.patreon.com/jacobevelyn)
|
55
|
-
[](https://liberapay.com/jacobevelyn/donate)
|
56
|
-
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=jacobevelyn%40gmail%2ecom&lc=US&item_name=Development%20of%20JacobEvelyn%2ffriends%20%28GitHub%20repository%29&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest)
|
57
|
-
[](https://flattr.com/submit/auto?user_id=jacobevelyn&url=https://github.com/JacobEvelyn/friends&title=friends&tags=github&category=software)
|
58
|
-
[](https://nrobinson2000.github.io/donate-bitcoin?address=1CFu6gWpmS89EnitPPdYssZhFMRWx5qhW4&amount=10&name=support-friends-development)
|
59
|
-
|
60
|
-
👆 Donate with these buttons! 👆
|
63
|
+
`friends` is a volunteer project. If you find it valuable, please consider
|
64
|
+
making a small donation (🙏) with the **Sponsor** button at the top of this page
|
65
|
+
to show you appreciate its continued development.
|
61
66
|
|
62
67
|
## Contributors
|
63
68
|
|
data/.github/FUNDING.yml
ADDED
data/.github/ISSUE_TEMPLATE.md
CHANGED
@@ -1,6 +1 @@
|
|
1
|
-
<!-- Love friends? Please consider making a small donation (🙏) to show you appreciate its continued development
|
2
|
-
|
3
|
-
👉 https://opencollective.com/friends/donate
|
4
|
-
👉 https://www.patreon.com/jacobevelyn
|
5
|
-
👉 https://liberapay.com/jacobevelyn/donate
|
6
|
-
👉 ...or for more ways to donate (PayPal, Flattr, Bitcoin) see the README. -->
|
1
|
+
<!-- Love friends? Please consider making a small donation (🙏) with the **Sponsor** button at the top of this page to show you appreciate its continued development! 💝 -->
|
data/CHANGELOG.md
CHANGED
@@ -1,18 +1,25 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
`friends` is a volunteer project. If you find it
|
4
|
-
making a small donation (🙏)
|
3
|
+
`friends` is a volunteer project. If you find it valuable, please consider
|
4
|
+
making a small donation (🙏) with the **Sponsor** button at the top of this page to
|
5
|
+
show you appreciate its continued development.
|
5
6
|
|
6
|
-
|
7
|
+
## [v0.48](https://github.com/JacobEvelyn/friends/tree/v0.48) (2020-03-27)
|
7
8
|
|
8
|
-
[
|
9
|
-
[](https://www.patreon.com/jacobevelyn)
|
10
|
-
[](https://liberapay.com/jacobevelyn/donate)
|
11
|
-
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=jacobevelyn%40gmail%2ecom&lc=US&item_name=Development%20of%20JacobEvelyn%2ffriends%20%28GitHub%20repository%29&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest)
|
12
|
-
[](https://flattr.com/submit/auto?user_id=jacobevelyn&url=https://github.com/JacobEvelyn/friends&title=friends&tags=github&category=software)
|
13
|
-
[](https://nrobinson2000.github.io/donate-bitcoin?address=1CFu6gWpmS89EnitPPdYssZhFMRWx5qhW4&amount=10&name=support-friends-development)
|
9
|
+
[Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.47...v0.48)
|
14
10
|
|
15
|
-
|
11
|
+
**Implemented enhancements:**
|
12
|
+
|
13
|
+
- Change trigger for implicit location from `moved to \_LOCATION\_` to `to \_LOCATION\_` [\#245](https://github.com/JacobEvelyn/friends/pull/245) ([shen-sat](https://github.com/shen-sat))
|
14
|
+
|
15
|
+
**Closed issues:**
|
16
|
+
|
17
|
+
- Fix minitest deprecation warnings [\#249](https://github.com/JacobEvelyn/friends/issues/249)
|
18
|
+
|
19
|
+
**Merged pull requests:**
|
20
|
+
|
21
|
+
- Fix minitest deprecation warnings [\#250](https://github.com/JacobEvelyn/friends/pull/250) ([JacobEvelyn](https://github.com/JacobEvelyn))
|
22
|
+
- Bump simplecov from cb968abf857a704364283b5dec4d9fa3d096287e to 0.18.0 [\#248](https://github.com/JacobEvelyn/friends/pull/248) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
16
23
|
|
17
24
|
## [v0.47](https://github.com/JacobEvelyn/friends/tree/v0.47) (2019-12-11)
|
18
25
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -5,19 +5,9 @@
|
|
5
5
|
[](http://inch-ci.org/github/JacobEvelyn/friends)
|
6
6
|
[](https://rubygems.org/gems/friends)
|
7
7
|
|
8
|
-
`friends` is a volunteer project. If you find it
|
9
|
-
making a small donation (🙏)
|
10
|
-
|
11
|
-
👇 Donate with these buttons! 👇
|
12
|
-
|
13
|
-
[/badge.svg>)](#backers) [/badge.svg>)](#sponsors)
|
14
|
-
[](https://www.patreon.com/jacobevelyn)
|
15
|
-
[](https://liberapay.com/jacobevelyn/donate)
|
16
|
-
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=jacobevelyn%40gmail%2ecom&lc=US&item_name=Development%20of%20JacobEvelyn%2ffriends%20%28GitHub%20repository%29&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest)
|
17
|
-
[](https://flattr.com/submit/auto?user_id=jacobevelyn&url=https://github.com/JacobEvelyn/friends&title=friends&tags=github&category=software)
|
18
|
-
[](https://nrobinson2000.github.io/donate-bitcoin?address=1CFu6gWpmS89EnitPPdYssZhFMRWx5qhW4&amount=10&name=support-friends-development)
|
19
|
-
|
20
|
-
👆 Donate with these buttons! 👆
|
8
|
+
`friends` is a volunteer project. If you find it valuable, please consider
|
9
|
+
making a small donation (🙏) with the **Sponsor** button at the top of this page
|
10
|
+
to show you appreciate its continued development.
|
21
11
|
|
22
12
|
# `friends`
|
23
13
|
|
@@ -47,6 +37,7 @@ lots of help), and give feedback! This project is
|
|
47
37
|
- [`add tag`](#add-tag)
|
48
38
|
- [`add location`](#add-location)
|
49
39
|
- [`add nickname`](#add-nickname)
|
40
|
+
- [Adding a default location](#adding-a-default-location)
|
50
41
|
- [`clean`](#clean)
|
51
42
|
- [`graph`](#graph)
|
52
43
|
- [`help`](#help)
|
@@ -141,7 +132,7 @@ FRIENDS_PAGER="less -RF"
|
|
141
132
|
- **Friends**: The people you do _activities_ with. Each friend has a name and,
|
142
133
|
optionally, one or several nicknames. (Examples: `John`, `Grace Hopper`)
|
143
134
|
- **Locations**: The places in which _activities_ happen. (Examples: `Paris`,
|
144
|
-
`
|
135
|
+
`Martha's Vineyard`)
|
145
136
|
- **Tags**: A way to categorize your _activities_ with tags of your
|
146
137
|
choosing. Tags may contain colons and hyphens inside them. (Examples: `@exercise:running`, `@school`, `@science:indoors:agronomy-with-hydroponics`)
|
147
138
|
- **Notes**: Any additional information you want to record about a _friend_
|
@@ -155,7 +146,7 @@ The `friends.md` Markdown file that stores all of your data contains:
|
|
155
146
|
### Locations:
|
156
147
|
|
157
148
|
- Atlantis
|
158
|
-
-
|
149
|
+
- Martha's Vineyard
|
159
150
|
- Paris
|
160
151
|
```
|
161
152
|
|
@@ -174,7 +165,7 @@ The `friends.md` Markdown file that stores all of your data contains:
|
|
174
165
|
```markdown
|
175
166
|
### Activities:
|
176
167
|
|
177
|
-
- 2018-11-01: **Grace Hopper** and I went to
|
168
|
+
- 2018-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
|
178
169
|
- 2018-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**.
|
179
170
|
- 2017-12-31: Celebrated the new year in _Paris_ with **Marie Curie**.
|
180
171
|
- 2017-11-15: Talked to **George Washington Carver** on the phone for an hour.
|
@@ -339,8 +330,8 @@ $ friends add activity last Monday
|
|
339
330
|
You can escape the names of friends you don't want `friends` to match with a backslash:
|
340
331
|
|
341
332
|
```bash
|
342
|
-
$ friends add activity "2018-11-01: Grace and I went to \
|
343
|
-
Activity added: "2018-11-01: Grace Hopper and I went to
|
333
|
+
$ friends add activity "2018-11-01: Grace and I went to \Martha's Vineyard. \George had to cancel at the last minute."
|
334
|
+
Activity added: "2018-11-01: Grace Hopper and I went to Martha's Vineyard. George had to cancel at the last minute."
|
344
335
|
```
|
345
336
|
|
346
337
|
And if an activity contains friends or locations you haven't yet added, you can simply
|
@@ -420,6 +411,27 @@ $ friends add nickname "Grace Hopper" "Amazing Grace"
|
|
420
411
|
Nickname added: "Grace Hopper (a.k.a. The Admiral a.k.a. Amazing Grace)"
|
421
412
|
```
|
422
413
|
|
414
|
+
#### Setting a default location
|
415
|
+
|
416
|
+
When an activity includes the phrase to \_LOCATION\_ (e.g., Took a plane to \_Paris\_), all future activities that have no explicit location will be associated with that location:
|
417
|
+
|
418
|
+
```bash
|
419
|
+
$ friends add activity Took a plane to Paris
|
420
|
+
Activity added: "2020-01-04: Took a plane to Paris"
|
421
|
+
Default location set to: "Paris"
|
422
|
+
$ friends add activity Ate lunch at a charming café
|
423
|
+
Activity added: "2020-01-04: Ate lunch at a charming café"
|
424
|
+
$ friends add activity Left the city to go to Chamonix
|
425
|
+
Activity added: "2020-01-04: Left the city to go to Chamonix"
|
426
|
+
Default location set to: "Chamonix"
|
427
|
+
```
|
428
|
+
|
429
|
+
```bash
|
430
|
+
$ friends list activities --in Paris
|
431
|
+
2019-01-04: Ate lunch at a charming café
|
432
|
+
2019-01-04: Took a plane to Paris
|
433
|
+
```
|
434
|
+
|
423
435
|
#### `clean`
|
424
436
|
|
425
437
|
Reads and re-writes the `friends.md` file:
|
@@ -951,16 +963,7 @@ A big big thanks to all of this project's lovely
|
|
951
963
|
|
952
964
|
<a href="https://github.com/JacobEvelyn/friends/graphs/contributors"><img src="https://opencollective.com/friends/contributors.svg?width=890" /></a>
|
953
965
|
|
954
|
-
Another way to contribute is to make a donation with
|
955
|
-
|
956
|
-
[/badge.svg>)](https://opencollective.com/friends#backer) [/badge.svg>)](https://opencollective.com/friends#sponsor)
|
957
|
-
[](https://www.patreon.com/jacobevelyn)
|
958
|
-
[](https://liberapay.com/jacobevelyn/donate)
|
959
|
-
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=jacobevelyn%40gmail%2ecom&lc=US&item_name=Development%20of%20JacobEvelyn%2ffriends%20%28GitHub%20repository%29&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest)
|
960
|
-
[](https://flattr.com/submit/auto?user_id=jacobevelyn&url=https://github.com/JacobEvelyn/friends&title=friends&tags=github&category=software)
|
961
|
-
[](https://nrobinson2000.github.io/donate-bitcoin?address=1CFu6gWpmS89EnitPPdYssZhFMRWx5qhW4&amount=10&name=support-friends-development)
|
962
|
-
|
963
|
-
👆 Donate with these buttons right here! 👆
|
966
|
+
Another way to contribute is to make a donation with the **Sponsor** button at the top of this page!
|
964
967
|
|
965
968
|
### Backers
|
966
969
|
|
data/RELEASING.md
CHANGED
@@ -8,7 +8,7 @@ These are steps for the maintainer to take to release a new version of this gem.
|
|
8
8
|
3. Add a tag (`git tag -am "vX.X" vX.X`).
|
9
9
|
4. `git push && git push --tags`
|
10
10
|
5. Copy the top of `CHANGELOG` to the clipboard.
|
11
|
-
6. `CHANGELOG_GITHUB_TOKEN=... github_changelog_generator`
|
11
|
+
6. `CHANGELOG_GITHUB_TOKEN=... github_changelog_generator --user JacobEvelyn --project friends`
|
12
12
|
7. Paste from the clipboard to the top of the `CHANGELOG`.
|
13
13
|
8. Confirm the `CHANGELOG` looks correct with `git diff`
|
14
14
|
9. `git add -A && git commit -m 'Update CHANGELOG for vX.X'`
|
data/friends.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
### Activities:
|
2
|
-
- 2018-11-01: **Grace Hopper** and I went to
|
2
|
+
- 2018-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
|
3
3
|
- 2018-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
4
4
|
- 2017-12-31: Celebrated the new year in _Paris_ with **Marie Curie**. @partying
|
5
5
|
- 2017-11-15: Talked to **George Washington Carver** on the phone for an hour.
|
@@ -15,5 +15,5 @@
|
|
15
15
|
|
16
16
|
### Locations:
|
17
17
|
- Atlantis
|
18
|
-
-
|
18
|
+
- Martha's Vineyard
|
19
19
|
- Paris
|
@@ -9,8 +9,8 @@ command :edit do |edit|
|
|
9
9
|
puts "Opening \"#{filename}\" with \"#{editor}\"" unless global_options[:quiet]
|
10
10
|
|
11
11
|
# Mark the file for cleaning once the editor was closed correctly.
|
12
|
-
if Kernel.system(
|
13
|
-
@introvert = Friends::Introvert.new(filename:
|
12
|
+
if Kernel.system(editor, filename)
|
13
|
+
@introvert = Friends::Introvert.new(filename: filename)
|
14
14
|
@clean_command = true
|
15
15
|
@dirty = true
|
16
16
|
elsif !global_options[:quiet]
|
data/lib/friends/event.rb
CHANGED
@@ -138,8 +138,8 @@ module Friends
|
|
138
138
|
location_in_description?(location) || location_is_implicit?(location)
|
139
139
|
end
|
140
140
|
|
141
|
-
def
|
142
|
-
@description[/(?<=
|
141
|
+
def default_location
|
142
|
+
@default_location ||= @description[/(?<=to _)\w[^_]*(?=_)/]
|
143
143
|
end
|
144
144
|
|
145
145
|
# @param friend [Friend] the friend to test
|
data/lib/friends/introvert.rb
CHANGED
@@ -107,9 +107,11 @@ module Friends
|
|
107
107
|
|
108
108
|
activity.highlight_description(introvert: self)
|
109
109
|
|
110
|
-
@activities.unshift(activity)
|
111
|
-
|
112
110
|
@output << "Activity added: \"#{activity}\""
|
111
|
+
|
112
|
+
@output << default_location_output(activity) if activity.default_location
|
113
|
+
|
114
|
+
@activities.unshift(activity)
|
113
115
|
end
|
114
116
|
end
|
115
117
|
|
@@ -660,8 +662,9 @@ module Friends
|
|
660
662
|
|
661
663
|
def set_implicit_locations!
|
662
664
|
implicit_location = nil
|
665
|
+
# reverse_each here moves through the activities in chronological order
|
663
666
|
@activities.reverse_each do |activity|
|
664
|
-
implicit_location = activity.
|
667
|
+
implicit_location = activity.default_location if activity.default_location
|
665
668
|
activity.implicit_location = implicit_location if activity.description_location_names.empty?
|
666
669
|
end
|
667
670
|
end
|
@@ -685,6 +688,9 @@ module Friends
|
|
685
688
|
# Parse the line and update the parsing state.
|
686
689
|
state = parse_line!(line, line_num: line_num, state: state)
|
687
690
|
end
|
691
|
+
# sort the activities from earliest to latest, in case friends.md has been corrupted
|
692
|
+
@activities = stable_sort(@activities)
|
693
|
+
|
688
694
|
set_implicit_locations!
|
689
695
|
|
690
696
|
set_n_activities!(:friend)
|
@@ -719,7 +725,7 @@ module Friends
|
|
719
725
|
|
720
726
|
begin
|
721
727
|
instance_variable_get("@#{stage.id}") << stage.klass.deserialize(line)
|
722
|
-
rescue => ex
|
728
|
+
rescue StandardError => ex
|
723
729
|
bad_line(ex, line_num)
|
724
730
|
end
|
725
731
|
|
@@ -777,5 +783,37 @@ module Friends
|
|
777
783
|
def bad_line(expected, line_num)
|
778
784
|
raise FriendsError, "Expected \"#{expected}\" on line #{line_num}"
|
779
785
|
end
|
786
|
+
|
787
|
+
# @param [Activity] the activity that was added by the user
|
788
|
+
# @return [String] specifying default location and its time range
|
789
|
+
def default_location_output(activity)
|
790
|
+
str = "Default location"
|
791
|
+
|
792
|
+
earlier_activities, later_activities = @activities.partition { |a| a.date <= activity.date }
|
793
|
+
|
794
|
+
earlier_activity_with_default_location = activity
|
795
|
+
|
796
|
+
earlier_activities.each do |a|
|
797
|
+
next unless a.default_location
|
798
|
+
|
799
|
+
break unless a.default_location == activity.default_location
|
800
|
+
|
801
|
+
earlier_activity_with_default_location = a
|
802
|
+
end
|
803
|
+
|
804
|
+
unless later_activities.empty?
|
805
|
+
str += " from #{Paint[earlier_activity_with_default_location.date, :bold]}"
|
806
|
+
|
807
|
+
later_activity = later_activities.find do |a|
|
808
|
+
a.default_location && a.default_location != activity.default_location
|
809
|
+
end
|
810
|
+
|
811
|
+
str += " to #{Paint[(later_activity.date if later_activity) || 'present', :bold]}"
|
812
|
+
end
|
813
|
+
|
814
|
+
str += " already" if earlier_activity_with_default_location != activity
|
815
|
+
|
816
|
+
"#{str} set to: \"#{activity.default_location}\""
|
817
|
+
end
|
780
818
|
end
|
781
819
|
end
|
data/lib/friends/version.rb
CHANGED
data/test/add_event_helper.rb
CHANGED
@@ -449,15 +449,15 @@ FILE
|
|
449
449
|
end
|
450
450
|
|
451
451
|
describe "when description contains both names and locations" do
|
452
|
-
let(:description) { "Grace and I
|
452
|
+
let(:description) { "Grace and I visited Atlantis and then Paris for lunch with George." }
|
453
453
|
|
454
454
|
it do
|
455
|
-
line_added "- #{date}: **Grace Hopper** and I
|
455
|
+
line_added "- #{date}: **Grace Hopper** and I visited _Atlantis_ and then _Paris_ for "\
|
456
456
|
"lunch with **George Washington Carver**."
|
457
457
|
end
|
458
458
|
if test_stdout
|
459
459
|
it do
|
460
|
-
stdout_only "#{capitalized_event} added: \"#{date}: Grace Hopper and I
|
460
|
+
stdout_only "#{capitalized_event} added: \"#{date}: Grace Hopper and I visited "\
|
461
461
|
"Atlantis and then Paris for lunch with George Washington Carver.\""
|
462
462
|
end
|
463
463
|
end
|
@@ -51,5 +51,299 @@ FILE
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
describe "adding default location" do
|
55
|
+
describe "when it is the latest activity" do
|
56
|
+
subject { run_cmd("add activity Moved to _Paris_") }
|
57
|
+
let(:content) do
|
58
|
+
<<-FILE
|
59
|
+
### Activities:
|
60
|
+
- #{preceding_activity}
|
61
|
+
|
62
|
+
### Notes:
|
63
|
+
|
64
|
+
### Friends:
|
65
|
+
|
66
|
+
### Locations:
|
67
|
+
FILE
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "when there is no preceding default location" do
|
71
|
+
let(:preceding_activity) { "2016-01-01: Went to the library." }
|
72
|
+
|
73
|
+
it "prints 'Default location set to [LOCATION]'" do
|
74
|
+
output = 'Default location set to: "Paris"'
|
75
|
+
assert_default_location_output(output)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "when preceding default location is different" do
|
80
|
+
let(:preceding_activity) { "2016-01-01: Moved to _Berlin_." }
|
81
|
+
|
82
|
+
it "prints 'Default location set to [LOCATION]'" do
|
83
|
+
output = 'Default location set to: "Paris"'
|
84
|
+
assert_default_location_output(output)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "when preceding default location is the same" do
|
89
|
+
let(:preceding_activity) { "2016-01-01: Flew to _Paris_." }
|
90
|
+
|
91
|
+
it "prints 'Default location already set to [LOCATION]'" do
|
92
|
+
output = 'Default location already set to: "Paris"'
|
93
|
+
assert_default_location_output(output)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "when it is not the latest activity" do
|
99
|
+
subject { run_cmd("add activity 2009-01-01: Moved to _Paris_") }
|
100
|
+
let(:content) do
|
101
|
+
<<-FILE
|
102
|
+
### Activities:
|
103
|
+
- #{following_activity}
|
104
|
+
- #{preceding_activity}
|
105
|
+
|
106
|
+
### Notes:
|
107
|
+
|
108
|
+
### Friends:
|
109
|
+
|
110
|
+
### Locations:
|
111
|
+
FILE
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "when there is no following default location" do
|
115
|
+
let(:following_activity) { "2019-01-01: Visited a cafe" }
|
116
|
+
|
117
|
+
describe "when there is no preceding default location" do
|
118
|
+
let(:preceding_activity) { "1999-01-01: Visited a library" }
|
119
|
+
|
120
|
+
it "prints 'Default location from [ADDED ACTIVITY DATE] to present set to [LOCATION]'" do
|
121
|
+
message = 'Default location from 2009-01-01 to present set to: "Paris"'
|
122
|
+
assert_default_location_output(message)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "when preceding default location is different" do
|
127
|
+
let(:preceding_activity) { "1999-01-01: Went to _Berlin_" }
|
128
|
+
|
129
|
+
it "prints 'Default location from [ADDED ACTIVITY DATE] to present set to [LOCATION]'" do
|
130
|
+
output = 'Default location from 2009-01-01 to present set to: "Paris"'
|
131
|
+
assert_default_location_output(output)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
describe "when preceding default location is same" do
|
136
|
+
let(:preceding_activity) { "1999-01-01: Went to _Paris_" }
|
137
|
+
|
138
|
+
it "prints 'Default location from [PRECEDING DEFAULT LOCATION ACTIVITY DATE] to " \
|
139
|
+
"present already set to [LOCATION]'" do
|
140
|
+
output = 'Default location from 1999-01-01 to present already set to: "Paris"'
|
141
|
+
assert_default_location_output(output)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe "when multiple preceding default locations are same and consecutive" do
|
146
|
+
let(:content) do
|
147
|
+
<<-FILE
|
148
|
+
### Activities:
|
149
|
+
- 2019-01-01: Visited a cafe
|
150
|
+
- 1999-01-01: Went to _Paris_
|
151
|
+
- 1989-01-01: Relocated to _Paris_
|
152
|
+
|
153
|
+
### Notes:
|
154
|
+
|
155
|
+
### Friends:
|
156
|
+
|
157
|
+
### Locations:
|
158
|
+
FILE
|
159
|
+
end
|
160
|
+
|
161
|
+
it "prints 'Default location from " \
|
162
|
+
"[EARLIEST CONSECUTIVE DEFAULT LOCATION ACTIVITY DATE] to " \
|
163
|
+
"present already set to [LOCATION]'" do
|
164
|
+
output = 'Default location from 1989-01-01 to present already set to: "Paris"'
|
165
|
+
assert_default_location_output(output)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe "when multiple preceding default locations are the same but not consecutive" do
|
170
|
+
let(:content) do
|
171
|
+
<<-FILE
|
172
|
+
### Activities:
|
173
|
+
- 2019-01-01: Visited a cafe
|
174
|
+
- 1999-01-01: Went to _Paris_
|
175
|
+
- 1989-01-01: Went to _Berlin_
|
176
|
+
- 1979-01-01: Relocated to _Paris_
|
177
|
+
|
178
|
+
### Notes:
|
179
|
+
|
180
|
+
### Friends:
|
181
|
+
|
182
|
+
### Locations:
|
183
|
+
FILE
|
184
|
+
end
|
185
|
+
|
186
|
+
it "prints 'Default location from " \
|
187
|
+
"[EARLIEST CONSECUTIVE DEFAULT LOCATION ACTIVITY DATE] to " \
|
188
|
+
"present already set to [LOCATION]'" do
|
189
|
+
output = 'Default location from 1999-01-01 to present already set to: "Paris"'
|
190
|
+
assert_default_location_output(output)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe "when there are no preceding default locations" do
|
196
|
+
let(:preceding_activity) { "1999-01-01: Visited a cafe" }
|
197
|
+
|
198
|
+
describe "when following default location is the same" do
|
199
|
+
let(:following_activity) { "2019-01-01: Went to _Paris_" }
|
200
|
+
|
201
|
+
it "prints 'Default location from [ADDED ACTIVITY DATE] to present set to [LOCATION]'" do
|
202
|
+
output = 'Default location from 2009-01-01 to present set to: "Paris"'
|
203
|
+
assert_default_location_output(output)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
describe "when following default location is different" do
|
208
|
+
let(:following_activity) { "2019-01-01: Went to _Berlin_" }
|
209
|
+
|
210
|
+
it "prints 'Default location from [ADDED ACTIVITY DATE] to " \
|
211
|
+
"[NEXT DIFFERENT DEFAULT LOCATION ACIVITY DATE] set to [LOCATION]'" do
|
212
|
+
output = 'Default location from 2009-01-01 to 2019-01-01 set to: "Paris"'
|
213
|
+
assert_default_location_output(output)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
describe "when multiple following default locations are the same and consecutive" do
|
218
|
+
let(:content) do
|
219
|
+
<<-FILE
|
220
|
+
### Activities:
|
221
|
+
- 2019-01-01: Went to _Paris_
|
222
|
+
- 2018-01-01: Relocated to _Paris_
|
223
|
+
|
224
|
+
### Notes:
|
225
|
+
|
226
|
+
### Friends:
|
227
|
+
|
228
|
+
### Locations:
|
229
|
+
FILE
|
230
|
+
end
|
231
|
+
|
232
|
+
it "prints 'Default location from [ADDED ACTIVITY DATE] to present set to [LOCATION]'" do
|
233
|
+
output = 'Default location from 2009-01-01 to present set to: "Paris"'
|
234
|
+
assert_default_location_output(output)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
describe "when multiple following default locations are the same but not consecutive" do
|
239
|
+
let(:content) do
|
240
|
+
<<-FILE
|
241
|
+
### Activities:
|
242
|
+
- 2019-01-01: Went to _Paris_
|
243
|
+
- 2018-01-01: Went to _Berlin_
|
244
|
+
- 2017-01-01: Relocated to _Paris_
|
245
|
+
|
246
|
+
### Notes:
|
247
|
+
|
248
|
+
### Friends:
|
249
|
+
|
250
|
+
### Locations:
|
251
|
+
FILE
|
252
|
+
end
|
253
|
+
|
254
|
+
it "prints 'Default location from [ADDED ACTIVITY DATE] to " \
|
255
|
+
"[NEXT DIFFERENT DEFAULT LOCATION ACIVITY DATE] set to [LOCATION]'" do
|
256
|
+
output = 'Default location from 2009-01-01 to 2018-01-01 set to: "Paris"'
|
257
|
+
assert_default_location_output(output)
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
describe "when preceding default location is the same" do
|
263
|
+
let(:preceding_activity) { "1999-01-01: Went to _Paris_" }
|
264
|
+
|
265
|
+
describe "when following default location is the same" do
|
266
|
+
let(:following_activity) { "2019-01-01: Relocated to _Paris_" }
|
267
|
+
|
268
|
+
it "prints 'Default location from " \
|
269
|
+
"[PRECEDING ACTIVITY DATE] to present already set to [LOCATION]'" do
|
270
|
+
output = 'Default location from 1999-01-01 to present already set to: "Paris"'
|
271
|
+
assert_default_location_output(output)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
describe "when following default location is different" do
|
276
|
+
let(:following_activity) { "2019-01-01: Relocated to _Berlin_" }
|
277
|
+
|
278
|
+
it "prints 'Default location from " \
|
279
|
+
"[PRECEDING ACTIVITY DATE] to " \
|
280
|
+
"[FOLLOWING ACTIVITY DATE] set to [LOCATION]'" do
|
281
|
+
output = 'Default location from 1999-01-01 to 2019-01-01 already set to: "Paris"'
|
282
|
+
assert_default_location_output(output)
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
describe "when preceding default location is different" do
|
288
|
+
let(:preceding_activity) { "1999-01-01: Went to _Berlin_" }
|
289
|
+
|
290
|
+
describe "when following default location is the same" do
|
291
|
+
let(:following_activity) { "2019-01-01: Relocated to _Paris_" }
|
292
|
+
|
293
|
+
it "prints 'Default location from [ADDED ACTIVITY DATE] to present set to [LOCATION]'" do
|
294
|
+
output = 'Default location from 2009-01-01 to present set to: "Paris"'
|
295
|
+
assert_default_location_output(output)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
describe "when following default location is different" do
|
300
|
+
let(:following_activity) { "2019-01-01: Relocated to _Berlin_" }
|
301
|
+
|
302
|
+
it "prints 'Default location from " \
|
303
|
+
"[ADDED ACTIVITY DATE] to " \
|
304
|
+
"[FOLLOWING ACTIVITY DATE] set to [LOCATION]'" do
|
305
|
+
output = 'Default location from 2009-01-01 to 2019-01-01 set to: "Paris"'
|
306
|
+
assert_default_location_output(output)
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
describe "when activities are out of order" do
|
312
|
+
let(:content) do
|
313
|
+
<<-FILE
|
314
|
+
### Activities:
|
315
|
+
- 2018-01-01: Went to _Berlin_
|
316
|
+
- 2019-01-01: Went to _Paris_
|
317
|
+
|
318
|
+
### Notes:
|
319
|
+
|
320
|
+
### Friends:
|
321
|
+
|
322
|
+
### Locations:
|
323
|
+
FILE
|
324
|
+
end
|
325
|
+
|
326
|
+
it "uses the sorted order for determining output" do
|
327
|
+
output = 'Default location from 2009-01-01 to 2018-01-01 set to: "Paris"'
|
328
|
+
assert_default_location_output(output)
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
54
334
|
parsing_specs(event: :activity)
|
335
|
+
|
336
|
+
private
|
337
|
+
|
338
|
+
def assert_default_location_output(expected_output)
|
339
|
+
output = select_default_activity_output(subject[:stdout])
|
340
|
+
|
341
|
+
value(output.size).must_equal(1)
|
342
|
+
value(output).must_include(expected_output)
|
343
|
+
end
|
344
|
+
|
345
|
+
def select_default_activity_output(output)
|
346
|
+
lines = output.split("\n")
|
347
|
+
lines.select { |line| line.include?("Default") }
|
348
|
+
end
|
55
349
|
end
|
data/test/commands/edit_spec.rb
CHANGED
@@ -78,7 +78,7 @@ Not cleaning file: "#{filename}" ("exit 1 #" did not exit successfully)
|
|
78
78
|
<<-EXPECTED_CONTENT
|
79
79
|
### Activities:
|
80
80
|
- 2018-02-06: @science:indoors:agronomy-with-hydroponics: **Norman Borlaug** and **George Washington Carver** scored a tour of _Atlantis_' hydroponics gardens through wetplants@example.org and they took me along.
|
81
|
-
- 2015-11-01: **Grace Hopper** and I went to
|
81
|
+
- 2015-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
|
82
82
|
- 2015-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
83
83
|
- 2014-12-31: Celebrated the new year in _Paris_ with **Marie Curie**. @partying
|
84
84
|
- 2014-12-16: Okay, yep, I definitely just saw **Bigfoot** in the _Mysterious Mountains_!
|
@@ -101,7 +101,7 @@ Not cleaning file: "#{filename}" ("exit 1 #" did not exit successfully)
|
|
101
101
|
|
102
102
|
### Locations:
|
103
103
|
- Atlantis
|
104
|
-
-
|
104
|
+
- Martha's Vineyard
|
105
105
|
- Mysterious Mountains
|
106
106
|
- Paris
|
107
107
|
EXPECTED_CONTENT
|
data/test/commands/graph_spec.rb
CHANGED
@@ -27,7 +27,7 @@ clean_describe "graph" do
|
|
27
27
|
let(:content) do
|
28
28
|
<<-FILE
|
29
29
|
### Activities:
|
30
|
-
- 2015-11-01: **Grace Hopper** and I went to
|
30
|
+
- 2015-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
|
31
31
|
- 2015-01-14: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
32
32
|
- 2015-01-06: Did some other things in _Paris_.
|
33
33
|
- 2015-01-06: Did even more things in _Paris_.
|
@@ -42,7 +42,7 @@ clean_describe "graph" do
|
|
42
42
|
|
43
43
|
### Locations:
|
44
44
|
- Atlantis
|
45
|
-
-
|
45
|
+
- Martha's Vineyard
|
46
46
|
- Paris
|
47
47
|
FILE
|
48
48
|
end
|
@@ -273,7 +273,7 @@ Nov 2014 |∙|
|
|
273
273
|
|
274
274
|
it "matches tag case-insensitively and scales the graph" do
|
275
275
|
stdout_only <<-OUTPUT
|
276
|
-
Nov 2015
|
276
|
+
Nov 2015 |∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙|
|
277
277
|
Oct 2015 |∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙|
|
278
278
|
Sep 2015 |∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙|
|
279
279
|
Aug 2015 |∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙|
|
@@ -294,7 +294,7 @@ Nov 2014 |∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙|
|
|
294
294
|
|
295
295
|
it "matches tag case-insensitively and does not scale graph" do
|
296
296
|
stdout_only <<-OUTPUT
|
297
|
-
Nov 2015
|
297
|
+
Nov 2015 |∙|
|
298
298
|
Oct 2015 |
|
299
299
|
Sep 2015 |
|
300
300
|
Aug 2015 |
|
@@ -26,13 +26,13 @@ clean_describe "list activities" do
|
|
26
26
|
# only reads from the (usually-sorted) file.
|
27
27
|
let(:content) { SCRAMBLED_CONTENT }
|
28
28
|
|
29
|
-
it "lists activities in
|
29
|
+
it "lists activities in sorted order" do
|
30
30
|
stdout_only <<-OUTPUT
|
31
|
-
2015-01-04: Got lunch with Grace Hopper and George Washington Carver. @food
|
32
|
-
2015-11-01: Grace Hopper and I went to Marie's Diner. George had to cancel at the last minute. @food
|
33
31
|
2018-02-06: @science:indoors:agronomy-with-hydroponics: Norman Borlaug and George Washington Carver scored a tour of Atlantis' hydroponics gardens through wetplants@example.org and they took me along.
|
34
|
-
|
32
|
+
2015-11-01: Grace Hopper and I went to Martha's Vineyard. George had to cancel at the last minute.
|
33
|
+
2015-01-04: Got lunch with Grace Hopper and George Washington Carver. @food
|
35
34
|
2014-12-31: Celebrated the new year in Paris with Marie Curie. @partying
|
35
|
+
2014-11-15: Talked to George Washington Carver on the phone for an hour.
|
36
36
|
OUTPUT
|
37
37
|
end
|
38
38
|
|
@@ -55,15 +55,16 @@ clean_describe "list activities" do
|
|
55
55
|
|
56
56
|
describe "when implicit location is set" do
|
57
57
|
let(:location_name) { "atlantis" }
|
58
|
-
|
59
|
-
|
58
|
+
describe "when activities are in order" do
|
59
|
+
let(:content) do
|
60
|
+
<<-FILE
|
60
61
|
### Activities:
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
62
|
+
- 2000-01-06: Went to a museum with **George Washington Carver**.
|
63
|
+
- 2000-01-05: Moved to _Paris_.
|
64
|
+
- 2000-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
65
|
+
- 2000-01-03: Celebrated my birthday in _Paris_ with **Marie Curie**. @partying @food
|
66
|
+
- 2000-01-02: Went to _Atlantis_.
|
67
|
+
- 2000-01-01: Talked to **George Washington Carver** on the phone for an hour.
|
67
68
|
|
68
69
|
### Friends:
|
69
70
|
- George Washington Carver
|
@@ -73,14 +74,44 @@ clean_describe "list activities" do
|
|
73
74
|
### Locations:
|
74
75
|
- Atlantis
|
75
76
|
- Paris
|
76
|
-
|
77
|
+
FILE
|
78
|
+
end
|
79
|
+
|
80
|
+
it "matches location case-insensitively" do
|
81
|
+
stdout_only <<-OUTPUT
|
82
|
+
2000-01-04: Got lunch with Grace Hopper and George Washington Carver. @food
|
83
|
+
2000-01-02: Went to Atlantis.
|
84
|
+
OUTPUT
|
85
|
+
end
|
77
86
|
end
|
87
|
+
describe "when activities are not in order" do
|
88
|
+
let(:content) do
|
89
|
+
<<-FILE
|
90
|
+
### Activities:
|
91
|
+
- 2000-01-06: Went to a museum with **George Washington Carver**.
|
92
|
+
- 2000-01-02: Went to _Atlantis_.
|
93
|
+
- 2000-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
94
|
+
- 2000-01-03: Celebrated my birthday in _Paris_ with **Marie Curie**. @partying @food
|
95
|
+
- 2000-01-05: Moved to _Paris_.
|
96
|
+
- 2000-01-01: Talked to **George Washington Carver** on the phone for an hour.
|
78
97
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
98
|
+
### Friends:
|
99
|
+
- George Washington Carver
|
100
|
+
- Marie Curie [Atlantis] @science
|
101
|
+
- Grace Hopper (a.k.a. The Admiral a.k.a. Amazing Grace) [Paris] @navy @science
|
102
|
+
|
103
|
+
### Locations:
|
104
|
+
- Atlantis
|
105
|
+
- Paris
|
106
|
+
FILE
|
107
|
+
end
|
108
|
+
|
109
|
+
it "matches location case-insensitively" do
|
110
|
+
stdout_only <<-OUTPUT
|
111
|
+
2000-01-04: Got lunch with Grace Hopper and George Washington Carver. @food
|
112
|
+
2000-01-02: Went to Atlantis.
|
113
|
+
OUTPUT
|
114
|
+
end
|
84
115
|
end
|
85
116
|
end
|
86
117
|
end
|
@@ -127,7 +158,6 @@ clean_describe "list activities" do
|
|
127
158
|
it "matches tag case-insensitively" do
|
128
159
|
stdout_only <<-OUTPUT
|
129
160
|
2015-01-04: Got lunch with Grace Hopper and George Washington Carver. @food
|
130
|
-
2015-11-01: Grace Hopper and I went to Marie's Diner. George had to cancel at the last minute. @food
|
131
161
|
OUTPUT
|
132
162
|
end
|
133
163
|
|
@@ -139,7 +169,7 @@ clean_describe "list activities" do
|
|
139
169
|
<<-FILE
|
140
170
|
### Activities:
|
141
171
|
- 2015-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
142
|
-
- 2015-11-01: **Grace Hopper** and I went to
|
172
|
+
- 2015-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
|
143
173
|
- 2014-11-15: Talked to **George Washington Carver** on the phone for an hour.
|
144
174
|
- 2014-12-31: Celebrated the new year in _Paris_ with **Marie Curie**. @partying @food
|
145
175
|
|
@@ -161,11 +191,11 @@ FILE
|
|
161
191
|
describe "--since" do
|
162
192
|
subject { run_cmd("list activities --since 'January 4th 2015'") }
|
163
193
|
|
164
|
-
it "lists activities on and after the specified date" do
|
194
|
+
it "lists activities on and after the specified date in order" do
|
165
195
|
stdout_only <<-OUTPUT
|
166
|
-
2015-01-04: Got lunch with Grace Hopper and George Washington Carver. @food
|
167
|
-
2015-11-01: Grace Hopper and I went to Marie's Diner. George had to cancel at the last minute. @food
|
168
196
|
2018-02-06: @science:indoors:agronomy-with-hydroponics: Norman Borlaug and George Washington Carver scored a tour of Atlantis' hydroponics gardens through wetplants@example.org and they took me along.
|
197
|
+
2015-11-01: Grace Hopper and I went to Martha's Vineyard. George had to cancel at the last minute.
|
198
|
+
2015-01-04: Got lunch with Grace Hopper and George Washington Carver. @food
|
169
199
|
OUTPUT
|
170
200
|
end
|
171
201
|
end
|
@@ -173,11 +203,11 @@ FILE
|
|
173
203
|
describe "--until" do
|
174
204
|
subject { run_cmd("list activities --until 'January 4th 2015'") }
|
175
205
|
|
176
|
-
it "lists activities before and on the specified date" do
|
206
|
+
it "lists activities before and on the specified date in order" do
|
177
207
|
stdout_only <<-OUTPUT
|
178
208
|
2015-01-04: Got lunch with Grace Hopper and George Washington Carver. @food
|
179
|
-
2014-11-15: Talked to George Washington Carver on the phone for an hour.
|
180
209
|
2014-12-31: Celebrated the new year in Paris with Marie Curie. @partying
|
210
|
+
2014-11-15: Talked to George Washington Carver on the phone for an hour.
|
181
211
|
OUTPUT
|
182
212
|
end
|
183
213
|
end
|
@@ -26,7 +26,7 @@ clean_describe "list favorite friends" do
|
|
26
26
|
<<-FILE
|
27
27
|
### Activities:
|
28
28
|
- 2017-01-01: Did some math with **Grace Hopper**.
|
29
|
-
- 2015-11-01: **Grace Hopper** and I went to
|
29
|
+
- 2015-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
|
30
30
|
- 2015-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
31
31
|
- 2014-12-31: Celebrated the new year in _Paris_ with **Marie Curie**. @partying
|
32
32
|
- 2014-11-15: Talked to **George Washington Carver** on the phone for an hour.
|
@@ -25,8 +25,8 @@ clean_describe "list favorite locations" do
|
|
25
25
|
let(:content) do
|
26
26
|
<<-FILE
|
27
27
|
### Activities:
|
28
|
-
- 2017-01-01: **Grace Hopper** and I went to
|
29
|
-
- 2015-11-01: **Grace Hopper** and I went to
|
28
|
+
- 2017-01-01: **Grace Hopper** and I went to _Martha's Vineyard_ for breakfast.
|
29
|
+
- 2015-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
|
30
30
|
- 2015-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
31
31
|
- 2014-12-31: Celebrated the new year in _Paris_ with **Marie Curie**. @partying
|
32
32
|
- 2014-11-15: Talked to **George Washington Carver** on the phone for an hour.
|
@@ -38,7 +38,7 @@ clean_describe "list favorite locations" do
|
|
38
38
|
|
39
39
|
### Locations:
|
40
40
|
- Atlantis
|
41
|
-
-
|
41
|
+
- Martha's Vineyard
|
42
42
|
- Paris
|
43
43
|
FILE
|
44
44
|
end
|
@@ -46,9 +46,9 @@ FILE
|
|
46
46
|
it "lists locations in order of decreasing activity" do
|
47
47
|
stdout_only <<-OUTPUT
|
48
48
|
Your favorite locations:
|
49
|
-
1.
|
50
|
-
2. Paris
|
51
|
-
3. Atlantis
|
49
|
+
1. Martha's Vineyard (2 activities)
|
50
|
+
2. Paris (1)
|
51
|
+
3. Atlantis (0)
|
52
52
|
OUTPUT
|
53
53
|
end
|
54
54
|
|
@@ -120,10 +120,10 @@ FILE
|
|
120
120
|
<<-FILE
|
121
121
|
### Activities:
|
122
122
|
- 2015-01-30: Went to a museum with **George Washington Carver**.
|
123
|
-
- 2015-01-29:
|
123
|
+
- 2015-01-29: Moved to _Paris_.
|
124
124
|
- 2015-01-01: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
125
125
|
- 2014-12-31: Celebrated the new year in _Paris_ with **Marie Curie**. @partying @food
|
126
|
-
- 2014-12-30:
|
126
|
+
- 2014-12-30: Went to _Atlantis_.
|
127
127
|
- 2014-12-29: Talked to **George Washington Carver** on the phone for an hour.
|
128
128
|
|
129
129
|
### Friends:
|
@@ -35,7 +35,7 @@ clean_describe "rename friend" do
|
|
35
35
|
it "updates friend name in activities" do
|
36
36
|
value(run_cmd("list activities")[:stdout]).must_equal <<-FILE
|
37
37
|
2018-02-06: @science:indoors:agronomy-with-hydroponics: Norman Borlaug and George Washington Carver scored a tour of Atlantis' hydroponics gardens through wetplants@example.org and they took me along.
|
38
|
-
2015-11-01: Grace Hopper and I went to
|
38
|
+
2015-11-01: Grace Hopper and I went to Martha's Vineyard. George had to cancel at the last minute.
|
39
39
|
2015-01-04: Got lunch with Grace Hopper and George Washington Carver. @food
|
40
40
|
2014-12-31: Celebrated the new year in Paris with Marie Curie. @partying
|
41
41
|
2014-11-15: Talked to George Washington Carver on the phone for an hour.
|
@@ -43,7 +43,7 @@ clean_describe "rename friend" do
|
|
43
43
|
subject
|
44
44
|
value(run_cmd("list activities")[:stdout]).must_equal <<-FILE
|
45
45
|
2018-02-06: @science:indoors:agronomy-with-hydroponics: Norman Borlaug and George Washington scored a tour of Atlantis' hydroponics gardens through wetplants@example.org and they took me along.
|
46
|
-
2015-11-01: Grace Hopper and I went to
|
46
|
+
2015-11-01: Grace Hopper and I went to Martha's Vineyard. George had to cancel at the last minute.
|
47
47
|
2015-01-04: Got lunch with Grace Hopper and George Washington. @food
|
48
48
|
2014-12-31: Celebrated the new year in Paris with Marie Curie. @partying
|
49
49
|
2014-11-15: Talked to George Washington on the phone for an hour.
|
@@ -48,7 +48,7 @@ Close friend: None found
|
|
48
48
|
- 2016-03-01: Met up with **Grace Hopper**.
|
49
49
|
- 2016-02-01: Met up with **Grace Hopper**.
|
50
50
|
- 2016-01-01: Met up with **Grace Hopper**.
|
51
|
-
- 2015-11-01: **Grace Hopper** and I went to
|
51
|
+
- 2015-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
|
52
52
|
- 2015-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
53
53
|
- 2014-12-31: Celebrated the new year in _Paris_ with **Marie Curie**. @partying
|
54
54
|
- 2014-11-15: Talked to **George Washington Carver** on the phone for an hour.
|
@@ -60,7 +60,7 @@ Close friend: None found
|
|
60
60
|
|
61
61
|
### Locations:
|
62
62
|
- Atlantis
|
63
|
-
-
|
63
|
+
- Martha's Vineyard
|
64
64
|
- Paris
|
65
65
|
FILE
|
66
66
|
end
|
data/test/helper.rb
CHANGED
@@ -27,7 +27,7 @@ require "friends"
|
|
27
27
|
CONTENT = <<-FILE.freeze
|
28
28
|
### Activities:
|
29
29
|
- 2018-02-06: @science:indoors:agronomy-with-hydroponics: **Norman Borlaug** and **George Washington Carver** scored a tour of _Atlantis_' hydroponics gardens through wetplants@example.org and they took me along.
|
30
|
-
- 2015-11-01: **Grace Hopper** and I went to
|
30
|
+
- 2015-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
|
31
31
|
- 2015-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
32
32
|
- 2014-12-31: Celebrated the new year in _Paris_ with **Marie Curie**. @partying
|
33
33
|
- 2014-11-15: Talked to **George Washington Carver** on the phone for an hour.
|
@@ -47,7 +47,7 @@ CONTENT = <<-FILE.freeze
|
|
47
47
|
|
48
48
|
### Locations:
|
49
49
|
- Atlantis
|
50
|
-
-
|
50
|
+
- Martha's Vineyard
|
51
51
|
- Paris
|
52
52
|
FILE
|
53
53
|
|
@@ -55,7 +55,7 @@ FILE
|
|
55
55
|
SCRAMBLED_CONTENT = <<-FILE.freeze
|
56
56
|
### Activities:
|
57
57
|
- 2015-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
58
|
-
- 2015-11-01: **Grace Hopper** and I went to
|
58
|
+
- 2015-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
|
59
59
|
- 2018-02-06: @science:indoors:agronomy-with-hydroponics: **Norman Borlaug** and **George Washington Carver** scored a tour of _Atlantis_' hydroponics gardens through wetplants@example.org and they took me along.
|
60
60
|
- 2014-11-15: Talked to **George Washington Carver** on the phone for an hour.
|
61
61
|
- 2014-12-31: Celebrated the new year in _Paris_ with **Marie Curie**. @partying
|
@@ -76,7 +76,7 @@ SCRAMBLED_CONTENT = <<-FILE.freeze
|
|
76
76
|
### Locations:
|
77
77
|
- Paris
|
78
78
|
- Atlantis
|
79
|
-
-
|
79
|
+
- Martha's Vineyard
|
80
80
|
FILE
|
81
81
|
|
82
82
|
# Define these methods so they can be referenced in the methods below. They'll be overridden in
|
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.
|
4
|
+
version: '0.48'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Evelyn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic
|
@@ -137,6 +137,7 @@ extensions: []
|
|
137
137
|
extra_rdoc_files: []
|
138
138
|
files:
|
139
139
|
- ".github/CONTRIBUTING.md"
|
140
|
+
- ".github/FUNDING.yml"
|
140
141
|
- ".github/ISSUE_TEMPLATE.md"
|
141
142
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
142
143
|
- ".gitignore"
|