montrose 0.10.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,8 @@ module Montrose
13
13
  Frequency,
14
14
  Rule::After,
15
15
  Rule::Until,
16
- Rule::Between,
16
+ Rule::Covering,
17
+ Rule::During,
17
18
  Rule::Except,
18
19
  Rule::Total,
19
20
  Rule::TimeOfDay,
@@ -43,7 +44,7 @@ module Montrose
43
44
  yes, no = @stack.partition { |rule| rule.include?(time) }
44
45
 
45
46
  if no.empty?
46
- yes.all? { |rule| rule.advance!(time) } or return false
47
+ yes.all? { |rule| rule.advance!(time) } || (return false)
47
48
  puts time if ENV["DEBUG"]
48
49
  yield time if block_given?
49
50
  true
@@ -29,7 +29,7 @@ module Montrose
29
29
 
30
30
  # Recurrence at fractions of a second are not recognized
31
31
  def normalize_time(time)
32
- time && time.change(usec: 0)
32
+ time&.change(usec: 0)
33
33
  end
34
34
 
35
35
  def as_date(time)
@@ -56,8 +56,8 @@ module Montrose
56
56
 
57
57
  def month_number!(name)
58
58
  month_numbers = MONTHS.map.with_index { |_n, i| i.to_s }.slice(1, 12)
59
- month_number(name) or fail ConfigurationError,
60
- "Did not recognize month #{name}, must be one of #{(MONTHS + month_numbers).inspect}"
59
+ month_number(name) || raise(ConfigurationError,
60
+ "Did not recognize month #{name}, must be one of #{(MONTHS + month_numbers).inspect}")
61
61
  end
62
62
 
63
63
  def day_number(name)
@@ -74,8 +74,8 @@ module Montrose
74
74
 
75
75
  def day_number!(name)
76
76
  day_numbers = DAYS.map.with_index { |_n, i| i.to_s }
77
- day_number(name) or fail ConfigurationError,
78
- "Did not recognize day #{name}, must be one of #{(DAYS + day_numbers).inspect}"
77
+ day_number(name) || raise(ConfigurationError,
78
+ "Did not recognize day #{name}, must be one of #{(DAYS + day_numbers).inspect}")
79
79
  end
80
80
 
81
81
  def days_in_month(month, year = current_time.year)
@@ -93,7 +93,7 @@ module Montrose
93
93
  # Returns string.to_i only if string fully matches an integer
94
94
  # otherwise ensures that return value won't match a valid index
95
95
  def to_index(string)
96
- string =~ %r{^\d+} ? string.to_i : -1
96
+ /^\d+/.match?(string) ? string.to_i : -1
97
97
  end
98
98
  end
99
99
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Montrose
4
- VERSION = "0.10.0"
4
+ VERSION = "0.12.0"
5
5
  end
data/montrose.gemspec CHANGED
@@ -5,29 +5,29 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require "montrose/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = "montrose"
9
- spec.version = Montrose::VERSION
10
- spec.authors = ["Ross Kaffenberger"]
11
- spec.email = ["rosskaff@gmail.com"]
8
+ spec.name = "montrose"
9
+ spec.version = Montrose::VERSION
10
+ spec.authors = ["Ross Kaffenberger"]
11
+ spec.email = ["rosskaff@gmail.com"]
12
12
 
13
- spec.summary = "Recurring events in Ruby"
14
- spec.description = "A library for specifying, quering, and enumerating recurring events for calendars in Ruby."
15
- spec.homepage = "https://github.com/rossta/montrose"
16
- spec.license = "MIT"
13
+ spec.summary = "Recurring events in Ruby"
14
+ spec.description = "A library for specifying, quering, and enumerating recurring events for calendars in Ruby."
15
+ spec.homepage = "https://github.com/rossta/montrose"
16
+ spec.license = "MIT"
17
17
 
18
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
- spec.bindir = "exe"
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.required_ruby_version = ">= 2.3.0"
23
+ spec.required_ruby_version = ">= 2.5.0"
24
24
 
25
- spec.add_dependency "activesupport", ">= 4.1", "< 6.0"
25
+ spec.add_dependency "activesupport", ">= 5.2", "<= 7.0"
26
26
 
27
- spec.add_development_dependency "appraisal", "~> 2.2.0"
28
- spec.add_development_dependency "m", "~> 1.5"
27
+ spec.add_development_dependency "appraisal"
28
+ spec.add_development_dependency "m"
29
29
  spec.add_development_dependency "minitest"
