mnc 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e77d647f24181ed3c773372cc620a6ea35dde4079a81aac31e54e84323df9ec
4
- data.tar.gz: 69467981647a3637c704e50c00adff473a9b52993c45c9e622420aad600b3618
3
+ metadata.gz: 6fd4d19c21cb543ea5c1bef3c207d2ea6be312e0d97abcbdc7d83bc50d0a8121
4
+ data.tar.gz: 9abb02f41998330d15d72590b9fc2b27812cb9389f66b57a89cd75c7452c4c87
5
5
  SHA512:
6
- metadata.gz: fddf5ddebd23030434fa9c23ea8db67e1a2e6b86e086485cb84d7b5e9add7a66eca269258549a50669c456cda347bde43844a4c6dd6ea9f727de35dbb0a125f1
7
- data.tar.gz: e8a02283f940afeac9104c515f0cfe5a87f841ffb59a9d2ce1118134ead0b6388c81649941ad92bb01251bd5a1cd75d6006ab8791117ccbf09d6998eb5ee93b3
6
+ metadata.gz: e89dfb50b9a33854e1cdf9ea52917bbe0dd766f482cbef43528ad35e6c18981dc618a37977b2c9770318687826b9ddb0fa457ace0950f993c3c6b86e1d934e12
7
+ data.tar.gz: d47db045b0970a8db444096c928b6a8965eb8ed1d5307f0c96f516d378fb313a0b07059192639cd975daf5bf0e1e2a6b306e554cb5dc637aec18fe49ccfca6c3
data/.rubocop.yml CHANGED
@@ -9,6 +9,8 @@ Style/StringLiteralsInInterpolation:
9
9
  Enabled: true
10
10
  EnforcedStyle: double_quotes
11
11
 
12
+ Layout/SpaceAroundMethodCallOperator:
13
+ Enabled: false
12
14
  Metrics/AbcSize:
13
15
  Enabled: false
14
16
  Metrics/CyclomaticComplexity:
data/Gemfile CHANGED
@@ -11,3 +11,6 @@ gem 'rubocop-rake'
11
11
 
12
12
  gem 'minitest', '~> 5.0'
13
13
  gem 'rubocop-minitest'
14
+
15
+ # not ready to make this a hard dependency yet
16
+ gem 'parslet', '~> 2.0'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mnc (0.1.2)
4
+ mnc (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -11,6 +11,7 @@ GEM
11
11
  parallel (1.20.1)
12
12
  parser (3.0.1.1)
13
13
  ast (~> 2.4.1)
14
+ parslet (2.0.0)
14
15
  rainbow (3.0.0)
15
16
  rake (13.0.3)
16
17
  regexp_parser (2.1.1)
@@ -39,6 +40,7 @@ PLATFORMS
39
40
  DEPENDENCIES
40
41
  minitest (~> 5.0)
41
42
  mnc!
43
+ parslet (~> 2.0)
42
44
  rake (~> 13.0)
43
45
  rubocop (~> 1.7)
44
46
  rubocop-minitest
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'parslet'
4
+
5
+ module MNC
6
+ class Parslet < Parslet::Parser
7
+ rule(:crontab) { lines.as(:crontab) }
8
+ rule(:lines) { (line >> eol).repeat }
9
+ rule(:line) { cron | env | comment | blank }
10
+
11
+ rule(:space) { match[" \t"].repeat(1) }
12
+ rule(:eol) { line_end.repeat(1) }
13
+ rule(:line_end) { crlf >> space.maybe }
14
+ rule(:crlf) { match["\r\n"].repeat(1) }
15
+ rule(:eof) { any.absent? }
16
+
17
+ rule(:blank) { space.repeat }
18
+
19
+ rule(:comment) { space >> hash >> match["^\n"].repeat }
20
+ rule(:hash) { str('#') }
21
+
22
+ rule(:env) { variable >> space >> equal >> space >> value }
23
+ rule(:variable) { match('\w').repeat(1) }
24
+ rule(:equal) { str('=') }
25
+ rule(:value) { match["^\n"].repeat(1) }
26
+
27
+ rule(:cron) { (special | traditional).as(:cron) >> space >> command }
28
+ rule(:special) { (str('@') >> match['a-z'].repeat(1)).as(:special) }
29
+ rule(:traditional) { minute >> space >> hour >> space >> dom >> space >> month >> space >> dow }
30
+
31
+ rule(:minute) { entry.as(:minute) }
32
+ rule(:hour) { entry.as(:hour) }
33
+ rule(:dom) { entry.as(:dom) }
34
+ rule(:month) { entry.as(:month) }
35
+ rule(:dow) { entry.as(:dow) }
36
+
37
+ rule(:entry) { step | wildcard | list }
38
+ rule(:step) { str('*/') >> integer }
39
+ rule(:wildcard) { str('*') }
40
+ rule(:list) { (range | integer) >> (str(',') >> (range | integer)).repeat }
41
+ rule(:range) { integer >> str('-') >> integer }
42
+ rule(:integer) { match['0-9'].repeat(1) }
43
+ rule(:command) { match["^\n"].repeat(1) }
44
+
45
+ root(:crontab)
46
+ end
47
+ end
data/lib/mnc/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MNC
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mnc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank J. Cameron
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-22 00:00:00.000000000 Z
11
+ date: 2021-06-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -29,6 +29,7 @@ files:
29
29
  - bin/console
30
30
  - bin/setup
31
31
  - lib/mnc.rb
32
+ - lib/mnc/parslet.rb
32
33
  - lib/mnc/version.rb
33
34
  - mnc.gemspec
34
35
  homepage: https://gitlab.com/fjc/mnc