Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jyruzicka/rb-dayone
A ruby library for creating (and, one day, editing and removing) DayOne.app entries
https://github.com/jyruzicka/rb-dayone
Last synced: 3 months ago
JSON representation
A ruby library for creating (and, one day, editing and removing) DayOne.app entries
- Host: GitHub
- URL: https://github.com/jyruzicka/rb-dayone
- Owner: jyruzicka
- Created: 2012-08-06T20:06:58.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2023-01-01T23:13:37.000Z (almost 2 years ago)
- Last Synced: 2024-07-09T16:19:47.230Z (4 months ago)
- Language: Ruby
- Size: 108 KB
- Stars: 29
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: History.rdoc
Awesome Lists containing this project
- project-awesome - jyruzicka/rb-dayone - A ruby library for creating (and, one day, editing and removing) DayOne.app entries (Ruby)
README
# rb-dayone
A means to create DayOne entries in ruby.
**Note:** This gem is designed to work with DayOne Version 1 *only*. Once I have updated to DayOne Version 2 I will look at how to make this work with it. Until then, sorry Version 2 folks!
## Examples
You can create an entry pretty simply:
e = DayOne::Entry.new "# Hello, world!"
You can also set up other values via a hash:e = DayOne::Entry.new "I totally posted this an hour ago", creation_date: Time.now-3600
Otherwise, you can set values using simple accessor methods, as you'd expect:
e = DayOne::Entry.new "I need to remember this."
e.starred = trueWhen you're ready to save your entry, just run the `create!` method:
e.create!
### Searching
You can now search your DayOne archives. Use the `DayOne::Search` object to start a search:
s = DayOne::Search.new do
entry_text.include "Foo" # Entry must have "foo" in the entry text
entry_text.exclude "Bar" # Entry cannot have "bar" in the entry text
tag.include "baz" # Entry must be tagged "baz"
tag.exclude "caz" # Entry cannot be tagged "caz"
starred.is true # Entry is starred
starred.is false # Entry is not starred
creation_date.after t # Entry created after +t+
creation_date.before t # Entry created before +t+
ends.results # Retrieve an array of search results
Most of these methods can be combined, e.g.:
s = DayOne::Search.new do
entry_text.include "Eggs"
entry_text.include "Milk"
endThis will only find posts that contain both the words "Eggs" and "Milk" in the entry text.
## Binary
Rb-dayone ships with a binary, `dayone`. Run `dayone --help` for instructions on how to use it.
## Install
gem install rb-dayone
## Author
Original author: [Jan-Yves Ruzicka](http://www.1klb.com). Get in touch [via email](mailto:[email protected]).