tasky 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: db1582774b9884c7ef5c7cc69cf085c8c8284f10cd52ce71208c64b35520efbd
4
+ data.tar.gz: '09102a7245298415c46fb7d8e73c5ee3bc15b63903c01560cf4c187f28659d96'
5
+ SHA512:
6
+ metadata.gz: 884fe2c3ec87771fc07806d8e8d0d2394c4f3532e2995a10c9910154122a60b75f3b6ba5e792d78c1a2a38479522f45d2692787dc4999656f3dab6876fb8f215
7
+ data.tar.gz: c2eca28661889f0b00eae6f5c358e96742287163ff149dec372fc1502a6435bff168e7bb03e6fb3e24e1a2e4bbf6a0d1a70687d9517064ea635e67e03bbf9741
data/.gitignore ADDED
@@ -0,0 +1,57 @@
1
+ # files without extensions except directories
2
+ #*
3
+ #!/**/
4
+ #!?*.*
5
+
6
+ # directories
7
+ /.bundle
8
+ /_yardoc
9
+ /coverage
10
+ /doc
11
+ /pkg
12
+ /spec/reports
13
+ /tmp
14
+ /vendor
15
+
16
+ # files
17
+ *.dump
18
+ *.log
19
+ *.mod
20
+ *.o
21
+ *~
22
+ .*.swp
23
+ .DS_Store
24
+ .byebug
25
+ .idea
26
+ .project
27
+ .rake*
28
+ .rake*
29
+ .ruby-*
30
+ .rvmrc
31
+ .rubocop*
32
+ .secret
33
+ .yardoc
34
+ TODO.md
35
+ core.*
36
+ cscope.out
37
+ secrets.yml
38
+ .tags
39
+
40
+ # don't ignore
41
+ !.gitignore
42
+ !.keep
43
+ !Capfile
44
+ !Cheffile
45
+ !Gemfile
46
+ ![MR]akefile
47
+ !bin/**/[^.]*
48
+ !exe/**/[^.]*
49
+
50
+ /.bundle/
51
+ /.yardoc
52
+ /_yardoc/
53
+ /coverage/
54
+ /doc/
55
+ /pkg/
56
+ /spec/reports/
57
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.0
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in tasky.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,48 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ tasky (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ansi (1.5.0)
10
+ builder (3.2.4)
11
+ byebug (11.1.3)
12
+ minitest (5.14.3)
13
+ minitest-english (0.1.0)
14
+ minitest-fail-fast (0.1.0)
15
+ minitest (~> 5)
16
+ minitest-global_expectations (1.0.1)
17
+ minitest (> 5)
18
+ minitest-hooks (1.5.0)
19
+ minitest (> 5.3)
20
+ minitest-reporters (1.4.3)
21
+ ansi
22
+ builder
23
+ minitest (>= 5.0)
24
+ ruby-progressbar
25
+ minitest-sprint (1.2.1)
26
+ path_expander (~> 1.1)
27
+ path_expander (1.1.0)
28
+ rake (12.3.3)
29
+ ruby-progressbar (1.11.0)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ bundler
36
+ byebug
37
+ minitest (~> 5.0)
38
+ minitest-english
39
+ minitest-fail-fast
40
+ minitest-global_expectations
41
+ minitest-hooks
42
+ minitest-reporters
43
+ minitest-sprint
44
+ rake
45
+ tasky!
46
+
47
+ BUNDLED WITH
48
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 sergioro
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,21 @@
1
+
2
+ Create a task:
3
+
4
+ $ todo pay taxes before March
5
+
6
+ Print tasks:
7
+
8
+ $ todo -l
9
+ [ ] finish quarterly report
10
+ [ ] pay taxes before March
11
+
12
+
13
+ Print done tasks:
14
+
15
+ $ todo -d
16
+ [x] make a ruby gem
17
+ [x] call my pal Luis
18
+
19
+ Edit the todo list:
20
+
21
+ $ todo -e
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+ require 'rake/clean'
4
+
5
+ CLEAN.include ['**/.*.sw?', '**/*.gem', 'test/test.log']
6
+
7
+ task default: %i[test package]
8
+ task package: :clean
9
+
10
+ Rake::TestTask.new do |t|
11
+ t.libs << 'lib' << 'test'
12
+ t.test_files = FileList['test/**/*_test.rb']
13
+ t.warning = false
14
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "tasky"
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(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/todo ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
4
+
5
+ require "tasky"
6
+
7
+ Todo.start ARGV
data/lib/tasky.rb ADDED
@@ -0,0 +1,113 @@
1
+ $LOAD_PATH.unshift __dir__
2
+
3
+ require "tasky/version"
4
+ require "optparse"
5
+ require "fileutils"
6
+
7
+ module Todo
8
+ class Options
9
+ def self.parse(args)
10
+ options = {}
11
+
12
+ opt_parser = OptionParser.new do |opts|
13
+ opts.banner = "Usage: example.rb [options]"
14
+
15
+ opts.on("-l", "--list", "Print todo tasks") do
16
+ Todo.print_tasks
17
+ end
18
+
19
+ opts.on("-d", "--done", "Print done tasks") do
20
+ Todo.print_tasks(:done)
21
+ end
22
+
23
+ opts.on("-e", "--edit", "Edit tasks file") do
24
+ Todo.edit
25
+ end
26
+
27
+ opts.on_tail("-h", "--help", "Prints this help") do
28
+ puts opts
29
+ exit
30
+ end
31
+
32
+ opts.on_tail("-v", "--version", "Prints version") do
33
+ puts "todo #{VERSION}"
34
+ exit
35
+ end
36
+ end
37
+
38
+ opt_parser.parse!(args)
39
+ options
40
+ end
41
+ end
42
+
43
+ class << self
44
+ def start(args)
45
+ options = Options.parse args
46
+
47
+ @task = Task.new args
48
+
49
+ @task.save
50
+ end
51
+
52
+ def print_tasks(status = :todo)
53
+ pattern = status == :todo ? /^\[x/ : /^\[ /
54
+ File.open(Task.file).each_line do |l|
55
+ puts(l) unless l[pattern]
56
+ end
57
+ exit
58
+ end
59
+
60
+ def edit
61
+ exec("#{editor} #{Todo::Task.file}")
62
+ end
63
+
64
+ def editor
65
+ ENV['VISUAL'] || ENV['EDITOR'] || 'vim'
66
+ end
67
+
68
+ def help
69
+ puts 'Usage: todo [options] <args>'
70
+ exit
71
+ end
72
+
73
+ def version
74
+ VERSION
75
+ end
76
+ end
77
+
78
+ class Task
79
+ class InvalidStatus < StandardError; end
80
+
81
+ attr_accessor :message
82
+
83
+ def initialize(message)
84
+ Todo.help if message.empty?
85
+
86
+ @message = '[ ] ' + message.join(' ')
87
+
88
+ # make sure the file exists
89
+ FileUtils.touch(file)
90
+ end
91
+
92
+ def save
93
+ File.open(file, 'a') do |f|
94
+ f.puts message
95
+ end
96
+
97
+ File.size(file)
98
+ end
99
+
100
+ def size
101
+ message.size
102
+ end
103
+
104
+ def file
105
+ File.expand_path(File.join('~', '.todo'))
106
+ end
107
+
108
+ # wrapper to Task#file with a dummy task
109
+ def self.file
110
+ new([?.]).file
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,3 @@
1
+ module Todo
2
+ VERSION = "0.1.0"
3
+ end
data/tasky.gemspec ADDED
@@ -0,0 +1,40 @@
1
+ require_relative 'lib/tasky/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "tasky"
5
+ spec.version = Todo::VERSION
6
+ spec.authors = ["sergioro"]
7
+ spec.email = ["yo@sergioro.com"]
8
+
9
+ spec.summary = %q{TO DO}
10
+ spec.description = %q{TO DO}
11
+ #spec.homepage = "TODO TODO TODO"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ #spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
16
+
17
+ #spec.metadata["homepage_uri"] = spec.homepage
18
+ #spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
19
+ #spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency 'minitest', "~> 5.0"
31
+ spec.add_development_dependency 'minitest-sprint'
32
+ spec.add_development_dependency 'minitest-reporters'
33
+ spec.add_development_dependency 'minitest-english'
34
+ spec.add_development_dependency 'minitest-hooks'
35
+ spec.add_development_dependency 'minitest-fail-fast'
36
+ spec.add_development_dependency 'minitest-global_expectations'
37
+ spec.add_development_dependency 'bundler'
38
+ spec.add_development_dependency 'rake'
39
+ spec.add_development_dependency 'byebug'
40
+ end
metadata ADDED
@@ -0,0 +1,197 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tasky
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - sergioro
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-02-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest-sprint
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: minitest-reporters
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
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: minitest-english
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
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: minitest-hooks
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: minitest-fail-fast
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest-global_expectations
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: bundler
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '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'
139
+ - !ruby/object:Gem::Dependency
140
+ name: byebug
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: TO DO
154
+ email:
155
+ - yo@sergioro.com
156
+ executables:
157
+ - todo
158
+ extensions: []
159
+ extra_rdoc_files: []
160
+ files:
161
+ - ".gitignore"
162
+ - ".travis.yml"
163
+ - Gemfile
164
+ - Gemfile.lock
165
+ - LICENSE.txt
166
+ - README.md
167
+ - Rakefile
168
+ - bin/console
169
+ - bin/setup
170
+ - exe/todo
171
+ - lib/tasky.rb
172
+ - lib/tasky/version.rb
173
+ - tasky.gemspec
174
+ homepage:
175
+ licenses:
176
+ - MIT
177
+ metadata: {}
178
+ post_install_message:
179
+ rdoc_options: []
180
+ require_paths:
181
+ - lib
182
+ required_ruby_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: 2.3.0
187
+ required_rubygems_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ requirements: []
193
+ rubygems_version: 3.1.4
194
+ signing_key:
195
+ specification_version: 4
196
+ summary: TO DO
197
+ test_files: []