mirrored 0.1.0
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 +2 -0
- data/License.txt +20 -0
- data/Manifest.txt +47 -0
- data/README.txt +1 -0
- data/Rakefile +4 -0
- data/config/hoe.rb +71 -0
- data/config/requirements.rb +17 -0
- data/lib/mirrored/base.rb +50 -0
- data/lib/mirrored/connection.rb +39 -0
- data/lib/mirrored/date.rb +28 -0
- data/lib/mirrored/post.rb +120 -0
- data/lib/mirrored/tag.rb +34 -0
- data/lib/mirrored/update.rb +16 -0
- data/lib/mirrored/version.rb +9 -0
- data/lib/mirrored.rb +25 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/tasks/deployment.rake +27 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- data/test/fixtures/xml/add_post_done.xml +2 -0
- data/test/fixtures/xml/all_posts.xml +2919 -0
- data/test/fixtures/xml/all_posts_by_tag.xml +30 -0
- data/test/fixtures/xml/dates.xml +739 -0
- data/test/fixtures/xml/dates_for_tag.xml +270 -0
- data/test/fixtures/xml/delete_post.xml +2 -0
- data/test/fixtures/xml/delete_post_failed.xml +2 -0
- data/test/fixtures/xml/posts.xml +6 -0
- data/test/fixtures/xml/posts_by_date.xml +4 -0
- data/test/fixtures/xml/posts_by_tag.xml +4 -0
- data/test/fixtures/xml/posts_by_url.xml +4 -0
- data/test/fixtures/xml/recent_posts.xml +19 -0
- data/test/fixtures/xml/recent_posts_by_tag.xml +19 -0
- data/test/fixtures/xml/recent_posts_by_tag_and_count.xml +8 -0
- data/test/fixtures/xml/tag_rename.xml +2 -0
- data/test/fixtures/xml/tags.xml +1368 -0
- data/test/test_base.rb +33 -0
- data/test/test_date.rb +26 -0
- data/test/test_helper.rb +12 -0
- data/test/test_post.rb +135 -0
- data/test/test_tag.rb +23 -0
- data/test/test_update.rb +18 -0
- data/website/css/common.css +47 -0
- data/website/index.html +92 -0
- metadata +109 -0
data/test/test_base.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestBase < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
Mirrored::Base.remove_connection
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'should know service' do
|
10
|
+
Mirrored::Base.establish_connection(:delicious, 'jnunemaker', 'password')
|
11
|
+
assert_equal :delicious, Mirrored::Base.service
|
12
|
+
end
|
13
|
+
|
14
|
+
test 'should allow using valid service' do
|
15
|
+
assert_nothing_raised do
|
16
|
+
Mirrored::Base.establish_connection(:delicious, 'jnunemaker', 'password')
|
17
|
+
Mirrored::Base.establish_connection(:magnolia, 'jnunemaker', 'password')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
test 'should not allowing using invalid service' do
|
22
|
+
assert_raises(Mirrored::InvalidService) do
|
23
|
+
Mirrored::Base.establish_connection(:funkychicken, 'jnunemaker', 'password')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
test 'should find correct api url based on service' do
|
28
|
+
Mirrored::Base.establish_connection(:delicious, 'jnunemaker', 'password')
|
29
|
+
assert_equal 'https://api.del.icio.us/v1', Mirrored::Base.api_url
|
30
|
+
Mirrored::Base.establish_connection(:magnolia, 'jnunemaker', 'password')
|
31
|
+
assert_equal 'https://ma.gnolia.com/api/mirrord/v1', Mirrored::Base.api_url
|
32
|
+
end
|
33
|
+
end
|
data/test/test_date.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestDate < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
Mirrored::Base.establish_connection(:magnolia, 'jnunemaker', 'password')
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'should get all dates' do
|
10
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/dates.xml')).read
|
11
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/dates'), :string => data)
|
12
|
+
dates = Mirrored::Date.find(:all)
|
13
|
+
assert_equal 663, dates.size
|
14
|
+
assert_equal Date.civil(2005, 5, 10), dates.first.date
|
15
|
+
assert_equal '87', dates.first.count
|
16
|
+
end
|
17
|
+
|
18
|
+
test 'should get all dates for tag' do
|
19
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/dates_for_tag.xml')).read
|
20
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/dates?tag=ruby'), :string => data)
|
21
|
+
dates = Mirrored::Date.find(:all, :tag => 'ruby')
|
22
|
+
assert_equal 241, dates.size
|
23
|
+
assert_equal Date.civil(2006, 2, 8), dates.first.date
|
24
|
+
assert_equal '1', dates.first.count
|
25
|
+
end
|
26
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'fake_web'
|
4
|
+
require File.dirname(__FILE__) + '/../lib/mirrored'
|
5
|
+
|
6
|
+
class << Test::Unit::TestCase
|
7
|
+
def test(name, &block)
|
8
|
+
test_name = :"test_#{name.gsub(' ','_')}"
|
9
|
+
raise ArgumentError, "#{test_name} is already defined" if self.instance_methods.include? test_name.to_s
|
10
|
+
define_method test_name, &block
|
11
|
+
end
|
12
|
+
end
|
data/test/test_post.rb
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestPost < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
Mirrored::Base.establish_connection(:magnolia, 'jnunemaker', 'password')
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'should get posts' do
|
10
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/posts.xml')).read
|
11
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/get'), :string => data)
|
12
|
+
posts = Mirrored::Post.find(:get)
|
13
|
+
assert_equal 3, posts.size
|
14
|
+
first = posts.first
|
15
|
+
assert_equal 'http://codersifu.blogspot.com/2007/10/restful-pdf-on-rails-20.html', first.href
|
16
|
+
assert_equal 'CoderSifu: RESTful PDF on Rails 2.0', first.description
|
17
|
+
assert_equal 'A nice simple example of responding to the pdf format using rails rest-fulness.', first.extended
|
18
|
+
assert_equal '580485cf09ea39f3cb4a1182390a6dfb', first.hash
|
19
|
+
assert_equal '1', first.others
|
20
|
+
assert_equal ['ruby on rails', 'rest', 'pdf', 'plugins', 'railstips'], first.tags
|
21
|
+
assert_equal Time.utc(2007, 10, 05, 14, 59, 02), first.time
|
22
|
+
end
|
23
|
+
|
24
|
+
test 'should get posts by tag' do
|
25
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/posts_by_tag.xml')).read
|
26
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/get?tag=ruby'), :string => data)
|
27
|
+
posts = Mirrored::Post.find(:get, :tag => 'ruby')
|
28
|
+
assert_equal 1, posts.size
|
29
|
+
end
|
30
|
+
|
31
|
+
test 'should get posts by date' do
|
32
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/posts_by_date.xml')).read
|
33
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/get?dt=2007-10-05'), :string => data)
|
34
|
+
posts = Mirrored::Post.find(:get, :dt => '2007-10-05')
|
35
|
+
assert_equal 2, posts.size
|
36
|
+
end
|
37
|
+
|
38
|
+
test 'should get posts by url' do
|
39
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/posts_by_url.xml')).read
|
40
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/get?url=http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes'), :string => data)
|
41
|
+
posts = Mirrored::Post.find(:get, :url => 'http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes')
|
42
|
+
assert_equal 1, posts.size
|
43
|
+
end
|
44
|
+
|
45
|
+
test 'should filter by recent posts' do
|
46
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/recent_posts.xml')).read
|
47
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/recent'), :string => data)
|
48
|
+
posts = Mirrored::Post.find(:recent)
|
49
|
+
assert_equal 15, posts.size
|
50
|
+
end
|
51
|
+
|
52
|
+
test 'should filter recent posts by tag' do
|
53
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/recent_posts_by_tag.xml')).read
|
54
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/recent?tag=ruby'), :string => data)
|
55
|
+
posts = Mirrored::Post.find(:recent, :tag => 'ruby')
|
56
|
+
assert_equal 15, posts.size
|
57
|
+
end
|
58
|
+
|
59
|
+
test 'should filter recent posts by tag and count' do
|
60
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/recent_posts_by_tag_and_count.xml')).read
|
61
|
+
# TODO: make fake web realize that tag=ruby&count=5 is the same as count=5&tag=ruby
|
62
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/recent?tag=ruby&count=5'), :string => data)
|
63
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/recent?count=5&tag=ruby'), :string => data)
|
64
|
+
posts = Mirrored::Post.find(:recent, :tag => 'ruby', :count => 5)
|
65
|
+
assert_equal 5, posts.size
|
66
|
+
end
|
67
|
+
|
68
|
+
test 'should get all posts' do
|
69
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/all_posts.xml')).read
|
70
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/all'), :string => data)
|
71
|
+
posts = Mirrored::Post.find(:all)
|
72
|
+
assert_equal 2607, posts.size
|
73
|
+
end
|
74
|
+
|
75
|
+
test 'should get all posts for tag' do
|
76
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/all_posts_by_tag.xml')).read
|
77
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/all?tag=actionscript'), :string => data)
|
78
|
+
posts = Mirrored::Post.find(:all, :tag => 'actionscript')
|
79
|
+
assert_equal 24, posts.size
|
80
|
+
end
|
81
|
+
|
82
|
+
test 'should be able to convert post to hash' do
|
83
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/posts_by_url.xml')).read
|
84
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/get?url=http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes'), :string => data)
|
85
|
+
posts = Mirrored::Post.find(:get, :url => 'http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes')
|
86
|
+
post = posts.first
|
87
|
+
post_hash = {
|
88
|
+
:description => 'Easy charting with amcharts and ruby on rails.',
|
89
|
+
:extended => 'Rails on the Run - Sexy charts in less than 5 minutes',
|
90
|
+
:tags => 'charts ruby_on_rails railstips',
|
91
|
+
:url => 'http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes',
|
92
|
+
:share => 'yes'
|
93
|
+
}
|
94
|
+
assert_equal post_hash.keys.map { |k| k.to_s }.sort, post.to_h.keys.map { |k| k.to_s }.sort
|
95
|
+
assert_equal post_hash.values.sort, post.to_h.values.sort
|
96
|
+
end
|
97
|
+
|
98
|
+
# TODO: Figure out best way to test this. Fakeweb craps out because of hash keys not being ordered correctly in url. I don't feel like thinking about it now.
|
99
|
+
# test 'should be able to add post' do
|
100
|
+
# data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/add_post_done.xml')).read
|
101
|
+
# FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/add?'), :string => data)
|
102
|
+
# p = Mirrored::Post.new
|
103
|
+
# p.url = 'http://addictedtonew.com'
|
104
|
+
# p.description = 'Addicted to New by John Nuneamker'
|
105
|
+
# p.dt = Time.now.utc
|
106
|
+
# p.extended = 'Really cool dude'
|
107
|
+
# p.tags = %w(cool dude ruby)
|
108
|
+
# p.save(false)
|
109
|
+
# end
|
110
|
+
|
111
|
+
test 'should know if destroy succeeded' do
|
112
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/delete_post.xml')).read
|
113
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/delete?url=http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes'), :string => data)
|
114
|
+
assert Mirrored::Post.destroy('http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes')
|
115
|
+
end
|
116
|
+
|
117
|
+
test 'should also know if aliased delete succeeded' do
|
118
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/delete_post.xml')).read
|
119
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/delete?url=http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes'), :string => data)
|
120
|
+
assert Mirrored::Post.delete('http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes')
|
121
|
+
end
|
122
|
+
|
123
|
+
test 'should know if destroy failed' do
|
124
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/delete_post_failed.xml')).read
|
125
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/delete?url=http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes'), :string => data)
|
126
|
+
assert ! Mirrored::Post.destroy('http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes')
|
127
|
+
end
|
128
|
+
|
129
|
+
test 'should also know if aliased delete failed' do
|
130
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/delete_post_failed.xml')).read
|
131
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/delete?url=http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes'), :string => data)
|
132
|
+
assert ! Mirrored::Post.delete('http://www.railsontherun.com/2007/10/4/sexy-charts-in-less-than-5-minutes')
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
data/test/test_tag.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestTag < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
Mirrored::Base.establish_connection(:magnolia, 'jnunemaker', 'password')
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'should find tags' do
|
10
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/tags.xml')).read
|
11
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'tags/get'), :string => data)
|
12
|
+
tags = Mirrored::Tag.find(:all)
|
13
|
+
assert_equal 1229, tags.size
|
14
|
+
assert_equal '300', tags.first.name
|
15
|
+
assert_equal '2', tags.first.count
|
16
|
+
end
|
17
|
+
|
18
|
+
test 'should be able to rename tag' do
|
19
|
+
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/tag_rename.xml')).read
|
20
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'tags/rename'), :string => data)
|
21
|
+
assert Mirrored::Tag.rename('fart', 'poo')
|
22
|
+
end
|
23
|
+
end
|
data/test/test_update.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestUpdate < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
Mirrored::Base.establish_connection(:delicious, 'jnunemaker', 'password')
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'should find last updated time' do
|
10
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/update'), :string => %q{<update time="2007-10-05T14:59:02Z" />})
|
11
|
+
assert_equal Time.utc(2007, 10, 05, 14, 59, 02), Mirrored::Update.last
|
12
|
+
end
|
13
|
+
|
14
|
+
test 'should not bomb' do
|
15
|
+
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/update'), :string => "")
|
16
|
+
assert_equal '', Mirrored::Update.last
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
@media screen, projection {
|
2
|
+
/*
|
3
|
+
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
4
|
+
Code licensed under the BSD License:
|
5
|
+
http://developer.yahoo.net/yui/license.txt
|
6
|
+
version: 2.2.0
|
7
|
+
*/
|
8
|
+
body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;}
|
9
|
+
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}/*ol,ul {list-style:none;}*/caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;}
|
10
|
+
/* end of yahoo reset and fonts */
|
11
|
+
|
12
|
+
body {color:#333; background:#4b1a1a; line-height:1.3;}
|
13
|
+
p {margin:0 0 20px;}
|
14
|
+
a {color:#4b1a1a;}
|
15
|
+
a:hover {text-decoration:none;}
|
16
|
+
strong {font-weight:bold;}
|
17
|
+
em {font-style:italics;}
|
18
|
+
h1,h2,h3,h4,h5,h6 {font-weight:bold;}
|
19
|
+
h1 {font-size:197%; margin:30px 0; color:#4b1a1a;}
|
20
|
+
h2 {font-size:174%; margin:20px 0; color:#b8111a;}
|
21
|
+
h3 {font-size:152%; margin:10px 0;}
|
22
|
+
h4 {font-size:129%; margin:10px 0;}
|
23
|
+
pre {background:#eee; padding:20px; border:1px solid #ccc; font-size:100%; overflow:auto;}
|
24
|
+
code {font-size:100%; margin:0; padding:0;}
|
25
|
+
ul, ol {margin:10px 0 10px 25px;}
|
26
|
+
ol li {margin:0 0 10px;}
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
div#wrapper {background:#fff; width:560px; margin:0 auto; padding:20px; border:10px solid #bc8c46; border-width:0 10px;}
|
33
|
+
div#header {position:relative; border-bottom:1px dotted; margin:0 0 10px; padding:0 0 10px;}
|
34
|
+
div#header p {margin:0; padding:0;}
|
35
|
+
div#header h1 {margin:0; padding:0;}
|
36
|
+
ul#nav {position:absolute; top:0; right:0; list-style:none; margin:0; padding:0;}
|
37
|
+
ul#nav li {display:inline; padding:0 0 0 5px;}
|
38
|
+
ul#nav li a {}
|
39
|
+
div#content {}
|
40
|
+
div#footer {margin:40px 0 0; border-top:1px dotted; padding:10px 0 0;}
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
}
|
data/website/index.html
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
5
|
+
<title>Mirrored by John Nunemaker</title>
|
6
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
|
10
|
+
<div id="wrapper">
|
11
|
+
<div id="header">
|
12
|
+
<h1>Mirrored</h1>
|
13
|
+
<p>Bookmarking discrimination is no more.</p>
|
14
|
+
|
15
|
+
<ul id="nav">
|
16
|
+
<li><a href="mirrored/">Docs</a></li>
|
17
|
+
<li><a href="http://rubyforge.org/projects/mirrored/">Rubyforge Page</a></li>
|
18
|
+
</ul>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div id="content">
|
22
|
+
<p>Mirrored is a wrapper for the <a href="http://wiki.ma.gnolia.com/Mirror%27d_API">mirrored</a> <a href="http://del.icio.us">del.icio.us</a> and <a href="http://ma.gnolia.com">ma.gnolia</a> apis</a>.</p>
|
23
|
+
|
24
|
+
<h2>Installation</h2>
|
25
|
+
|
26
|
+
<pre><code>$ sudo gem install mirrored</code></pre>
|
27
|
+
|
28
|
+
<h2>Usage</h2>
|
29
|
+
|
30
|
+
<h3>Last Update</h3>
|
31
|
+
<pre><code class="ruby">Mirrored::Update.last # => ruby time object equal to last update</code></pre>
|
32
|
+
|
33
|
+
<h3>Posts</h3>
|
34
|
+
<pre><code class="ruby"># => posts
|
35
|
+
Mirrored::Post.find(:get)
|
36
|
+
|
37
|
+
# => posts tagged ruby
|
38
|
+
Mirrored::Post.find(:get, :tag => 'ruby')
|
39
|
+
|
40
|
+
# => posts tagged ruby on oct. 5, 2007
|
41
|
+
Mirrored::Post.find(:get, :tag => 'ruby', :dt => '2007-10-05')
|
42
|
+
|
43
|
+
# => posts with url http://addictedtonew
|
44
|
+
Mirrored::Post.find(:get, :url => 'http://addictedtonew')
|
45
|
+
|
46
|
+
# => all posts (use sparingly according to delicious and magnolia)
|
47
|
+
Mirrored::Post.find(:all)
|
48
|
+
|
49
|
+
# => all posts for tag ruby (use sparingly according to delicious and magnolia)
|
50
|
+
Mirrored::Post.find(:all, :tag => 'ruby')
|
51
|
+
|
52
|
+
# most recent posts
|
53
|
+
Mirrored::Post.find(:recent)
|
54
|
+
|
55
|
+
# => most recent posts for tag ruby
|
56
|
+
Mirrored::Post.find(:recent, :tag => 'ruby')
|
57
|
+
|
58
|
+
# => 5 most recent posts for tag ruby
|
59
|
+
Mirrored::Post.find(:recent, :tag => 'ruby', :count => '5')
|
60
|
+
</code></pre>
|
61
|
+
|
62
|
+
<h3>Tags</h3>
|
63
|
+
<pre><code class="ruby"># gets list of all tags and the number of times you've used them
|
64
|
+
Mirrored::Tag.find(:get)
|
65
|
+
|
66
|
+
# Rename a tag
|
67
|
+
Mirrored::Tag.rename('microsoft', 'suckfest')</code></pre>
|
68
|
+
|
69
|
+
<h3>Dates</h3>
|
70
|
+
<pre><code class="ruby"># => finds all dates you have posted with counts for each day
|
71
|
+
Mirrored::Date.find(:all)
|
72
|
+
|
73
|
+
# => finds all dates you have posted something tagged ruby with counts for each day
|
74
|
+
Mirrored::Date.find(:all, :tag => 'ruby')</code></pre>
|
75
|
+
|
76
|
+
</div>
|
77
|
+
|
78
|
+
<div id="footer">
|
79
|
+
<p>Created by <a href="http://addictedtonew.com/about/">John Nunemaker</a></p>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
|
84
|
+
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
|
85
|
+
<script type="text/javascript">_uacct = "UA-85301-14"; urchinTracker();</script>
|
86
|
+
|
87
|
+
<!-- 103bees.com 'bee' code v1.11 - please do not make any changes! -->
|
88
|
+
<script type="text/javascript" src="http://103bees.com/bees/?bee=3672&fid=9245"></script>
|
89
|
+
<!-- 103bees.com 'bee' code -->
|
90
|
+
|
91
|
+
</body>
|
92
|
+
</html>
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.4
|
3
|
+
specification_version: 1
|
4
|
+
name: mirrored
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.1.0
|
7
|
+
date: 2007-10-06 00:00:00 -04:00
|
8
|
+
summary: Wrapper for delicious and magnolia mirrored apis
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: nunemaker@gmail.com
|
12
|
+
homepage: http://mirrored.rubyforge.org
|
13
|
+
rubyforge_project: mirrored
|
14
|
+
description: Wrapper for delicious and magnolia mirrored apis
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- John Nunemaker
|
31
|
+
files:
|
32
|
+
- History.txt
|
33
|
+
- License.txt
|
34
|
+
- Manifest.txt
|
35
|
+
- README.txt
|
36
|
+
- Rakefile
|
37
|
+
- config/hoe.rb
|
38
|
+
- config/requirements.rb
|
39
|
+
- lib/mirrored.rb
|
40
|
+
- lib/mirrored/base.rb
|
41
|
+
- lib/mirrored/connection.rb
|
42
|
+
- lib/mirrored/date.rb
|
43
|
+
- lib/mirrored/post.rb
|
44
|
+
- lib/mirrored/tag.rb
|
45
|
+
- lib/mirrored/update.rb
|
46
|
+
- lib/mirrored/version.rb
|
47
|
+
- script/destroy
|
48
|
+
- script/generate
|
49
|
+
- script/txt2html
|
50
|
+
- setup.rb
|
51
|
+
- tasks/deployment.rake
|
52
|
+
- tasks/environment.rake
|
53
|
+
- tasks/website.rake
|
54
|
+
- test/test_base.rb
|
55
|
+
- test/test_date.rb
|
56
|
+
- test/test_helper.rb
|
57
|
+
- test/test_post.rb
|
58
|
+
- test/test_tag.rb
|
59
|
+
- test/test_update.rb
|
60
|
+
- test/fixtures/xml/add_post_done.xml
|
61
|
+
- test/fixtures/xml/all_posts.xml
|
62
|
+
- test/fixtures/xml/all_posts_by_tag.xml
|
63
|
+
- test/fixtures/xml/dates.xml
|
64
|
+
- test/fixtures/xml/dates_for_tag.xml
|
65
|
+
- test/fixtures/xml/delete_post.xml
|
66
|
+
- test/fixtures/xml/delete_post_failed.xml
|
67
|
+
- test/fixtures/xml/posts.xml
|
68
|
+
- test/fixtures/xml/posts_by_date.xml
|
69
|
+
- test/fixtures/xml/posts_by_tag.xml
|
70
|
+
- test/fixtures/xml/posts_by_url.xml
|
71
|
+
- test/fixtures/xml/recent_posts.xml
|
72
|
+
- test/fixtures/xml/recent_posts_by_tag.xml
|
73
|
+
- test/fixtures/xml/recent_posts_by_tag_and_count.xml
|
74
|
+
- test/fixtures/xml/tag_rename.xml
|
75
|
+
- test/fixtures/xml/tags.xml
|
76
|
+
- website/css/common.css
|
77
|
+
- website/images
|
78
|
+
- website/index.html
|
79
|
+
test_files:
|
80
|
+
- test/test_base.rb
|
81
|
+
- test/test_date.rb
|
82
|
+
- test/test_helper.rb
|
83
|
+
- test/test_post.rb
|
84
|
+
- test/test_tag.rb
|
85
|
+
- test/test_update.rb
|
86
|
+
rdoc_options:
|
87
|
+
- --main
|
88
|
+
- README.txt
|
89
|
+
extra_rdoc_files:
|
90
|
+
- History.txt
|
91
|
+
- License.txt
|
92
|
+
- Manifest.txt
|
93
|
+
- README.txt
|
94
|
+
executables: []
|
95
|
+
|
96
|
+
extensions: []
|
97
|
+
|
98
|
+
requirements: []
|
99
|
+
|
100
|
+
dependencies:
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: hpricot
|
103
|
+
version_requirement:
|
104
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
105
|
+
requirements:
|
106
|
+
- - "="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: "0.5"
|
109
|
+
version:
|