tod-gem 0.1
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.
- checksums.yaml +7 -0
- data/README.md +10 -0
- data/bin/tod +86 -0
- data/tod-gem.gemspec +12 -0
- metadata +61 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 368ef80d53e5cb545486dfb66e8190ec3a5a4f5a
|
4
|
+
data.tar.gz: ddeaf57048d804a9c2b3fdb95008bff11913549c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e77cb83b5296ebdb3847fc555c14385d8210afe05d015cd39533640e6732dab8c0c70d5584bf670a3392551eba0292533e27c4f17710c456680a86c17873171
|
7
|
+
data.tar.gz: cc98020805f47dcbdc4dfc9483d9a65a17e076ad700695bd5c9d5c3b830c00540933b7d97881bffdf28efdbd9b1fa5d3ed1718c081ec0190536bfcee726bd8c9
|
data/README.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
tod
|
2
|
+
===
|
3
|
+
|
4
|
+
A simple command line todo manager
|
5
|
+
|
6
|
+
License
|
7
|
+
-------
|
8
|
+
Copyright 2013 Michal Siwek
|
9
|
+
|
10
|
+
This project including all of its source files is released under the terms of [GNU General Public License (version 3 or later)](http://www.gnu.org/licenses/gpl.txt)
|
data/bin/tod
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'colorize'
|
3
|
+
|
4
|
+
@command = ARGV[0]
|
5
|
+
@todfile_exists = File.exists?('.todfile')
|
6
|
+
|
7
|
+
def list(kind = 'left')
|
8
|
+
if @todfile_exists
|
9
|
+
File.open('.todfile').each_line do |line|
|
10
|
+
unless kind == 'done'
|
11
|
+
if line.chars.first == '-'
|
12
|
+
puts '*'.yellow + line.reverse.chop.reverse
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
if kind == 'all' || kind == 'done'
|
17
|
+
if line.chars.first == '+'
|
18
|
+
todo = line.chomp.reverse.chop.reverse
|
19
|
+
todo = todo.green if kind == 'all'
|
20
|
+
|
21
|
+
puts '*'.green + todo
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
else
|
26
|
+
puts 'Nothing to do here.'
|
27
|
+
puts '`tod add "name"` to create new todo.'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def add(todo)
|
32
|
+
File.open('.todfile', 'a') do |todfile|
|
33
|
+
todfile.puts '- ' + todo
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def done(todo)
|
38
|
+
if @todfile_exists
|
39
|
+
newlines = []
|
40
|
+
|
41
|
+
File.open('.todfile').each_line do |line|
|
42
|
+
unless line.include?(todo)
|
43
|
+
newlines << line.chomp
|
44
|
+
else
|
45
|
+
newlines << line.chomp.gsub(/\-/, '+')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
replace_todfile_with(newlines)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def clear_done
|
54
|
+
if @todfile_exists
|
55
|
+
newlines = []
|
56
|
+
|
57
|
+
File.open('.todfile').each_line do |line|
|
58
|
+
newlines << line unless line.chars.first == '+'
|
59
|
+
end
|
60
|
+
|
61
|
+
replace_todfile_with(newlines)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def replace_todfile_with(lines)
|
66
|
+
File.open('.todfile', 'w') do |todfile|
|
67
|
+
lines.each { |line| todfile.puts line }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
case @command
|
72
|
+
when nil
|
73
|
+
list
|
74
|
+
when 'all'
|
75
|
+
list 'all'
|
76
|
+
when 'finished'
|
77
|
+
list 'done'
|
78
|
+
when 'add'
|
79
|
+
@newtodo = ARGV[1]
|
80
|
+
add @newtodo
|
81
|
+
when 'done'
|
82
|
+
@query = ARGV[1]
|
83
|
+
done @query
|
84
|
+
when 'clear'
|
85
|
+
clear_done
|
86
|
+
end
|
data/tod-gem.gemspec
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'tod-gem'
|
3
|
+
s.version = '0.1'
|
4
|
+
s.summary = 'Simple command line todo manager'
|
5
|
+
s.authors = ['Michal Siwek']
|
6
|
+
s.email = 'mike21@aol.pl'
|
7
|
+
s.license = 'GPL-3.0'
|
8
|
+
s.files = `git ls-files`.split("\n")
|
9
|
+
s.executables << 'tod'
|
10
|
+
|
11
|
+
s.add_runtime_dependency 'colorize'
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tod-gem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michal Siwek
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description:
|
28
|
+
email: mike21@aol.pl
|
29
|
+
executables:
|
30
|
+
- tod
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- README.md
|
35
|
+
- bin/tod
|
36
|
+
- tod-gem.gemspec
|
37
|
+
homepage:
|
38
|
+
licenses:
|
39
|
+
- GPL-3.0
|
40
|
+
metadata: {}
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 2.1.10
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: Simple command line todo manager
|
61
|
+
test_files: []
|