mailbot 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a50225982a8cfa58cc26463a849817a8430f4b6f
4
- data.tar.gz: 1fa013de47f20e3e33bf483a027db0be56eda42a
3
+ metadata.gz: 9359f348fbe935c4fe446d9da7130ba9554a2a34
4
+ data.tar.gz: 37e498478b89c2e999c6f64c352ea7aa3ae53fdd
5
5
  SHA512:
6
- metadata.gz: 1b3c336a2ae3e473f1019c06171c07ffe777ded64deb21fbc6d7e069a1689704bb7a0c5aed5545a194e14f30a8bcc5259f5c69629465b29dd9b9907257bf0dcb
7
- data.tar.gz: 810bcb753c25457dafc336850f07e8132d49f64226a3927539f29dd375e0cc17e07b4b0108cac22bce5a454a9773247b24ef9c7808d29ecd94c37e18820c7d9e
6
+ metadata.gz: a9a6bf3127c8fd89ca0380092bc3c87f0f0e603d61aeb5c080d3c25c9fe40b1ee56e7c396b9afc6798226ab6d7b80689a19bc0e08859f8f4f1f04c8c58ceab9e
7
+ data.tar.gz: b9a9f653a8da0b924c3ad045e47b46671f3f5694438e6a0b126408a7d28adc03620f53527dd7aaf1eb4638f1ad04d6fcf42c3edc3f1f3f527fbe93c5acff58be
data/bin/mailbot CHANGED
@@ -2,5 +2,4 @@
2
2
  $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
3
3
  require "mailbot"
4
4
 
5
- Dotenv.load!
6
5
  Mailbot::CommandFactory.create(ARGV).execute
@@ -15,7 +15,7 @@ module Mailbot
15
15
  # @return [Mailbot::Commands::Base]
16
16
  def create
17
17
  command_class.new @argv
18
- rescue Errors::CommandNotFound
18
+ rescue Errors::CommandNotFoundError
19
19
  terminate
20
20
  end
21
21
 
@@ -26,7 +26,7 @@ module Mailbot
26
26
  when "sync"
27
27
  Commands::Sync
28
28
  else
29
- raise Errors::CommandNotFound
29
+ raise Errors::CommandNotFoundError
30
30
  end
31
31
  end
32
32
 
@@ -9,19 +9,31 @@ module Mailbot
9
9
 
10
10
  # Sync given file to Mailbox
11
11
  def execute
12
+ load_env!
12
13
  Mailbot::Repository.new(file).sync
13
14
  end
14
15
 
15
16
  private
16
17
 
18
+ def load_env!
19
+ Dotenv.load! env
20
+ end
21
+
17
22
  def file
18
- options[:file]
23
+ option = options[:file]
24
+ raise Errors::CommandPreconditionError.new "option `file` must be specified" unless option
25
+ option
26
+ end
27
+
28
+ def env
29
+ options[:env] || ".env"
19
30
  end
20
31
 
21
32
  def options
22
33
  @options ||= Slop.parse!(@argv, help: true) do
23
34
  banner "Usage: #{$0} sync [options]"
24
35
  on "file=", "Path to the markdown file to sync"
36
+ on "env=", "Path to the env file to sync"
25
37
  end
26
38
  end
27
39
 
@@ -4,7 +4,10 @@ module Mailbot
4
4
  class Base < StandardError
5
5
  end
6
6
 
7
- class CommandNotFound < Base
7
+ class CommandNotFoundError < Base
8
+ end
9
+
10
+ class CommandPreconditionError < Base
8
11
  end
9
12
 
10
13
  end
@@ -1,3 +1,3 @@
1
1
  module Mailbot
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - monzou
@@ -157,10 +157,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  version: '0'
158
158
  requirements: []
159
159
  rubyforge_project:
160
- rubygems_version: 2.4.1
160
+ rubygems_version: 2.2.2
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: Learn with Mailbox
164
164
  test_files:
165
165
  - test/entry_test.rb
166
166
  - test/test_helper.rb
167
+ has_rdoc: