share-me 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +12 -0
- data/MIT-LICENSE +20 -0
- data/README +35 -0
- data/Rakefile +67 -0
- data/install.rb +0 -0
- data/lib/share-me.rb +1 -0
- data/lib/share_me.rb +17 -0
- data/lib/share_me/digg.rb +26 -0
- data/lib/share_me/facebook.rb +10 -0
- data/lib/share_me/google.rb +10 -0
- data/lib/share_me/stumble.rb +11 -0
- data/lib/share_me/twitter.rb +18 -0
- data/lib/share_me/version.rb +3 -0
- data/lib/shareme.rb +1 -0
- data/test/share_me_test.rb +40 -0
- data/test/share_me_twitter_test.rb +10 -0
- data/test/test_helper.rb +2 -0
- metadata +79 -0
data/CHANGELOG
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
* v0.2.4
|
2
|
+
1. LiveData::ThreadWatch module is implemented.
|
3
|
+
2. default ReadTime and WaitTime is set to 25
|
4
|
+
3. write_json method is removed from Channel class
|
5
|
+
* v0.2.3
|
6
|
+
1. Make the live data compartable to ruby 1.8.x
|
7
|
+
* v0.2.2
|
8
|
+
1. New method set_read_time in User class.
|
9
|
+
2. handle read & write locking in User class.
|
10
|
+
3. write_json and read_json methods are removed from the User class.
|
11
|
+
4. Default ReadTime is set to 30 seconds.
|
12
|
+
5. handle the user list in group
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 siddick.com
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
== ShareMe
|
2
|
+
Share your webpage on social sites.
|
3
|
+
|
4
|
+
== Installation
|
5
|
+
Step 1 :-
|
6
|
+
Install share-me gem
|
7
|
+
* gem install share-me
|
8
|
+
Add the share-me gem in config/environment.rb
|
9
|
+
* config.gem "share-me"
|
10
|
+
|
11
|
+
== Example
|
12
|
+
|
13
|
+
<% url = "http://www.google.com/" %>
|
14
|
+
<h1> Share Button </h2>
|
15
|
+
<table><tr>
|
16
|
+
<td><%= ShareMe::Twitter.button( url ) %></td>
|
17
|
+
<td><%= ShareMe::Facebook.button( url ) %></td>
|
18
|
+
<td><%= ShareMe::Google.button( url ) %></td>
|
19
|
+
<td><%= ShareMe::Stumble.button( url ) %></td>
|
20
|
+
<td><%= ShareMe::Digg.button( url ) %></td>
|
21
|
+
</tr></table>
|
22
|
+
|
23
|
+
<h1> Small Share Button </h2>
|
24
|
+
<table><tr>
|
25
|
+
<td><%= ShareMe::Twitter.small_button( url ) %></td>
|
26
|
+
<td><%= ShareMe::Facebook.small_button( url ) %></td>
|
27
|
+
<td><%= ShareMe::Google.small_button( url ) %></td>
|
28
|
+
<td><%= ShareMe::Stumble.small_button( url ) %></td>
|
29
|
+
<td><%= ShareMe::Digg.small_button( url ) %></td>
|
30
|
+
</tr></table>
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
require 'rake/gempackagetask'
|
5
|
+
require File.join(File.dirname(__FILE__), 'lib', 'share_me', 'version')
|
6
|
+
|
7
|
+
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
8
|
+
PKG_NAME = 'share-me'
|
9
|
+
PKG_VERSION = ShareMe::Version + PKG_BUILD
|
10
|
+
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
11
|
+
|
12
|
+
RELEASE_NAME = "REL #{PKG_VERSION}"
|
13
|
+
|
14
|
+
|
15
|
+
desc 'Default: run unit tests.'
|
16
|
+
task :default => :test
|
17
|
+
|
18
|
+
desc 'Test the share_me plugin.'
|
19
|
+
Rake::TestTask.new(:test) do |t|
|
20
|
+
t.libs << 'lib'
|
21
|
+
t.libs << 'test'
|
22
|
+
t.pattern = 'test/**/*_test.rb'
|
23
|
+
t.verbose = true
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'Generate documentation for the share_me plugin.'
|
27
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
28
|
+
rdoc.rdoc_dir = 'rdoc'
|
29
|
+
rdoc.title = 'ShareMe'
|
30
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
31
|
+
rdoc.rdoc_files.include('README')
|
32
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
33
|
+
end
|
34
|
+
|
35
|
+
dist_dirs = [ "lib", "test", "examples" ]
|
36
|
+
|
37
|
+
spec = Gem::Specification.new do |s|
|
38
|
+
s.platform = Gem::Platform::RUBY
|
39
|
+
s.name = PKG_NAME
|
40
|
+
s.version = PKG_VERSION
|
41
|
+
s.summary = "Share your webpage on social sites"
|
42
|
+
s.description = %q{Using the share_me plugin, you can share your web page on social sites}
|
43
|
+
|
44
|
+
s.files = [ "Rakefile","MIT-LICENSE", "install.rb", "README", "CHANGELOG" ]
|
45
|
+
dist_dirs.each do |dir|
|
46
|
+
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
47
|
+
end
|
48
|
+
|
49
|
+
s.require_path = 'lib'
|
50
|
+
s.autorequire = 'share_me'
|
51
|
+
|
52
|
+
s.has_rdoc = true
|
53
|
+
s.extra_rdoc_files = %w( README )
|
54
|
+
s.rdoc_options.concat ['--main', 'README']
|
55
|
+
|
56
|
+
s.author = "Mohammed Siddick. E"
|
57
|
+
s.email = "siddick.mails@gmail.com"
|
58
|
+
s.homepage = "http://siddick.github.com/"
|
59
|
+
#s.rubyforge_project = "live_data"
|
60
|
+
end
|
61
|
+
|
62
|
+
Rake::GemPackageTask.new(spec) do |p|
|
63
|
+
p.gem_spec = spec
|
64
|
+
p.need_tar = true
|
65
|
+
p.need_zip = true
|
66
|
+
end
|
67
|
+
|
data/install.rb
ADDED
File without changes
|
data/lib/share-me.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'share_me'
|
data/lib/share_me.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
module ShareMe
|
3
|
+
autoload :Twitter, 'share_me/twitter'
|
4
|
+
autoload :Facebook, 'share_me/facebook'
|
5
|
+
autoload :Google, 'share_me/google'
|
6
|
+
autoload :Stumble, 'share_me/stumble'
|
7
|
+
autoload :Digg, 'share_me/digg'
|
8
|
+
autoload :Version, 'share_me/version'
|
9
|
+
|
10
|
+
def self.button( url, service = :Facebook )
|
11
|
+
const_get( service ).button( url )
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.small_button( url, service = :Facebook )
|
15
|
+
const_get( service ).small_button( url )
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ShareMe
|
2
|
+
module Digg
|
3
|
+
def self.button( url )
|
4
|
+
"<a class='DiggThisButton DiggMedium' href='http://digg.com/submit?url=#{url}' ></a>
|
5
|
+
<script type='text/javascript'>
|
6
|
+
(function() {
|
7
|
+
var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
|
8
|
+
s.type = 'text/javascript';
|
9
|
+
s.src = 'http://widgets.digg.com/buttons.js';
|
10
|
+
s1.parentNode.insertBefore(s, s1);
|
11
|
+
})();
|
12
|
+
</script>"
|
13
|
+
end
|
14
|
+
def self.small_button( url )
|
15
|
+
"<a class='DiggThisButton DiggCompact' href='http://digg.com/submit?url=#{url}' ></a>
|
16
|
+
<script type='text/javascript'>
|
17
|
+
(function() {
|
18
|
+
var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
|
19
|
+
s.type = 'text/javascript';
|
20
|
+
s.src = 'http://widgets.digg.com/buttons.js';
|
21
|
+
s1.parentNode.insertBefore(s, s1);
|
22
|
+
})();
|
23
|
+
</script>"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module ShareMe
|
2
|
+
module Facebook
|
3
|
+
def self.button( url )
|
4
|
+
"<a name='fb_share' type='box_count' share_url='#{url}' href='http://www.facebook.com/sharer.php'>Share</a><script src='http://static.ak.fbcdn.net/connect.php/js/FB.Share' type='text/javascript'></script>"
|
5
|
+
end
|
6
|
+
def self.small_button( url )
|
7
|
+
"<a name='fb_share' type='button_count' share_url='#{url}' href='http://www.facebook.com/sharer.php'>Share</a><script src='http://static.ak.fbcdn.net/connect.php/js/FB.Share' type='text/javascript'></script>"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module ShareMe
|
2
|
+
module Google
|
3
|
+
def self.button( url )
|
4
|
+
"<a title='Post on Google Buzz' class='google-buzz-button' href='http://www.google.com/buzz/post' data-button-style='normal-count' data-locale='en_GB' data-url='#{url}'></a><script type='text/javascript' src='http://www.google.com/buzz/api/button.js'></script>"
|
5
|
+
end
|
6
|
+
def self.small_button( url )
|
7
|
+
"<a title='Post on Google Buzz' class='google-buzz-button' href='http://www.google.com/buzz/post' data-button-style='small-count' data-locale='en_GB' data-url='#{url}'></a><script type='text/javascript' src='http://www.google.com/buzz/api/button.js'></script>"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ShareMe
|
2
|
+
module Stumble
|
3
|
+
def self.button( url )
|
4
|
+
"<script src='http://www.stumbleupon.com/hostedbadge.php?s=5&r=#{url}'></script>"
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.small_button( url )
|
8
|
+
"<script src='http://www.stumbleupon.com/hostedbadge.php?s=1&r=#{url}'></script>"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ShareMe
|
2
|
+
module Twitter
|
3
|
+
def self.button( url )
|
4
|
+
"<script type='text/javascript'>
|
5
|
+
tweetmeme_url = '#{url}';
|
6
|
+
tweetmeme_style = '';
|
7
|
+
</script>
|
8
|
+
<script type='text/javascript' src='http://tweetmeme.com/i/scripts/button.js'></script>"
|
9
|
+
end
|
10
|
+
def self.small_button( url )
|
11
|
+
"<script type='text/javascript'>
|
12
|
+
tweetmeme_url = '#{url}';
|
13
|
+
tweetmeme_style = 'compact';
|
14
|
+
</script>
|
15
|
+
<script type='text/javascript' src='http://tweetmeme.com/i/scripts/button.js'></script>"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/shareme.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'share_me'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ShareMeTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
Url = "http://www.siddick.com/"
|
6
|
+
def test_twitter
|
7
|
+
content = ShareMe.button( Url, :Twitter )
|
8
|
+
assert content.is_a? String
|
9
|
+
content = ShareMe.small_button( Url, :Twitter )
|
10
|
+
assert content.is_a? String
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_facebook
|
14
|
+
content = ShareMe.button( Url, :Facebook )
|
15
|
+
assert content.is_a? String
|
16
|
+
content = ShareMe.small_button( Url, :Facebook )
|
17
|
+
assert content.is_a? String
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_google
|
21
|
+
content = ShareMe.button( Url, :Google )
|
22
|
+
assert content.is_a? String
|
23
|
+
content = ShareMe.small_button( Url, :Google )
|
24
|
+
assert content.is_a? String
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_stumble
|
28
|
+
content = ShareMe.button( Url, :Stumble )
|
29
|
+
assert content.is_a? String
|
30
|
+
content = ShareMe.small_button( Url, :Stumble )
|
31
|
+
assert content.is_a? String
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_digg
|
35
|
+
content = ShareMe.button( Url, :Digg )
|
36
|
+
assert content.is_a? String
|
37
|
+
content = ShareMe.small_button( Url, :Digg )
|
38
|
+
assert content.is_a? String
|
39
|
+
end
|
40
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: share-me
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Mohammed Siddick. E
|
13
|
+
autorequire: share_me
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-05-24 00:00:00 +05:30
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Using the share_me plugin, you can share your web page on social sites
|
22
|
+
email: siddick.mails@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README
|
29
|
+
files:
|
30
|
+
- Rakefile
|
31
|
+
- MIT-LICENSE
|
32
|
+
- install.rb
|
33
|
+
- README
|
34
|
+
- CHANGELOG
|
35
|
+
- lib/share_me/twitter.rb
|
36
|
+
- lib/share_me/stumble.rb
|
37
|
+
- lib/share_me/facebook.rb
|
38
|
+
- lib/share_me/digg.rb
|
39
|
+
- lib/share_me/version.rb
|
40
|
+
- lib/share_me/google.rb
|
41
|
+
- lib/shareme.rb
|
42
|
+
- lib/share_me.rb
|
43
|
+
- lib/share-me.rb
|
44
|
+
- test/share_me_test.rb
|
45
|
+
- test/share_me_twitter_test.rb
|
46
|
+
- test/test_helper.rb
|
47
|
+
has_rdoc: true
|
48
|
+
homepage: http://siddick.github.com/
|
49
|
+
licenses: []
|
50
|
+
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options:
|
53
|
+
- --main
|
54
|
+
- README
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
segments:
|
69
|
+
- 0
|
70
|
+
version: "0"
|
71
|
+
requirements: []
|
72
|
+
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 1.3.6
|
75
|
+
signing_key:
|
76
|
+
specification_version: 3
|
77
|
+
summary: Share your webpage on social sites
|
78
|
+
test_files: []
|
79
|
+
|