rb-dayone 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.
- data/Gemfile +3 -0
- data/Gemfile.lock +10 -0
- data/History.txt +25 -0
- data/README.md +57 -0
- data/Rakefile +21 -0
- data/bin/dayone +34 -0
- data/spec/entry_spec.rb +47 -0
- data/spec/spec_helper.rb +2 -0
- metadata +82 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/History.txt
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
== 0.1.4 / 2012-08-12
|
2
|
+
|
3
|
+
* Added a couple more tests for better coverage
|
4
|
+
|
5
|
+
== 0.1.3 / 2012-08-12
|
6
|
+
|
7
|
+
* Removed the SimpleXML class, now using the Builder gem
|
8
|
+
|
9
|
+
== 0.1.2 / 2012-08-12
|
10
|
+
|
11
|
+
* [FIXED] Actual testing on my own system
|
12
|
+
|
13
|
+
== 0.1.1 / 2012-08-07
|
14
|
+
|
15
|
+
* [FIXED] DayOne constants are now `attr_accessors` - set them yourself if you wish!
|
16
|
+
|
17
|
+
== 0.1.0 / 2012-08-06
|
18
|
+
|
19
|
+
* Added binary
|
20
|
+
* Support for DayOne locations
|
21
|
+
* Uploaded to github!
|
22
|
+
|
23
|
+
== 0.0.1 / 2012-08-05
|
24
|
+
|
25
|
+
* Started development
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
rb-dayone
|
2
|
+
<<<<<<< HEAD
|
3
|
+
===========
|
4
|
+
|
5
|
+
A means to create DayOne entries in ruby.
|
6
|
+
|
7
|
+
Examples
|
8
|
+
--------
|
9
|
+
|
10
|
+
e = DayOne::Entry.new "# Hello, world!"
|
11
|
+
e.starred = true
|
12
|
+
e.create!
|
13
|
+
|
14
|
+
Install
|
15
|
+
-------
|
16
|
+
|
17
|
+
`gem install rb-dayone`
|
18
|
+
|
19
|
+
Author
|
20
|
+
------
|
21
|
+
|
22
|
+
Original author: Jan-Yves Ruzicka
|
23
|
+
|
24
|
+
Roadmap
|
25
|
+
-------
|
26
|
+
|
27
|
+
* Image support
|
28
|
+
* Location support?
|
29
|
+
|
30
|
+
License
|
31
|
+
-------
|
32
|
+
|
33
|
+
Copyright (c) 2012 Jan-Yves Ruzicka
|
34
|
+
|
35
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
36
|
+
a copy of this software and associated documentation files (the
|
37
|
+
'Software'), to deal in the Software without restriction, including
|
38
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
39
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
40
|
+
permit persons to whom the Software is furnished to do so, subject to
|
41
|
+
the following conditions:
|
42
|
+
|
43
|
+
The above copyright notice and this permission notice shall be
|
44
|
+
included in all copies or substantial portions of the Software.
|
45
|
+
|
46
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
47
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
48
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
49
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
50
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
51
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
52
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
53
|
+
=======
|
54
|
+
=========
|
55
|
+
|
56
|
+
A ruby library for creating (and, one day, editing and removing) DayOne.app entries
|
57
|
+
>>>>>>> d4606a817c5f5757f6b5e4c996d7f61cb0d023b1
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
gem_title = 'rb-dayone'
|
2
|
+
|
3
|
+
task :build do
|
4
|
+
specfile = "#{gem_title}.gemspec"
|
5
|
+
puts `gem build '#{specfile}'`
|
6
|
+
|
7
|
+
gem_file = Dir["#{gem_title}-*.gem"]
|
8
|
+
gem_file.each do |f|
|
9
|
+
puts `mv '#{f}' pkg`
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
task :install do
|
14
|
+
pkg = Dir['pkg/*.gem'].sort[-1]
|
15
|
+
puts `gem install #{pkg}`
|
16
|
+
end
|
17
|
+
|
18
|
+
task :go => [:build, :install] do
|
19
|
+
end
|
20
|
+
|
21
|
+
task :default => :go
|
data/bin/dayone
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
USAGE = <<-end
|
5
|
+
Usage:
|
6
|
+
dayone --set location <PATH>
|
7
|
+
end
|
8
|
+
|
9
|
+
def usage
|
10
|
+
puts USAGE
|
11
|
+
exit 1
|
12
|
+
end
|
13
|
+
|
14
|
+
# Put your code here
|
15
|
+
case ARGV[0]
|
16
|
+
when '--set'
|
17
|
+
case ARGV[1]
|
18
|
+
when 'location'
|
19
|
+
# Make sure location store folder exists
|
20
|
+
dayone_folder = File.join(ENV['HOME'], '.rb-dayone')
|
21
|
+
FileUtils::mkdir_p dayone_folder
|
22
|
+
|
23
|
+
# Put our location in it
|
24
|
+
new_dayone_location = File.expand_path(ARGV[2])
|
25
|
+
File.open(File.join(dayone_folder, 'location'),'w'){ |io| io.puts new_dayone_location }
|
26
|
+
|
27
|
+
# Let the user know
|
28
|
+
puts "DayOne journal now located at: #{new_dayone_location}"
|
29
|
+
else
|
30
|
+
usage
|
31
|
+
end
|
32
|
+
else
|
33
|
+
usage
|
34
|
+
end
|
data/spec/entry_spec.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require './spec/spec_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
describe DayOne::Entry do
|
5
|
+
|
6
|
+
let(:entry){ DayOne::Entry.new }
|
7
|
+
|
8
|
+
after do
|
9
|
+
Dir['spec/entries/*.doentry'].each{ |f| FileUtils.rm(f) }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#to_xml" do
|
13
|
+
it "should give a default entry" do
|
14
|
+
e = entry.to_xml
|
15
|
+
e.should match %r|<key>Entry Text</key>\s*<string></string>|
|
16
|
+
e.should match %r|<key>Starred</key>\s*<false/>|
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should set from initialize" do
|
20
|
+
e = DayOne::Entry.new 'foo', starred:true
|
21
|
+
e.starred.should be_true
|
22
|
+
e.entry_text.should == 'foo'
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should act properly when starred" do
|
26
|
+
e = DayOne::Entry.new('foo', starred:true).to_xml
|
27
|
+
e.should match %r|<key>Starred</key>\s*<true/>|
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "#create!" do
|
32
|
+
it "should correctly create a .doentry file" do
|
33
|
+
DayOne::journal_location = 'spec'
|
34
|
+
FileUtils::mkdir_p 'spec/entries'
|
35
|
+
|
36
|
+
e = entry
|
37
|
+
e.entry_text = "Hello, world!"
|
38
|
+
e.create!
|
39
|
+
|
40
|
+
file_location = Dir['spec/entries/*.doentry'][0]
|
41
|
+
file_location.should_not be_nil
|
42
|
+
|
43
|
+
contents = File.read(file_location)
|
44
|
+
contents.should == e.to_xml
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rb-dayone
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jan-Yves Ruzicka
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-12 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: builder
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.0'
|
30
|
+
description: ! " require 'rb-dayone'\n e = DayOne::Entry.new \"Hello, world!\"\n
|
31
|
+
\ e.starred = true\n e.create!\n"
|
32
|
+
email: janyves.ruzicka@gmail.com
|
33
|
+
executables:
|
34
|
+
- dayone
|
35
|
+
extensions: []
|
36
|
+
extra_rdoc_files:
|
37
|
+
- README.md
|
38
|
+
files:
|
39
|
+
- bin/dayone
|
40
|
+
- Gemfile
|
41
|
+
- Gemfile.lock
|
42
|
+
- History.txt
|
43
|
+
- Rakefile
|
44
|
+
- README.md
|
45
|
+
- spec/entry_spec.rb
|
46
|
+
- spec/spec_helper.rb
|
47
|
+
homepage: http://www.rubygems.org/rb-dayone
|
48
|
+
licenses: []
|
49
|
+
post_install_message: ! '--------------------------------------------------------------------------------
|
50
|
+
|
51
|
+
Thank you for installing rb-dayone!
|
52
|
+
|
53
|
+
|
54
|
+
To finish setup, run `dayone --set location <location>` to specify where your DayOne
|
55
|
+
journal is stored.
|
56
|
+
|
57
|
+
--------------------------------------------------------------------------------
|
58
|
+
|
59
|
+
'
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 1.8.23
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: Create DayOne journal entries in ruby.
|
82
|
+
test_files: []
|