tickle 2.0.0.rc1 → 2.0.0rc3
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 +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +4 -6
- data/CHANGES.md +19 -4
- data/Gemfile +5 -3
- data/lib/tickle.rb +7 -9
- data/lib/tickle/tickle.rb +4 -4
- data/lib/tickle/tickled.rb +6 -7
- data/lib/tickle/version.rb +2 -2
- data/spec/spec_helper.rb +2 -0
- data/spec/tickle_spec.rb +8 -0
- data/tickle.gemspec +2 -2
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1f47be53e642fa9fd7cd412b7d76768807ed9398de11df69a77855f6d2b26b44
|
4
|
+
data.tar.gz: bc3a4d7d5c9048444ef7dfa47e6e55318c3e3577f7ec70145d4500bf441b5c4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6852b109c5091c3abee0bef6c8bf8ea804e9b2a7ff7b7ffd0d995b237f2dc799e3504ef10740a44e320dcd55544e1895e48235bbc745fde25394fc3b315f0121
|
7
|
+
data.tar.gz: 790b5b8790873c0e9a99c882cfe57628fd52ea756738e9c503ff76b38bd664b8ec469a6cc2fe313e823b26a498d6416f39d1986dda1236a3fa62c41c3dc057a3
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
-
|
4
|
-
-
|
5
|
-
-
|
6
|
-
- ruby-head
|
7
|
-
- jruby-19mode
|
8
|
-
# - rbx-2.1.1 # not working right now, will look at later
|
3
|
+
- 2.7
|
4
|
+
- jruby
|
5
|
+
- truffleruby
|
9
6
|
|
10
7
|
# whitelist
|
11
8
|
branches:
|
12
9
|
only:
|
13
10
|
- master
|
14
11
|
- develop
|
12
|
+
- v1-branch
|
data/CHANGES.md
CHANGED
@@ -1,13 +1,27 @@
|
|
1
1
|
# CH CH CH CH CHANGES! #
|
2
2
|
|
3
|
+
## Friday the 18th of September 2002, v2.0.0rc3
|
4
|
+
|
5
|
+
* Changed the dependency from chronic to gitlab-chronic, thanks to @bjonord
|
6
|
+
|
7
|
+
----
|
8
|
+
|
9
|
+
## v2.0.0.rc2, Friday the 8th of December 2017 ##
|
10
|
+
|
11
|
+
* Fixed issue #20 https://github.com/yb66/tickle/pull/20, thanks to [@antogon](https://github.com/antogon)
|
12
|
+
|
13
|
+
----
|
14
|
+
|
15
|
+
|
3
16
|
## Saturday the 7th of November 2015, 2.0.0.rc1 ##
|
4
17
|
|
5
|
-
|
6
|
-
|
7
|
-
|
18
|
+
* Rewrite of the internals.
|
19
|
+
* API should be pretty much the same from the outside, but enough things on the inside change to warrant the major version bump.
|
20
|
+
* Chronic updated to 0.10.2.
|
8
21
|
|
9
22
|
----
|
10
23
|
|
24
|
+
|
11
25
|
## Monday the 11th of November 2013, v1.0.2 ##
|
12
26
|
|
13
27
|
* Shoulda and simplecov aren't runtime dependencies, fixed that in the gemfile.
|
@@ -15,6 +29,7 @@
|
|
15
29
|
|
16
30
|
----
|
17
31
|
|
32
|
+
|
18
33
|
## Monday the 11th of November 2013, v1.0.1 ##
|
19
34
|
|
20
35
|
* Moved library to new maintainer [https://github.com/yb66/tickle](@yb66)
|
@@ -26,4 +41,4 @@
|
|
26
41
|
* Moved library to Bundler to make it easier to set up and develop against.
|
27
42
|
* Started using Yardoc for more niceness with documentation.
|
28
43
|
|
29
|
-
----
|
44
|
+
----
|
data/Gemfile
CHANGED
@@ -3,11 +3,13 @@ source "https://rubygems.org"
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem "wirble"
|
7
6
|
gem "maruku"
|
8
7
|
gem "yard"
|
9
|
-
|
10
|
-
|
8
|
+
unless RUBY_ENGINE == 'jruby'
|
9
|
+
gem "pry-byebug"
|
10
|
+
gem "pry-state"
|
11
|
+
gem "rb-readline"
|
12
|
+
end
|
11
13
|
end
|
12
14
|
|
13
15
|
group :test do
|
data/lib/tickle.rb
CHANGED
@@ -7,11 +7,16 @@
|
|
7
7
|
#=============================================================================
|
8
8
|
|
9
9
|
|
10
|
-
|
10
|
+
if ENV["DEBUG"]
|
11
|
+
warn "DEBUG MODE ON"
|
12
|
+
require 'pry-byebug'
|
13
|
+
require 'pry-state'
|
14
|
+
binding.pry
|
15
|
+
end
|
11
16
|
|
12
17
|
require 'date'
|
13
18
|
require 'time'
|
14
|
-
require 'chronic'
|
19
|
+
require 'gitlab-chronic'
|
15
20
|
|
16
21
|
require 'tickle/tickle'
|
17
22
|
require 'tickle/handler'
|
@@ -21,13 +26,6 @@ require_relative "ext/array.rb"
|
|
21
26
|
require_relative "ext/date_and_time.rb"
|
22
27
|
require_relative "ext/string.rb"
|
23
28
|
|
24
|
-
# these are required not because they're used by the library
|
25
|
-
# but because they clobber so much that testing
|
26
|
-
# without them will miss possible problems
|
27
|
-
require 'active_support/core_ext/string/conversions'
|
28
|
-
require 'active_support/core_ext/date/calculations'
|
29
|
-
require 'active_support/core_ext/date_time/calculations'
|
30
|
-
require 'active_support/core_ext/time/calculations'
|
31
29
|
|
32
30
|
# Tickle is a natural language parser for recurring events.
|
33
31
|
module Tickle
|
data/lib/tickle/tickle.rb
CHANGED
@@ -50,7 +50,7 @@ module Tickle
|
|
50
50
|
# check to see if this event starts some other time and reset now
|
51
51
|
scan_expression! tickled
|
52
52
|
|
53
|
-
fail(InvalidDateExpression, "the start date (#{@start.to_date}) cannot occur in the past for a future event") if @start && @start.to_date <
|
53
|
+
fail(InvalidDateExpression, "the start date (#{@start.to_date}) cannot occur in the past for a future event") if @start && @start.to_date < tickled.now.to_date
|
54
54
|
fail(InvalidDateExpression, "the start date (#{@start.to_date}) cannot occur after the end date") if @until && @start.to_date > @until.to_date
|
55
55
|
|
56
56
|
# no need to guess at expression if the start_date is in the future
|
@@ -75,7 +75,7 @@ module Tickle
|
|
75
75
|
|
76
76
|
# if we can't guess it maybe chronic can
|
77
77
|
_guess = guess(@tokens, @start)
|
78
|
-
best_guess = _guess || chronic_parse(tickled.event) # TODO fix this call
|
78
|
+
best_guess = _guess || chronic_parse(tickled.event) # TODO fix this call
|
79
79
|
end
|
80
80
|
|
81
81
|
fail(InvalidDateExpression, "the next occurrence takes place after the end date specified") if @until && (best_guess.to_date > @until.to_date)
|
@@ -131,10 +131,10 @@ module Tickle
|
|
131
131
|
fail(InvalidDateExpression,"the ending date expression \"#{tickled.ending}\" could not be interpretted")
|
132
132
|
end
|
133
133
|
else
|
134
|
-
@until =
|
134
|
+
@until =
|
135
135
|
if tickled.starting && !tickled.starting.to_s.blank?
|
136
136
|
if tickled.until && !tickled.until.to_s.blank?
|
137
|
-
if tickled.until.to_time >
|
137
|
+
if tickled.until.to_time > @start
|
138
138
|
tickled.until.to_time
|
139
139
|
end
|
140
140
|
end
|
data/lib/tickle/tickled.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
require 'chronic'
|
2
1
|
require 'texttube/base'
|
3
2
|
require_relative "filters.rb"
|
4
|
-
require 'chronic'
|
3
|
+
require 'gitlab-chronic'
|
5
4
|
|
6
5
|
module Tickle
|
7
|
-
|
6
|
+
|
8
7
|
|
9
8
|
|
10
9
|
# Contains the initial input and the result of parsing it.
|
@@ -39,7 +38,7 @@ module Tickle
|
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
42
|
-
t =
|
41
|
+
t =
|
43
42
|
if asked.respond_to?(:to_time)
|
44
43
|
asked
|
45
44
|
elsif (t = Time.parse(asked) rescue nil) # a legitimate use!
|
@@ -129,7 +128,7 @@ module Tickle
|
|
129
128
|
|
130
129
|
[:starting, :ending, :event].each do |meth|
|
131
130
|
define_method meth do
|
132
|
-
@opts[meth]
|
131
|
+
@opts[meth]
|
133
132
|
end
|
134
133
|
define_method "#{meth}=" do |value|
|
135
134
|
@opts[meth] = Tickled.new value
|
@@ -157,13 +156,13 @@ module Tickle
|
|
157
156
|
def to_s
|
158
157
|
self
|
159
158
|
end
|
160
|
-
|
159
|
+
|
161
160
|
def blank?
|
162
161
|
if respond_to? :empty?
|
163
162
|
empty? || !self
|
164
163
|
elsif respond_to? :localtime
|
165
164
|
false
|
166
|
-
end
|
165
|
+
end
|
167
166
|
end
|
168
167
|
|
169
168
|
# def inspect
|
data/lib/tickle/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -9,8 +9,10 @@ Spec_dir = File.expand_path( File.dirname __FILE__ )
|
|
9
9
|
require 'simplecov'
|
10
10
|
SimpleCov.start do
|
11
11
|
add_filter "/vendor/"
|
12
|
+
add_filter "/vendor.noindex/"
|
12
13
|
add_filter "/bin/"
|
13
14
|
add_filter "/spec/"
|
15
|
+
add_filter "/coverage/" # It used to do this for some reason, defensive of me.
|
14
16
|
end
|
15
17
|
|
16
18
|
|
data/spec/tickle_spec.rb
CHANGED
@@ -241,6 +241,14 @@ describe "Parsing" do
|
|
241
241
|
end
|
242
242
|
end
|
243
243
|
|
244
|
+
context "Given that start is in the past, respect now option in parse" do
|
245
|
+
context "every other day" do
|
246
|
+
subject{ Tickle.parse('every other day', {:start=>Time.parse("2009-05-09 00:00:00 +0000"), :now=>Time.parse("2009-05-09 00:00:00 +0000"), :until=>Time.parse("2017-10-21 00:00:00 +0000") }) }
|
247
|
+
let(:expected) { {:next=>Time.parse("2009-05-11 00:00:00 +0000"), :expression=>"every other day", :starting=>Time.parse("2009-05-09 00:00:00 +0000"), :until=>nil} }
|
248
|
+
it { should == expected }
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
244
252
|
context "Given that now is in the future, 2020-04-01 00:00:00 +0000" do
|
245
253
|
context "February" do
|
246
254
|
subject{ Tickle.parse('February', {:start=>Time.parse("2020-04-01 00:00:00 +0000"), :now=>Time.parse("2020-04-01 00:00:00 +0000")}) }
|
data/tickle.gemspec
CHANGED
@@ -17,11 +17,11 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.files = `git ls-files`.split($/)
|
18
18
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
20
|
-
|
20
|
+
|
21
21
|
s.require_paths = ["lib"]
|
22
22
|
|
23
23
|
s.add_dependency "numerizer", "~> 0.2.0"
|
24
|
-
s.add_dependency "chronic", "~> 0.10.
|
24
|
+
s.add_dependency "gitlab-chronic", "~> 0.10.6"
|
25
25
|
s.add_dependency "texttube", "~> 6.0.0"
|
26
26
|
end
|
27
27
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tickle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.0rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Lippiner
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: numerizer
|
@@ -26,19 +26,19 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 0.2.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name: chronic
|
29
|
+
name: gitlab-chronic
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.10.
|
34
|
+
version: 0.10.6
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.10.
|
41
|
+
version: 0.10.6
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: texttube
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,8 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: 1.3.1
|
116
116
|
requirements: []
|
117
|
-
|
118
|
-
rubygems_version: 2.4.5
|
117
|
+
rubygems_version: 3.1.2
|
119
118
|
signing_key:
|
120
119
|
specification_version: 4
|
121
120
|
summary: natural language parser for recurring events
|