micro_manager 1.0.0
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/.github/workflows/main.yml +22 -0
- data/.gitignore +15 -0
- data/.rspec +3 -0
- data/.rubocop.yml +23 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +0 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +80 -0
- data/LICENSE +21 -0
- data/README.md +43 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/exe/just +14 -0
- data/lib/cli.rb +16 -0
- data/lib/cli/add_task.rb +20 -0
- data/lib/cli/command_builder.rb +46 -0
- data/lib/cli/complete_task.rb +28 -0
- data/lib/cli/list_tasks.rb +26 -0
- data/lib/cli/relative_date.rb +32 -0
- data/lib/cli/result.rb +19 -0
- data/lib/cli/show_help.rb +19 -0
- data/lib/micro_manager.rb +13 -0
- data/lib/micro_manager/config.rb +11 -0
- data/lib/micro_manager/persistence.rb +24 -0
- data/lib/micro_manager/schedule.rb +25 -0
- data/lib/micro_manager/task.rb +26 -0
- data/lib/micro_manager/version.rb +5 -0
- data/micro_manager.gemspec +32 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f01d3a2b0ca42701e6db6495bde53401187fb9e88642036e174dbb2aba5ec01c
|
4
|
+
data.tar.gz: 7e0c1aa8fdadc1758a874f7f883bfaf5d47b568dd7c092cb481f3d5569217178
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4f5b6062a84749f6595717ad23ae0aaf4be72e2ba90e1cc706659627391320eada050dc8e568a21d96b4cf11e8105e6933df8ec1dedd78248f30b9617d7f29cb
|
7
|
+
data.tar.gz: d6a55e88eac46618e317e67a1605f68ee6d17def31aa55b3e972217a3f710e7f4dbb878555556bbf1dcf2a01aef2463baae9e44bc7e2f550ea86a007ccd2ed05
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push,pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- name: Set up Ruby
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 3.0.0
|
14
|
+
- name: Install gems
|
15
|
+
run: |
|
16
|
+
gem install bundler -v 2.2.3
|
17
|
+
bundle install
|
18
|
+
- name: Run Rubocop
|
19
|
+
run: bundle exec rubocop
|
20
|
+
- name: Run tests
|
21
|
+
run: |
|
22
|
+
bundle exec rspec
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
|
4
|
+
Layout/LineLength:
|
5
|
+
Max: 200
|
6
|
+
Style/StringLiterals:
|
7
|
+
EnforcedStyle: double_quotes
|
8
|
+
Style/Documentation:
|
9
|
+
Enabled: false
|
10
|
+
Style/AccessModifierDeclarations:
|
11
|
+
Enabled: false
|
12
|
+
Metrics/BlockLength:
|
13
|
+
Exclude:
|
14
|
+
- 'spec/**/*_spec.rb'
|
15
|
+
Lint/UnusedMethodArgument:
|
16
|
+
AllowUnusedKeywordArguments: true
|
17
|
+
IgnoreNotImplementedMethods: true
|
18
|
+
Gemspec/RequiredRubyVersion:
|
19
|
+
Enabled: false
|
20
|
+
Metrics/AbcSize:
|
21
|
+
Enabled: false
|
22
|
+
Metrics/MethodLength:
|
23
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-3.0.0
|
data/CHANGELOG.md
ADDED
File without changes
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
micro_manager (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.1)
|
10
|
+
diff-lcs (1.4.4)
|
11
|
+
parallel (1.20.1)
|
12
|
+
parser (3.0.0.0)
|
13
|
+
ast (~> 2.4.1)
|
14
|
+
pastel (0.8.0)
|
15
|
+
tty-color (~> 0.5)
|
16
|
+
rainbow (3.0.0)
|
17
|
+
rake (13.0.3)
|
18
|
+
regexp_parser (2.0.3)
|
19
|
+
rexml (3.2.4)
|
20
|
+
rspec (3.10.0)
|
21
|
+
rspec-core (~> 3.10.0)
|
22
|
+
rspec-expectations (~> 3.10.0)
|
23
|
+
rspec-mocks (~> 3.10.0)
|
24
|
+
rspec-core (3.10.1)
|
25
|
+
rspec-support (~> 3.10.0)
|
26
|
+
rspec-expectations (3.10.1)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.10.0)
|
29
|
+
rspec-mocks (3.10.1)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.10.0)
|
32
|
+
rspec-support (3.10.1)
|
33
|
+
rubocop (1.7.0)
|
34
|
+
parallel (~> 1.10)
|
35
|
+
parser (>= 2.7.1.5)
|
36
|
+
rainbow (>= 2.2.2, < 4.0)
|
37
|
+
regexp_parser (>= 1.8, < 3.0)
|
38
|
+
rexml
|
39
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
40
|
+
ruby-progressbar (~> 1.7)
|
41
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
42
|
+
rubocop-ast (1.4.0)
|
43
|
+
parser (>= 2.7.1.5)
|
44
|
+
ruby-progressbar (1.11.0)
|
45
|
+
strings (0.2.0)
|
46
|
+
strings-ansi (~> 0.2)
|
47
|
+
unicode-display_width (~> 1.5)
|
48
|
+
unicode_utils (~> 1.4)
|
49
|
+
strings-ansi (0.2.0)
|
50
|
+
tty-color (0.6.0)
|
51
|
+
tty-cursor (0.7.1)
|
52
|
+
tty-prompt (0.23.0)
|
53
|
+
pastel (~> 0.8)
|
54
|
+
tty-reader (~> 0.8)
|
55
|
+
tty-reader (0.9.0)
|
56
|
+
tty-cursor (~> 0.7)
|
57
|
+
tty-screen (~> 0.8)
|
58
|
+
wisper (~> 2.0)
|
59
|
+
tty-screen (0.8.1)
|
60
|
+
tty-table (0.12.0)
|
61
|
+
pastel (~> 0.8)
|
62
|
+
strings (~> 0.2.0)
|
63
|
+
tty-screen (~> 0.8)
|
64
|
+
unicode-display_width (1.7.0)
|
65
|
+
unicode_utils (1.4.0)
|
66
|
+
wisper (2.0.1)
|
67
|
+
|
68
|
+
PLATFORMS
|
69
|
+
x86_64-darwin-18
|
70
|
+
|
71
|
+
DEPENDENCIES
|
72
|
+
micro_manager!
|
73
|
+
rake (~> 13.0)
|
74
|
+
rspec (~> 3.0)
|
75
|
+
rubocop (~> 1.7)
|
76
|
+
tty-prompt (~> 0.23.0)
|
77
|
+
tty-table (~> 0.12.0)
|
78
|
+
|
79
|
+
BUNDLED WITH
|
80
|
+
2.2.3
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Bruno Vezoli
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# MicroManager
|
2
|
+
|
3
|
+
This gems is aimed at improving productivity by allowing to create quick TO-DO tasks from the terminal.
|
4
|
+
The name is a pun on [micro-management](https://en.wikipedia.org/wiki/Micromanagement) and it's usage is also inspired on
|
5
|
+
a word they usually say a lot "Just do this feature, it should be easy", "Oh, it's just a text change. It shouldn't take long"
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install it as:
|
10
|
+
|
11
|
+
$ gem install micro_manager
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
MicroManager adds a `just` command, which can be used to add tasks like:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
$ just Add what you want to do --due 1-week # you can also use a date or leave it blank to default to today
|
19
|
+
```
|
20
|
+
|
21
|
+
List tasks:
|
22
|
+
|
23
|
+
```bash
|
24
|
+
$ just --list-tasks # or -l
|
25
|
+
```
|
26
|
+
|
27
|
+
And finally complete tasks:
|
28
|
+
|
29
|
+
```bash
|
30
|
+
$ just --complete-task
|
31
|
+
```
|
32
|
+
|
33
|
+
For more detail run `just --help`
|
34
|
+
|
35
|
+
## Development
|
36
|
+
|
37
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
38
|
+
|
39
|
+
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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/brunvez/micro_manager.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "micro_manager"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/just
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "../lib/cli"
|
5
|
+
|
6
|
+
config = MicroManager::Config.new
|
7
|
+
persistence = MicroManager::Persistence.new(config)
|
8
|
+
schedule = persistence.recover || MicroManager::Schedule.new
|
9
|
+
|
10
|
+
command = MicroManager::CLI::CommandBuilder.new.build(ARGV)
|
11
|
+
result = command.run(schedule: schedule)
|
12
|
+
print result.render
|
13
|
+
|
14
|
+
persistence.save(schedule)
|
data/lib/cli.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tty-table"
|
4
|
+
require_relative "micro_manager"
|
5
|
+
require_relative "cli/relative_date"
|
6
|
+
require_relative "cli/command_builder"
|
7
|
+
require_relative "cli/result"
|
8
|
+
require_relative "cli/add_task"
|
9
|
+
require_relative "cli/list_tasks"
|
10
|
+
require_relative "cli/complete_task"
|
11
|
+
require_relative "cli/show_help"
|
12
|
+
|
13
|
+
module MicroManager
|
14
|
+
module CLI
|
15
|
+
end
|
16
|
+
end
|
data/lib/cli/add_task.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MicroManager
|
4
|
+
module CLI
|
5
|
+
class AddTask
|
6
|
+
private attr_reader :description, :due
|
7
|
+
|
8
|
+
def initialize(description:, due: Date.today)
|
9
|
+
@description = description
|
10
|
+
@due = due
|
11
|
+
end
|
12
|
+
|
13
|
+
def run(schedule:)
|
14
|
+
schedule.add_task(description: description, due: due)
|
15
|
+
|
16
|
+
Result.new { "Task added successfully" }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "optparse"
|
4
|
+
|
5
|
+
module MicroManager
|
6
|
+
module CLI
|
7
|
+
class CommandBuilder
|
8
|
+
def build(input)
|
9
|
+
params = parse_input(input)
|
10
|
+
|
11
|
+
if params[:help]
|
12
|
+
ShowHelp.new(parser)
|
13
|
+
elsif params[:"complete-task"]
|
14
|
+
CompleteTask.new
|
15
|
+
elsif params[:"list-tasks"] || params[:rest].empty?
|
16
|
+
ListTasks.new
|
17
|
+
else
|
18
|
+
task = { description: params[:rest].join(" ") }
|
19
|
+
task.merge!(due: params[:due]) if params[:due]
|
20
|
+
AddTask.new(**task)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def parse_input(input)
|
27
|
+
params = {}
|
28
|
+
rest = parser.parse(input, into: params)
|
29
|
+
|
30
|
+
params.merge(rest: rest)
|
31
|
+
end
|
32
|
+
|
33
|
+
def parser
|
34
|
+
OptionParser.new do |opts|
|
35
|
+
opts.accept(RelativeDate) do |date|
|
36
|
+
RelativeDate.parse(date)
|
37
|
+
end
|
38
|
+
opts.on("-d", "--due [DATE]", RelativeDate, "Date to which the task is due, defaults to Date.today. Supports relative dates (e.g. 1-day, 2-weeks, etc)")
|
39
|
+
opts.on("-c", "--complete-task", "Prompts on a task to mark as completed")
|
40
|
+
opts.on("-l", "--list-tasks", "Lists all due tasks and tasks completed today")
|
41
|
+
opts.on("-h", "--help", "Prints this help")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tty-prompt"
|
4
|
+
|
5
|
+
module MicroManager
|
6
|
+
module CLI
|
7
|
+
class CompleteTask
|
8
|
+
private attr_reader :prompt
|
9
|
+
|
10
|
+
def initialize(prompt: TTY::Prompt.new)
|
11
|
+
@prompt = prompt
|
12
|
+
end
|
13
|
+
|
14
|
+
def run(schedule:)
|
15
|
+
tasks = schedule.outstanding_tasks
|
16
|
+
options = tasks.map { |task| { task.description => task } }
|
17
|
+
options << { "Exit" => nil }
|
18
|
+
|
19
|
+
Result.new do
|
20
|
+
task = prompt.select("Complete task", options)
|
21
|
+
task&.complete
|
22
|
+
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MicroManager
|
4
|
+
module CLI
|
5
|
+
class ListTasks
|
6
|
+
def run(schedule:)
|
7
|
+
tasks = schedule.outstanding_tasks + schedule.tasks_completed(on: Date.today)
|
8
|
+
rows = tasks.map { |task| task_row(task) }
|
9
|
+
table = TTY::Table.new(header: ["", "Description", "Due"], rows: rows)
|
10
|
+
renderer = TTY::Table::Renderer::Unicode.new(table, padding: [0, 1])
|
11
|
+
|
12
|
+
Result.new { renderer.render }
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def task_row(task)
|
18
|
+
[
|
19
|
+
task.completed? ? "[X]" : "[ ]",
|
20
|
+
task.description,
|
21
|
+
task.due.to_s
|
22
|
+
]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MicroManager
|
4
|
+
module CLI
|
5
|
+
class RelativeDate
|
6
|
+
def self.parse(string, *args)
|
7
|
+
date = parse_relative_date(string)
|
8
|
+
return date if date
|
9
|
+
|
10
|
+
Date.parse(string, *args)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.parse_relative_date(string)
|
14
|
+
regex = /(?<n>\d+)-(?<modifier>day|week|month)/
|
15
|
+
matches = string.match(regex)
|
16
|
+
return unless matches
|
17
|
+
|
18
|
+
Date.today + date_offset(matches[:n], matches[:modifier])
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.date_offset(num, modifier)
|
22
|
+
modifier_days = {
|
23
|
+
"day" => 1,
|
24
|
+
"week" => 7,
|
25
|
+
"month" => 30
|
26
|
+
}
|
27
|
+
|
28
|
+
num.to_i * modifier_days[modifier]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/cli/result.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MicroManager
|
4
|
+
module CLI
|
5
|
+
class Result
|
6
|
+
private attr_reader :render_block
|
7
|
+
|
8
|
+
def initialize(&block)
|
9
|
+
raise ArgumentError, "A block is required" unless block_given?
|
10
|
+
|
11
|
+
@render_block = block
|
12
|
+
end
|
13
|
+
|
14
|
+
def render
|
15
|
+
@render_block.call
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MicroManager
|
4
|
+
module CLI
|
5
|
+
class ShowHelp
|
6
|
+
private attr_reader :parser
|
7
|
+
|
8
|
+
def initialize(parser)
|
9
|
+
@parser = parser
|
10
|
+
end
|
11
|
+
|
12
|
+
def run(schedule:)
|
13
|
+
parser.banner = "Usage: just [task-description] [options]"
|
14
|
+
|
15
|
+
parser.help
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require_relative "micro_manager/version"
|
5
|
+
require_relative "micro_manager/schedule"
|
6
|
+
require_relative "micro_manager/task"
|
7
|
+
require_relative "micro_manager/persistence"
|
8
|
+
require_relative "micro_manager/config"
|
9
|
+
|
10
|
+
module MicroManager
|
11
|
+
class Error < StandardError; end
|
12
|
+
# Your code goes here...
|
13
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
|
5
|
+
module MicroManager
|
6
|
+
class Persistence
|
7
|
+
private attr_reader :config
|
8
|
+
|
9
|
+
def initialize(config)
|
10
|
+
@config = config
|
11
|
+
end
|
12
|
+
|
13
|
+
def save(schedule, serializer: YAML, writer: File)
|
14
|
+
file = config.save_location
|
15
|
+
serialized_schedule = serializer.dump(schedule)
|
16
|
+
writer.write(file, serialized_schedule)
|
17
|
+
end
|
18
|
+
|
19
|
+
def recover(serializer: YAML, reader: File)
|
20
|
+
content = reader.read(config.save_location)
|
21
|
+
serializer.load(content)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MicroManager
|
4
|
+
class Schedule
|
5
|
+
private attr_reader :tasks
|
6
|
+
|
7
|
+
def initialize(tasks: [])
|
8
|
+
@tasks = tasks
|
9
|
+
end
|
10
|
+
|
11
|
+
def add_task(description:, due:)
|
12
|
+
tasks << Task.new(description: description, due: due)
|
13
|
+
end
|
14
|
+
|
15
|
+
def outstanding_tasks
|
16
|
+
tasks
|
17
|
+
.reject(&:completed?)
|
18
|
+
.sort_by(&:due)
|
19
|
+
end
|
20
|
+
|
21
|
+
def tasks_completed(on:)
|
22
|
+
tasks.select { |task| task.completed? && task.completed_on == on }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MicroManager
|
4
|
+
class Task
|
5
|
+
attr_reader :description, :due, :completed_on
|
6
|
+
|
7
|
+
def initialize(description:, due:)
|
8
|
+
@description = description
|
9
|
+
@due = due
|
10
|
+
@completed = false
|
11
|
+
end
|
12
|
+
|
13
|
+
def complete
|
14
|
+
@completed = true
|
15
|
+
@completed_on = Date.today
|
16
|
+
end
|
17
|
+
|
18
|
+
def completed?
|
19
|
+
@completed
|
20
|
+
end
|
21
|
+
|
22
|
+
def ==(other)
|
23
|
+
description == other.description && completed? == other.completed?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/micro_manager/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "micro_manager"
|
7
|
+
spec.version = MicroManager::VERSION
|
8
|
+
spec.authors = ["Bruno Vezoli"]
|
9
|
+
spec.email = ["brunvez@gmail.com"]
|
10
|
+
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
13
|
+
spec.summary = "A utility to help get shit done"
|
14
|
+
spec.description = "A glorified TO-DO list with a couple of useful commands"
|
15
|
+
spec.homepage = "https://github.com/brunvez/micro_manager"
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
17
|
+
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/brunvez/micro_manager"
|
20
|
+
spec.metadata["changelog_uri"] = "https://github.com/brunvez/micro_manager/blob/master/CHANGELOG.md"
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_development_dependency "rubocop", "~> 1.7"
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: micro_manager
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bruno Vezoli
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubocop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
description: A glorified TO-DO list with a couple of useful commands
|
28
|
+
email:
|
29
|
+
- brunvez@gmail.com
|
30
|
+
executables:
|
31
|
+
- just
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- ".github/workflows/main.yml"
|
36
|
+
- ".gitignore"
|
37
|
+
- ".rspec"
|
38
|
+
- ".rubocop.yml"
|
39
|
+
- ".ruby-version"
|
40
|
+
- CHANGELOG.md
|
41
|
+
- Gemfile
|
42
|
+
- Gemfile.lock
|
43
|
+
- LICENSE
|
44
|
+
- README.md
|
45
|
+
- Rakefile
|
46
|
+
- bin/console
|
47
|
+
- bin/setup
|
48
|
+
- exe/just
|
49
|
+
- lib/cli.rb
|
50
|
+
- lib/cli/add_task.rb
|
51
|
+
- lib/cli/command_builder.rb
|
52
|
+
- lib/cli/complete_task.rb
|
53
|
+
- lib/cli/list_tasks.rb
|
54
|
+
- lib/cli/relative_date.rb
|
55
|
+
- lib/cli/result.rb
|
56
|
+
- lib/cli/show_help.rb
|
57
|
+
- lib/micro_manager.rb
|
58
|
+
- lib/micro_manager/config.rb
|
59
|
+
- lib/micro_manager/persistence.rb
|
60
|
+
- lib/micro_manager/schedule.rb
|
61
|
+
- lib/micro_manager/task.rb
|
62
|
+
- lib/micro_manager/version.rb
|
63
|
+
- micro_manager.gemspec
|
64
|
+
homepage: https://github.com/brunvez/micro_manager
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata:
|
68
|
+
homepage_uri: https://github.com/brunvez/micro_manager
|
69
|
+
source_code_uri: https://github.com/brunvez/micro_manager
|
70
|
+
changelog_uri: https://github.com/brunvez/micro_manager/blob/master/CHANGELOG.md
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 2.3.0
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubygems_version: 3.2.3
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: A utility to help get shit done
|
90
|
+
test_files: []
|