omnifocus_parser 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +17 -0
- data/.ruby-version +1 -0
- data/.standard.yml +3 -0
- data/.vscode/settings.json +5 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +79 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +14 -0
- data/lib/omnifocus_parser/action.rb +16 -0
- data/lib/omnifocus_parser/builder.rb +39 -0
- data/lib/omnifocus_parser/parser.rb +15 -0
- data/lib/omnifocus_parser/project.rb +16 -0
- data/lib/omnifocus_parser/version.rb +5 -0
- data/lib/omnifocus_parser.rb +9 -0
- data/omnifocus_parser.gemspec +36 -0
- data/sig/omnifocus_parser.rbs +4 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4aa7bed8ea0fad435f0682b7b33f6bcfa12d78adde0273e10a793797409f0388
|
4
|
+
data.tar.gz: 7dc575f2d16e48cc0c6a3586436fe226d1634c1f5a737dc7adbb3d2941960cf7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '0883608fa3dad57ab1ed6d40f565ecdbad137faeeb532e06fe3596c64f561cd7113be83a5c599548c4db2afcc283cc612b78d2134f343809c1929b90823f2740'
|
7
|
+
data.tar.gz: cc51c2cc85c406f179cbd75730b868f5b9f6a9083beadad306912b914d0f7a20382d22bc16dd069fd207b86cd77055f67fb8ac79fe532f28d9e73af0e2bd60d5
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# based on https://evilmartians.com/chronicles/rubocoping-with-legacy-bring-your-ruby-code-up-to-standard
|
2
|
+
|
3
|
+
inherit_mode:
|
4
|
+
merge:
|
5
|
+
- Exclude
|
6
|
+
|
7
|
+
require:
|
8
|
+
- rubocop-performance
|
9
|
+
- rubocop-minitest
|
10
|
+
- rubocop-rake
|
11
|
+
- standard
|
12
|
+
|
13
|
+
inherit_gem:
|
14
|
+
standard: config/ruby-3.0.yml
|
15
|
+
|
16
|
+
AllCops:
|
17
|
+
NewCops: disable
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.2.0
|
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in omnifocus_parser.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "debug"
|
9
|
+
gem "minitest", "~> 5.0"
|
10
|
+
gem "rake", "~> 13.0"
|
11
|
+
gem "ruby-lsp", require: false
|
12
|
+
gem "rubocop-minitest"
|
13
|
+
gem "rubocop-rake"
|
14
|
+
gem "standard", "~> 1.3"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omnifocus_parser (0.1.0)
|
5
|
+
zeitwerk
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.2)
|
11
|
+
debug (1.7.1)
|
12
|
+
irb (>= 1.5.0)
|
13
|
+
reline (>= 0.3.1)
|
14
|
+
io-console (0.6.0)
|
15
|
+
irb (1.6.2)
|
16
|
+
reline (>= 0.3.0)
|
17
|
+
json (2.6.3)
|
18
|
+
language_server-protocol (3.17.0.2)
|
19
|
+
minitest (5.16.3)
|
20
|
+
parallel (1.22.1)
|
21
|
+
parser (3.1.3.0)
|
22
|
+
ast (~> 2.4.1)
|
23
|
+
prettier_print (1.2.0)
|
24
|
+
rainbow (3.1.1)
|
25
|
+
rake (13.0.6)
|
26
|
+
regexp_parser (2.6.1)
|
27
|
+
reline (0.3.2)
|
28
|
+
io-console (~> 0.5)
|
29
|
+
rexml (3.2.5)
|
30
|
+
rubocop (1.40.0)
|
31
|
+
json (~> 2.3)
|
32
|
+
parallel (~> 1.10)
|
33
|
+
parser (>= 3.1.2.1)
|
34
|
+
rainbow (>= 2.2.2, < 4.0)
|
35
|
+
regexp_parser (>= 1.8, < 3.0)
|
36
|
+
rexml (>= 3.2.5, < 4.0)
|
37
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
38
|
+
ruby-progressbar (~> 1.7)
|
39
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
40
|
+
rubocop-ast (1.24.0)
|
41
|
+
parser (>= 3.1.1.0)
|
42
|
+
rubocop-minitest (0.25.1)
|
43
|
+
rubocop (>= 0.90, < 2.0)
|
44
|
+
rubocop-performance (1.15.1)
|
45
|
+
rubocop (>= 1.7.0, < 2.0)
|
46
|
+
rubocop-ast (>= 0.4.0)
|
47
|
+
rubocop-rake (0.6.0)
|
48
|
+
rubocop (~> 1.0)
|
49
|
+
ruby-lsp (0.3.7)
|
50
|
+
language_server-protocol (~> 3.17.0)
|
51
|
+
sorbet-runtime
|
52
|
+
syntax_tree (>= 4.0.2, < 5.0.0)
|
53
|
+
ruby-progressbar (1.11.0)
|
54
|
+
sorbet-runtime (0.5.10598)
|
55
|
+
standard (1.20.0)
|
56
|
+
language_server-protocol (~> 3.17.0.2)
|
57
|
+
rubocop (= 1.40.0)
|
58
|
+
rubocop-performance (= 1.15.1)
|
59
|
+
syntax_tree (4.3.0)
|
60
|
+
prettier_print (>= 1.0.2)
|
61
|
+
unicode-display_width (2.3.0)
|
62
|
+
zeitwerk (2.6.6)
|
63
|
+
|
64
|
+
PLATFORMS
|
65
|
+
arm64-darwin-22
|
66
|
+
x86_64-linux
|
67
|
+
|
68
|
+
DEPENDENCIES
|
69
|
+
debug
|
70
|
+
minitest (~> 5.0)
|
71
|
+
omnifocus_parser!
|
72
|
+
rake (~> 13.0)
|
73
|
+
rubocop-minitest
|
74
|
+
rubocop-rake
|
75
|
+
ruby-lsp
|
76
|
+
standard (~> 1.3)
|
77
|
+
|
78
|
+
BUNDLED WITH
|
79
|
+
2.4.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Andy Waite
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# OmnifocusParser
|
2
|
+
|
3
|
+
This library parses a CSV export from [OmniFocus](https://www.omnigroup.com/omnifocus/) into a set of convenient objects.
|
4
|
+
|
5
|
+
Note: I wrote this gem to try out the newly added `Data` core class in Ruby ([learn more](https://blog.saeloun.com/2022/11/22/data-immutable-object.html)), so it can only be used with Ruby 3.2 or newer.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
|
11
|
+
$ bundle add omnifocus_parser
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
$ gem install omnifocus_parser
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
require "omnifocus_parser"
|
21
|
+
|
22
|
+
parser = OmniFocusParser::Parser.new("example.csv")
|
23
|
+
entries = parser.parse
|
24
|
+
entries[0].class # => OmnifocusParser::Project
|
25
|
+
entries[1].class # => OmnifocusParser::Item
|
26
|
+
```
|
27
|
+
|
28
|
+
## Development
|
29
|
+
|
30
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
31
|
+
|
32
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/andyw8/omnifocus_parser.
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
require "standard/rake"
|
13
|
+
|
14
|
+
task default: %i[test standard]
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module OmnifocusParser
|
2
|
+
class Builder
|
3
|
+
MAPPING = {
|
4
|
+
"Project" => Project,
|
5
|
+
"Action" => Action
|
6
|
+
}
|
7
|
+
|
8
|
+
def self.from_row(row)
|
9
|
+
task_id = row.fetch("Task ID")
|
10
|
+
type = row.fetch("Type")
|
11
|
+
name = row.fetch("Name")
|
12
|
+
status = row.fetch("Status")
|
13
|
+
project = row.fetch("Project")
|
14
|
+
context = row.fetch("Context")
|
15
|
+
due_date = row.fetch("Due Date")&.then { DateTime.parse(_1) }
|
16
|
+
completion_date = row.fetch("Completion Date")&.then { Date.parse(_1) }
|
17
|
+
duration = row.fetch("Duration")
|
18
|
+
start_date = row.fetch("Start Date")&.then { DateTime.parse(_1) }
|
19
|
+
flagged = row.fetch("Flagged") == "1"
|
20
|
+
notes = row.fetch("Notes")
|
21
|
+
tags = row.fetch("Tags")&.split(",")
|
22
|
+
|
23
|
+
MAPPING.fetch(type).new(
|
24
|
+
task_id: task_id,
|
25
|
+
name: name,
|
26
|
+
status: status,
|
27
|
+
project: project,
|
28
|
+
context: context,
|
29
|
+
due_date: due_date,
|
30
|
+
completion_date: completion_date,
|
31
|
+
duration: duration,
|
32
|
+
start_date: start_date,
|
33
|
+
flagged: flagged,
|
34
|
+
notes: notes,
|
35
|
+
tags: tags
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/omnifocus_parser/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "omnifocus_parser"
|
7
|
+
spec.version = OmnifocusParser::VERSION
|
8
|
+
spec.authors = ["Andy Waite"]
|
9
|
+
spec.email = ["andyw8@users.noreply.github.com"]
|
10
|
+
|
11
|
+
spec.summary = "OmniFocus parser"
|
12
|
+
spec.homepage = "https://gitub.com/andyw8/omnifocus_parser"
|
13
|
+
spec.license = "MIT"
|
14
|
+
spec.required_ruby_version = ">= 3.2.0"
|
15
|
+
|
16
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
17
|
+
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(__dir__) do
|
24
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
25
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
|
26
|
+
end
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_dependency "zeitwerk"
|
33
|
+
|
34
|
+
# For more information and examples about making a new gem, check out our
|
35
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omnifocus_parser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andy Waite
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-12-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: zeitwerk
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- andyw8@users.noreply.github.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".rubocop.yml"
|
35
|
+
- ".ruby-version"
|
36
|
+
- ".standard.yml"
|
37
|
+
- ".vscode/settings.json"
|
38
|
+
- CHANGELOG.md
|
39
|
+
- Gemfile
|
40
|
+
- Gemfile.lock
|
41
|
+
- LICENSE.txt
|
42
|
+
- README.md
|
43
|
+
- Rakefile
|
44
|
+
- lib/omnifocus_parser.rb
|
45
|
+
- lib/omnifocus_parser/action.rb
|
46
|
+
- lib/omnifocus_parser/builder.rb
|
47
|
+
- lib/omnifocus_parser/parser.rb
|
48
|
+
- lib/omnifocus_parser/project.rb
|
49
|
+
- lib/omnifocus_parser/version.rb
|
50
|
+
- omnifocus_parser.gemspec
|
51
|
+
- sig/omnifocus_parser.rbs
|
52
|
+
homepage: https://gitub.com/andyw8/omnifocus_parser
|
53
|
+
licenses:
|
54
|
+
- MIT
|
55
|
+
metadata:
|
56
|
+
allowed_push_host: https://rubygems.org
|
57
|
+
homepage_uri: https://gitub.com/andyw8/omnifocus_parser
|
58
|
+
source_code_uri: https://gitub.com/andyw8/omnifocus_parser
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 3.2.0
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubygems_version: 3.4.1
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: OmniFocus parser
|
78
|
+
test_files: []
|