friends 0.50 → 0.51

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: caa472946e4b1055d2168cac599d3723c53f42c751afd9de3c2561184e6886da
4
- data.tar.gz: 2bea663a17650429b4b5bfb7dd0a6bd292891d77ccd889c67a76b77a4ed20174
3
+ metadata.gz: 1a48314cd65423f48134663c087be43e3978f940c9c26d47dd25e83f9d3d7af1
4
+ data.tar.gz: cb6064161d7ff10e4b2300127aa22a0740f02fec6051a93e90288ed1268f8595
5
5
  SHA512:
6
- metadata.gz: 158f60b3d085a2f4fbeaabb6d418bd71e8bc34fdf4a1a9965dc1df6828362ef71f3ba1998e8b01421d9d6357789fa5a4022a04e5533c133305800d75638eb26f
7
- data.tar.gz: 2365522a4994fd2581ec2acecfb09cfd1c0ae4a10122f3f316bfffd284c9fed1cb076eef54b7dced2e38d819c95b559e6a305539c0a1805f89f8954966d7dea5
6
+ metadata.gz: 941c76dab927034c7b9663b48f06f1299b522b2595e92ccb5b829c4adea7fc52b37e7ac8f03d50810b799422cf59441b56b26851f11b2835d380b26ba244a0f3
7
+ data.tar.gz: 4e079a3d0e94d69f4e18d30e3313a4e0e520f9c3917528c313d2ac919a7ac920c1dbdf5e3ad0d6afe95d44bda47ce85bd06c3fd64fdad4b3a45f96a7ece3b16e
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.2
2
+ TargetRubyVersion: 2.3
3
3
 
4
4
  Gemspec/RequiredRubyVersion:
5
5
  Enabled: false
@@ -10,9 +10,18 @@ Layout/ClosingHeredocIndentation:
10
10
  Layout/DotPosition:
11
11
  EnforcedStyle: trailing
12
12
 
13
- Layout/IndentHeredoc:
13
+ Layout/HeredocIndentation:
14
14
  Enabled: false
15
15
 
16
+ Layout/LineLength:
17
+ Max: 100
18
+
19
+ Lint/RaiseException:
20
+ Enabled: true
21
+
22
+ Lint/StructNewOverride:
23
+ Enabled: true
24
+
16
25
  Metrics/AbcSize:
17
26
  Enabled: false
18
27
 
@@ -28,9 +37,6 @@ Metrics/ClassLength:
28
37
  Metrics/CyclomaticComplexity:
29
38
  Enabled: false
30
39
 
31
- Metrics/LineLength:
32
- Max: 100
33
-
34
40
  Metrics/MethodLength:
35
41
  Enabled: false
36
42
 
@@ -46,6 +52,15 @@ Naming/AccessorMethodName:
46
52
  Style/Documentation:
47
53
  Enabled: false
48
54
 
55
+ Style/HashEachMethods:
56
+ Enabled: true
57
+
58
+ Style/HashTransformKeys:
59
+ Enabled: true
60
+
61
+ Style/HashTransformValues:
62
+ Enabled: true
63
+
49
64
  Style/MultilineBlockChain:
50
65
  Enabled: false
51
66
 
@@ -1,7 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1
4
- - 2.2
5
3
  - 2.3
6
4
  - 2.4
7
5
  - 2.5
@@ -15,7 +13,7 @@ matrix:
15
13
  gemfile: Gemfile
16
14
  script:
17
15
  - bundle exec rake test
18
- - gem install --no-document rubocop -v 0.67 && rubocop
16
+ - gem install --no-document rubocop && rubocop
19
17
  env:
20
18
  - CODE_COVERAGE=true
21
19
  branches:
@@ -4,6 +4,22 @@
4
4
  making a small donation (🙏) with the **Sponsor** button at the top of this page to
5
5
  show you appreciate its continued development.
6
6
 
