dayone_toolbox 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/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +57 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dayone_toolbox.gemspec +38 -0
- data/exe/dayone-entry +14 -0
- data/exe/dayone-journal +14 -0
- data/lib/dayone_toolbox/api.rb +98 -0
- data/lib/dayone_toolbox/cli/entry.rb +73 -0
- data/lib/dayone_toolbox/cli/journal.rb +42 -0
- data/lib/dayone_toolbox/cli.rb +9 -0
- data/lib/dayone_toolbox/entry.rb +96 -0
- data/lib/dayone_toolbox/journal.rb +16 -0
- data/lib/dayone_toolbox/version.rb +3 -0
- data/lib/dayone_toolbox.rb +9 -0
- metadata +164 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ab3ddd4b806efe11802fb5f8e00843027c5210bd
|
4
|
+
data.tar.gz: bdd491a5bda47915bb9efa49f29fe4874db1ec1f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f3fda84dd1dcbda0217772fb40d61a2830a74d1c092629c470daa5d35db1b9b38f327e73d51f368fabaaf1decfd8a77f54073b42dedf5950824e2af340f6716c
|
7
|
+
data.tar.gz: ce56fc9c61888e5b0e39bdbe391a5c52e2ec4ee173710a962a6d691fd7ed417e01be494f1a54705bf4c082e020bb191b5a8ba853e47e7a9297e5b31ad0a7b0d7
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Masato INOUE (masainox@gmail.com)
|
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,57 @@
|
|
1
|
+
# DayoneToolbox
|
2
|
+
|
3
|
+
DayoneToolbox is utility tools for Day One Classic (http://dayoneapp.com/).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'dayone_toolbox'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install dayone_toolbox
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
$ dayone-entry fetch YOUR_ENTRY_FILE --tags --uuid
|
24
|
+
{"tags":["tag1"],"uuid":"A5380A52F6134A29B1F6A63921B46378"}
|
25
|
+
|
26
|
+
$ dayone-journal search Journal.dayone --starred
|
27
|
+
Journal.dayone/entries/202DCB6A56F74FF7B92DFF47A636E3E0.doentry
|
28
|
+
Journal.dayone/entries/38B5B62F6D0841E59A1EDC97C7FCE9BC.doentry
|
29
|
+
Journal.dayone/entries/545A5A33FCCA4B4995540E51BF7C74B3.doentry
|
30
|
+
Journal.dayone/entries/673B001DE48C4191AF03722B9981A48C.doentry
|
31
|
+
Journal.dayone/entries/769A5B14BE314ED98CEDBCBC1099C0D5.doentry
|
32
|
+
Journal.dayone/entries/798344CA2A774668AF8190BF16AE4580.doentry
|
33
|
+
Journal.dayone/entries/9F89DD5C4C4C40FBA04567FBAC6D9840.doentry
|
34
|
+
Journal.dayone/entries/A5380A52F6134A29B1F6A63921B46378.doentry
|
35
|
+
Journal.dayone/entries/E2FDA62CF2994F198ADC6A5113E4316F.doentry
|
36
|
+
Journal.dayone/entries/F96AD614B8094F12B1948AC3ACD16439.doentry
|
37
|
+
|
38
|
+
See also
|
39
|
+
|
40
|
+
$ dayone-entry help
|
41
|
+
$ dayone-journal help
|
42
|
+
|
43
|
+
## Development
|
44
|
+
|
45
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
46
|
+
|
47
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/masainox/dayone_toolbox.
|
52
|
+
|
53
|
+
|
54
|
+
## License
|
55
|
+
|
56
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
57
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dayone_toolbox"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'dayone_toolbox/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dayone_toolbox"
|
8
|
+
spec.version = DayoneToolbox::VERSION
|
9
|
+
spec.authors = ["Masato INOUE"]
|
10
|
+
spec.email = ["masainox@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{DayoneToolbox is utility tools for Day One Classic.}
|
13
|
+
spec.description = %q{DayoneToolbox is utility tools for Day One Classic.}
|
14
|
+
spec.homepage = "https://github.com/masainox/dayone_toolbox"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
#spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
spec.add_development_dependency "simplecov", "~> 0.14.1"
|
34
|
+
spec.add_development_dependency "timecop", "~> 0.9.1"
|
35
|
+
|
36
|
+
spec.add_dependency "plist", "~> 3.3.0"
|
37
|
+
spec.add_dependency "thor", "~> 0.19.4"
|
38
|
+
end
|
data/exe/dayone-entry
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dayone_toolbox"
|
5
|
+
|
6
|
+
|
7
|
+
class DayoneToolbox::CLI::Entry
|
8
|
+
desc "version", "Show version number"
|
9
|
+
def version
|
10
|
+
puts DayoneToolbox::VERSION
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
DayoneToolbox::CLI::Entry.start(ARGV)
|
data/exe/dayone-journal
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dayone_toolbox"
|
5
|
+
|
6
|
+
|
7
|
+
class DayoneToolbox::CLI::Journal
|
8
|
+
desc "version", "Show version number"
|
9
|
+
def version
|
10
|
+
puts v = DayoneToolbox::VERSION
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
DayoneToolbox::CLI::Journal.start(ARGV)
|
@@ -0,0 +1,98 @@
|
|
1
|
+
|
2
|
+
module DayoneToolbox::API
|
3
|
+
end
|
4
|
+
|
5
|
+
|
6
|
+
class DayoneToolbox::API::Base
|
7
|
+
attr_reader :entry, :result, :cli_exit_code
|
8
|
+
def initialize(file, options={})
|
9
|
+
@file = file
|
10
|
+
@entry = DayoneToolbox::Entry.new(@file)
|
11
|
+
@options = options
|
12
|
+
@result = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def store(path = @file)
|
16
|
+
File.open(path, 'w') do |f|
|
17
|
+
f.puts @entry.to_plist
|
18
|
+
end
|
19
|
+
self
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
class DayoneToolbox::API::SearchEntry < DayoneToolbox::API::Base
|
25
|
+
def plist_options
|
26
|
+
new_options = {}
|
27
|
+
@options.map do |k, v|
|
28
|
+
new_options.merge!(DayoneToolbox::Entry.entry_attributes[k] => v)
|
29
|
+
end
|
30
|
+
new_options
|
31
|
+
end
|
32
|
+
|
33
|
+
def exec
|
34
|
+
@result = plist_options < @entry.to_h
|
35
|
+
self
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
class DayoneToolbox::API::SearchEntryByTag < DayoneToolbox::API::Base
|
41
|
+
def tag_include?
|
42
|
+
@entry.tags.include?(@options[:include])
|
43
|
+
end
|
44
|
+
|
45
|
+
def tag_not_include?
|
46
|
+
! @entry.tags.include?(@options[:not])
|
47
|
+
end
|
48
|
+
|
49
|
+
def exec
|
50
|
+
if @options[:include]
|
51
|
+
@result = tag_include?
|
52
|
+
elsif @options[:not]
|
53
|
+
@result = tag_not_include?
|
54
|
+
end
|
55
|
+
self
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
class DayoneToolbox::API::AddEntry < DayoneToolbox::API::Base
|
61
|
+
def exec
|
62
|
+
hash = {}
|
63
|
+
@options.each do |k, v|
|
64
|
+
current_value = @entry.send("#{k}")
|
65
|
+
set_value = current_value << v
|
66
|
+
set_value.flatten! if set_value.class == Array
|
67
|
+
@entry.send("#{k}=", set_value)
|
68
|
+
hash.merge!({"#{k}" => set_value})
|
69
|
+
end
|
70
|
+
@result = hash
|
71
|
+
self
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
class DayoneToolbox::API::EditEntry < DayoneToolbox::API::Base
|
77
|
+
def exec
|
78
|
+
hash = {}
|
79
|
+
@options.each do |k, v|
|
80
|
+
@entry.send("#{k}=", v)
|
81
|
+
hash.merge!({"#{k}" => v})
|
82
|
+
end
|
83
|
+
@result = hash
|
84
|
+
self
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
class DayoneToolbox::API::FetchEntry < DayoneToolbox::API::Base
|
90
|
+
def exec
|
91
|
+
hash = {}
|
92
|
+
@options.each do |k, v|
|
93
|
+
hash.merge!({ "#{k}" => @entry.send(k)})
|
94
|
+
end
|
95
|
+
@result = hash
|
96
|
+
self
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
|
2
|
+
class DayoneToolbox::CLI::Entry < Thor
|
3
|
+
class << self
|
4
|
+
def exit_on_failure?
|
5
|
+
true
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_reader :api
|
10
|
+
|
11
|
+
|
12
|
+
desc "fetch ENTRY_FILE OPTION", "Fetch values of .doentry file"
|
13
|
+
option :tags, :aliases => :t
|
14
|
+
option :uuid, :aliases => :u
|
15
|
+
option :entry_text, :aliases => :e
|
16
|
+
option :creation_date, :aliases => :d
|
17
|
+
option :creator, :aliases => :c
|
18
|
+
option :starred, :aliases => :s
|
19
|
+
option :time_zone, :aliases => :z
|
20
|
+
option :location, :aliases => :l
|
21
|
+
option :weather, :aliases => :w
|
22
|
+
def fetch(file)
|
23
|
+
@api = DayoneToolbox::API::FetchEntry.new(file, options).exec
|
24
|
+
return self if (@api.result.nil? || @api.result.empty?)
|
25
|
+
puts JSON.generate(@api.result)
|
26
|
+
self
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
desc "edit ENTRY_FILE OPTION", "Edit values of .doentry file"
|
31
|
+
option :tags, :type => :array, :aliases => :t
|
32
|
+
option :uuid, :aliases => :u
|
33
|
+
option :entry_text, :aliases => :e
|
34
|
+
option :creation_date, :aliases => :d
|
35
|
+
option :creator, :aliases => :c
|
36
|
+
option :starred, :type => :boolean, :aliases => :s
|
37
|
+
option :time_zone, :aliases => :z
|
38
|
+
option :location, :aliases => :l
|
39
|
+
option :weather, :aliases => :w
|
40
|
+
def edit(file)
|
41
|
+
@api = DayoneToolbox::API::EditEntry.new(file, options).exec.store
|
42
|
+
puts @api.result
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
desc "add-tags ENTRY_FILE OPTION", "Add values to .doentry file"
|
48
|
+
option :tags, :type => :array, :aliases => :t
|
49
|
+
def add_tags(file)
|
50
|
+
@api = DayoneToolbox::API::AddEntry.new(file, options).exec.store
|
51
|
+
puts @api.result
|
52
|
+
self
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
desc "search ENTRY_FILE OPTION", "Search values of .doentry file"
|
57
|
+
option :tags, :type => :array, :aliases => :t
|
58
|
+
option :uuid, :aliases => :u
|
59
|
+
option :starred, :type => :boolean, :aliases => :s
|
60
|
+
option :time_zone, :aliases => :z
|
61
|
+
def search(file)
|
62
|
+
@api = DayoneToolbox::API::SearchEntry.new(file, search_options).exec
|
63
|
+
puts @api.result
|
64
|
+
self
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
def search_options
|
69
|
+
new_options = options.dup
|
70
|
+
new_options['tags'] = [] if options.has_key?('tags') and options['tags'].nil?
|
71
|
+
new_options
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
class DayoneToolbox::CLI::Journal < Thor
|
3
|
+
class << self
|
4
|
+
def exit_on_failure?
|
5
|
+
true
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
desc "search JOURNAL_FILE OPTION", "Search entry files in Journal.dayone"
|
11
|
+
option :tags, :type => :array, :aliases => :t
|
12
|
+
option :uuid, :aliases => :u
|
13
|
+
option :starred, :type => :boolean, :aliases => :s
|
14
|
+
option :time_zone, :aliases => :z
|
15
|
+
def search(journal_path)
|
16
|
+
DayoneToolbox::Journal.new(journal_path).entries.each do |file|
|
17
|
+
api = DayoneToolbox::API::SearchEntry.new(file, search_options).exec
|
18
|
+
puts api.entry.file if api.result
|
19
|
+
end
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
desc "search-tag JOURNAL_FILE OPTION", "Search entry files in Journal.dayone"
|
25
|
+
option :include, :aliases => :i
|
26
|
+
option :not, :aliases => :n
|
27
|
+
def search_tag(journal_path)
|
28
|
+
DayoneToolbox::Journal.new(journal_path).entries.each do |file|
|
29
|
+
api = DayoneToolbox::API::SearchEntryByTag.new(file, options).exec
|
30
|
+
puts api.entry.file if api.result
|
31
|
+
end
|
32
|
+
self
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
private
|
37
|
+
def search_options
|
38
|
+
new_options = options.dup
|
39
|
+
new_options['tags'] = [] if options.has_key?('tags') and options['tags'].nil?
|
40
|
+
new_options
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
|
2
|
+
require 'plist'
|
3
|
+
|
4
|
+
class DayoneToolbox::Entry
|
5
|
+
KEY_TAGS = 'Tags'
|
6
|
+
KEY_UUID = 'UUID'
|
7
|
+
KEY_ENTRY_TEXT = 'Entry Text'
|
8
|
+
KEY_CREATION_DATE = 'Creation Date'
|
9
|
+
KEY_CREATOR = 'Creator'
|
10
|
+
KEY_STARRED = 'Starred'
|
11
|
+
KEY_TIME_ZONE = 'Time Zone'
|
12
|
+
KEY_LOCATION = 'Location'
|
13
|
+
KEY_WEATHER = 'Weather'
|
14
|
+
|
15
|
+
|
16
|
+
def self.entry_attributes
|
17
|
+
{
|
18
|
+
"tags" => KEY_TAGS,
|
19
|
+
"uuid" => KEY_UUID,
|
20
|
+
"entry_text" => KEY_ENTRY_TEXT,
|
21
|
+
"creation_date" => KEY_CREATION_DATE,
|
22
|
+
"creator" => KEY_CREATOR,
|
23
|
+
"starred" => KEY_STARRED,
|
24
|
+
"time_zone" => KEY_TIME_ZONE,
|
25
|
+
"location" => KEY_LOCATION,
|
26
|
+
"weather" => KEY_WEATHER
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
attr_reader :file
|
32
|
+
def initialize(file)
|
33
|
+
@file = file
|
34
|
+
@hash = Plist.parse_xml(file)
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
def to_plist
|
39
|
+
@hash.to_plist
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
def to_h
|
44
|
+
@hash
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
def tags ; @hash[KEY_TAGS] ; end
|
49
|
+
def tags=(attr) ; @hash[KEY_TAGS] = attr ; end
|
50
|
+
def tags? ; @hash.has_key?(KEY_TAGS) ; end
|
51
|
+
|
52
|
+
def uuid ; @hash[KEY_UUID] ; end
|
53
|
+
def uuid=(attr) ; @hash[KEY_UUID] = attr ; end
|
54
|
+
def uuid? ; @hash.has_key?(KEY_UUID) ; end
|
55
|
+
|
56
|
+
def entry_text ; @hash[KEY_ENTRY_TEXT] ; end
|
57
|
+
def entry_text=(attr) ; @hash[KEY_ENTRY_TEXT] = attr ; end
|
58
|
+
def entry_text? ; @hash.has_key?(KEY_ENTRY_TEXT) ; end
|
59
|
+
|
60
|
+
def creation_date ; @hash[KEY_CREATION_DATE] ; end
|
61
|
+
def creation_date=(attr) ; @hash[KEY_CREATION_DATE] = attr ; end
|
62
|
+
def creation_date? ; @hash.has_key?(KEY_CREATION_DATE) ; end
|
63
|
+
|
64
|
+
def creator ; @hash[KEY_CREATOR] ; end
|
65
|
+
def creator=(attr) ; @hash[KEY_CREATOR] = attr ; end
|
66
|
+
def creator? ; @hash.has_key?(KEY_CREATOR) ; end
|
67
|
+
|
68
|
+
def starred ; @hash[KEY_STARRED] ; end
|
69
|
+
def starred=(attr) ; @hash[KEY_STARRED] = attr ; end
|
70
|
+
def starred? ; @hash.has_key?(KEY_STARRED) ; end
|
71
|
+
|
72
|
+
def time_zone ; @hash[KEY_TIME_ZONE] ; end
|
73
|
+
def time_zone=(attr) ; @hash[KEY_TIME_ZONE] = attr ; end
|
74
|
+
def time_zone? ; @hash.has_key?(KEY_TIME_ZONE) ; end
|
75
|
+
|
76
|
+
def location ; @hash[KEY_LOCATION] ; end
|
77
|
+
def location=(attr) ; @hash[KEY_LOCATION] = attr ; end
|
78
|
+
def location? ; @hash.has_key?(KEY_LOCATION) ; end
|
79
|
+
|
80
|
+
def weather ; @hash[KEY_WEATHER] ; end
|
81
|
+
def weather=(attr) ; @hash[KEY_WEATHER] = attr ; end
|
82
|
+
def weather? ; @hash.has_key?(KEY_WEATHER) ; end
|
83
|
+
|
84
|
+
|
85
|
+
def custom_key(key)
|
86
|
+
@hash[key]
|
87
|
+
end
|
88
|
+
|
89
|
+
def custom_key?(key)
|
90
|
+
@hash.has_key?("#{key}")
|
91
|
+
end
|
92
|
+
|
93
|
+
def set_custom_key(key, value)
|
94
|
+
@hash["#{key}"] = value
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
class DayoneToolbox::Journal
|
3
|
+
ENTRIES_DIR = 'entries/'
|
4
|
+
PHOTOS_DIR = 'photos/'
|
5
|
+
|
6
|
+
attr_reader :path, :entries_path, :photos_path
|
7
|
+
def initialize(dir_path)
|
8
|
+
@path = dir_path
|
9
|
+
@entries_path = File.join(@path, ENTRIES_DIR)
|
10
|
+
@photos_path = File.join(@path, PHOTOS_DIR)
|
11
|
+
end
|
12
|
+
|
13
|
+
def entries
|
14
|
+
Dir.glob("#{@entries_path}**/*.doentry")
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dayone_toolbox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masato INOUE
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-07-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.14.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.14.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: timecop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.9.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.9.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: plist
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.3.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.3.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: thor
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.19.4
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.19.4
|
111
|
+
description: DayoneToolbox is utility tools for Day One Classic.
|
112
|
+
email:
|
113
|
+
- masainox@gmail.com
|
114
|
+
executables:
|
115
|
+
- dayone-entry
|
116
|
+
- dayone-journal
|
117
|
+
extensions: []
|
118
|
+
extra_rdoc_files: []
|
119
|
+
files:
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rspec"
|
122
|
+
- ".travis.yml"
|
123
|
+
- Gemfile
|
124
|
+
- LICENSE.txt
|
125
|
+
- README.md
|
126
|
+
- Rakefile
|
127
|
+
- bin/console
|
128
|
+
- bin/setup
|
129
|
+
- dayone_toolbox.gemspec
|
130
|
+
- exe/dayone-entry
|
131
|
+
- exe/dayone-journal
|
132
|
+
- lib/dayone_toolbox.rb
|
133
|
+
- lib/dayone_toolbox/api.rb
|
134
|
+
- lib/dayone_toolbox/cli.rb
|
135
|
+
- lib/dayone_toolbox/cli/entry.rb
|
136
|
+
- lib/dayone_toolbox/cli/journal.rb
|
137
|
+
- lib/dayone_toolbox/entry.rb
|
138
|
+
- lib/dayone_toolbox/journal.rb
|
139
|
+
- lib/dayone_toolbox/version.rb
|
140
|
+
homepage: https://github.com/masainox/dayone_toolbox
|
141
|
+
licenses:
|
142
|
+
- MIT
|
143
|
+
metadata: {}
|
144
|
+
post_install_message:
|
145
|
+
rdoc_options: []
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
requirements: []
|
159
|
+
rubyforge_project:
|
160
|
+
rubygems_version: 2.6.4
|
161
|
+
signing_key:
|
162
|
+
specification_version: 4
|
163
|
+
summary: DayoneToolbox is utility tools for Day One Classic.
|
164
|
+
test_files: []
|