spacer 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/MIT-LICENSE +21 -0
- data/Manifest.txt +34 -0
- data/README.txt +54 -0
- data/Rakefile +20 -0
- data/bin/spacer +8 -0
- data/lib/spacer.rb +63 -0
- data/lib/spacer/auth.rb +23 -0
- data/lib/spacer/client.rb +141 -0
- data/lib/spacer/model.rb +124 -0
- data/lib/spacer/models/album.rb +6 -0
- data/lib/spacer/models/details.rb +6 -0
- data/lib/spacer/models/group.rb +6 -0
- data/lib/spacer/models/interest.rb +6 -0
- data/lib/spacer/models/mood.rb +6 -0
- data/lib/spacer/models/photo.rb +6 -0
- data/lib/spacer/models/profile.rb +6 -0
- data/lib/spacer/models/status.rb +6 -0
- data/lib/spacer/models/user.rb +77 -0
- data/lib/spacer/models/video.rb +6 -0
- data/tasks/annotations.rake +30 -0
- data/tasks/doc.rake +49 -0
- data/tasks/gem.rake +89 -0
- data/tasks/manifest.rake +55 -0
- data/tasks/post_load.rake +18 -0
- data/tasks/rubyforge.rake +57 -0
- data/tasks/setup.rb +191 -0
- data/tasks/spec.rake +43 -0
- data/tasks/svn.rake +44 -0
- data/tasks/test.rake +40 -0
- data/test/test_client.rb +144 -0
- data/test/test_helper.rb +82 -0
- data/test/test_spacer.rb +0 -0
- data/test/test_user.rb +33 -0
- metadata +85 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
module Spacer
|
2
|
+
class Group
|
3
|
+
include Model
|
4
|
+
attr_accessor :user, :moderatorUserId, :memberBulletins, :descriptionShort, :city, :region, :groupUri, :nonMemberBoardPosting, :memberCount, :isPrivate, :groupName, :categoryId, :membersCanInvite, :imageId, :country, :isAdult, :groupUrl, :approveMembers, :postalCode, :description, :memberImages, :isPublic, :groupId, :__type, :categoryName, :imageType, :createDate
|
5
|
+
end
|
6
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Spacer
|
2
|
+
class User
|
3
|
+
include Model
|
4
|
+
attr_accessor :name, :uri, :webUri, :userType, :userId, :onlineNow, :image, :__type
|
5
|
+
attr_accessor :client
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def from_hash_with_client(hash, client)
|
9
|
+
instance = new(hash)
|
10
|
+
instance.client = client
|
11
|
+
instance
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
## These are helper methods to access client calls if you already have a user instance
|
16
|
+
|
17
|
+
def profile
|
18
|
+
@client.profile(userId)
|
19
|
+
end
|
20
|
+
|
21
|
+
def friends(page=nil, page_size=nil, list=nil)
|
22
|
+
@client.friends(userId, page, page_size, list)
|
23
|
+
end
|
24
|
+
|
25
|
+
def albums
|
26
|
+
@client.albums(userId)
|
27
|
+
end
|
28
|
+
|
29
|
+
def album(album_id)
|
30
|
+
@client.album(userId, album_id)
|
31
|
+
end
|
32
|
+
|
33
|
+
def photos_for_album(album_id)
|
34
|
+
@client.photos_for_album(userId, album_id)
|
35
|
+
end
|
36
|
+
|
37
|
+
def photos
|
38
|
+
@client.photos(userId)
|
39
|
+
end
|
40
|
+
|
41
|
+
def interests
|
42
|
+
@client.interests(userId)
|
43
|
+
end
|
44
|
+
|
45
|
+
def details
|
46
|
+
@client.details(userId)
|
47
|
+
end
|
48
|
+
|
49
|
+
def videos
|
50
|
+
@client.videos(userId)
|
51
|
+
end
|
52
|
+
|
53
|
+
def video(video_id)
|
54
|
+
@client.video(userId, video_id)
|
55
|
+
end
|
56
|
+
|
57
|
+
def photo(photo_id)
|
58
|
+
@client.photo(userId, photo_id)
|
59
|
+
end
|
60
|
+
|
61
|
+
def status
|
62
|
+
@client.status(userId)
|
63
|
+
end
|
64
|
+
|
65
|
+
def mood
|
66
|
+
@client.mood(userId)
|
67
|
+
end
|
68
|
+
|
69
|
+
def friends_with?(friends_ids)
|
70
|
+
@client.friendship?(userId, friend_ids)
|
71
|
+
end
|
72
|
+
|
73
|
+
def groups
|
74
|
+
@client.groups(userId)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
module Spacer
|
2
|
+
class Video
|
3
|
+
include Model
|
4
|
+
attr_accessor :user, :totalrating, :thumbnail, :title, :resourceuserid, :language, :dateupdated, :totalviews, :mediastatus, :country, :id, :runtime, :description, :privacy, :mediatype, :datecreated, :__type, :totalvotes, :videoUri
|
5
|
+
end
|
6
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
if HAVE_BONES
|
4
|
+
|
5
|
+
desc "Enumerate all annotations"
|
6
|
+
task :notes do
|
7
|
+
Bones::AnnotationExtractor.enumerate(
|
8
|
+
PROJ, "OPTIMIZE|FIXME|TODO", :tag => true)
|
9
|
+
end
|
10
|
+
|
11
|
+
namespace :notes do
|
12
|
+
desc "Enumerate all OPTIMIZE annotations"
|
13
|
+
task :optimize do
|
14
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "OPTIMIZE")
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Enumerate all FIXME annotations"
|
18
|
+
task :fixme do
|
19
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "FIXME")
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Enumerate all TODO annotations"
|
23
|
+
task :todo do
|
24
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "TODO")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end # if HAVE_BONES
|
29
|
+
|
30
|
+
# EOF
|
data/tasks/doc.rake
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
namespace :doc do
|
6
|
+
|
7
|
+
desc 'Generate RDoc documentation'
|
8
|
+
Rake::RDocTask.new do |rd|
|
9
|
+
rd.main = PROJ.rdoc_main
|
10
|
+
rd.rdoc_dir = PROJ.rdoc_dir
|
11
|
+
|
12
|
+
incl = Regexp.new(PROJ.rdoc_include.join('|'))
|
13
|
+
excl = Regexp.new(PROJ.rdoc_exclude.join('|'))
|
14
|
+
files = PROJ.files.find_all do |fn|
|
15
|
+
case fn
|
16
|
+
when excl; false
|
17
|
+
when incl; true
|
18
|
+
else false end
|
19
|
+
end
|
20
|
+
rd.rdoc_files.push(*files)
|
21
|
+
|
22
|
+
title = "#{PROJ.name}-#{PROJ.version} Documentation"
|
23
|
+
title = "#{PROJ.rubyforge_name}'s " + title if PROJ.rubyforge_name != title
|
24
|
+
|
25
|
+
rd.options << "-t #{title}"
|
26
|
+
rd.options.concat(PROJ.rdoc_opts)
|
27
|
+
end
|
28
|
+
|
29
|
+
desc 'Generate ri locally for testing'
|
30
|
+
task :ri => :clobber_ri do
|
31
|
+
sh "#{RDOC} --ri -o ri ."
|
32
|
+
end
|
33
|
+
|
34
|
+
desc 'Remove ri products'
|
35
|
+
task :clobber_ri do
|
36
|
+
rm_r 'ri' rescue nil
|
37
|
+
end
|
38
|
+
|
39
|
+
end # namespace :doc
|
40
|
+
|
41
|
+
desc 'Alias to doc:rdoc'
|
42
|
+
task :doc => 'doc:rdoc'
|
43
|
+
|
44
|
+
desc 'Remove all build products'
|
45
|
+
task :clobber => %w(doc:clobber_rdoc doc:clobber_ri)
|
46
|
+
|
47
|
+
remove_desc_for_task %w(doc:clobber_rdoc doc:clobber_ri)
|
48
|
+
|
49
|
+
# EOF
|
data/tasks/gem.rake
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
require 'rake/gempackagetask'
|
4
|
+
|
5
|
+
namespace :gem do
|
6
|
+
|
7
|
+
PROJ.spec = Gem::Specification.new do |s|
|
8
|
+
s.name = PROJ.name
|
9
|
+
s.version = PROJ.version
|
10
|
+
s.summary = PROJ.summary
|
11
|
+
s.authors = Array(PROJ.authors)
|
12
|
+
s.email = PROJ.email
|
13
|
+
s.homepage = Array(PROJ.url).first
|
14
|
+
s.rubyforge_project = PROJ.rubyforge_name
|
15
|
+
|
16
|
+
s.description = PROJ.description
|
17
|
+
|
18
|
+
PROJ.dependencies.each do |dep|
|
19
|
+
s.add_dependency(*dep)
|
20
|
+
end
|
21
|
+
|
22
|
+
s.files = PROJ.files
|
23
|
+
s.executables = PROJ.executables.map {|fn| File.basename(fn)}
|
24
|
+
s.extensions = PROJ.files.grep %r/extconf\.rb$/
|
25
|
+
|
26
|
+
s.bindir = 'bin'
|
27
|
+
dirs = Dir["{#{PROJ.libs.join(',')}}"]
|
28
|
+
s.require_paths = dirs unless dirs.empty?
|
29
|
+
|
30
|
+
incl = Regexp.new(PROJ.rdoc_include.join('|'))
|
31
|
+
excl = PROJ.rdoc_exclude.dup.concat %w[\.rb$ ^(\.\/|\/)?ext]
|
32
|
+
excl = Regexp.new(excl.join('|'))
|
33
|
+
rdoc_files = PROJ.files.find_all do |fn|
|
34
|
+
case fn
|
35
|
+
when excl; false
|
36
|
+
when incl; true
|
37
|
+
else false end
|
38
|
+
end
|
39
|
+
s.rdoc_options = PROJ.rdoc_opts + ['--main', PROJ.rdoc_main]
|
40
|
+
s.extra_rdoc_files = rdoc_files
|
41
|
+
s.has_rdoc = true
|
42
|
+
|
43
|
+
if test ?f, PROJ.test_file
|
44
|
+
s.test_file = PROJ.test_file
|
45
|
+
else
|
46
|
+
s.test_files = PROJ.tests.to_a
|
47
|
+
end
|
48
|
+
|
49
|
+
# Do any extra stuff the user wants
|
50
|
+
# spec_extras.each do |msg, val|
|
51
|
+
# case val
|
52
|
+
# when Proc
|
53
|
+
# val.call(s.send(msg))
|
54
|
+
# else
|
55
|
+
# s.send "#{msg}=", val
|
56
|
+
# end
|
57
|
+
# end
|
58
|
+
end
|
59
|
+
|
60
|
+
desc 'Show information about the gem'
|
61
|
+
task :debug do
|
62
|
+
puts PROJ.spec.to_ruby
|
63
|
+
end
|
64
|
+
|
65
|
+
Rake::GemPackageTask.new(PROJ.spec) do |pkg|
|
66
|
+
pkg.need_tar = PROJ.need_tar
|
67
|
+
pkg.need_zip = PROJ.need_zip
|
68
|
+
end
|
69
|
+
|
70
|
+
desc 'Install the gem'
|
71
|
+
task :install => [:clobber, :package] do
|
72
|
+
sh "#{SUDO} #{GEM} install pkg/#{PROJ.spec.full_name}"
|
73
|
+
end
|
74
|
+
|
75
|
+
desc 'Uninstall the gem'
|
76
|
+
task :uninstall do
|
77
|
+
sh "#{SUDO} #{GEM} uninstall -v '#{PROJ.version}' -x #{PROJ.name}"
|
78
|
+
end
|
79
|
+
|
80
|
+
end # namespace :gem
|
81
|
+
|
82
|
+
desc 'Alias to gem:package'
|
83
|
+
task :gem => 'gem:package'
|
84
|
+
|
85
|
+
task :clobber => 'gem:clobber_package'
|
86
|
+
|
87
|
+
remove_desc_for_task %w(gem:clobber_package)
|
88
|
+
|
89
|
+
# EOF
|
data/tasks/manifest.rake
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
require 'find'
|
4
|
+
|
5
|
+
namespace :manifest do
|
6
|
+
|
7
|
+
desc 'Verify the manifest'
|
8
|
+
task :check do
|
9
|
+
fn = 'Manifest.tmp'
|
10
|
+
files = []
|
11
|
+
exclude = Regexp.new(PROJ.exclude.join('|'))
|
12
|
+
Find.find '.' do |path|
|
13
|
+
path.sub! %r/^(\.\/|\/)/o, ''
|
14
|
+
next unless test ?f, path
|
15
|
+
next if path =~ exclude
|
16
|
+
files << path
|
17
|
+
end
|
18
|
+
|
19
|
+
File.open(fn, 'w') {|fp| fp.puts files.sort}
|
20
|
+
lines = %x(#{DIFF} -du Manifest.txt #{fn}).split("\n")
|
21
|
+
if HAVE_FACETS_ANSICODE and ENV.has_key?('TERM')
|
22
|
+
lines.map! do |line|
|
23
|
+
case line
|
24
|
+
when %r/^(-{3}|\+{3})/; nil
|
25
|
+
when %r/^@/; Console::ANSICode.blue line
|
26
|
+
when %r/^\+/; Console::ANSICode.green line
|
27
|
+
when %r/^\-/; Console::ANSICode.red line
|
28
|
+
else line end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
puts lines.compact
|
32
|
+
rm fn rescue nil
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Create a new manifest'
|
36
|
+
task :create do
|
37
|
+
fn = 'Manifest.txt'
|
38
|
+
files = []
|
39
|
+
exclude = Regexp.new(PROJ.exclude.join('|'))
|
40
|
+
Find.find '.' do |path|
|
41
|
+
path.sub! %r/^(\.\/|\/)/o, ''
|
42
|
+
next unless test ?f, path
|
43
|
+
next if path =~ exclude
|
44
|
+
files << path
|
45
|
+
end
|
46
|
+
|
47
|
+
files << fn unless test ?f, fn
|
48
|
+
File.open(fn, 'w') {|fp| fp.puts files.sort}
|
49
|
+
end
|
50
|
+
end # namespace :manifest
|
51
|
+
|
52
|
+
desc 'Alias to manifest:check'
|
53
|
+
task :manifest => 'manifest:check'
|
54
|
+
|
55
|
+
# EOF
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
# This file does not define any rake tasks. It is used to load some project
|
4
|
+
# settings if they are not defined by the user.
|
5
|
+
|
6
|
+
unless PROJ.changes
|
7
|
+
PROJ.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
|
8
|
+
end
|
9
|
+
|
10
|
+
unless PROJ.description
|
11
|
+
PROJ.description = paragraphs_of('README.txt', 'description').join("\n\n")
|
12
|
+
end
|
13
|
+
|
14
|
+
unless PROJ.summary
|
15
|
+
PROJ.summary = PROJ.description.split('.').first
|
16
|
+
end
|
17
|
+
|
18
|
+
# EOF
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
if PROJ.rubyforge_name && HAVE_RUBYFORGE
|
4
|
+
|
5
|
+
require 'rubyforge'
|
6
|
+
require 'rake/contrib/sshpublisher'
|
7
|
+
|
8
|
+
namespace :gem do
|
9
|
+
desc 'Package and upload to RubyForge'
|
10
|
+
task :release => [:clobber, :package] do |t|
|
11
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
12
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
13
|
+
pkg = "pkg/#{PROJ.spec.full_name}"
|
14
|
+
|
15
|
+
if $DEBUG then
|
16
|
+
puts "release_id = rf.add_release #{PROJ.rubyforge_name.inspect}, #{PROJ.name.inspect}, #{PROJ.version.inspect}, \"#{pkg}.tgz\""
|
17
|
+
puts "rf.add_file #{PROJ.rubyforge_name.inspect}, #{PROJ.name.inspect}, release_id, \"#{pkg}.gem\""
|
18
|
+
end
|
19
|
+
|
20
|
+
rf = RubyForge.new
|
21
|
+
puts 'Logging in'
|
22
|
+
rf.login
|
23
|
+
|
24
|
+
c = rf.userconfig
|
25
|
+
c['release_notes'] = PROJ.description if PROJ.description
|
26
|
+
c['release_changes'] = PROJ.changes if PROJ.changes
|
27
|
+
c['preformatted'] = true
|
28
|
+
|
29
|
+
files = [(PROJ.need_tar ? "#{pkg}.tgz" : nil),
|
30
|
+
(PROJ.need_zip ? "#{pkg}.zip" : nil),
|
31
|
+
"#{pkg}.gem"].compact
|
32
|
+
|
33
|
+
puts "Releasing #{PROJ.name} v. #{PROJ.version}"
|
34
|
+
rf.add_release PROJ.rubyforge_name, PROJ.name, PROJ.version, *files
|
35
|
+
end
|
36
|
+
end # namespace :gem
|
37
|
+
|
38
|
+
|
39
|
+
namespace :doc do
|
40
|
+
desc "Publish RDoc to RubyForge"
|
41
|
+
task :release => %w(doc:clobber_rdoc doc:rdoc) do
|
42
|
+
config = YAML.load(
|
43
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
44
|
+
)
|
45
|
+
|
46
|
+
host = "#{config['username']}@rubyforge.org"
|
47
|
+
remote_dir = "/var/www/gforge-projects/#{PROJ.rubyforge_name}/"
|
48
|
+
remote_dir << PROJ.rdoc_remote_dir if PROJ.rdoc_remote_dir
|
49
|
+
local_dir = PROJ.rdoc_dir
|
50
|
+
|
51
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
52
|
+
end
|
53
|
+
end # namespace :doc
|
54
|
+
|
55
|
+
end # if HAVE_RUBYFORGE
|
56
|
+
|
57
|
+
# EOF
|