hato 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51d1a23f2c7c13c67eb66e3de4f90028df29da6b
4
- data.tar.gz: 3e98e5f54c6afb3d289efe803cf4fb368e81f818
3
+ metadata.gz: 1cede082c4d5590b359033a018197adabe7160ef
4
+ data.tar.gz: 97a83788feb34dce3e3180f98fc4a1a7fec7d84f
5
5
  SHA512:
6
- metadata.gz: 53d3879360b6c5ed8be4105e678985612ee905bae151a2417a7ade8b5174c7ee2e82f519b90445edfab582bf6635f03a38bca87832273fc2208a41e44b0a07dd
7
- data.tar.gz: b4d4793abd6db91892b1241d628968a1b95adc3433ed7d69a293b21161d4cbe3673d476bbebb4ba4e2375f2efa2ddbe777ffc648dc24d7def897b6a8a936d518
6
+ metadata.gz: 7f08a21f559fffad23aeb1465b2809cdbbd896809c124c7c928aa80415bc49dd398f822665a4aa9dfaab78f370be3d3731df80ebc343ca7dbec5cec8e4a548f9
7
+ data.tar.gz: 95b893b89b4604b315692aa576289de2c5ab5ca9d75570fee9e08ed1040790d8468db4e831f5ee61cc5a2fbb6b4688f1659fd6b9a6cac17711cac9b2b90e5283
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Hato [![BuildStatus](https://secure.travis-ci.org/kentaro/hato.png)](http://travis-ci.org/kentaro/hato)
2
2
 
3
- Hato is a tool to manage notification methods. Once you configure notification methods, you can send notifications via the methods just by posting message to this tool.
3
+ Hato is a tool to manage various notification methods. Once you configure notification methods, you can send messages via the methods just by posting them to Hato.
4
4
 
5
5
  ## Usage
6
6
 
@@ -24,27 +24,25 @@ e.g. config.rb:
24
24
 
25
25
  ```
26
26
  Hato::Config.define do
27
- config.api_key = 'test'
28
- config.host = '0.0.0.0'
29
- config.port = 9699
27
+ api_key 'test'
28
+ host '0.0.0.0'
29
+ port 9699
30
30
 
31
31
  tag 'test' do
32
32
  plugin 'Ikachan' do
33
- config.scheme = 'http'
34
- config.host = 'irc.example.com'
35
- config.port = 4979
36
- config.channel = 'hato'
33
+ scheme 'http'
34
+ host 'irc.example.com'
35
+ port 4979
36
+ channel 'hato'
37
37
  end
38
38
 
39
39
  plugin 'Mail' do
40
- config.smtp = {
41
- address: 'smtp.example.com',
42
- port: 587,
43
- domain: 'example',
44
- user_name: 'hato',
45
- password: 'password',
46
- enable_ssl: true,
47
- }
40
+ smtp address: 'smtp.example.com',
41
+ port: 587,
42
+ domain: 'example',
43
+ user_name: 'hato',
44
+ password: 'password',
45
+ enable_ssl: true
48
46
 
49
47
  subject_template = <<EOS
50
48
  [<%= args[:tag] %>] Notification
@@ -55,15 +53,13 @@ You've got a message:
55
53
  <%= args[:message] %>
56
54
  EOS
57
55
 
58
- config.message = {
59
- from: 'hato@example.com',
60
- to: [
61
- 'foo@example.com',
62
- 'bar@example.com',
63
- ],
64
- subject_template: subject_template,
65
- body_template: body_template,
66
- }
56
+ message from: 'hato@example.com',
57
+ to: [
58
+ 'foo@example.com',
59
+ 'bar@example.com',
60
+ ],
61
+ subject_template: subject_template,
62
+ body_template: body_template
67
63
  end
68
64
  end
69
65
  end
@@ -86,7 +82,7 @@ At first, create a `Gemfile` to manage dependencies:
86
82
  source 'https://rubygems.org'
87
83
 
88
84
  gem 'hato'
89
- gem 'hato/plugin/awesome_plugin'
85
+ gem 'hato-plugin-awesome_plugin'
90
86
  ```
91
87
 
92
88
  Then, execute `bundle exec hato -c your_config_file`
@@ -112,3 +108,4 @@ Or install it yourself as:
112
108
  3. Commit your changes (`git commit -am 'Add some feature'`)
113
109
  4. Push to the branch (`git push origin my-new-feature`)
114
110
  5. Create new Pull Request
111
+
data/lib/hato/config.rb CHANGED
@@ -12,7 +12,11 @@ module Hato
12
12
  end
13
13
 
14
14
  def method_missing(method, *args)
15
- config.send(method)
15
+ if args.empty?
16
+ config.send(method)
17
+ else
18
+ config[method] = args.first
19
+ end
16
20
  end
17
21
 
18
22
  private
data/lib/hato/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hato
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,25 +1,23 @@
1
1
  Hato::Config.define do
2
- config.api_key = 'test'
3
- config.host = '0.0.0.0'
4
- config.port = 9699
2
+ api_key 'test'
3
+ host '0.0.0.0'
4
+ port 9699
5
5
 
6
6
  tag 'test' do
7
7
  plugin 'Ikachan' do
8
- config.scheme = 'http'
9
- config.host = 'irc.example.com'
10
- config.port = 4979
11
- config.channel = 'hato'
8
+ scheme 'http'
9
+ host 'irc.example.com'
10
+ port 4979
11
+ channel 'hato'
12
12
  end
13
13
 
14
14
  plugin 'Mail' do
15
- config.smtp = {
16
- address: 'smtp.example.com',
17
- port: 587,
18
- domain: 'example',
19
- user_name: 'hato',
20
- password: 'password',
21
- enable_ssl: true,
22
- }
15
+ smtp address: 'smtp.example.com',
16
+ port: 587,
17
+ domain: 'example',
18
+ user_name: 'hato',
19
+ password: 'password',
20
+ enable_ssl: true
23
21
 
24
22
  subject_template = <<EOS
25
23
  [<%= args[:tag] %>] Notification
@@ -30,15 +28,13 @@ You've got a message:
30
28
  <%= args[:message] %>
31
29
  EOS
32
30
 
33
- config.message = {
34
- from: 'hato@example.com',
35
- to: [
36
- 'foo@example.com',
37
- 'bar@example.com',
38
- ],
39
- subject_template: subject_template,
40
- body_template: body_template,
41
- }
31
+ message from: 'hato@example.com',
32
+ to: [
33
+ 'foo@example.com',
34
+ 'bar@example.com',
35
+ ],
36
+ subject_template: subject_template,
37
+ body_template: body_template
42
38
  end
43
39
  end
44
40
  end
@@ -46,9 +46,13 @@ describe Hato::Config do
46
46
  expect(tag.plugins).to be_an_instance_of Array
47
47
  expect(tag.plugins.size).to be == 2
48
48
 
49
- plugin = tag.plugins.first
50
- expect(plugin.name).to be == 'Ikachan'
51
- expect(plugin.host).to be == 'irc.example.com'
49
+ ikachan = tag.plugins[0]
50
+ expect(ikachan.name).to be == 'Ikachan'
51
+ expect(ikachan.host).to be == 'irc.example.com'
52
+
53
+ mail = tag.plugins[1]
54
+ expect(mail.message).to be_an_instance_of Hashie::Mash
55
+ expect(mail.message['from']).to be == 'hato@example.com'
52
56
  }
53
57
  end
54
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hato
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
  - Kentaro Kuribayashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-06 00:00:00.000000000 Z
11
+ date: 2013-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -147,7 +147,7 @@ files:
147
147
  - lib/hato/plugin/mail.rb
148
148
  - lib/hato/version.rb
149
149
  - spec/assets/config/test.rb
150
- - spec/lib/pigeon/config_spec.rb
150
+ - spec/lib/hato/config_spec.rb
151
151
  - spec/spec_helper.rb
152
152
  homepage: https://github.com/kentaro/hato
153
153
  licenses:
@@ -175,5 +175,5 @@ specification_version: 4
175
175
  summary: A Notification Management Tools
176
176
  test_files:
177
177
  - spec/assets/config/test.rb
178
- - spec/lib/pigeon/config_spec.rb
178
+ - spec/lib/hato/config_spec.rb
179
179
  - spec/spec_helper.rb