smackr 0.0.1-universal-java-1.6

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,49 @@
1
+ # rcov generated
2
+ coverage
3
+ coverage.data
4
+
5
+ # rdoc generated
6
+ rdoc
7
+
8
+ # yard generated
9
+ doc
10
+ .yardoc
11
+
12
+ # bundler
13
+ .bundle
14
+
15
+ # jeweler generated
16
+ pkg
17
+
18
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
19
+ #
20
+ # * Create a file at ~/.gitignore
21
+ # * Include files you want ignored
22
+ # * Run: git config --global core.excludesfile ~/.gitignore
23
+ #
24
+ # After doing this, these files will be ignored in all your git projects,
25
+ # saving you from having to 'pollute' every project you touch with them
26
+ #
27
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
28
+ #
29
+ # For MacOS:
30
+ #
31
+ #.DS_Store
32
+
33
+ # For TextMate
34
+ #*.tmproj
35
+ #tmtags
36
+
37
+ # For emacs:
38
+ #*~
39
+ #\#*
40
+ #.\#*
41
+
42
+ # For vim:
43
+ #*.swp
44
+
45
+ # For redcar:
46
+ #.redcar
47
+
48
+ # For rubinius:
49
+ #*.rbc
data/.rvmrc ADDED
@@ -0,0 +1,2 @@
1
+ rvm use jruby-1.6.7-ruby19
2
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in smackr.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,15 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ smackr (0.0.1-java)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ java
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ smackr!
data/LICENSE.txt ADDED
@@ -0,0 +1,31 @@
1
+ SNACKR LICENSE:
2
+ Copyright 2012 PayPal, Inc.
3
+
4
+ All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+
17
+
18
+ SNACK LICENSE:
19
+ Copyright 2002-2008 Jive Software.
20
+
21
+ All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
22
+ you may not use this file except in compliance with the License.
23
+ You may obtain a copy of the License at
24
+
25
+ http://www.apache.org/licenses/LICENSE-2.0
26
+
27
+ Unless required by applicable law or agreed to in writing, software
28
+ distributed under the License is distributed on an "AS IS" BASIS,
29
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30
+ See the License for the specific language governing permissions and
31
+ limitations under the License.
data/README.rdoc ADDED
@@ -0,0 +1,22 @@
1
+ = smackr
2
+
3
+ Smackr is a JRuby gem which wraps the Smack XMPP Java library.
4
+
5
+ == Installing JRuby 1.6.7 Correctly
6
+
7
+ rvm get latest
8
+ rvm reload
9
+ rvm install jruby-1.6.7-ruby19 --1.9
10
+ rvm jruby-1.6.7-ruby19 exec gem install bundler
11
+
12
+ == Authors
13
+
14
+ Pete Gamache and Bob Breznak
15
+
16
+ == Copyright
17
+
18
+ Snackr is Copyright (c) 2012 PayPal, Inc.
19
+ Snack is Copyright (c) 2002-2008 Jive Software.
20
+ Both are released under the Apache License v2.0.
21
+ See LICENSE.txt for further details.
22
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
Binary file
Binary file
data/lib/smackr.rb ADDED
@@ -0,0 +1,16 @@
1
+ require 'java'
2
+
3
+ ## Load our version of Smack (with smackx), if the our user hasn't loaded
4
+ ## one already
5
+ smack_is_already_loaded = org.jivesoftware.smack.Connection rescue nil
6
+ unless smack_is_already_loaded
7
+ require File.dirname(__FILE__)+'/java/smack.jar'
8
+ require File.dirname(__FILE__)+'/java/smackx.jar'
9
+ org.jivesoftware.smack.Connection # this does stuff, oddly enough
10
+ end
11
+
12
+ ## Load Smackr
13
+ %w(main version chat).each do |file|
14
+ require File.dirname(__FILE__)+"/smackr/#{file}"
15
+ end
16
+
@@ -0,0 +1,43 @@
1
+ class Smackr
2
+ class Chat
3
+ attr_reader :chat, :chat_manager
4
+ attr_accessor :message_callback
5
+ attr_accessor :messages
6
+
7
+ def initialize(opts={})
8
+ unless opts[:chat_manager]
9
+ raise ArgumentError, ":chat_manager is required"
10
+ end
11
+ unless opts[:target]
12
+ raise ArgumentError, ':target is required'
13
+ end
14
+
15
+ @chat_manager = opts[:chat_manager]
16
+ @message_callback = opts[:message_callback]
17
+ self.messages = []
18
+ @chat = self.chat_manager.create_chat(opts[:target],
19
+ MessageReceiver.new(:chat => self))
20
+ end
21
+
22
+ def send_message(msg)
23
+ if msg.is_a?(String)
24
+ self.chat.send_message(msg)
25
+ else #TODO take a proper Message object instead of just the message body
26
+ raise Exception, "NOT IMPLEMENTED, SUCKA"
27
+ end
28
+ end
29
+
30
+ class MessageReceiver
31
+ include org.jivesoftware.smack.MessageListener
32
+ attr_accessor :chat
33
+ def initialize(opts={})
34
+ self.chat = opts[:chat]
35
+ end
36
+ def process_message(conn, msg)
37
+ chat.messages << msg
38
+ chat.message_callback.call(conn, msg) if chat.message_callback
39
+ end
40
+ end
41
+
42
+ end
43
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ class Smackr
2
+ VERSION = "0.0.1"
3
+ end
data/smackr.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "smackr/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "smackr"
7
+ s.version = Smackr::VERSION
8
+ s.authors = ["pete gamache", "Bob Breznak"]
9
+ s.email = ["pete@where.com", "bob@where.com"]
10
+ s.homepage = "https://github.com/where/smackr/"
11
+ s.summary = %q{Smackr is a JRuby gem which wraps the Smack XMPP Java library}
12
+ s.description = %q{Smackr is a JRuby gem which wraps the Smack XMPP Java library}
13
+ s.platform = Gem::Platform::CURRENT
14
+
15
+ s.rubyforge_project = "smackr"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ # specify any dependencies here; for example:
23
+ # s.add_development_dependency "rspec"
24
+ # s.add_runtime_dependency "rest-client"
25
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'smackr'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestSmackr < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smackr
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: universal-java-1.6
7
+ authors:
8
+ - pete gamache
9
+ - Bob Breznak
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-03-09 00:00:00.000000000Z
14
+ dependencies: []
15
+ description: Smackr is a JRuby gem which wraps the Smack XMPP Java library
16
+ email:
17
+ - pete@where.com
18
+ - bob@where.com
19
+ executables: []
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - .document
24
+ - .gitignore
25
+ - .rvmrc
26
+ - Gemfile
27
+ - Gemfile.lock
28
+ - LICENSE.txt
29
+ - README.rdoc
30
+ - Rakefile
31
+ - lib/java/smack.jar
32
+ - lib/java/smackx.jar
33
+ - lib/smackr.rb
34
+ - lib/smackr/chat.rb
35
+ - lib/smackr/main.rb
36
+ - lib/smackr/version.rb
37
+ - smackr.gemspec
38
+ - test/helper.rb
39
+ - test/test_smackr.rb
40
+ homepage: https://github.com/where/smackr/
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ none: false
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ none: false
58
+ requirements: []
59
+ rubyforge_project: smackr
60
+ rubygems_version: 1.8.15
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Smackr is a JRuby gem which wraps the Smack XMPP Java library
64
+ test_files:
65
+ - test/helper.rb
66
+ - test/test_smackr.rb
67
+ ...