30
- spec.add_development_dependency "rake", "~> 11.0"
31
- spec.add_development_dependency "rubocop", "~> 0.64.0"
30
+ spec.add_development_dependency "rake", ">= 12.3.3"
31
+ spec.add_development_dependency "standard"
32
32
  spec.add_development_dependency "timecop"
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: montrose
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Kaffenberger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-18 00:00:00.000000000 Z
11
+ date: 2021-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,48 +16,48 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.1'
20
- - - "<"
19
+ version: '5.2'
20
+ - - "<="
21
21
  - !ruby/object:Gem::Version
22
- version: '6.0'
22
+ version: '7.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '4.1'
30
- - - "<"
29
+ version: '5.2'
30
+ - - "<="
31
31
  - !ruby/object:Gem::Version
32
- version: '6.0'
32
+ version: '7.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: appraisal
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 2.2.0
39
+ version: '0'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 2.2.0
46
+ version: '0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: m
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: '1.5'
53
+ version: '0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - "~>"
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: '1.5'
60
+ version: '0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: minitest
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -76,30 +76,30 @@ dependencies:
76
76
  name: rake
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - "~>"
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
- version: '11.0'
81
+ version: 12.3.3
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - "~>"
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
- version: '11.0'
88
+ version: 12.3.3
89
89
  - !ruby/object:Gem::Dependency
90
- name: rubocop
90
+ name: standard
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - "~>"
93
+ - - ">="
94
94
  - !ruby/object:Gem::Version
95
- version: 0.64.0
95
+ version: '0'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - "~>"
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: 0.64.0
102
+ version: '0'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: timecop
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -122,10 +122,9 @@ executables: []
122
122
  extensions: []
123
123
  extra_rdoc_files: []
124
124
  files:
125
+ - ".circleci/config.yml"
125
126
  - ".codeclimate.yml"
126
127
  - ".gitignore"
127
- - ".rubocop.yml"
128
- - ".travis.yml"
129
128
  - Appraisals
130
129
  - CHANGELOG.md
131
130
  - CODE_OF_CONDUCT.md
@@ -140,14 +139,11 @@ files:
140
139
  - bin/guard
141
140
  - bin/m
142
141
  - bin/rake
143
- - bin/rubocop
144
142
  - bin/setup
145
- - gemfiles/activesupport_4.1.gemfile
146
- - gemfiles/activesupport_4.2.gemfile
147
- - gemfiles/activesupport_5.0.gemfile
148
- - gemfiles/activesupport_5.1.gemfile
143
+ - bin/standardrb
149
144
  - gemfiles/activesupport_5.2.gemfile
150
145
  - gemfiles/activesupport_6.0.gemfile
146
+ - gemfiles/activesupport_6.1.gemfile
151
147
  - lib/montrose.rb
152
148
  - lib/montrose/chainable.rb
153
149
  - lib/montrose/clock.rb
@@ -166,9 +162,11 @@ files:
166
162
  - lib/montrose/rule.rb
167
163
  - lib/montrose/rule/after.rb
168
164
  - lib/montrose/rule/between.rb
165
+ - lib/montrose/rule/covering.rb
169
166
  - lib/montrose/rule/day_of_month.rb
170
167
  - lib/montrose/rule/day_of_week.rb
171
168
  - lib/montrose/rule/day_of_year.rb
169
+ - lib/montrose/rule/during.rb
172
170
  - lib/montrose/rule/except.rb
173
171
  - lib/montrose/rule/hour_of_day.rb
174
172
  - lib/montrose/rule/month_of_year.rb
@@ -188,7 +186,7 @@ homepage: https://github.com/rossta/montrose
188
186
  licenses:
189
187
  - MIT
190
188
  metadata: {}
191
- post_install_message:
189
+ post_install_message:
192
190
  rdoc_options: []
193
191
  require_paths:
194
192
  - lib
@@ -196,15 +194,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
194
  requirements:
197
195
  - - ">="
198
196
  - !ruby/object:Gem::Version
199
- version: 2.3.0
197
+ version: 2.5.0
200
198
  required_rubygems_version: !ruby/object:Gem::Requirement
201
199
  requirements:
202
200
  - - ">="
203
201
  - !ruby/object:Gem::Version
204
202
  version: '0'
205
203
  requirements: []
206
- rubygems_version: 3.0.3
207
- signing_key:
204
+ rubygems_version: 3.2.8
205
+ signing_key:
208
206
  specification_version: 4
209
207
  summary: Recurring events in Ruby
210
208
  test_files: []
