friends 0.49 → 0.54
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 +1 -1
- data/.rubocop.yml +20 -5
- data/.travis.yml +6 -6
- data/CHANGELOG.md +76 -4
- data/Gemfile +2 -2
- data/README.md +29 -7
- data/RELEASING.md +1 -1
- data/bin/friends +3 -7
- data/friends.gemspec +3 -5
- data/lib/friends/commands/add.rb +12 -3
- data/lib/friends/commands/list.rb +5 -2
- data/lib/friends/commands/remove.rb +9 -0
- data/lib/friends/commands/update.rb +2 -2
- data/lib/friends/event.rb +2 -2
- data/lib/friends/friend.rb +5 -7
- data/lib/friends/graph.rb +1 -1
- data/lib/friends/introvert.rb +55 -17
- data/lib/friends/location.rb +40 -8
- data/lib/friends/post_install_message.rb +1 -2
- data/lib/friends/regex_builder.rb +8 -8
- data/lib/friends/sem_ver_comparator.rb +20 -0
- data/lib/friends/serializable.rb +1 -1
- data/lib/friends/version.rb +1 -1
- data/test/add_event_helper.rb +6 -4
- data/test/commands/add/alias_spec.rb +74 -0
- data/test/commands/add/nickname_spec.rb +9 -0
- data/test/commands/add/tag_spec.rb +9 -0
- data/test/commands/edit_spec.rb +1 -0
- data/test/commands/list/locations_spec.rb +14 -0
- data/test/commands/remove/alias_spec.rb +68 -0
- data/test/commands/remove/tag_spec.rb +9 -0
- data/test/commands/stats_spec.rb +1 -1
- data/test/editor +2 -0
- data/test/helper.rb +4 -2
- metadata +13 -28
|
@@ -7,6 +7,15 @@ clean_describe "add nickname" do
|
|
|
7
7
|
|
|
8
8
|
let(:content) { CONTENT }
|
|
9
9
|
|
|
10
|
+
describe "when friend name and nickname are blank" do
|
|
11
|
+
let(:friend_name) { nil }
|
|
12
|
+
let(:nickname) { nil }
|
|
13
|
+
|
|
14
|
+
it "prints an error message" do
|
|
15
|
+
stderr_only 'Error: Expected "[Friend Name]" "[Nickname]"'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
10
19
|
describe "when friend name has no matches" do
|
|
11
20
|
let(:friend_name) { "Garbage" }
|
|
12
21
|
let(:nickname) { "Georgie" }
|
|
@@ -7,6 +7,15 @@ clean_describe "add tag" do
|
|
|
7
7
|
|
|
8
8
|
let(:content) { CONTENT }
|
|
9
9
|
|
|
10
|
+
describe "when friend name and tag are blank" do
|
|
11
|
+
let(:friend_name) { nil }
|
|
12
|
+
let(:tag) { nil }
|
|
13
|
+
|
|
14
|
+
it "prints an error message" do
|
|
15
|
+
stderr_only 'Error: Expected "[Friend Name]" "[Tag]"'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
10
19
|
describe "when friend name has no matches" do
|
|
11
20
|
let(:friend_name) { "Garbage" }
|
|
12
21
|
let(:tag) { "school" }
|
data/test/commands/edit_spec.rb
CHANGED
|
@@ -31,7 +31,21 @@ clean_describe "list locations" do
|
|
|
31
31
|
Paris
|
|
32
32
|
Atlantis
|
|
33
33
|
Martha's Vineyard
|
|
34
|
+
New York City
|
|
34
35
|
OUTPUT
|
|
35
36
|
end
|
|
37
|
+
|
|
38
|
+
describe "--verbose" do
|
|
39
|
+
subject { run_cmd("list locations --verbose") }
|
|
40
|
+
|
|
41
|
+
it "lists locations in file order with details" do
|
|
42
|
+
stdout_only <<-OUTPUT
|
|
43
|
+
Paris
|
|
44
|
+
Atlantis
|
|
45
|
+
Martha's Vineyard
|
|
46
|
+
New York City (a.k.a. NYC a.k.a. NY)
|
|
47
|
+
OUTPUT
|
|
48
|
+
end
|
|
49
|
+
end
|
|
36
50
|
end
|
|
37
51
|
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "./test/helper"
|
|
4
|
+
|
|
5
|
+
clean_describe "remove alias" do
|
|
6
|
+
subject { run_cmd("remove alias #{location_name} #{nickname}") }
|
|
7
|
+
|
|
8
|
+
let(:content) { CONTENT }
|
|
9
|
+
|
|
10
|
+
describe "when location and nickname are nil" do
|
|
11
|
+
let(:location_name) { nil }
|
|
12
|
+
let(:nickname) { nil }
|
|
13
|
+
|
|
14
|
+
it "prints an error message" do
|
|
15
|
+
stderr_only 'Error: Expected "[Location Name]" "[Alias]"'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe "when location name has no matches" do
|
|
20
|
+
let(:location_name) { "Garbage" }
|
|
21
|
+
let(:nickname) { "'Big Apple Pie'" }
|
|
22
|
+
|
|
23
|
+
it "prints an error message" do
|
|
24
|
+
stderr_only 'Error: No location found for "Garbage"'
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe "when location name has one match" do
|
|
29
|
+
let(:location_name) { "'New York City'" }
|
|
30
|
+
|
|
31
|
+
describe "when alias is nil" do
|
|
32
|
+
let(:nickname) { nil }
|
|
33
|
+
it "prints an error message" do
|
|
34
|
+
stderr_only "Error: Alias cannot be blank"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
describe "when alias is not present on location" do
|
|
39
|
+
let(:nickname) { "Gotham" }
|
|
40
|
+
it "prints an error message" do
|
|
41
|
+
stderr_only 'Error: Alias "Gotham" not found for "New York City"'
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
describe "when alias is present on location" do
|
|
46
|
+
let(:nickname) { "'NYC'" }
|
|
47
|
+
|
|
48
|
+
it "removes alias from location" do
|
|
49
|
+
line_changed(
|
|
50
|
+
"- New York City (a.k.a. NYC a.k.a. NY)",
|
|
51
|
+
"- New York City (a.k.a. NY)"
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "removes parenthetical from file when location has no more nicknames" do
|
|
56
|
+
run_cmd("remove alias #{location_name} 'NY'")
|
|
57
|
+
line_changed(
|
|
58
|
+
"- New York City (a.k.a. NYC)",
|
|
59
|
+
"- New York City"
|
|
60
|
+
)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "prints an output message" do
|
|
64
|
+
stdout_only 'Alias removed: "New York City (a.k.a. NY)"'
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -7,6 +7,15 @@ clean_describe "remove tag" do
|
|
|
7
7
|
|
|
8
8
|
let(:content) { CONTENT }
|
|
9
9
|
|
|
10
|
+
describe "when friend name and tag are blank" do
|
|
11
|
+
let(:friend_name) { nil }
|
|
12
|
+
let(:tag) { nil }
|
|
13
|
+
|
|
14
|
+
it "prints an error message" do
|
|
15
|
+
stderr_only 'Error: No friend found for ""'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
10
19
|
describe "when friend name has no matches" do
|
|
11
20
|
let(:friend_name) { "Garbage" }
|
|
12
21
|
let(:tag) { "science" }
|
data/test/commands/stats_spec.rb
CHANGED
data/test/editor
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
3
5
|
# This is an example "editor" used to test the `friends edit` command.
|
|
4
6
|
# It inserts a new activity into the second line of the file, allowing
|
|
5
7
|
# us to test that friends and locations added in an `edit` command are
|
data/test/helper.rb
CHANGED
|
@@ -24,7 +24,7 @@ require "securerandom"
|
|
|
24
24
|
|
|
25
25
|
require "friends"
|
|
26
26
|
|
|
27
|
-
CONTENT = <<-FILE
|
|
27
|
+
CONTENT = <<-FILE
|
|
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
30
|
- 2015-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
|
|
@@ -48,11 +48,12 @@ CONTENT = <<-FILE.freeze
|
|
|
48
48
|
### Locations:
|
|
49
49
|
- Atlantis
|
|
50
50
|
- Martha's Vineyard
|
|
51
|
+
- New York City (a.k.a. NYC a.k.a. NY)
|
|
51
52
|
- Paris
|
|
52
53
|
FILE
|
|
53
54
|
|
|
54
55
|
# This is CONTENT but with activities, friends, and locations unsorted.
|
|
55
|
-
SCRAMBLED_CONTENT = <<-FILE
|
|
56
|
+
SCRAMBLED_CONTENT = <<-FILE
|
|
56
57
|
### Activities:
|
|
57
58
|
- 2015-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
|
|
58
59
|
- 2015-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
|
|
@@ -77,6 +78,7 @@ SCRAMBLED_CONTENT = <<-FILE.freeze
|
|
|
77
78
|
- Paris
|
|
78
79
|
- Atlantis
|
|
79
80
|
- Martha's Vineyard
|
|
81
|
+
- New York City (a.k.a. NYC a.k.a. NY)
|
|
80
82
|
FILE
|
|
81
83
|
|
|
82
84
|
# 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.54'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jacob Evelyn
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-10-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: chronic
|
|
@@ -52,26 +52,6 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '2.0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: semverse
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '2'
|
|
62
|
-
- - "<"
|
|
63
|
-
- !ruby/object:Gem::Version
|
|
64
|
-
version: '4'
|
|
65
|
-
type: :runtime
|
|
66
|
-
prerelease: false
|
|
67
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
68
|
-
requirements:
|
|
69
|
-
- - ">="
|
|
70
|
-
- !ruby/object:Gem::Version
|
|
71
|
-
version: '2'
|
|
72
|
-
- - "<"
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '4'
|
|
75
55
|
- !ruby/object:Gem::Dependency
|
|
76
56
|
name: tty-pager
|
|
77
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -120,14 +100,14 @@ dependencies:
|
|
|
120
100
|
requirements:
|
|
121
101
|
- - "~>"
|
|
122
102
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: '
|
|
103
|
+
version: '13.0'
|
|
124
104
|
type: :development
|
|
125
105
|
prerelease: false
|
|
126
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
127
107
|
requirements:
|
|
128
108
|
- - "~>"
|
|
129
109
|
- !ruby/object:Gem::Version
|
|
130
|
-
version: '
|
|
110
|
+
version: '13.0'
|
|
131
111
|
description: Spend time with the people you care about. Introvert-tested. Extrovert-approved.
|
|
132
112
|
email:
|
|
133
113
|
- jacobevelyn@gmail.com
|
|
@@ -177,11 +157,13 @@ files:
|
|
|
177
157
|
- lib/friends/note.rb
|
|
178
158
|
- lib/friends/post_install_message.rb
|
|
179
159
|
- lib/friends/regex_builder.rb
|
|
160
|
+
- lib/friends/sem_ver_comparator.rb
|
|
180
161
|
- lib/friends/serializable.rb
|
|
181
162
|
- lib/friends/tag_regex.rb
|
|
182
163
|
- lib/friends/version.rb
|
|
183
164
|
- test/add_event_helper.rb
|
|
184
165
|
- test/commands/add/activity_spec.rb
|
|
166
|
+
- test/commands/add/alias_spec.rb
|
|
185
167
|
- test/commands/add/friend_spec.rb
|
|
186
168
|
- test/commands/add/location_spec.rb
|
|
187
169
|
- test/commands/add/nickname_spec.rb
|
|
@@ -198,6 +180,7 @@ files:
|
|
|
198
180
|
- test/commands/list/locations_spec.rb
|
|
199
181
|
- test/commands/list/notes_spec.rb
|
|
200
182
|
- test/commands/list/tags_spec.rb
|
|
183
|
+
- test/commands/remove/alias_spec.rb
|
|
201
184
|
- test/commands/remove/nickname_spec.rb
|
|
202
185
|
- test/commands/remove/tag_spec.rb
|
|
203
186
|
- test/commands/rename/friend_spec.rb
|
|
@@ -224,20 +207,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
224
207
|
requirements:
|
|
225
208
|
- - ">="
|
|
226
209
|
- !ruby/object:Gem::Version
|
|
227
|
-
version: '2.
|
|
210
|
+
version: '2.3'
|
|
228
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
212
|
requirements:
|
|
230
213
|
- - ">="
|
|
231
214
|
- !ruby/object:Gem::Version
|
|
232
215
|
version: '0'
|
|
233
216
|
requirements: []
|
|
234
|
-
rubygems_version: 3.
|
|
235
|
-
signing_key:
|
|
217
|
+
rubygems_version: 3.1.4
|
|
218
|
+
signing_key:
|
|
236
219
|
specification_version: 4
|
|
237
220
|
summary: Spend time with the people you care about.
|
|
238
221
|
test_files:
|
|
239
222
|
- test/add_event_helper.rb
|
|
240
223
|
- test/commands/add/activity_spec.rb
|
|
224
|
+
- test/commands/add/alias_spec.rb
|
|
241
225
|
- test/commands/add/friend_spec.rb
|
|
242
226
|
- test/commands/add/location_spec.rb
|
|
243
227
|
- test/commands/add/nickname_spec.rb
|
|
@@ -254,6 +238,7 @@ test_files:
|
|
|
254
238
|
- test/commands/list/locations_spec.rb
|
|
255
239
|
- test/commands/list/notes_spec.rb
|
|
256
240
|
- test/commands/list/tags_spec.rb
|
|
241
|
+
- test/commands/remove/alias_spec.rb
|
|
257
242
|
- test/commands/remove/nickname_spec.rb
|
|
258
243
|
- test/commands/remove/tag_spec.rb
|
|
259
244
|
- test/commands/rename/friend_spec.rb
|