oneday 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +40 -0
- data/Rakefile +2 -0
- data/bin/oneday +36 -0
- data/lib/oneday.rb +9 -0
- data/lib/oneday/command.rb +5 -0
- data/lib/oneday/command/oneday.rb +34 -0
- data/lib/oneday/model.rb +23 -0
- data/lib/oneday/model/note.rb +4 -0
- data/lib/oneday/model/project.rb +4 -0
- data/lib/oneday/version.rb +3 -0
- data/oneday.gemspec +27 -0
- metadata +145 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3872a04a3d15a93b210ec9411ea0ea4fabb23bd9
|
4
|
+
data.tar.gz: 7b1dc391c513572fce038d970a32993b5e2fde70
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8a5e4378cf9dd4286ecbd80e2866aacd322eb93fd5c067b15212f57a1bc214413d05566c52ea81623b315e50c880664c5544f818b81a9704169f36dd48d9e642
|
7
|
+
data.tar.gz: 388aaba29f45e338842f740add3921cc7fc5a27104fabb9bb7eeaab2e6c967a050b06f607c1eac4d8bcb60597b2632c139124981237e1bfe4efb44968e6d5d53
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
oneday
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0-p353
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Ma Lucheng
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Oneday
|
2
|
+
|
3
|
+
Oneday is a command line tool for daily record
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'oneday'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install oneday
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```bash
|
22
|
+
oneday "this is content"
|
23
|
+
```
|
24
|
+
|
25
|
+
```bash
|
26
|
+
oneday "project step 1 finish" --project onestep
|
27
|
+
```
|
28
|
+
|
29
|
+
```bash
|
30
|
+
oneday "pizza is delicacious" --tag food
|
31
|
+
```
|
32
|
+
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
1. Fork it ( https://github.com/[my-github-username]/oneday/fork )
|
37
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
38
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
39
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
40
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/oneday
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'oneday'
|
3
|
+
|
4
|
+
# DB = Sequel.sqlite # memory database
|
5
|
+
# DB.create_table :notes do # create a table
|
6
|
+
# primary_key :id
|
7
|
+
# String :content
|
8
|
+
# end
|
9
|
+
|
10
|
+
|
11
|
+
Oneday::Command::Oneday.start(ARGV)
|
12
|
+
# require 'sequel'
|
13
|
+
|
14
|
+
# DB = Sequel.sqlite # memory database
|
15
|
+
|
16
|
+
# DB.create_table :notes do # create a table
|
17
|
+
# primary_key :id
|
18
|
+
# String :content
|
19
|
+
# end
|
20
|
+
|
21
|
+
# notes = DB[:notes] # Create a dataset
|
22
|
+
|
23
|
+
# # Populate the table
|
24
|
+
# notes.insert(content: 'hello world')
|
25
|
+
|
26
|
+
# # Print out the number of records
|
27
|
+
# puts "There are #{notes.count} notes"
|
28
|
+
|
29
|
+
################################################
|
30
|
+
|
31
|
+
# first it should read a config file default local ~/.oneday
|
32
|
+
# then according the config file it should local the db file
|
33
|
+
# if db not exist, it should ask user where to store the db
|
34
|
+
# else it will load the target db
|
35
|
+
|
36
|
+
# args -p "project name" create_or_find
|
data/lib/oneday.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'thor'
|
2
|
+
module Oneday
|
3
|
+
module Command
|
4
|
+
|
5
|
+
class Oneday < Thor
|
6
|
+
desc "hello NAME", "say hello to NAME"
|
7
|
+
def hello(name = "teddy")
|
8
|
+
puts "Hello #{name}"
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "NOTE_CONTENT", "record a note to oneday"
|
12
|
+
option :project
|
13
|
+
def record(content)
|
14
|
+
puts "I will record #{content} with project #{options[:project]}"
|
15
|
+
project = Project.where(name: options[:project]).first || Project.create(name: options[:project])
|
16
|
+
note = Note.new(content: content)
|
17
|
+
note.save
|
18
|
+
project.add_note(note)
|
19
|
+
notes = Note.all
|
20
|
+
puts notes.inspect
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "LIST_NOTES", "list maybe today's notes"
|
24
|
+
def list
|
25
|
+
Note.new(content: "demo").save
|
26
|
+
notes = Note.all
|
27
|
+
puts notes.inspect
|
28
|
+
end
|
29
|
+
|
30
|
+
default_task :hello
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/lib/oneday/model.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require "sequel"
|
2
|
+
DB = Sequel.sqlite
|
3
|
+
|
4
|
+
# init db schema
|
5
|
+
|
6
|
+
DB.create_table :projects do
|
7
|
+
primary_key :id
|
8
|
+
String :name
|
9
|
+
int :project_id
|
10
|
+
end
|
11
|
+
|
12
|
+
DB.create_table :notes do
|
13
|
+
primary_key :id
|
14
|
+
String :content
|
15
|
+
foreign_key :project_id, :projects
|
16
|
+
end
|
17
|
+
|
18
|
+
require "oneday/model/project"
|
19
|
+
require "oneday/model/note"
|
20
|
+
|
21
|
+
module Oneday
|
22
|
+
|
23
|
+
end
|
data/oneday.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'oneday/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "oneday"
|
8
|
+
spec.version = Oneday::VERSION
|
9
|
+
spec.authors = ["Ma Lucheng"]
|
10
|
+
spec.email = ["teddy@javaer.me"]
|
11
|
+
spec.summary = %q{a command line note tool}
|
12
|
+
spec.description = %q{a dayone like command line tool}
|
13
|
+
spec.homepage = "http://oneday.javer.me"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_runtime_dependency "sequel" # used to connection to [sqlite] database
|
24
|
+
spec.add_runtime_dependency "sqlite3" # default use sqlite3 as database
|
25
|
+
spec.add_development_dependency "pry" # better than irb
|
26
|
+
spec.add_runtime_dependency "thor" # command line interface
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: oneday
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ma Lucheng
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-30 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.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sequel
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sqlite3
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: thor
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: a dayone like command line tool
|
98
|
+
email:
|
99
|
+
- teddy@javaer.me
|
100
|
+
executables:
|
101
|
+
- oneday
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- .gitignore
|
106
|
+
- .ruby-gemset
|
107
|
+
- .ruby-version
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/oneday
|
113
|
+
- lib/oneday.rb
|
114
|
+
- lib/oneday/command.rb
|
115
|
+
- lib/oneday/command/oneday.rb
|
116
|
+
- lib/oneday/model.rb
|
117
|
+
- lib/oneday/model/note.rb
|
118
|
+
- lib/oneday/model/project.rb
|
119
|
+
- lib/oneday/version.rb
|
120
|
+
- oneday.gemspec
|
121
|
+
homepage: http://oneday.javer.me
|
122
|
+
licenses:
|
123
|
+
- MIT
|
124
|
+
metadata: {}
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubyforge_project:
|
141
|
+
rubygems_version: 2.1.11
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: a command line note tool
|
145
|
+
test_files: []
|