my_todo 2.1.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -0
- data/bin/my_todo +4 -2
- data/lib/db/todos_development.sqlite3 +0 -0
- data/lib/db/todos_test.sqlite3 +0 -0
- data/lib/my_todo.rb +17 -19
- data/lib/my_todo/version.rb +1 -1
- data/my_todo.gemspec +3 -1
- data/spec/actions/search_spec.rb +11 -8
- data/spec/spec_helper.rb +2 -0
- metadata +32 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2f1837cba62f5d258fe7f433ad5679bf50c0d3c
|
4
|
+
data.tar.gz: 9bf63f143f84b658d09ebb6fc42379564bebf289
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e34014d8ec9df7510ac8d5cedbfe322f71b0b23ef4f94fe5b5e23eb2feb679d7d0f8d31c930ea5326c8518d6a4b020ce3b95e07bda06f6c79f0f7d144614637e
|
7
|
+
data.tar.gz: 62a79fe9055aadf01da2418f91672008e8387963760a42197249633dc20406978fa63879a9986bd8da07c388fa612c8bafa239b9ee5a7af66b002925338e6534
|
data/README.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# My Todo
|
2
|
+
|
3
|
+
## Summary
|
4
|
+
This is yet another simple todo application. This was built because I found myself having to create quick reminders when things came up but needing to switch windows from the terminal to the todo application via the GUI. This application is the result of that one annoyance :). It is still a work in progress but I hope you find it useful.
|
5
|
+
|
6
|
+
## Features
|
7
|
+
* SQLIte3 backend (database is located in $HOME/.my_todo)
|
8
|
+
* CRUD actions for todo items (Create, Read, Update & Delete)
|
9
|
+
* Tag / Untag todo items to group / ungroup them.
|
10
|
+
* Search for todo items
|
11
|
+
* Add / Remove additional notes to todo items
|
12
|
+
|
1
13
|
## Installation
|
2
14
|
|
3
15
|
To install this gem onto your system
|
@@ -50,6 +62,23 @@ Tags: default
|
|
50
62
|
Complete: false
|
51
63
|
```
|
52
64
|
|
65
|
+
Use aliasing to shorten the syntax:
|
66
|
+
```
|
67
|
+
#aliases
|
68
|
+
alias m='my_todo'
|
69
|
+
alias mlist='my_todo list'
|
70
|
+
alias mcreate='my_todo create'
|
71
|
+
alias mupdate='my_todo update'
|
72
|
+
alias mdelete='my_todo delete'
|
73
|
+
alias mtag='my_todo tag'
|
74
|
+
alias mrmtag='my_todo rm_tag'
|
75
|
+
alias mnote='my_todo note'
|
76
|
+
alias mrmnote='my_todo rm_note'
|
77
|
+
alias msearch='my_todo search'
|
78
|
+
```
|
79
|
+
|
80
|
+
Functions can be created around these actions to possibly shorten the syntax that much more
|
81
|
+
|
53
82
|
## Development
|
54
83
|
|
55
84
|
After checking out the repo, run `bin/setup` to install dependencies. Then `RAILS_ENV=development bin/my_todo rake db:migrate` to create the development DB. You can also run `RAILS_ENV=development bin/console` for an interactive prompt that will allow you to experiment.
|
data/bin/my_todo
CHANGED
@@ -32,8 +32,10 @@ if exec_type == 'rake'
|
|
32
32
|
require 'pp'
|
33
33
|
|
34
34
|
# Generate standalone migration file configs for sqlite3
|
35
|
-
|
36
|
-
|
35
|
+
if ENV['RAILS_ENV'] == 'production'
|
36
|
+
Setup.start(%w[db_config])
|
37
|
+
Setup.start(%w[standard_migrations_override])
|
38
|
+
end
|
37
39
|
# Get current working directory
|
38
40
|
pwd=Dir.pwd
|
39
41
|
# Go into root of gems directory to load rakefile
|
Binary file
|
data/lib/db/todos_test.sqlite3
CHANGED
Binary file
|
data/lib/my_todo.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# @author Lovell McIlwain
|
1
|
+
# @author Lovell McIlwain
|
2
2
|
# Handles running the todo application
|
3
3
|
require File.expand_path('../../lib/my_todo/version', __FILE__)
|
4
4
|
require 'thor'
|
@@ -7,6 +7,7 @@ require 'sqlite3'
|
|
7
7
|
require 'active_record'
|
8
8
|
require 'active_model'
|
9
9
|
require 'yaml'
|
10
|
+
require 'ransack'
|
10
11
|
require_relative 'ar_base'
|
11
12
|
require_relative 'item'
|
12
13
|
require_relative 'stub'
|
@@ -19,22 +20,24 @@ module MyTodo
|
|
19
20
|
# Add additional thor tasks
|
20
21
|
include Thor::Actions
|
21
22
|
|
22
|
-
# Private methods
|
23
|
+
# Private methods
|
23
24
|
no_commands do
|
24
25
|
def output(item)
|
25
|
-
|
26
|
+
say ERB.new(File.read(File.expand_path("../../lib/my_todo/templates/output.erb", __FILE__))).result(binding)
|
27
|
+
end
|
28
|
+
|
29
|
+
def item
|
30
|
+
@item ||= Item.where(id: options[:id]).first
|
26
31
|
end
|
27
32
|
end
|
28
33
|
|
29
|
-
desc 'list([
|
30
|
-
def list(
|
31
|
-
items = case
|
32
|
-
when
|
34
|
+
desc 'list([STATUS])', 'list todos. Default: undone, [all], [done], [undone]'
|
35
|
+
def list(status=nil)
|
36
|
+
items = case status
|
37
|
+
when 'all'
|
33
38
|
Item.all
|
34
|
-
when
|
39
|
+
when 'done'
|
35
40
|
Item.where(done: true)
|
36
|
-
when req == 'unfinished'
|
37
|
-
Item.where(done: false)
|
38
41
|
else
|
39
42
|
Item.where(done: false)
|
40
43
|
end
|
@@ -66,7 +69,6 @@ module MyTodo
|
|
66
69
|
option :updated_at, default: DateTime.now
|
67
70
|
def update
|
68
71
|
begin
|
69
|
-
item = Item.find(options[:id])
|
70
72
|
item.update!(options)
|
71
73
|
say 'ToDo UPDATED!'
|
72
74
|
output item
|
@@ -87,11 +89,11 @@ module MyTodo
|
|
87
89
|
end
|
88
90
|
end
|
89
91
|
|
90
|
-
desc 'search(
|
91
|
-
def search(
|
92
|
-
items = Item.
|
92
|
+
desc 'search(TEXT)', 'search for todo by item body, tag name or note body'
|
93
|
+
def search(text)
|
94
|
+
items = Item.ransack(body_or_tags_name_or_notes_body_cont: text).result
|
93
95
|
say "ToDos FOUND: #{items.count}"
|
94
|
-
items.each {|
|
96
|
+
items.each {|item| output item}
|
95
97
|
end
|
96
98
|
|
97
99
|
desc "tag --id=TODO_ID --tag=TAG_NAME", 'add a tag to an existing todo'
|
@@ -99,7 +101,6 @@ module MyTodo
|
|
99
101
|
option :tag
|
100
102
|
def tag
|
101
103
|
begin
|
102
|
-
item = Item.where(id: options[:id]).first
|
103
104
|
item.tags.create!(name: options[:tag])
|
104
105
|
rescue Exception => e
|
105
106
|
say e.message
|
@@ -111,7 +112,6 @@ module MyTodo
|
|
111
112
|
option :tag
|
112
113
|
def rm_tag
|
113
114
|
begin
|
114
|
-
item = Item.where(id: options[:id]).first
|
115
115
|
item.tags.where(name: options[:tag]).first.destroy!
|
116
116
|
output item.reload
|
117
117
|
rescue Exception => e
|
@@ -124,7 +124,6 @@ module MyTodo
|
|
124
124
|
option :body
|
125
125
|
def note
|
126
126
|
begin
|
127
|
-
item = Item.where(id: options[:id]).first
|
128
127
|
item.notes.create(body: options[:body])
|
129
128
|
output item.reload
|
130
129
|
rescue Exception => e
|
@@ -137,7 +136,6 @@ module MyTodo
|
|
137
136
|
option :noteid
|
138
137
|
def rm_note
|
139
138
|
begin
|
140
|
-
item = Item.where(id: options[:id]).first
|
141
139
|
item.notes.where(id: options[:noteid]).first.destroy!
|
142
140
|
output item.reload
|
143
141
|
rescue Exception => e
|
data/lib/my_todo/version.rb
CHANGED
data/my_todo.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["lovell.mcilwain@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{A basic todo application with tags.}
|
13
|
-
spec.description = %q{A terminal based todo application for creating todo items. Adding tags makes for an easy way to group and search for related items.}
|
13
|
+
spec.description = %q{A terminal based todo application for creating todo items. Adding tags makes for an easy way to group and search for related items. Create additional notes for a todo item as new related information comes up}
|
14
14
|
spec.homepage = "https://github.com/vmcilwain/my_todo"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -28,11 +28,13 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'shoulda-matchers', '~> 3.1'
|
29
29
|
spec.add_development_dependency 'byebug', '~> 9.0.5'
|
30
30
|
spec.add_development_dependency 'yard', '~> 0.9.5'
|
31
|
+
spec.add_development_dependency 'simplecov', '~> 0.12.0'
|
31
32
|
spec.add_dependency 'activerecord', '~> 5.0.0.1'
|
32
33
|
spec.add_dependency 'activesupport', '~> 5.0.0.1'
|
33
34
|
spec.add_dependency 'thor', '~> 0.19.1'
|
34
35
|
spec.add_dependency 'standalone_migrations', '~> 5.0.0'
|
35
36
|
spec.add_dependency 'sqlite3', '~> 1.3.11'
|
37
|
+
spec.add_dependency 'ransack', '~> 1.8.2'
|
36
38
|
|
37
39
|
spec.metadata["yard.run"] = "yri"
|
38
40
|
spec.post_install_message = "Don't forget to migrate the db. `my_todo rake db:migrate`"
|
data/spec/actions/search_spec.rb
CHANGED
@@ -5,24 +5,27 @@ describe MyTodo do
|
|
5
5
|
context 'success search' do
|
6
6
|
before do
|
7
7
|
@todo1 = FactoryGirl.create(:item, body: 'nfl')
|
8
|
+
@todo1.tags.create(name: 'tag1')
|
8
9
|
@todo2 = FactoryGirl.create(:item, body: 'rocks')
|
9
10
|
@todo3 = FactoryGirl.create(:item, body: 'always')
|
11
|
+
@todo3.notes.create(body: 'note1')
|
10
12
|
end
|
11
13
|
|
12
|
-
it 'finds todo item by id' do
|
13
|
-
expect{MyTodo::Todo.start( %W(search #{@todo3.id} ))}.to output("ToDos FOUND: 1\n\nID: 3\nToDo: always\nTags: \nComplete: \n\n").to_stdout
|
14
|
-
end
|
15
14
|
|
16
15
|
it 'finds todo item by body' do
|
17
|
-
expect{MyTodo::Todo.start( %w[search nfl])}.to output("ToDos FOUND: 1\n\nID: 1\nToDo: nfl\nTags: \nComplete: \n\n").to_stdout
|
16
|
+
expect{MyTodo::Todo.start( %w[search nfl])}.to output("ToDos FOUND: 1\n\nID: 1\nToDo: nfl\nTags: tag1\nComplete: \n\n").to_stdout
|
18
17
|
end
|
19
|
-
end
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
expect{MyTodo::Todo.start( %w(search 1))}.to output("ToDos FOUND: 0\n").to_stdout
|
19
|
+
it 'finds todo items by associated tag' do
|
20
|
+
expect{MyTodo::Todo.start( %w[search tag1])}.to output("ToDos FOUND: 1\n\nID: 1\nToDo: nfl\nTags: tag1\nComplete: \n\n").to_stdout
|
24
21
|
end
|
25
22
|
|
23
|
+
it 'finds todo items by associated notes content' do
|
24
|
+
expect{MyTodo::Todo.start( %w[search note1])}.to output("ToDos FOUND: 1\n\nID: 3\nToDo: always\nTags: \nComplete: \n\nNotes:\n\n1: note1\n\n\n").to_stdout
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'unsuccessful search' do
|
26
29
|
it 'returns no results when searching on invalid body' do
|
27
30
|
expect{MyTodo::Todo.start( %w(search no_body))}.to output("ToDos FOUND: 0\n").to_stdout
|
28
31
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_todo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.9.5
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.12.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.12.0
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: activerecord
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,8 +206,23 @@ dependencies:
|
|
192
206
|
- - "~>"
|
193
207
|
- !ruby/object:Gem::Version
|
194
208
|
version: 1.3.11
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: ransack
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - "~>"
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: 1.8.2
|
216
|
+
type: :runtime
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - "~>"
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: 1.8.2
|
195
223
|
description: A terminal based todo application for creating todo items. Adding tags
|
196
|
-
makes for an easy way to group and search for related items.
|
224
|
+
makes for an easy way to group and search for related items. Create additional notes
|
225
|
+
for a todo item as new related information comes up
|
197
226
|
email:
|
198
227
|
- lovell.mcilwain@gmail.com
|
199
228
|
executables:
|