guard-notifier-blink1 0.1.0
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 +7 -0
- data/.gitignore +14 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +90 -0
- data/Rakefile +2 -0
- data/guard-notifier-blink1.gemspec +27 -0
- data/lib/guard-notifier-blink1.rb +5 -0
- data/lib/guard-notifier-blink1/version.rb +5 -0
- data/lib/guard/notifier/blink1.rb +60 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f83ab4aae2ac5a6a46ad345482c1fb6004f0b62b
|
4
|
+
data.tar.gz: 38784a9c0a6b10ca3b682e782b990bb41e0c6e44
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 12aef90e74c6a22104e972543002fc6142ec13d762c4e9342eb46c34f0466d1a25d959acf11399c44fec9b54fbb1cca8eb564010ff0dea8d82907c5202d477f6
|
7
|
+
data.tar.gz: 46a29db762d9c3d13a9b4021d8cbafdfa8284ee328bb141a5016b1f4a29065420de58027603f0af8d71589c62eb8ecf41343eaa48d3396c987b14028df670d8f
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Tomohiro Nishimura
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# Guard::Notifier::Blink1
|
2
|
+
|
3
|
+
[blink(1)](http://blink1.thingm.com/) notifier for Guard.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'guard-notifier-blink1', require: false
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install guard-notifier-blink1
|
20
|
+
|
21
|
+
And the notifier requires `blink1-tool`.
|
22
|
+
See oficial site: http://blink1.thingm.com/blink1-tool/
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
Add the following to your Guardfile.
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require "guard/notifier/blink1"
|
30
|
+
|
31
|
+
notification :blink1
|
32
|
+
```
|
33
|
+
|
34
|
+
## Options
|
35
|
+
|
36
|
+
### :method
|
37
|
+
|
38
|
+
This option is used as flash method of `blink(1)`.
|
39
|
+
|
40
|
+
|name|description|
|
41
|
+
|--|--|
|
42
|
+
|:emission|LED emits until is sent `--off` option.|
|
43
|
+
|:blink|use `--blink` option|
|
44
|
+
|:glimmer|use `--glimer` option|
|
45
|
+
|
46
|
+
Default: `:blink`
|
47
|
+
|
48
|
+
### :colors
|
49
|
+
|
50
|
+
This options is used as LED color.
|
51
|
+
You can set color of result types individually.
|
52
|
+
|
53
|
+
Default:
|
54
|
+
```ruby
|
55
|
+
{
|
56
|
+
success: "#00ff00",
|
57
|
+
pending: "#ffff00",
|
58
|
+
failed: "#ff0000",
|
59
|
+
notify: "#0000ff",
|
60
|
+
}
|
61
|
+
```
|
62
|
+
|
63
|
+
### :count
|
64
|
+
|
65
|
+
This option is used as the number of flashes when the `:method` is set to `blink` or `glimmer`.
|
66
|
+
|
67
|
+
Default: `3`
|
68
|
+
|
69
|
+
## Sample
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
notification :blink1,
|
73
|
+
method: :glimmer,
|
74
|
+
count: 5
|
75
|
+
colors: {
|
76
|
+
success: "#003200",
|
77
|
+
pending: "#323200",
|
78
|
+
failed: "#320000",
|
79
|
+
notify: "#000032",
|
80
|
+
}
|
81
|
+
```
|
82
|
+
|
83
|
+
## Contributing
|
84
|
+
|
85
|
+
1. Fork it ( https://github.com/Sixeight/guard-notifier-blink1/fork )
|
86
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
87
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
88
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
89
|
+
5. Create a new Pull Request
|
90
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'guard-notifier-blink1/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "guard-notifier-blink1"
|
8
|
+
spec.version = GuardNotifierBlink1::VERSION
|
9
|
+
spec.authors = ["Tomohiro Nishimura"]
|
10
|
+
spec.email = ["tomohiro68@gmail.com"]
|
11
|
+
spec.summary = %q{blink(1) notifier for Guard.}
|
12
|
+
spec.description = %q{blink(1) notifier for Guard.}
|
13
|
+
spec.homepage = "https://github.com/Sixeight/guard-notifier-blink1"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "guard", "~> 2.6.1"
|
22
|
+
spec.add_runtime_dependency "colorable", "~> 0.2.0"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
module Guard
|
3
|
+
module Notifier
|
4
|
+
class Blink1 < Base
|
5
|
+
require "colorable"
|
6
|
+
|
7
|
+
DEFAULT_METHOD = :blink
|
8
|
+
DEFAULT_COLORS = {
|
9
|
+
success: "#00ff00",
|
10
|
+
pending: "#ffff00",
|
11
|
+
failed: "#ff0000",
|
12
|
+
notify: "#0000ff",
|
13
|
+
}.freeze
|
14
|
+
DEFAULT_COUNT = 3
|
15
|
+
|
16
|
+
def self.available?(opts = {})
|
17
|
+
super && command?("blink1-tool")
|
18
|
+
end
|
19
|
+
|
20
|
+
def notify(message, opts = {})
|
21
|
+
super
|
22
|
+
|
23
|
+
type = opts[:type]
|
24
|
+
method = opts[:method] || DEFAULT_METHOD
|
25
|
+
colors = opts[:colors] || {}
|
26
|
+
color = colors[type] || DEFAULT_COLORS[type]
|
27
|
+
color = color.to_color.rgb.join(",")
|
28
|
+
count = opts[:count] || DEFAULT_COUNT
|
29
|
+
|
30
|
+
execute method, color, count
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
def execute(method, color, count)
|
35
|
+
__send__ method, color, count
|
36
|
+
rescue
|
37
|
+
::Guard::UI.error 'unrecognized method is set to :method option.'
|
38
|
+
end
|
39
|
+
|
40
|
+
def emission(color, count)
|
41
|
+
system "blink1-tool", "--rgb=#{color}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def blink(color, count)
|
45
|
+
system "blink1-tool", "--rgb=#{color}", "--blink=#{count}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def glimmer(color, count)
|
49
|
+
system "blink1-tool", "--rgb=#{color}", "--glimmer=#{count}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.command?(name)
|
53
|
+
system "type #{name} > /dev/null 2>&1"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
NOTIFIERS << {blink1: Blink1}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-notifier-blink1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tomohiro Nishimura
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: guard
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.6.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.6.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: colorable
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.2.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description: blink(1) notifier for Guard.
|
70
|
+
email:
|
71
|
+
- tomohiro68@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- CHANGELOG.md
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- guard-notifier-blink1.gemspec
|
83
|
+
- lib/guard-notifier-blink1.rb
|
84
|
+
- lib/guard-notifier-blink1/version.rb
|
85
|
+
- lib/guard/notifier/blink1.rb
|
86
|
+
homepage: https://github.com/Sixeight/guard-notifier-blink1
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.4.1
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: blink(1) notifier for Guard.
|
110
|
+
test_files: []
|
111
|
+
has_rdoc:
|