jabber_notifier 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.document +5 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +29 -0
- data/Rakefile +6 -0
- data/bin/jn +13 -0
- data/examples/settings_sample.yaml +4 -0
- data/jabber_notifier.gemspec +28 -0
- data/lib/jabber_notifier.rb +7 -0
- data/lib/jabber_notifier/cli.rb +18 -0
- data/lib/jabber_notifier/connection.rb +34 -0
- data/lib/jabber_notifier/options_parser.rb +42 -0
- data/lib/jabber_notifier/version.rb +3 -0
- data/spec/jabber_notifier_spec.rb +11 -0
- data/spec/spec_helper.rb +2 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MDkwZTBiY2VjYmU0YWRhOGU3NTljMmQyZTRiNmJkNTFmNzdlODA1OA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
M2MxOGQ4YmU5MmE4OWEzMGZjOWUyNTg4ZDcxZWJhNGVjNTExNjIwOA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NWQxYzhmNmI0NTA1NDVjMTAyMzAyY2NmNzAwZjQxY2FjYWU3ZGY0YjIyMzEx
|
10
|
+
NDE1NDBkMDlhZjg2YjQ0OGNkNGU2MTBkNzUxZjVhNTA5ZmNhNzFiNGUzYjdm
|
11
|
+
ZDM2MDI4Yjg3OGY3YzdhM2VmMmQ0M2Q3NWNkODFlN2M0Y2M5ZTI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NWZlZGE2Zjk0OTVlMzA2NjIwOWMxY2I0MDNhOWQ2M2RlZGU0YTNkODA5OTE5
|
14
|
+
MjMxZjg1YThmNjE4MjBiMzg1ZDM0M2ZmZDY3M2JhMTJhNzg1MmZhMDRlZGJm
|
15
|
+
MTgyNDZkMTNiYzY0ZWVjMTViZmMwZWQ1MDFiZmE5MmNkMzg3Y2M=
|
data/.document
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
jabber_notifier
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-1.9.3-p545
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
Copyright (c) 2011 javier.juarez
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# JabberNotifier
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'jabber_notifier'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install jabber_notifier
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/jabber_notifier/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/jn
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:<< File.join(File.dirname(__FILE__), %w{.. lib})
|
4
|
+
require 'jabber_notifier'
|
5
|
+
|
6
|
+
##
|
7
|
+
# ::main::
|
8
|
+
JabberNotifier::Cli.run(
|
9
|
+
:config =>Choice.choices[:config],
|
10
|
+
:to =>Choice.choices[:to],
|
11
|
+
:message =>Choice.choices[:message],
|
12
|
+
:delay =>Choice.choices[:delay]
|
13
|
+
)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$:.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jabber_notifier/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
|
8
|
+
spec.name = "jabber_notifier"
|
9
|
+
spec.version = JabberNotifier::VERSION
|
10
|
+
spec.authors = ["Javier Juarez"]
|
11
|
+
spec.email = ["javier.juarez@gmail.com"]
|
12
|
+
spec.summary = %q{CLI Jabber notifier}
|
13
|
+
spec.description = %q{CLI Jabber notifier designed for command line notifications}
|
14
|
+
spec.homepage = "http://github.com/jjuarez/jabber_notifier"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "choice"
|
23
|
+
spec.add_dependency "xmpp4r-simple-19"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rspec"
|
28
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'jabber_notifier/options_parser'
|
3
|
+
require 'jabber_notifier/connection'
|
4
|
+
|
5
|
+
|
6
|
+
module JabberNotifier
|
7
|
+
|
8
|
+
class Cli
|
9
|
+
|
10
|
+
def self.run(options)
|
11
|
+
|
12
|
+
config = YAML.load_file(options[:config])
|
13
|
+
connection = Connection.new(:username =>config["username"], :password =>config["password"], :delay =>options[:delay].to_f)
|
14
|
+
|
15
|
+
connection.notify(options[:to], options[:message])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'xmpp4r-simple'
|
3
|
+
|
4
|
+
|
5
|
+
module JabberNotifier
|
6
|
+
|
7
|
+
class Connection
|
8
|
+
|
9
|
+
DEFAULT_DELAY = 2.0
|
10
|
+
|
11
|
+
def initialize(options)
|
12
|
+
|
13
|
+
options = { :delay =>DEFAULT_DELAY }.merge(options)
|
14
|
+
|
15
|
+
@connection = Jabber::Simple.new(options[:username], options[:password])
|
16
|
+
@delay = options[:delay]
|
17
|
+
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def notify(to, message)
|
22
|
+
|
23
|
+
raise "Not connecteted" unless @connection.connected?
|
24
|
+
|
25
|
+
@connection.deliver(to, message)
|
26
|
+
sleep(@delay)
|
27
|
+
end
|
28
|
+
|
29
|
+
def close
|
30
|
+
|
31
|
+
@connection.disconnect if @connection.connected?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'choice'
|
2
|
+
|
3
|
+
|
4
|
+
Choice.options do
|
5
|
+
|
6
|
+
header ''
|
7
|
+
header ' Options:'
|
8
|
+
|
9
|
+
option :config, :required =>true do
|
10
|
+
|
11
|
+
short '-c'
|
12
|
+
long '--config'
|
13
|
+
end
|
14
|
+
|
15
|
+
option :to, :required =>true do
|
16
|
+
|
17
|
+
short '-t'
|
18
|
+
long '--to'
|
19
|
+
end
|
20
|
+
|
21
|
+
option :message, :required =>true do
|
22
|
+
|
23
|
+
short '-m'
|
24
|
+
long '--message'
|
25
|
+
end
|
26
|
+
|
27
|
+
option :delay, :required =>false do
|
28
|
+
|
29
|
+
short '-d'
|
30
|
+
long '--delay'
|
31
|
+
end
|
32
|
+
|
33
|
+
separator ''
|
34
|
+
separator ' Help:'
|
35
|
+
|
36
|
+
option :help do
|
37
|
+
short '-h'
|
38
|
+
long '--help'
|
39
|
+
end
|
40
|
+
|
41
|
+
separator ''
|
42
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jabber_notifier
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Javier Juarez
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: choice
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: xmpp4r-simple-19
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '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'
|
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.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: CLI Jabber notifier designed for command line notifications
|
84
|
+
email:
|
85
|
+
- javier.juarez@gmail.com
|
86
|
+
executables:
|
87
|
+
- jn
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .document
|
92
|
+
- .gitignore
|
93
|
+
- .rspec
|
94
|
+
- .ruby-gemset
|
95
|
+
- .ruby-version
|
96
|
+
- .travis.yml
|
97
|
+
- Gemfile
|
98
|
+
- Gemfile.lock
|
99
|
+
- LICENSE.txt
|
100
|
+
- README.md
|
101
|
+
- Rakefile
|
102
|
+
- bin/jn
|
103
|
+
- examples/settings_sample.yaml
|
104
|
+
- jabber_notifier.gemspec
|
105
|
+
- lib/jabber_notifier.rb
|
106
|
+
- lib/jabber_notifier/cli.rb
|
107
|
+
- lib/jabber_notifier/connection.rb
|
108
|
+
- lib/jabber_notifier/options_parser.rb
|
109
|
+
- lib/jabber_notifier/version.rb
|
110
|
+
- spec/jabber_notifier_spec.rb
|
111
|
+
- spec/spec_helper.rb
|
112
|
+
homepage: http://github.com/jjuarez/jabber_notifier
|
113
|
+
licenses:
|
114
|
+
- MIT
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
requirements: []
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 2.2.2
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: CLI Jabber notifier
|
136
|
+
test_files:
|
137
|
+
- spec/jabber_notifier_spec.rb
|
138
|
+
- spec/spec_helper.rb
|