7
+ ## [v0.51](https://github.com/JacobEvelyn/friends/tree/v0.51) (2020-04-05)
8
+
9
+ [Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.50...v0.51)
10
+
11
+ **Implemented enhancements:**
12
+
13
+ - Drop Semverse dependency [\#256](https://github.com/JacobEvelyn/friends/issues/256)
14
+
15
+ **Closed issues:**
16
+
17
+ - Drop support for Ruby \<2.3 [\#257](https://github.com/JacobEvelyn/friends/issues/257)
18
+
19
+ **Merged pull requests:**
20
+
21
+ - Remove Semverse dependency, and require Ruby 2.3+ [\#258](https://github.com/JacobEvelyn/friends/pull/258) ([JacobEvelyn](https://github.com/JacobEvelyn))
22
+
7
23
  ## [v0.50](https://github.com/JacobEvelyn/friends/tree/v0.50) (2020-04-03)
8
24
 
9
25
  [Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.49...v0.50)
@@ -12,7 +12,6 @@ end
12
12
  require "gli"
13
13
  require "paint"
14
14
  require "readline"
15
- require "semverse"
16
15
 
17
16
  require "friends/introvert"
18
17
  require "friends/version"
@@ -48,10 +47,7 @@ class Stripped; end
48
47
  accept(Stripped, &:strip)
49
48
 
50
49
  class InputDate; end
51
- accept(InputDate) do |value|
52
- time = Chronic.parse(value)
53
- time && time.to_date
54
- end
50
+ accept(InputDate) { |value| Chronic.parse(value)&.to_date }
55
51
 
56
52
  switch [:quiet],
57
53
  negatable: false,
@@ -102,7 +98,7 @@ post do
102
98
  rescue Errno::ENOENT
103
99
  # If the pager is not installed, just print the output.
104
100
  puts @introvert.output
105
- rescue Errno::EPIPE # rubocop:disable Lint/HandleExceptions
101
+ rescue Errno::EPIPE
106
102
  # Occurs when quitting the pager.
107
103
  end
108
104
  end
@@ -23,17 +23,15 @@ Gem::Specification.new do |spec|
23
23
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- # We need Ruby 2.1's default-less keyword arguments and default UTF-8
27
- # encoding.
28
- spec.required_ruby_version = ">= 2.1"
26
+ # We need Ruby 2.3's safe navigation operator.
27
+ spec.required_ruby_version = ">= 2.3"
29
28
 
30
29
  spec.add_dependency "chronic", "~> 0.10"
31
30
  spec.add_dependency "gli", "~> 2.14"
32
31
  spec.add_dependency "paint", "~> 2.0"
33
- spec.add_dependency "semverse", ">= 2", "< 4"
34
32
  spec.add_dependency "tty-pager", "~> 0.11"
35
33
 
36
34
  spec.add_development_dependency "minitest", "~> 5.5"
37
35
  spec.add_development_dependency "minitest-proveit", "~> 1.0"
38
- spec.add_development_dependency "rake", "~> 12.3"
36
+ spec.add_development_dependency "rake", "~> 13.0"
39
37
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "friends/post_install_message"
4
+ require "friends/sem_ver_comparator"
4
5
 
5
6
  desc "Updates the `friends` program"
6
7
  command :update do |update|
@@ -9,8 +10,7 @@ command :update do |update|
9
10
  if match = `gem search friends`.match(/^friends\s\(([^\)]+)\)$/)
10
11
  # rubocop:enable Lint/AssignmentInCondition
11
12
  remote_version = match[1]
12
- if Semverse::Version.coerce(remote_version) >
13
- Semverse::Version.coerce(Friends::VERSION)
13
+ if Friends::SemVerComparator.greater?(remote_version, Friends::VERSION)
14
14
  `gem update friends && gem cleanup friends`
15
15
 
16
16
  unless global_options[:quiet]
@@ -14,8 +14,8 @@ module Friends
14
14
  class Event
15
15
  extend Serializable
16
16
 
17
- SERIALIZATION_PREFIX = "- ".freeze
18
- DATE_PARTITION = ": ".freeze
17
+ SERIALIZATION_PREFIX = "- "
18
+ DATE_PARTITION = ": "
19
19
 
20
20
  # @return [Regexp] the regex for capturing groups in deserialization
21
21
  def self.deserialization_regex
@@ -10,13 +10,13 @@ module Friends
10
10
  class Friend
11
11
  extend Serializable
12
12
 
13
- SERIALIZATION_PREFIX = "- ".freeze
14
- NICKNAME_PREFIX = "a.k.a. ".freeze
13
+ SERIALIZATION_PREFIX = "- "
14
+ NICKNAME_PREFIX = "a.k.a. "
15
15
 
16
16
  # @return [Regexp] the regex for capturing groups in deserialization
17
17
  def self.deserialization_regex
18
18
  # Note: this regex must be on one line because whitespace is important
19
- /(#{SERIALIZATION_PREFIX})?(?<name>[^\(\[@]*[^\(\[@\s])(\s+\(#{NICKNAME_PREFIX}(?<nickname_str>.+)\))?(\s+\[(?<location_name>[^\]]+)\])?(\s+(?<tags_str>(#{TAG_REGEX}\s*)+))?/ # rubocop:disable Metrics/LineLength
19
+ /(#{SERIALIZATION_PREFIX})?(?<name>[^\(\[@]*[^\(\[@\s])(\s+\(#{NICKNAME_PREFIX}(?<nickname_str>.+)\))?(\s+\[(?<location_name>[^\]]+)\])?(\s+(?<tags_str>(#{TAG_REGEX}\s*)+))?/ # rubocop:disable Layout/LineLength
20
20
  end
21
21
 
22
22
  # @return [Regexp] the string of what we expected during deserialization
@@ -32,11 +32,9 @@ module Friends
32
32
  tags_str: nil
33
33
  )
34
34
  @name = name
35
- @nicknames = nickname_str &&
36
- nickname_str.split(" #{NICKNAME_PREFIX}") ||
37
- []
35
+ @nicknames = nickname_str&.split(" #{NICKNAME_PREFIX}") || []
38
36
  @location_name = location_name
39
- @tags = tags_str && tags_str.split(/\s+/) || []
37
+ @tags = tags_str&.split(/\s+/) || []
40
38
  end
41
39
 
42
40
  attr_accessor :name
@@ -4,7 +4,7 @@
4
4
 
5
5
  module Friends
6
6
  class Graph
7
- DATE_FORMAT = "%b %Y".freeze
7
+ DATE_FORMAT = "%b %Y"
8
8
  SCALED_SIZE = 20
9
9
 
10
10
  # @param filtered_activities [Array<Friends::Activity>] a list of activities to highlight in
@@ -16,10 +16,10 @@ require "friends/friends_error"
16
16
 
17
17
  module Friends
18
18
  class Introvert
19
- ACTIVITIES_HEADER = "### Activities:".freeze
20
- NOTES_HEADER = "### Notes:".freeze
21
- FRIENDS_HEADER = "### Friends:".freeze
22
- LOCATIONS_HEADER = "### Locations:".freeze
19
+ ACTIVITIES_HEADER = "### Activities:"
20
+ NOTES_HEADER = "### Notes:"
21
+ FRIENDS_HEADER = "### Friends:"
22
+ LOCATIONS_HEADER = "### Locations:"
23
23
 
24
24
  # @param filename [String] the name of the friends Markdown file
25
25
  def initialize(filename:)
@@ -725,8 +725,8 @@ module Friends
725
725
 
726
726
  begin
727
727
  instance_variable_get("@#{stage.id}") << stage.klass.deserialize(line)
728
- rescue StandardError => ex
729
- bad_line(ex, line_num)
728
+ rescue StandardError => e
729
+ bad_line(e, line_num)
730
730
  end
731
731
 
732
732
  state
@@ -808,7 +808,7 @@ module Friends
808
808
  a.default_location && a.default_location != activity.default_location
809
809
  end
810
810
 
811
- str += " to #{Paint[(later_activity.date if later_activity) || 'present', :bold]}"
811
+ str += " to #{Paint[later_activity&.date || 'present', :bold]}"
812
812
  end
813
813
 
814
814
  str += " already" if earlier_activity_with_default_location != activity
@@ -9,7 +9,7 @@ module Friends
9
9
  class Location
10
10
  extend Serializable
11
11
 
12
- SERIALIZATION_PREFIX = "- ".freeze
12
+ SERIALIZATION_PREFIX = "- "
13
13
 
14
14
  # @return [Regexp] the regex for capturing groups in deserialization
15
15
  def self.deserialization_regex
@@ -3,6 +3,5 @@
3
3
  module Friends
4
4
  POST_INSTALL_MESSAGE = "\nfriends is a volunteer project. If you find it useful, please "\
5
5
  "consider making a small donation:\n\n\t"\
6
- "https://github.com/JacobEvelyn/friends#contributing-its-encouraged\n\n".
7
- freeze
6
+ "https://github.com/JacobEvelyn/friends#contributing-its-encouraged\n\n"
8
7
  end
@@ -6,26 +6,26 @@ module Friends
6
6
  class RegexBuilder
7
7
  # We don't want to match strings that are "escaped" with a leading
8
8
  # backslash.
9
- NO_LEADING_BACKSLASH = "(?<!\\\\)".freeze
9
+ NO_LEADING_BACKSLASH = "(?<!\\\\)"
10
10
 
11
11
  # We don't want to match strings that are directly touching double asterisks
12
12
  # as these are treated as sacred by our program.
13
- NO_LEADING_ASTERISKS = "(?<!\\*\\*)".freeze
14
- NO_TRAILING_ASTERISKS = "(?!\\*\\*)".freeze
13
+ NO_LEADING_ASTERISKS = "(?<!\\*\\*)"
14
+ NO_TRAILING_ASTERISKS = "(?!\\*\\*)"
15
15
 
16
16
  # We don't want to match strings that are directly touching underscores
17
17
  # as these are treated as sacred by our program.
18
- NO_LEADING_UNDERSCORES = "(?<!_)".freeze
19
- NO_TRAILING_UNDERSCORES = "(?!_)".freeze
18
+ NO_LEADING_UNDERSCORES = "(?<!_)"
19
+ NO_TRAILING_UNDERSCORES = "(?!_)"
20
20
 
21
21
  # We don't want to match strings that are part of other words.
22
- NO_LEADING_ALPHABETICALS = "(?<![A-z])".freeze
23
- NO_TRAILING_ALPHABETICALS = "(?![A-z])".freeze
22
+ NO_LEADING_ALPHABETICALS = "(?<![A-z])"
23
+ NO_TRAILING_ALPHABETICALS = "(?![A-z])"
24
24
 
25
25
  # We ignore case within the regex as opposed to globally to allow consumers
26
26
  # of this API the ability to pass in strings that turn off this modifier
27
27
  # with the "(?-i)" string.
28
- IGNORE_CASE = "(?i)".freeze
28
+ IGNORE_CASE = "(?i)"
29
29
 
30
30
  def self.regex(str)
31
31
  Regexp.new(
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Friends
4
+ module SemVerComparator
5
+ SEPARATOR = "."
6
+ NUMBER_REGEX = /\d+/.freeze
7
+
8
+ def self.greater?(version_a, version_b)
9
+ version_a.split(SEPARATOR).zip(version_b.split(SEPARATOR)) do |a, b|
10
+ a_num = a&.[](NUMBER_REGEX)&.to_i
11
+ b_num = b&.[](NUMBER_REGEX)&.to_i
12
+ return false if a_num.nil?
13
+ return true if b_num.nil? || a_num > b_num
14
+ return false if a_num < b_num
15
+ end
16
+
17
+ false
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Friends
4
- VERSION = "0.50".freeze
4
+ VERSION = "0.51"
5
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def date_parsing_specs(test_stdout: true)
2
4
  describe "date parsing" do
3
5
  let(:description) { "Test." }
@@ -123,7 +125,7 @@ def description_parsing_specs(test_stdout: true)
123
125
 
124
126
  it { line_added "- #{date}: Met **Grace Hopper**, and others, at 12." }
125
127
  if test_stdout
126
- it { stdout_only "#{capitalized_event} added: \"#{date}: Met Grace Hopper, and others, at 12.\"" } # rubocop:disable Metrics/LineLength
128
+ it { stdout_only "#{capitalized_event} added: \"#{date}: Met Grace Hopper, and others, at 12.\"" } # rubocop:disable Layout/LineLength
127
129
  end
128
130
  end
129
131
 
@@ -132,7 +134,7 @@ def description_parsing_specs(test_stdout: true)
132
134
 
133
135
  it { line_added "- #{date}: Met **Grace Hopper**, King James, and others at 12." }
134
136
  if test_stdout
135
- it { stdout_only "#{capitalized_event} added: \"#{date}: Met Grace Hopper, King James, and others at 12.\"" } # rubocop:disable Metrics/LineLength
137
+ it { stdout_only "#{capitalized_event} added: \"#{date}: Met Grace Hopper, King James, and others at 12.\"" } # rubocop:disable Layout/LineLength
136
138
  end
137
139
  end
138
140
 
@@ -141,7 +143,7 @@ def description_parsing_specs(test_stdout: true)
141
143
 
142
144
  it { line_added "- #{date}: Met someone—**Grace Hopper**?! At 12." }
143
145
  if test_stdout
144
- it { stdout_only "#{capitalized_event} added: \"#{date}: Met someone—Grace Hopper?! At 12.\"" } # rubocop:disable Metrics/LineLength
146
+ it { stdout_only "#{capitalized_event} added: \"#{date}: Met someone—Grace Hopper?! At 12.\"" } # rubocop:disable Layout/LineLength
145
147
  end
146
148
  end
147
149
 
@@ -150,7 +152,7 @@ def description_parsing_specs(test_stdout: true)
150
152
 
151
153
  it { line_added "- #{date}: Met someone {**Grace Hopper**}—at 12." }
152
154
  if test_stdout
153
- it { stdout_only "#{capitalized_event} added: \"#{date}: Met someone {Grace Hopper}—at 12.\"" } # rubocop:disable Metrics/LineLength
155
+ it { stdout_only "#{capitalized_event} added: \"#{date}: Met someone {Grace Hopper}—at 12.\"" } # rubocop:disable Layout/LineLength
154
156
  end
155
157
  end
156
158
 
@@ -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
@@ -24,7 +24,7 @@ require "securerandom"
24
24
 
25
25
  require "friends"
26
26
 
27
- CONTENT = <<-FILE.freeze
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.
@@ -52,7 +52,7 @@ CONTENT = <<-FILE.freeze
52
52
  FILE
53
53
 
54
54
  # This is CONTENT but with activities, friends, and locations unsorted.
55
- SCRAMBLED_CONTENT = <<-FILE.freeze
55
+ SCRAMBLED_CONTENT = <<-FILE
56
56
  ### Activities:
57
57
  - 2015-01-04: Got lunch with **Grace Hopper** and **George Washington Carver**. @food
58
58
  - 2015-11-01: **Grace Hopper** and I went to _Martha's Vineyard_. George had to cancel at the last minute.
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.50'
4
+ version: '0.51'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Evelyn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-03 00:00:00.000000000 Z
11
+ date: 2020-04-05 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: '12.3'
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: '12.3'
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,6 +157,7 @@ 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
@@ -224,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
205
  requirements:
225
206
  - - ">="
226
207
  - !ruby/object:Gem::Version
227
- version: '2.1'
208
+ version: '2.3'
228
209
  required_rubygems_version: !ruby/object:Gem::Requirement
229
210
  requirements:
230
211
  - - ">="