worque 0.1.4 → 0.1.5
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 +4 -4
- data/README.md +22 -5
- data/bin/worque +0 -1
- data/lib/worque/cli.rb +8 -1
- data/lib/worque/command/todo/options.rb +2 -0
- data/lib/worque/command/todo.rb +15 -1
- data/lib/worque/utils/command.rb +6 -0
- data/lib/worque/utils/slack.rb +1 -1
- data/lib/worque/version.rb +1 -1
- data/lib/worque.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 509912a33940b740eb50a0c98aa55f256e90cd48
|
4
|
+
data.tar.gz: d7dc7cd45b482af9b5c6001289c2ea7dac11b258
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23dfc71b98a0d455469892dd4f917885bf7f40173db4bd30c4363f7c680d2da22c455eeb13a067da700409a74fdbd99cd28b09c1070fe06ef54c2c9406acc4d6
|
7
|
+
data.tar.gz: 9c16073df9e1e2d069739c4c7b535254892f765d8604d72e90b9abec64f539d529ca17e1888529665df2c46eca44969dfe50939e8842a613d2816ceae0e747af
|
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# Worque
|
2
|
+
[](https://travis-ci.org/huynhquancam/worque)
|
3
|
+
[](https://badge.fury.io/rb/worque)
|
2
4
|
|
3
5
|
Worque is a CLI which is helpful to manage your daily notes.
|
4
6
|
|
@@ -8,6 +10,14 @@ Worque is a CLI which is helpful to manage your daily notes.
|
|
8
10
|
|
9
11
|
Then worque is definitely a right tool for you!
|
10
12
|
|
13
|
+
## HOW IT WORKS
|
14
|
+
|
15
|
+

|
16
|
+
|
17
|
+
### WITH VIM
|
18
|
+
|
19
|
+

|
20
|
+
|
11
21
|
## Installation
|
12
22
|
|
13
23
|
**DO NOT add this to your Gemfile**
|
@@ -16,6 +26,11 @@ Install it by
|
|
16
26
|
|
17
27
|
$ gem install worque
|
18
28
|
|
29
|
+
Or, if you're using RVM and want the command available system-wide while keeping it in its own gemset
|
30
|
+
|
31
|
+
$ rvm default@worque --create do gem install worque
|
32
|
+
$ rvm wrapper default@worque --no-prefix worque
|
33
|
+
|
19
34
|
## Quick start guide
|
20
35
|
|
21
36
|
### CLI
|
@@ -61,6 +76,11 @@ You can also explicitly specify the file path
|
|
61
76
|
worque todo --for today --path ~/path/to/your/notes
|
62
77
|
```
|
63
78
|
|
79
|
+
Moreover, you can add a task into your notes quickly without open that file.
|
80
|
+
```sh
|
81
|
+
worque todo --for today --append-task "Your task"
|
82
|
+
```
|
83
|
+
|
64
84
|
It's chain-able with other commands
|
65
85
|
|
66
86
|
```sh
|
@@ -77,7 +97,7 @@ alias today="vim $(worque todo) +':cd $WORQUE_PATH'"
|
|
77
97
|
alias ytd="vim $(worque todo) +':cd $WORQUE_PATH'"
|
78
98
|
```
|
79
99
|
|
80
|
-
#### `worque
|
100
|
+
#### `worque push`
|
81
101
|
|
82
102
|
Please remember to add `SLACK_API_TOKEN` in your `.bash_profile`
|
83
103
|
|
@@ -122,17 +142,14 @@ bundle exec rake test
|
|
122
142
|
|
123
143
|
Something in my plan:
|
124
144
|
|
125
|
-
* Test suites: Embarrassingly there's no test currently, but this will be my
|
126
|
-
first priority.
|
127
145
|
* `worque list`: List all notes you have.
|
128
146
|
* `worque changelog`: Sync your Git commits to daily notes.
|
129
147
|
|
130
148
|
## Contributing
|
131
149
|
|
132
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/huynhquancam/worque.
|
150
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/huynhquancam/worque/issues](https://github.com/huynhquancam/worque/issues).
|
133
151
|
|
134
152
|
## License
|
135
153
|
|
136
154
|
The gem is available as open source under the terms of the
|
137
155
|
[MIT License](http://opensource.org/licenses/MIT).
|
138
|
-
|
data/bin/worque
CHANGED
data/lib/worque/cli.rb
CHANGED
@@ -13,9 +13,16 @@ module Worque
|
|
13
13
|
method_option :for, force: false, type: :string, enum: ['today', 'yesterday'], default: 'today'
|
14
14
|
method_option :skip_weekend, force: false, type: :boolean, default: true
|
15
15
|
method_option :path, force: false, type: :string, default: ENV['WORQUE_PATH']
|
16
|
+
method_option :append_task, force: false, type: :string
|
16
17
|
|
17
18
|
def todo
|
18
|
-
|
19
|
+
begin
|
20
|
+
result = Worque::Command::Todo.run(options)
|
21
|
+
rescue InvalidPath => e
|
22
|
+
abort e.message
|
23
|
+
end
|
24
|
+
|
25
|
+
$stdout.puts result
|
19
26
|
end
|
20
27
|
|
21
28
|
desc 'push', 'Push your notes to Slack channel'
|
@@ -6,12 +6,14 @@ module Worque
|
|
6
6
|
class Todo::Options
|
7
7
|
attr_accessor :path
|
8
8
|
attr_accessor :for
|
9
|
+
attr_accessor :append_task
|
9
10
|
attr_writer :skip_weekend
|
10
11
|
|
11
12
|
def initialize(opts)
|
12
13
|
@path = opts[:path]
|
13
14
|
@skip_weekend = opts[:skip_weekend]
|
14
15
|
@for = opts[:for]
|
16
|
+
@append_task = opts[:append_task]
|
15
17
|
end
|
16
18
|
|
17
19
|
def skip_weekend?
|
data/lib/worque/command/todo.rb
CHANGED
@@ -7,14 +7,22 @@ module Worque
|
|
7
7
|
class Todo
|
8
8
|
def initialize(options)
|
9
9
|
@options = options
|
10
|
+
validate_options!
|
10
11
|
end
|
11
12
|
|
12
13
|
def call
|
13
14
|
Worque::Utils::Command.mkdir(options.path)
|
14
15
|
|
15
|
-
filename(date_for)
|
16
|
+
notes_file_path = filename(date_for)
|
17
|
+
notes_file_path.tap do |f|
|
16
18
|
Worque::Utils::Command.touch f
|
17
19
|
end
|
20
|
+
|
21
|
+
if options.append_task
|
22
|
+
Worque::Utils::Command.append_text(notes_file_path, options.append_task)
|
23
|
+
end
|
24
|
+
|
25
|
+
notes_file_path
|
18
26
|
end
|
19
27
|
|
20
28
|
def self.run(options)
|
@@ -39,6 +47,12 @@ module Worque
|
|
39
47
|
def filename(date)
|
40
48
|
"#{options.path}/notes-#{date}.md"
|
41
49
|
end
|
50
|
+
|
51
|
+
def validate_options!
|
52
|
+
if options.path.to_s.empty?
|
53
|
+
raise InvalidPath, 'Neither --path nor WORQUE_PATH is not set'
|
54
|
+
end
|
55
|
+
end
|
42
56
|
end
|
43
57
|
end
|
44
58
|
end
|
data/lib/worque/utils/command.rb
CHANGED
data/lib/worque/utils/slack.rb
CHANGED
@@ -15,7 +15,7 @@ module Worque
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def post_form(channel, message)
|
18
|
-
uri = URI('https://slack.com/api/chat.postMessage')
|
18
|
+
uri = URI.parse('https://slack.com/api/chat.postMessage')
|
19
19
|
Net::HTTP.post_form(uri, as_user: true, channel: channel, token: @token, text: message)
|
20
20
|
end
|
21
21
|
end
|
data/lib/worque/version.rb
CHANGED
data/lib/worque.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worque
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cam Huynh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|