camper_van 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.gem
2
+ .bundle
3
+ pkg/*
data/.rvmrc ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ruby-1.9.2-p180@camper_van"
8
+
9
+ #
10
+ # First we attempt to load the desired environment directly from the environment
11
+ # file. This is very fast and efficicent compared to running through the entire
12
+ # CLI and selector. If you want feedback on which environment was used then
13
+ # insert the word 'use' after --create as this triggers verbose mode.
14
+ #
15
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
16
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
17
+ then
18
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
19
+
20
+ if [[ -s ".rvm/hooks/after_use" ]]
21
+ then
22
+ . ".rvm/hooks/after_use"
23
+ fi
24
+ else
25
+ # If the environment file has not yet been created, use the RVM CLI to select.
26
+ if ! rvm --create use "$environment_id"
27
+ then
28
+ echo "Failed to create RVM environment 'ruby-1.9.2-p180@campervan'."
29
+ fi
30
+ fi
31
+
32
+ #
33
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
34
+ # it be automatically loaded. Uncomment the following and adjust the filename if
35
+ # necessary.
36
+ #
37
+ # filename=".gems"
38
+ # if [[ -s "$filename" ]] ; then
39
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
40
+ # fi
41
+
42
+ #
43
+ # If you use bundler and would like to run bundle each time you enter the
44
+ # directory, you can uncomment the following code.
45
+ #
46
+ # export PATH="./bin:/Users/nathan/.rvm/gems/ruby-1.9.2-p180@camper_van/bin:/Users/nathan/.rvm/gems/ruby-1.9.2-p180@global/bin:/Users/nathan/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/nathan/.rvm/bin:/Users/nathan/bin:/Users/nathan/scripts:/usr/local/bin:/usr/local/sbin:/usr/local/share/python:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/Users/nathan/work/git_support/bin:/Users/nathan/work/bin"
47
+ #
48
+ # # Ensure that Bundler is installed. Install it if it is not.
49
+ # if ! command -v bundle >/dev/null; then
50
+ # printf "The rubygem 'bundler' is not installed. Installing it now.\n"
51
+ # gem install bundler
52
+ # fi
53
+ #
54
+ # # Bundle while reducing excess noise.
55
+ # printf "Bundling your gems. This may take a few minutes on a fresh clone.\n"
56
+ # bundle --binstubs | grep -v '^Using ' | grep -v ' is complete' | sed '/^$/d'
57
+ #
58
+ # alias bundle="bundle --binstubs"
59
+ #
60
+
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in camper_van.gemspec
4
+ gemspec
5
+
6
+ # specified here rather than in gemspec because they're
7
+ # for local mac development only
8
+ group :development do
9
+ gem "rb-fsevent", :require => false
10
+ gem "growl", :require => false
11
+ gem "guard"
12
+ # 0.4.0.rc versions are still git-only
13
+ gem "guard-minitest", :git => "https://github.com/guard/guard-minitest.git"
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,52 @@
1
+ GIT
2
+ remote: https://github.com/guard/guard-minitest.git
3
+ revision: c5c1efb9cd10f3be36de5c8fdb6615f9b74b5ef0
4
+ specs:
5
+ guard-minitest (0.4.0)
6
+ guard (~> 0.4)
7
+
8
+ PATH
9
+ remote: .
10
+ specs:
11
+ camper_van (0.0.1)
12
+ eventmachine (~> 0.12.10)
13
+ firering (~> 1.1.0)
14
+ logging (~> 1.5.1)
15
+ trollop (~> 1.16.2)
16
+
17
+ GEM
18
+ remote: http://rubygems.org/
19
+ specs:
20
+ addressable (2.2.6)
21
+ em-http-request (0.3.0)
22
+ addressable (>= 2.0.0)
23
+ escape_utils
24
+ eventmachine (>= 0.12.9)
25
+ escape_utils (0.2.3)
26
+ eventmachine (0.12.10)
27
+ firering (1.1.0)
28
+ em-http-request (~> 0.3.0)
29
+ eventmachine (~> 0.12.10)
30
+ yajl-ruby (~> 0.7.6)
31
+ growl (1.0.3)
32
+ guard (0.4.2)
33
+ thor (~> 0.14.6)
34
+ little-plugger (1.1.2)
35
+ logging (1.5.1)
36
+ little-plugger (>= 1.1.2)
37
+ minitest (2.2.2)
38
+ rb-fsevent (0.4.0)
39
+ thor (0.14.6)
40
+ trollop (1.16.2)
41
+ yajl-ruby (0.7.9)
42
+
43
+ PLATFORMS
44
+ ruby
45
+
46
+ DEPENDENCIES
47
+ camper_van!
48
+ growl
49
+ guard
50
+ guard-minitest!
51
+ minitest (~> 2.2.2)
52
+ rb-fsevent
data/Guardfile ADDED
@@ -0,0 +1,6 @@
1
+ guard 'minitest' do
2
+ # with Minitest::Spec
3
+ watch(%r|^spec/(.*)_spec\.rb|)
4
+ watch(%r|^lib/(.*)\.rb|) { |m| "spec/#{m[1]}_spec.rb" }
5
+ watch(%r|^spec/spec_helper\.rb|) { "spec" }
6
+ end
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 Nathan Witmer
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # CamperVan, a Campfire to IRC bridge
2
+
3
+ ## Features
4
+
5
+ CamperVan, as far as your IRC client is concerned, is just another ircd.
6
+
7
+ Campfire rooms and users are mapped as IRC channels and nicks. Campfire
8
+ messages, even custom ones such as tweets and sounds, are translated
9
+ for an IRC client to understand.
10
+
11
+ ## Mappings
12
+
13
+ Wherever possible, Campfire messages and IRC commands are translated
14
+ bidirectionally. Some of the mappings are:
15
+
16
+ IRC Campfire
17
+ --- --------
18
+ #day_job "Day Job" room
19
+ joe_bob (nick) Joe Bob (user)
20
+ @admin_user (nick) An admin user
21
+ "joe_bob: hello" (message) "Joe Bob: hello" (message)
22
+ https://tweet_url Tweet message
23
+ /me waves *waves*
24
+
25
+ /LIST List rooms
26
+ /JOIN #day_job Join the "Day Job" room
27
+ /PART #day_job Leave the "Day Job" room
28
+ /WHO #day_job List users in "Day Job"
29
+
30
+ /MODE +i #day_job Lock room
31
+ /MODE -i #day_job Unlock room
32
+
33
+ /TOPIC #day_job new topic Change room's topic to "new topic"
34
+
35
+ ## Usage
36
+
37
+ ### Installation
38
+
39
+ gem install camper_van
40
+ camper_van --help
41
+
42
+ ### Running CamperVan
43
+
44
+ camper_van
45
+
46
+ Then, from your IRC client, set up a connection to `localhost:6667`. To
47
+ authenticate with Campfire, you must configure your connection's
48
+ password (the IRC PASS command) to be
49
+
50
+ campfire_subdomain:api_key
51
+
52
+ Connect, and `/LIST` will show you the irc channels / campfire rooms you
53
+ have access to.
54
+
55
+ ## Development
56
+
57
+ CamperVan uses:
58
+
59
+ * ruby 1.9.2 + minitest
60
+ * [bundler](http://gembundler.com/)
61
+ * [eventmachine](http://rubyeventmachine.com/)
62
+ * [firering](https://github.com/EmmanuelOga/firering)
63
+ * [logging](https://github.com/TwP/logging)
64
+ * [trollop](http://trollop.rubyforge.org/)
65
+
66
+ ## License
67
+
68
+ See LICENSE for details.
69
+
70
+ ## Contributing
71
+
72
+ Fork, patch, test, pull request.
73
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs = %w(lib spec)
7
+ t.pattern = "spec/**/*_spec.rb"
8
+ end
9
+
10
+ task :default => :test
data/bin/camper_van ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "camper_van"
4
+ require "trollop"
5
+
6
+ def usage
7
+ STDERR.puts "camper_van proxy <server> [port]"
8
+ exit 1
9
+ end
10
+
11
+ parser = Trollop::Parser.new do
12
+ version "camper_van version #{CamperVan::VERSION}"
13
+ banner <<-banner
14
+ camper_van is a campfire to irc bridge.
15
+
16
+ Usage:
17
+
18
+ camper_van <bind address> [bind port] [options]
19
+
20
+ bind address defaults to 127.0.0.1
21
+ bind port defaults to 6667
22
+
23
+ For irc debugging, use the debugging proxy:
24
+
25
+ camper_van proxy <server> [port]
26
+
27
+ banner
28
+
29
+ stop_on "proxy"
30
+
31
+ opt :log_level, "Log level", :default => "info"
32
+ opt :log_file, "Log file", :short => "f", :type => :string
33
+ end
34
+
35
+ opts = Trollop.with_standard_exception_handling parser do
36
+ o = parser.parse ARGV
37
+
38
+ if (ARGV.first == "proxy" && ARGV.size == 1)
39
+ raise Trollop::HelpNeeded
40
+ end
41
+
42
+ o
43
+ end
44
+
45
+ if ARGV.first == "proxy"
46
+ if ARGV[2]
47
+ CamperVan::DebugProxy.run(ARGV[1], ARGV[2].to_i)
48
+ else
49
+ CamperVan::DebugProxy.run(ARGV[1])
50
+ end
51
+ else
52
+
53
+ CamperVan::Server.run(
54
+ ARGV[0] || "127.0.0.1",
55
+ ARGV[1] || 6667,
56
+ :log_level => opts[:log_level].to_sym,
57
+ :log_to => opts[:log_file]
58
+ )
59
+
60
+ end
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "camper_van/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "camper_van"
7
+ s.version = CamperVan::VERSION
8
+ s.authors = ["Nathan Witmer"]
9
+ s.email = ["nwitmer@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{An IRC to Campfire bridge}
12
+ s.description = %q{An IRC to Campfire bridge for IRC-based access to campfire chatrooms}
13
+
14
+ s.rubyforge_project = "camper_van"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "eventmachine", "~> 0.12.10"
22
+ s.add_dependency "firering", "~> 1.1.0"
23
+ s.add_dependency "logging", "~> 1.5.1"
24
+ s.add_dependency "trollop", "~> 1.16.2"
25
+
26
+ s.add_development_dependency "minitest", "~> 2.2.2"
27
+ end