todolist 0.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/todo +5 -0
- data/lib/todo.rb +185 -0
- data/lib/todo/version.rb +3 -0
- data/todolist.gemspec +22 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 76d17823ffe89e5cf27f88367db7705d774055b4
|
4
|
+
data.tar.gz: 2f5545c43c0effa991189e4deb69a57db3a16598
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4dcdc0298662064bc52a81403f6847648207b411cc2e00dd58802ca6c5233eeafd0e122ae50a760ef5eba9839d428bbed04c004f82c98db49eee63ef41ebcb44
|
7
|
+
data.tar.gz: 0e0c66d517525d5c2bccf8d8dfd1d03194657819cb84053d03c7a203a31c2ffa922c1bbf6e5d2a8e54a6dae2ddbfa585eb69e481a224e3104e01006432d5a2d7
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at ytbryan@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Todo
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/todo`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'todo'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install todo
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/todo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "todo"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/bin/todo
ADDED
data/lib/todo.rb
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
require "todo/version"
|
2
|
+
require "fileutils"
|
3
|
+
require "thor"
|
4
|
+
require "date"
|
5
|
+
|
6
|
+
module Todo
|
7
|
+
class Base < Thor
|
8
|
+
check_unknown_options!
|
9
|
+
package_name 'todo'
|
10
|
+
default_task :show
|
11
|
+
map 'g' => :generate,
|
12
|
+
'd' => :destroy,
|
13
|
+
'f' => :find
|
14
|
+
|
15
|
+
desc :complete, 'mark a task complete'
|
16
|
+
method_option :all, type: :string, aliases: '-a'
|
17
|
+
def complete name
|
18
|
+
#if option[:all] then remove all the files
|
19
|
+
#-------
|
20
|
+
#either the name or the number
|
21
|
+
#move the folder to completed
|
22
|
+
#write the complete date
|
23
|
+
end
|
24
|
+
|
25
|
+
desc :show, 'show task'
|
26
|
+
def show name=nil
|
27
|
+
allfiles = Dir.glob("#{Dir.home}/.todo/tasks/*.todo")
|
28
|
+
if allfiles.count == 0
|
29
|
+
puts "\nNothing to show. You have 0 items."
|
30
|
+
puts "ALL DONE. WELL DONE. 🙌🤗"
|
31
|
+
else
|
32
|
+
puts "\nYou have #{allfiles.count} items to complete."
|
33
|
+
end
|
34
|
+
# puts "---"
|
35
|
+
# puts "Last item was added 17 hours 20 minute ago. And you added approximately 10 items."
|
36
|
+
# puts "There is a total 10 items. You have done 4 items in the last 1 hour. You have 16 uncomplete tasks."
|
37
|
+
# puts "Total: 10 uncompleted items."
|
38
|
+
# puts "---"
|
39
|
+
puts "----"
|
40
|
+
|
41
|
+
allfiles.each_with_index do |value, index|
|
42
|
+
well = File.basename(value, ".todo")
|
43
|
+
# puts data = well.match(/([a-z 0-9]*-)*/)
|
44
|
+
data = get_name(well)
|
45
|
+
number = well.match(/-[0-9]+/)
|
46
|
+
# well = File.basename(value, ".todo")
|
47
|
+
final = data.to_s.gsub("-", " ") if value != nil
|
48
|
+
|
49
|
+
puts "[TODO] #{index+1}. #{final} " #{return_time_stamp(number.to_s.gsub("-",""))} !!!"
|
50
|
+
# puts "#{index+2}. #{File.basename(value, ".todo")} 2 days ago !!!"
|
51
|
+
end
|
52
|
+
puts "----"
|
53
|
+
# puts "Last item was added 3 days ago."
|
54
|
+
# puts "Type `todo complete task_name` to remove the task"
|
55
|
+
# puts "No tasks. Type `todo generate task_name` to generate one" if allfiles.count == 0
|
56
|
+
# puts "---"
|
57
|
+
# puts "Thank you for using Todo List. There is a paid minimalistic web version that I invite you to try out. http://todo-list.net"
|
58
|
+
end
|
59
|
+
|
60
|
+
desc :destroy, 'destroy a task'
|
61
|
+
method_option :all, type: :string, aliases: '-a'
|
62
|
+
method_option :name, type: :string, aliases: '-n'
|
63
|
+
|
64
|
+
def destroy name=nil
|
65
|
+
destination = "#{Dir.home}/.todo/everything/"
|
66
|
+
origin = "#{Dir.home}/.todo/tasks/"
|
67
|
+
|
68
|
+
if options[:name] == nil
|
69
|
+
array = Dir.glob(File.join(origin, '*.todo'))
|
70
|
+
file = array[name.to_i-1]
|
71
|
+
puts file
|
72
|
+
FileUtils.move file, File.join(destination, "1-#{File.basename(file)}")
|
73
|
+
else #if options[:name] is not nil
|
74
|
+
if options[:all] != nil
|
75
|
+
Dir.glob(File.join(origin, '*.todo')).each do |file|
|
76
|
+
if File.exists? File.join(destination, File.basename(file))
|
77
|
+
FileUtils.move file, File.join(destination, "1-#{File.basename(file)}")
|
78
|
+
else
|
79
|
+
FileUtils.move file, File.join(destination, File.basename(file))
|
80
|
+
end
|
81
|
+
end
|
82
|
+
puts "Destroy all. Done."
|
83
|
+
else
|
84
|
+
#if name is number, then okay, if not number
|
85
|
+
allfiles = Dir.glob("#{Dir.home}/.todo/tasks/*.todo")
|
86
|
+
counter = false
|
87
|
+
well = ""
|
88
|
+
allfiles.each do |value|
|
89
|
+
# puts well = File.basename(value, ".todo")
|
90
|
+
# puts value = well.match(/([a-z 0-9]*-)*/)
|
91
|
+
# puts number = well.match(/-[0-9]+/)
|
92
|
+
# puts final = value.to_s.gsub("-", " ") if value != nil
|
93
|
+
if name.strip == final.strip
|
94
|
+
FileUtils.rm "#{Dir.home}/.todo/tasks/#{well}.todo"
|
95
|
+
puts "great, i deleted something"
|
96
|
+
counter = true
|
97
|
+
end
|
98
|
+
end
|
99
|
+
if counter == false
|
100
|
+
puts "nothing deleted because nothing is found."
|
101
|
+
else
|
102
|
+
puts "#{Dir.home}/.todo/tasks/#{well}.todo deleted."
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end #if name
|
106
|
+
end
|
107
|
+
|
108
|
+
desc :generate, 'generate a task'
|
109
|
+
def generate desc
|
110
|
+
fingerprint = Time.now.to_i #1 #use time and hash
|
111
|
+
name = "#{desc.gsub(" ","-").downcase}-#{fingerprint}"
|
112
|
+
FileUtils.touch "#{Dir.home}/.todo/tasks/#{name}.todo"
|
113
|
+
end
|
114
|
+
|
115
|
+
desc :find, 'find a task'
|
116
|
+
def find
|
117
|
+
puts "find a task"
|
118
|
+
end
|
119
|
+
|
120
|
+
# desc :formula, 'do we need formula for repeated tasks'
|
121
|
+
# def formula
|
122
|
+
# puts "do we need formula for repeated tasks"
|
123
|
+
# end
|
124
|
+
|
125
|
+
# desc :repeat, 'repeated tasks'
|
126
|
+
# def repeat
|
127
|
+
# puts "repeated task"
|
128
|
+
# end
|
129
|
+
#
|
130
|
+
# desc :month, 'month'
|
131
|
+
# def month
|
132
|
+
# puts "month"
|
133
|
+
# end
|
134
|
+
#
|
135
|
+
# desc :today, 'today'
|
136
|
+
# def today
|
137
|
+
# puts "today"
|
138
|
+
# end
|
139
|
+
#
|
140
|
+
# desc :week, 'this week'
|
141
|
+
# def week
|
142
|
+
# puts "this week"
|
143
|
+
# end
|
144
|
+
#
|
145
|
+
# desc :stat, 'stat'
|
146
|
+
# def stat
|
147
|
+
# puts "stat"
|
148
|
+
# end
|
149
|
+
|
150
|
+
|
151
|
+
# desc :tags, 'find a tags'
|
152
|
+
# def tags
|
153
|
+
# puts "find a tags"
|
154
|
+
# end
|
155
|
+
|
156
|
+
|
157
|
+
# desc :later, 'do later'
|
158
|
+
# def later
|
159
|
+
# puts "doing later"
|
160
|
+
# end
|
161
|
+
#
|
162
|
+
# desc :ing, 'currently doing'
|
163
|
+
# def ing *tasks
|
164
|
+
# puts "#{tasks}"
|
165
|
+
# end
|
166
|
+
|
167
|
+
private
|
168
|
+
|
169
|
+
def get_name str
|
170
|
+
index = str.rindex(/-/) if str !=nil
|
171
|
+
index != nil ? answer = str[0,index] : answer = nil
|
172
|
+
return answer
|
173
|
+
end
|
174
|
+
|
175
|
+
def setup
|
176
|
+
#~/.todo
|
177
|
+
end
|
178
|
+
|
179
|
+
def return_time_stamp unix_int
|
180
|
+
data = DateTime.strptime(unix_int,'%s')
|
181
|
+
return " #{data.to_s} sec ago"
|
182
|
+
end
|
183
|
+
|
184
|
+
end
|
185
|
+
end
|
data/lib/todo/version.rb
ADDED
data/todolist.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'todo/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "todolist"
|
8
|
+
spec.version = Todo::VERSION
|
9
|
+
spec.authors = ["Bryan Lim"]
|
10
|
+
spec.email = ["ytbryan@gmail.com"]
|
11
|
+
spec.summary = %q{a simple todo list ✅ on your terminal}
|
12
|
+
spec.description = %q{a simple todo list ✅ on your terminal}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.executables = ["todo"]
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: todolist
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.pre
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bryan Lim
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-23 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.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: a simple todo list ✅ on your terminal
|
42
|
+
email:
|
43
|
+
- ytbryan@gmail.com
|
44
|
+
executables:
|
45
|
+
- todo
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- CODE_OF_CONDUCT.md
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- bin/console
|
56
|
+
- bin/setup
|
57
|
+
- bin/todo
|
58
|
+
- lib/todo.rb
|
59
|
+
- lib/todo/version.rb
|
60
|
+
- todolist.gemspec
|
61
|
+
homepage: ''
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 1.3.1
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.5.1
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: a simple todo list ✅ on your terminal
|
85
|
+
test_files: []
|