data/.rubocop.yml DELETED
@@ -1,136 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - 'bin/**/*'
4
- - 'gemfiles/**/*'
5
- - 'tmp/**/*'
6
- TargetRubyVersion: '2.3.0'
7
-
8
- Lint/HandleExceptions:
9
- Exclude:
10
- - 'test/test_helper.rb'
11
-
12
- Metrics/LineLength:
13
- Max: 120
14
-
15
- Metrics/ClassLength:
16
- Max: 300
17
-
18
- Metrics/ModuleLength:
19
- Max: 300
20
-
21
- Metrics/MethodLength:
22
- Max: 100
23
-
24
- Metrics/ParameterLists:
25
- Max: 8
26
-
27
- Metrics/AbcSize:
28
- Enabled: false
29
-
30
- Metrics/CyclomaticComplexity:
31
- Enabled: false
32
-
33
- Metrics/PerceivedComplexity:
34
- Enabled: false
35
-
36
- Metrics/BlockLength:
37
- Enabled: false
38
-
39
- Documentation:
40
- Enabled: false # TODO: Enable again once we have more docs
41
-
42
- Lint/HandleExceptions:
43
- Enabled: false
44
-
45
- Style/GlobalVars:
46
- Exclude:
47
- - spec/support/trace.rb
48
-
49
- Style/SafeNavigation:
50
- Enabled: false
51
-
52
- Style/SpecialGlobalVars:
53
- Enabled: false
54
-
55
- Style/TrivialAccessors:
56
- Enabled: false
57
-
58
- Style/HashSyntax:
59
- Enabled: true
60
-
61
- Naming/MethodName:
62
- Enabled: false
63
-
64
- Layout/AlignParameters:
65
- EnforcedStyle: with_fixed_indentation
66
-
67
- Layout/AccessModifierIndentation:
68
- Enabled: true
69
-
70
- Style/StringLiterals:
71
- EnforcedStyle: double_quotes
72
-
73
- Style/StringLiteralsInInterpolation:
74
- EnforcedStyle: double_quotes
75
-
76
- Layout/ClosingParenthesisIndentation:
77
- Enabled: false
78
-
79
- Layout/EndAlignment:
80
- Enabled: false
81
-
82
- Layout/DefEndAlignment:
83
- Enabled: false
84
-
85
- Style/OneLineConditional:
86
- Enabled: false
87
-
88
- Style/AndOr:
89
- Enabled: false
90
-
91
- Style/Not:
92
- Enabled: false
93
-
94
- Layout/CaseIndentation:
95
- SupportedStyles:
96
- - case
97
- - end
98
- IndentOneStep: false
99
-
100
- Style/PercentLiteralDelimiters:
101
- PreferredDelimiters:
102
- '%w': "[]"
103
- '%W': "[]"
104
-
105
- Layout/AccessModifierIndentation:
106
- EnforcedStyle: indent
107
-
108
- Style/SignalException:
109
- Enabled: false
110
-
111
- Layout/IndentationWidth:
112
- Enabled: false
113
-
114
- Style/TrivialAccessors:
115
- ExactNameMatch: true
116
-
117
- Style/RegexpLiteral:
118
- EnforcedStyle: percent_r
119
-
120
- Layout/DotPosition:
121
- EnforcedStyle: leading
122
-
123
- Naming/VariableNumber:
124
- Enabled: false
125
-
126
- Style/FormatString:
127
- Enabled: false
128
-
129
- Style/MutableConstant:
130
- Enabled: false
131
-
132
- Style/NumericPredicate:
133
- Enabled: false
134
-
135
- Style/SymbolArray:
136
- Enabled: false
data/.travis.yml DELETED
@@ -1,33 +0,0 @@
1
- bundler_args: "--jobs 4 --retry 3"
2
- cache: bundler
3
- gemfile:
4
- - gemfiles/activesupport_6.0.gemfile
5
- - gemfiles/activesupport_5.2.gemfile
6
- - gemfiles/activesupport_5.1.gemfile
7
- - gemfiles/activesupport_5.0.gemfile
8
- - gemfiles/activesupport_4.2.gemfile
9
- - gemfiles/activesupport_4.1.gemfile
10
- language: ruby
11
- matrix:
12
- exclude:
13
- - rvm: 2.3
14
- gemfile: gemfiles/activesupport_6.0.gemfile # Requires ruby 2.5+
15
- - rvm: 2.4
16
- gemfile: gemfiles/activesupport_4.1.gemfile # Requires json 1.8.5+
17
- - rvm: 2.4
18
- gemfile: gemfiles/activesupport_6.0.gemfile # Requires ruby 2.5+
19
- - rvm: 2.5
20
- gemfile: gemfiles/activesupport_4.1.gemfile # Requires json 1.8.5+
21
- - rvm: 2.6
22
- gemfile: gemfiles/activesupport_4.1.gemfile # Requires json 1.8.5+
23
- fast_finish: true
24
- rvm:
25
- - 2.3
26
- - 2.4
27
- - 2.5
28
- - 2.6
29
- sudo: false
30
- before_install:
31
- - gem update --system
32
- - gem --version
33
- - gem install bundler