davidsmalley-erlyfirerb 0.1

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.
data/History.txt ADDED
@@ -0,0 +1,3 @@
1
+ == 1.0.0 / 2008-11-04
2
+
3
+ * Gem release
data/Manifest.txt ADDED
@@ -0,0 +1,6 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/erlyfire.rb
6
+ lib/erlyfirerb.rb
data/README.txt ADDED
@@ -0,0 +1,32 @@
1
+ erlyfirerb
2
+ by David Smalley
3
+ http://github.com/davidsmalley/erlyfirerb
4
+
5
+ == DESCRIPTION:
6
+
7
+ Erlyfire.rb is a Ruby Interface to the erlyfire campfire bot (http://github.com/davidsmalley/erlyfire)
8
+
9
+ == LICENSE:
10
+
11
+ (The MIT License)
12
+
13
+ Copyright (c) 2008
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining
16
+ a copy of this software and associated documentation files (the
17
+ 'Software'), to deal in the Software without restriction, including
18
+ without limitation the rights to use, copy, modify, merge, publish,
19
+ distribute, sublicense, and/or sell copies of the Software, and to
20
+ permit persons to whom the Software is furnished to do so, subject to
21
+ the following conditions:
22
+
23
+ The above copyright notice and this permission notice shall be
24
+ included in all copies or substantial portions of the Software.
25
+
26
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
27
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
29
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
30
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
31
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
32
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ # Look in the tasks/setup.rb file for the various options that can be
2
+ # configured in this Rakefile. The .rake files in the tasks directory
3
+ # are where the options are used.
4
+
5
+ begin
6
+ require 'bones'
7
+ Bones.setup
8
+ rescue LoadError
9
+ load 'tasks/setup.rb'
10
+ end
11
+
12
+ ensure_in_path 'lib'
13
+ require 'erlyfirerb'
14
+
15
+ task :default => 'spec:run'
16
+
17
+ PROJ.name = 'erlyfirerb'
18
+ PROJ.authors = 'FIXME (who is writing this software)'
19
+ PROJ.email = 'FIXME (your e-mail)'
20
+ PROJ.url = 'FIXME (project homepage)'
21
+ PROJ.version = Erlyfirerb::VERSION
22
+ PROJ.rubyforge.name = 'erlyfirerb'
23
+
24
+ PROJ.spec.opts << '--color'
25
+
26
+ # EOF
data/lib/erlyfire.rb ADDED
@@ -0,0 +1,31 @@
1
+ require 'uri'
2
+ require 'net/http'
3
+ class Erlyfire
4
+
5
+ def initialize(url_string)
6
+ @url = URI.parse(url_string)
7
+ end
8
+
9
+ def message(body)
10
+ send(body, false)
11
+ end
12
+
13
+ def paste(body)
14
+ send(body, true)
15
+ end
16
+
17
+ private
18
+
19
+ def send(message, paste)
20
+ req = Net::HTTP::Post.new(@url.path)
21
+ req.set_form_data({'message'=> message, 'paste' => paste})
22
+ res = Net::HTTP.new(@url.host, @url.port).start {|http| http.request(req) }
23
+ case res
24
+ when Net::HTTPSuccess
25
+ true
26
+ else
27
+ false
28
+ end
29
+ end
30
+
31
+ end
data/lib/erlyfirerb.rb ADDED
@@ -0,0 +1,48 @@
1
+
2
+ module Erlyfirerb
3
+
4
+ # :stopdoc:
5
+ VERSION = '1.0.0'
6
+ LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
7
+ PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
8
+ # :startdoc:
9
+
10
+ # Returns the version string for the library.
11
+ #
12
+ def self.version
13
+ VERSION
14
+ end
15
+
16
+ # Returns the library path for the module. If any arguments are given,
17
+ # they will be joined to the end of the libray path using
18
+ # <tt>File.join</tt>.
19
+ #
20
+ def self.libpath( *args )
21
+ args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
22
+ end
23
+
24
+ # Returns the lpath for the module. If any arguments are given,
25
+ # they will be joined to the end of the path using
26
+ # <tt>File.join</tt>.
27
+ #
28
+ def self.path( *args )
29
+ args.empty? ? PATH : ::File.join(PATH, args.flatten)
30
+ end
31
+
32
+ # Utility method used to rquire all files ending in .rb that lie in the
33
+ # directory below this file that has the same name as the filename passed
34
+ # in. Optionally, a specific _directory_ name can be passed in such that
35
+ # the _filename_ does not have to be equivalent to the directory.
36
+ #
37
+ def self.require_all_libs_relative_to( fname, dir = nil )
38
+ dir ||= ::File.basename(fname, '.*')
39
+ search_me = ::File.expand_path(
40
+ ::File.join(::File.dirname(fname), dir, '*', '*.rb'))
41
+
42
+ Dir.glob(search_me).sort.each {|rb| require rb}
43
+ end
44
+
45
+ end # module Erlyfirerb
46
+
47
+ require 'erlyfire'
48
+ # EOF
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: davidsmalley-erlyfirerb
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.1"
5
+ platform: ruby
6
+ authors:
7
+ - David Smalley
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-10-16 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: A little wrapper around posting to the erlyfire campfire bot
17
+ email: david@davidsmalley.com.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - README.txt
26
+ - lib/erlyfirerb.rb
27
+ - lib/erlyfire.rb
28
+ - History.txt
29
+ - Manifest.txt
30
+ - Rakefile
31
+ has_rdoc: false
32
+ homepage: http://github.com/davidsmalley/erlyfirerb
33
+ post_install_message:
34
+ rdoc_options: []
35
+
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: "0"
43
+ version:
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ version:
50
+ requirements: []
51
+
52
+ rubyforge_project:
53
+ rubygems_version: 1.2.0
54
+ signing_key:
55
+ specification_version: 2
56
+ summary: A little wrapper around posting to the erlyfire campfire bot
57
+ test_files: []
58
+