cinch-endi 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
@@ -0,0 +1 @@
1
+ cinch-endi
@@ -0,0 +1 @@
1
+ ruby-1.9.3-p448
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cinch-endi.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jonah Ruiz
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,45 @@
1
+ Cinch::Endi [![Gem Version](https://badge.fury.io/rb/cinch-endi.png)](http://badge.fury.io/rb/cinch-endi) [![Dependency Status](https://gemnasium.com/jonahoffline/cinch-endi.png)](https://gemnasium.com/jonahoffline/cinch-endi) [![Code Climate](https://codeclimate.com/github/jonahoffline/cinch-endi.png)](https://codeclimate.com/github/jonahoffline/cinch-endi)
2
+ =================
3
+
4
+ Endi is a Cinch plugin for getting the latest news from endi.com
5
+ Endi / El Nuevo Dia is a Puerto Rican newspaper.
6
+
7
+ Installation
8
+ ---------------------
9
+
10
+ $ gem install cinch-endi
11
+
12
+ #### Command ####
13
+
14
+ * !endi [total of news] - Fetches the total of news or the top 25 by default.
15
+
16
+ ## Integration with Cinch ##
17
+
18
+ ```ruby
19
+ require 'cinch'
20
+ require 'cinch/plugins/endi'
21
+
22
+ bot = Cinch::Bot.new do
23
+ configure do |c|
24
+ c.server = 'irc.freenode.net'
25
+ c.nick = 'Tavin_Pumarejo'
26
+ c.channels = ['#RubyOnADHD']
27
+ c.plugins.plugins = [Cinch::Plugins::Endi]
28
+ end
29
+ end
30
+
31
+ bot.start
32
+ ```
33
+
34
+ Enjoy!
35
+
36
+ ## Author
37
+ * [Jonah Ruiz](http://www.pixelhipsters.com)
38
+
39
+ ## Contributing
40
+
41
+ 1. Fork it
42
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
43
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
44
+ 4. Push to the branch (`git push origin my-new-feature`)
45
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'cinch-endi'
7
+ spec.version = File.new('VERSION', 'r').read.chomp
8
+ spec.authors = ['Jonah Ruiz']
9
+ spec.email = ['jonah@pixelhipsters.com']
10
+ spec.description = %q{Endi is a Cinch plugin for getting the latest news from endi.com}
11
+ spec.summary = %q{Endi is a Cinch plugin for getting the latest news from endi.com / El Nuevo Dia Newspaper}
12
+ spec.homepage = 'https://github.com/jonahoffline/cinch-endi'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.require_paths = ['lib']
17
+ spec.required_ruby_version = '>= 1.9.3'
18
+
19
+ spec.add_dependency 'cinch', '~> 2.0.5'
20
+ spec.add_dependency 'endi_feed', '~> 0.0.1'
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.3'
23
+ spec.add_development_dependency 'rake'
24
+ end
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+ require 'cinch'
3
+ require 'endi_feed'
4
+
5
+ module Cinch
6
+ module Plugins
7
+ # @author Jonah Ruiz <jonah@pixelhipsters.com>
8
+ # Endi is a Cinch plugin for getting the latest news from endi.com
9
+ class Endi
10
+ include Cinch::Plugin
11
+
12
+ listen_to :channel
13
+
14
+ # Listens to channel and calls :get_news
15
+ # @param msg [Object] internal object provided by Cinch
16
+ # @return [String] formatted news to IRC channel
17
+ def listen(msg)
18
+ total = total_news(msg)
19
+ get_news(total).each { |headline| msg.reply(headline) } if total
20
+ end
21
+
22
+ # Delegates to EndiFeed.get_news
23
+ # @return [Array<String>] news headlines
24
+ def get_news(total)
25
+ EndiFeed.get_news(total)
26
+ end
27
+
28
+ # Gets the total of news to fetch
29
+ # @return [Integer] total of news to fetch
30
+ def total_news(msg)
31
+ any_arg?(msg) || no_args?(msg)
32
+ end
33
+
34
+ # Returns the total of news when there is a match
35
+ # @return [Integer] total of news to fetch
36
+ def any_arg?(msg)
37
+ $1 if !!(/^!endi (.+)$/ =~ msg.message)
38
+ end
39
+
40
+ # Returns the default total when there is a match
41
+ # @return [Integer] default total of news to fetch
42
+ def no_args?(msg)
43
+ 25 if !!(/^!endi/ =~ msg.message)
44
+ end
45
+ end
46
+ end
47
+ end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cinch-endi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jonah Ruiz
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-04 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: 2.0.5
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: 2.0.5
30
+ - !ruby/object:Gem::Dependency
31
+ name: endi_feed
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.0.1
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.0.1
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.3'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Endi is a Cinch plugin for getting the latest news from endi.com
79
+ email:
80
+ - jonah@pixelhipsters.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - .gitignore
86
+ - .ruby-gemset
87
+ - .ruby-version
88
+ - Gemfile
89
+ - LICENSE
90
+ - README.md
91
+ - Rakefile
92
+ - VERSION
93
+ - cinch-endi.gemspec
94
+ - lib/cinch/plugins/endi.rb
95
+ homepage: https://github.com/jonahoffline/cinch-endi
96
+ licenses:
97
+ - MIT
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: 1.9.3
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ segments:
115
+ - 0
116
+ hash: 1919150058774790695
117
+ requirements: []
118
+ rubyforge_project:
119
+ rubygems_version: 1.8.25
120
+ signing_key:
121
+ specification_version: 3
122
+ summary: Endi is a Cinch plugin for getting the latest news from endi.com / El Nuevo
123
+ Dia Newspaper
124
+ test_files: []