ircnotify 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ircnotify.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Łukasz Korecki
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.
@@ -0,0 +1,85 @@
1
+ # Ircnotify
2
+
3
+ Simple tool for sending messages to IRC.
4
+
5
+ `ircnotify` can be used for:
6
+
7
+ - notifying when Chef has finished creating a new VM
8
+ - new code has been pushed to production and your apps are running
9
+ - you're compiling something and want to get notified when it's finished
10
+ - possibly more
11
+
12
+
13
+ Simply:
14
+
15
+ - create a config (take a look at `example_conf.yml`)
16
+
17
+ - install `ircnotify`
18
+
19
+ - send your message: `$ ircnotify -m "task finished!"`
20
+
21
+ - done
22
+
23
+
24
+ ## 1000 words and oneliner
25
+
26
+
27
+ ```
28
+ $ ircnotify -m "yooooooo"
29
+
30
+ ```
31
+ ![screen](http://i.imgur.com/3YNT0.png)
32
+
33
+
34
+ ## Example configuration
35
+
36
+
37
+ ```yaml
38
+ nick: notifier
39
+ server: your.irc.com
40
+ port: 6667
41
+ password: 's4kr1t'
42
+ ssl:
43
+ use: true
44
+ verify: false
45
+
46
+ channels:
47
+ - '#test'
48
+ - '#test2'
49
+ ```
50
+
51
+ `ircnotify` is based on [Cinch](https://github.com/cinchrb/cinch) and makes use of
52
+ some of config options, but not all. They are trivial to add though.
53
+
54
+
55
+ By default `ircnofity` reads the config from `~/.ircnotify`
56
+
57
+ ## Usage
58
+
59
+
60
+ ```
61
+ Options:
62
+ ircnotifier 0.0.1
63
+ Usage:
64
+ ircnotifier <opts> --message "your message"
65
+
66
+ Options:
67
+ --config, -c <s>: Config file (default: /Users/lukasz/.ircnotifier)
68
+ --message, -m <s>: Your message (default: test)
69
+ --help, -e: Show this message
70
+
71
+ ```
72
+
73
+ ## Installation
74
+
75
+ ```
76
+ $ gem install ircnotify
77
+ ```
78
+
79
+ ## Contributing
80
+
81
+ 1. Fork it
82
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
83
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
84
+ 4. Push to the branch (`git push origin my-new-feature`)
85
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'ircnotify'
3
+ Ircnotify.main
@@ -0,0 +1,12 @@
1
+ nick: notifier
2
+ server: your.irc.com
3
+ port: 6667
4
+ password: 's4kr1t'
5
+ ssl:
6
+ use: true
7
+ verify: false
8
+
9
+ channels:
10
+ - '#test'
11
+ - '#test2'
12
+
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ircnotify/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "ircnotify"
8
+ gem.version = Ircnotify::VERSION
9
+ gem.authors = ["Łukasz Korecki"]
10
+ gem.email = ["lukasz@coffeesounds.com"]
11
+ gem.description = %q{Send a message to your IRC server/channel straight from the terminal}
12
+ gem.summary = %q{IRC notifier, useful for automating messages sent by deployment tools or test runners}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ gem.add_runtime_dependency "cinch", ">= 0"
20
+ gem.add_runtime_dependency "trollop", ">= 0"
21
+ end
@@ -0,0 +1,9 @@
1
+ require 'trollop'
2
+ require 'cinch'
3
+ require 'yaml'
4
+ require File.expand_path("../ircnotify/version", __FILE__)
5
+ require File.expand_path("../ircnotify/main", __FILE__)
6
+ require File.expand_path("../ircnotify/notifier",__FILE__)
7
+
8
+ module Ircnotify
9
+ end
@@ -0,0 +1,26 @@
1
+ module Ircnotify
2
+ IRC_CONF = {}
3
+ def self.main
4
+ options = ::Trollop::options do
5
+ banner <<-EOS
6
+ ircnotifier #{::Ircnotify::VERSION}
7
+ Usage:
8
+ ircnotifier <opts> --message "your message"
9
+
10
+ Options:
11
+ EOS
12
+ opt :config, "Config file", :type => :string, :default => File.expand_path("~/.ircnotify")
13
+ opt :message, "Your message", :type => :string, :default => 'test'
14
+ # TODO
15
+ # opt :notice, "Use /notice <channel>", :default => false
16
+ # opt :channels, "Comma-delimited list or irc channels", :type => :string, :default => 'test'
17
+
18
+ end
19
+
20
+ IRC_CONF.merge! ::YAML::load_file File.expand_path options.delete(:config)
21
+ notifier = Ircnotify::Notifier.new options.delete(:message)
22
+ notifier.notify
23
+
24
+ end
25
+ end
26
+
@@ -0,0 +1,32 @@
1
+ module Ircnotify
2
+ class Notifier
3
+ def initialize message, is_notice=false
4
+ @bot = ::Cinch::Bot.new do
5
+ configure do |c|
6
+ # TODO FIXME
7
+ # this doesn't handle all nested config options!
8
+ # see https://github.com/cinchrb/cinch/blob/master/docs/bot_options.md
9
+ IRC_CONF.each do |key,val|
10
+ if key != "ssl"
11
+ c.send :"#{key}=", val
12
+ else
13
+ val.each do |k,v|
14
+ c.ssl.send :"#{k}=",v
15
+ end
16
+ end
17
+
18
+ end
19
+ end
20
+
21
+ on :join do |m, channel|
22
+ m.reply message
23
+ @bot.quit "Message delivered"
24
+ end
25
+ end
26
+ end
27
+
28
+ def notify
29
+ @bot.start
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,3 @@
1
+ module Ircnotify
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ircnotify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Łukasz Korecki
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: cinch
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: trollop
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Send a message to your IRC server/channel straight from the terminal
47
+ email:
48
+ - lukasz@coffeesounds.com
49
+ executables:
50
+ - ircnotify
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - Gemfile
56
+ - LICENSE.txt
57
+ - README.md
58
+ - Rakefile
59
+ - bin/ircnotify
60
+ - example_conf.yml
61
+ - ircnotify.gemspec
62
+ - lib/ircnotify.rb
63
+ - lib/ircnotify/main.rb
64
+ - lib/ircnotify/notifier.rb
65
+ - lib/ircnotify/version.rb
66
+ homepage: ''
67
+ licenses: []
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubyforge_project:
86
+ rubygems_version: 1.8.24
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: IRC notifier, useful for automating messages sent by deployment tools or
90
+ test runners
91
+ test_files: []
92
+ has_rdoc: