worque 0.1.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 567433182ef250050cd55e4142292a4e5c583aea
4
+ data.tar.gz: 56a867bb80135417507a4b81808965d56d26f172
5
+ SHA512:
6
+ metadata.gz: 19ac08d6b0f7815b4e8390a4b2c14655378e45ca822088885310af3c88fe16dfb142f66bec665427956b269d8d4e7dfa43cedca289196ed4ddd666c8feaa9a59
7
+ data.tar.gz: f4171311af2b16fab768588ba4d692e57633dbd1fa3fb46fe3c06a35e3f3a6b67ab2dd65e44008fe296e0b3c5f0cada01e57b2afee5bf270cca2c9f6bc939747
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Cam Huynh
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,119 @@
1
+ # Worque
2
+
3
+ Worque is a CLI which is helpful to manage your daily notes.
4
+
5
+ * Ever stunned when your boss suddenly asked what you've done yesterday?
6
+ * Wanna check/note your daily tasks without exiting your favourite editor `VIM`?
7
+ * Something to report on daily stand-ups?
8
+
9
+ Then worque is definitely a right tool for you!
10
+
11
+ ## Installation
12
+
13
+ **DO NOT add this to your Gemfile**
14
+
15
+ Install it by
16
+
17
+ $ gem install worque
18
+
19
+ ## Quick start guide
20
+
21
+ ### CLI
22
+
23
+ #### `worque todo`
24
+
25
+ Add this to your `.bash_profile`
26
+
27
+ ```sh
28
+ export WORQUE_PATH='/path/to/your/notes'
29
+ ```
30
+
31
+ I often map it to my Dropbox like this
32
+
33
+ ```sh
34
+ export WORQUE_PATH='~/Dropbox/Notes/Todos'
35
+ ```
36
+
37
+ Then executing the command below will create a today's note for you
38
+
39
+ ```sh
40
+ worque todo --for today
41
+ # ~/notes/notes-2016-07-19.md
42
+ ```
43
+
44
+ Or look back what's done yesterday.
45
+
46
+ ```sh
47
+ workque todo --for=yesterday
48
+ # ~/notes/checklist-2016-07-18.md
49
+ # This will jump back to Friday's note if it's Monday today!
50
+ ```
51
+
52
+ If you're kind of nerd and you have no life. You would rather work over the weekend than hanging out with folks, so you should enable the **hardcore** mode which will stop skipping weekend for you.
53
+
54
+ ```sh
55
+ worque todo --for yesterday --no-skip-weekend
56
+ ```
57
+
58
+ You can also explicitly specify the file path
59
+
60
+ ```sh
61
+ worque todo --for today --path ~/path/to/your/notes
62
+ ```
63
+
64
+ It's chain-able with other commands
65
+
66
+ ```sh
67
+ vim worque
68
+ vim $(worque todo --for yesterday)
69
+ cat $(worque todo --for=yesterday) | grep pending
70
+ ```
71
+
72
+ Personally I alias it like `today` like this, so vim will automatically open the
73
+ file when I type `today`
74
+
75
+ ```sh
76
+ alias today="vim $(worque todo) +':cd $WORQUE_PATH'"
77
+ alias ytd="vim $(worque todo) +':cd $WORQUE_PATH'"
78
+ ```
79
+
80
+ ### VIM Integration
81
+
82
+ Add this to your VIM plugin manager
83
+
84
+ ```viml
85
+ Plug 'huynhquancam/vim-worque'
86
+ ```
87
+
88
+ Then `:TD`, `:YTD` for today and yesterday's notes respectively.
89
+
90
+ Read more about [vim-worque](https://github.com/huynhquancam/vim-worque).
91
+
92
+ View more in my [dotfiles](https://github.com/huynhquancam/dotfiles)
93
+
94
+ ## Development
95
+
96
+ ```sh
97
+ bundle install
98
+ bundle exec rake test
99
+ ```
100
+
101
+ ## To be implemented
102
+
103
+ Something in my plan:
104
+
105
+ * Test suites: Embarrassingly there's no test currently, but this will be my
106
+ first priority.
107
+ * `worque list`: List all notes you have.
108
+ * `worque push`: Push your daily notes to your specified Slack channel.
109
+ * `worque changelog`: Sync your Git commits to daily notes.
110
+
111
+ ## Contributing
112
+
113
+ Bug reports and pull requests are welcome on GitHub at https://github.com/huynhquancam/worque.
114
+
115
+ ## License
116
+
117
+ The gem is available as open source under the terms of the
118
+ [MIT License](http://opensource.org/licenses/MIT).
119
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "worque"
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/worque ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'worque'
5
+
6
+ Worque::CLI.start
7
+
data/lib/worque/cli.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'thor'
2
+ require 'worque/command/todo'
3
+ require 'worque/command/todo/options'
4
+
5
+ module Worque
6
+ class CLI < ::Thor
7
+ desc 'todo', 'Make a todo'
8
+
9
+ method_option :for, force: false, type: :string, enum: ['today', 'yesterday'], default: 'today'
10
+ method_option :skip_weekend, force: false, type: :boolean, default: true
11
+ method_option :path, force: false, type: :string, default: ENV['WORQUE_PATH']
12
+
13
+ def todo
14
+ $stdout.puts Worque::Command::Todo.run(options)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ require 'optparse'
2
+ require 'pathname'
3
+
4
+ module Worque
5
+ module Command
6
+ class Todo::Options
7
+ attr_accessor :path
8
+ attr_accessor :for
9
+ attr_writer :skip_weekend
10
+
11
+ def initialize(opts)
12
+ @path = opts[:path]
13
+ @skip_weekend = opts[:skip_weekend]
14
+ @for = opts[:for]
15
+ end
16
+
17
+ def skip_weekend?
18
+ !!@skip_weekend
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,44 @@
1
+ require 'worque/utils/command'
2
+ require 'worque/utils/business_day'
3
+ require 'date'
4
+
5
+ module Worque
6
+ module Command
7
+ class Todo
8
+ def initialize(options)
9
+ @options = options
10
+ end
11
+
12
+ def call
13
+ Worque::Utils::Command.mkdir(options.path)
14
+
15
+ filename(date_for).tap do |f|
16
+ Worque::Utils::Command.touch f
17
+ end
18
+ end
19
+
20
+ def self.run(options)
21
+ Worque::Command::Todo.new(
22
+ Worque::Command::Todo::Options.new(options)
23
+ ).call()
24
+ end
25
+
26
+ private
27
+
28
+ attr_reader :options
29
+
30
+ def date_for
31
+ case options.for.to_sym
32
+ when :today
33
+ Date.today
34
+ when :yesterday
35
+ Worque::Utils::BusinessDay.previous(Date.today, options.skip_weekend?)
36
+ end
37
+ end
38
+
39
+ def filename(date)
40
+ "#{options.path}/notes-#{date}.md"
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,10 @@
1
+ require 'worque/command/todo'
2
+ module Worque
3
+ module Command
4
+ extend self
5
+
6
+ def run(options)
7
+ Todo.new(options).call()
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,33 @@
1
+ module Worque
2
+ module Utils
3
+ module BusinessDay
4
+ extend self
5
+
6
+ def next(date)
7
+ shift(date, 1)
8
+ end
9
+
10
+ def previous(date, skip_weekend = true)
11
+ shift(date, -1, skip_weekend)
12
+ end
13
+
14
+ def previous_continuous(date)
15
+ shift(date, -1, false)
16
+ end
17
+
18
+ private
19
+
20
+ def shift(date, inc, skip_weekend = true)
21
+ loop do
22
+ date += inc
23
+ break if !skip_weekend || !weekend?(date)
24
+ end
25
+ date
26
+ end
27
+
28
+ def weekend?(date)
29
+ date.wday == 0 || date.wday == 6
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,17 @@
1
+ require 'fileutils'
2
+
3
+ module Worque
4
+ module Utils
5
+ module Command
6
+ extend self
7
+
8
+ def mkdir(dir)
9
+ FileUtils.mkdir_p(dir)
10
+ end
11
+
12
+ def touch(path)
13
+ FileUtils.touch(path)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Worque
2
+ VERSION = "0.1.3"
3
+ end
data/lib/worque.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "worque/version"
2
+ require 'worque/command'
3
+ require 'worque/cli'
4
+
5
+ module Worque; end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: worque
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ platform: ruby
6
+ authors:
7
+ - Cam Huynh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.19.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.19.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: timecop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.8.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.8.1
83
+ description: Manage your daily working list in Ruby
84
+ email:
85
+ - huynhquancam@gmail.com
86
+ executables:
87
+ - worque
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - LICENSE.txt
92
+ - README.md
93
+ - bin/console
94
+ - bin/worque
95
+ - lib/worque.rb
96
+ - lib/worque/cli.rb
97
+ - lib/worque/command.rb
98
+ - lib/worque/command/todo.rb
99
+ - lib/worque/command/todo/options.rb
100
+ - lib/worque/utils/business_day.rb
101
+ - lib/worque/utils/command.rb
102
+ - lib/worque/version.rb
103
+ homepage: https://github.com/huynhquancam/worque
104
+ licenses:
105
+ - MIT
106
+ metadata:
107
+ allowed_push_host: https://rubygems.org
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.4.5.1
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: Manage your daily working list
128
+ test_files: []