mailbot 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -4
- data/lib/mailbot.rb +1 -0
- data/lib/mailbot/command_factory.rb +2 -0
- data/lib/mailbot/commands/list.rb +38 -0
- data/lib/mailbot/commands/sync.rb +1 -1
- data/lib/mailbot/repository.rb +5 -4
- data/lib/mailbot/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e66301008f9e4f8acabd353f4f9aba8375c15fe
|
4
|
+
data.tar.gz: 24644ab6f8c5fc3663dc131b93e4261de11ac68a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c89aa1166015e253425b42db6f8bf3cfb03e6f3d132cdb3d7201b967e640a56261921eaced121b0d541df4db69a0f1402ceb76ad2884745c0b4a22d9d75142b6
|
7
|
+
data.tar.gz: 951f8980fc599cc72ecda68648539420c1919f0b19ebece41451a679f234f43478dd2bcd6f704dd993d9ef23dd8bb978c0f2b2f1f2c69d92309cb9b45aa727c9
|
data/README.md
CHANGED
@@ -4,11 +4,33 @@ Learn with [Mailbox](http://www.mailboxapp.com/)
|
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
7
|
+
### Sync
|
8
|
+
|
9
|
+
Sync the specified file to Mailbox
|
10
|
+
|
11
|
+
```
|
12
|
+
$ cd path-to-mailbot-sync-directory
|
13
|
+
$ mailbot sync
|
14
|
+
```
|
15
|
+
|
16
|
+
#### Options
|
17
|
+
|
18
|
+
|Option|Description|Default Value|
|
19
|
+
|:-----|:----------|:------------|
|
20
|
+
|file|The path to the markdown file to sync|index.md|
|
21
|
+
|env|The path to the env file to sync|.env|
|
22
|
+
|
23
|
+
### List
|
24
|
+
|
25
|
+
List all entries of the specified file
|
26
|
+
|
7
27
|
```
|
8
|
-
$ mailbot
|
28
|
+
$ cd path-to-mailbot-sync-directory
|
29
|
+
$ mailbot list
|
9
30
|
```
|
10
31
|
|
11
|
-
|
32
|
+
#### Options
|
12
33
|
|
13
|
-
|
14
|
-
|
34
|
+
|Option|Description|Default Value|
|
35
|
+
|:-----|:----------|:------------|
|
36
|
+
|file|The path to the markdown file to list|index.md|
|
data/lib/mailbot.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
module Mailbot
|
2
|
+
module Commands
|
3
|
+
class List < Base
|
4
|
+
|
5
|
+
DEFAULT_MARKDOWN_FILE = "index.md"
|
6
|
+
|
7
|
+
# @param argv [Array] ARGV
|
8
|
+
def initialize(argv)
|
9
|
+
@argv = argv
|
10
|
+
end
|
11
|
+
|
12
|
+
# List all entries of the specified file
|
13
|
+
def execute
|
14
|
+
puts Mailbot::Repository.new(file).entries.map { |entry| colorized_subject entry }.map(&:strip).join("\n")
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def colorized_subject(entry)
|
20
|
+
subject = entry.subject
|
21
|
+
subject = "\033[32m#{subject}\033[0m" unless entry.synced?
|
22
|
+
subject
|
23
|
+
end
|
24
|
+
|
25
|
+
def file
|
26
|
+
options[:file] || DEFAULT_MARKDOWN_FILE
|
27
|
+
end
|
28
|
+
|
29
|
+
def options
|
30
|
+
@options ||= Slop.parse!(@argv, help: true) do
|
31
|
+
banner "Usage: #{$0} list [options]"
|
32
|
+
on "file=", "Path to the markdown file to list"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/mailbot/repository.rb
CHANGED
@@ -24,6 +24,11 @@ module Mailbot
|
|
24
24
|
end.map(&:text).join("\n"))
|
25
25
|
end
|
26
26
|
|
27
|
+
# @return [Array<Mailbot::Entry>] An array of all entries in this repository
|
28
|
+
def entries
|
29
|
+
Mailbot::Entry::Parser.new.parse read
|
30
|
+
end
|
31
|
+
|
27
32
|
private
|
28
33
|
|
29
34
|
def write(text)
|
@@ -34,10 +39,6 @@ module Mailbot
|
|
34
39
|
open(@path, "r:UTF-8").read
|
35
40
|
end
|
36
41
|
|
37
|
-
def entries
|
38
|
-
Mailbot::Entry::Parser.new.parse read
|
39
|
-
end
|
40
|
-
|
41
42
|
end
|
42
43
|
|
43
44
|
end
|
data/lib/mailbot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- monzou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- lib/mailbot.rb
|
127
127
|
- lib/mailbot/command_factory.rb
|
128
128
|
- lib/mailbot/commands/base.rb
|
129
|
+
- lib/mailbot/commands/list.rb
|
129
130
|
- lib/mailbot/commands/sync.rb
|
130
131
|
- lib/mailbot/entry.rb
|
131
132
|
- lib/mailbot/errors.rb
|
@@ -157,10 +158,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
158
|
version: '0'
|
158
159
|
requirements: []
|
159
160
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.
|
161
|
+
rubygems_version: 2.2.2
|
161
162
|
signing_key:
|
162
163
|
specification_version: 4
|
163
164
|
summary: Learn with Mailbox
|
164
165
|
test_files:
|
165
166
|
- test/entry_test.rb
|
166
167
|
- test/test_helper.rb
|
168
|
+
has_rdoc:
|