rbvimeo 0.1.0 → 0.2.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 +6 -2
- data/README.txt +5 -3
- data/Rakefile +4 -3
- data/bin/rbVimeo +1 -11
- data/lib/User.rb +0 -2
- data/lib/Video.rb +67 -74
- data/lib/rbVimeo.rb +14 -5
- data/spec/Video_spec.rb +1 -1
- data/tasks/ann.rake +19 -14
- data/tasks/annotations.rake +1 -1
- data/tasks/bones.rake +6 -25
- data/tasks/doc.rake +7 -7
- data/tasks/gem.rake +46 -36
- data/tasks/post_load.rake +18 -11
- data/tasks/rubyforge.rake +12 -13
- data/tasks/setup.rb +122 -83
- data/tasks/spec.rake +12 -13
- data/tasks/svn.rake +15 -11
- metadata +15 -6
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
rbVimeo
|
2
|
-
|
3
|
-
|
2
|
+
by Matt Pruitt
|
3
|
+
www.guitsaru.com
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
@@ -17,6 +17,8 @@ vid = vimeo.video(video_id)
|
|
17
17
|
|
18
18
|
== INSTALL:
|
19
19
|
|
20
|
+
To install, run 'gem install rbvimeo'
|
21
|
+
|
20
22
|
In order to run the specs, first make a test_settings.yml file (a sample is
|
21
23
|
provided) using your api key and api secret.
|
22
24
|
|
@@ -24,7 +26,7 @@ provided) using your api key and api secret.
|
|
24
26
|
|
25
27
|
(The MIT License)
|
26
28
|
|
27
|
-
Copyright (c) 2008
|
29
|
+
Copyright (c) 2008 Matt Pruitt
|
28
30
|
|
29
31
|
Permission is hereby granted, free of charge, to any person obtaining
|
30
32
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -13,8 +13,9 @@ PROJ.name = 'rbvimeo'
|
|
13
13
|
PROJ.authors = 'Matt Pruitt'
|
14
14
|
PROJ.email = 'guitsaru@gmail.com'
|
15
15
|
PROJ.url = 'www.guitsaru.com'
|
16
|
-
PROJ.
|
17
|
-
PROJ.version = '0.
|
18
|
-
PROJ.
|
16
|
+
PROJ.rubyforge.name = 'rbvimeo'
|
17
|
+
PROJ.version = '0.2.0'
|
18
|
+
PROJ.spec.opts << '--color'
|
19
|
+
PROJ.gem.dependencies << 'hpricot'
|
19
20
|
|
20
21
|
# EOF
|
data/bin/rbVimeo
CHANGED
@@ -1,15 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
File.join(File.dirname(__FILE__), '..', 'lib', 'rbVimeo'))
|
5
|
-
require File.expand_path(
|
6
|
-
File.join(File.dirname(__FILE__), '..', 'lib', 'Video'))
|
7
|
-
require File.expand_path(
|
8
|
-
File.join(File.dirname(__FILE__), '..', 'lib', 'Comment'))
|
9
|
-
require File.expand_path(
|
10
|
-
File.join(File.dirname(__FILE__), '..', 'lib', 'Thumbnail'))
|
11
|
-
require File.expand_path(
|
12
|
-
File.join(File.dirname(__FILE__), '..', 'lib', 'User'))
|
13
|
-
# Put your code here
|
3
|
+
require '../lib/rbVimeo'
|
14
4
|
|
15
5
|
# EOF
|
data/lib/User.rb
CHANGED
data/lib/Video.rb
CHANGED
@@ -1,15 +1,12 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require
|
4
|
-
require File.join(File.dirname(__FILE__), %w[User])
|
5
|
-
require File.join(File.dirname(__FILE__), %w[Thumbnail])
|
6
|
-
require File.join(File.dirname(__FILE__), %w[Comment])
|
1
|
+
require 'rubygems'
|
2
|
+
require 'hpricot'
|
3
|
+
require 'open-uri'
|
7
4
|
|
8
5
|
module RBVIMEO
|
9
6
|
class Video
|
10
7
|
attr_reader :id, :title, :caption, :upload_date, :likes, :plays
|
11
8
|
attr_reader :num_comments, :width, :height, :owner, :tags, :url
|
12
|
-
attr_reader :thumbs
|
9
|
+
attr_reader :thumbs
|
13
10
|
|
14
11
|
# Fetches data about a video from the Vimeo site
|
15
12
|
# id is the id of the the Vimeo video
|
@@ -19,52 +16,50 @@ module RBVIMEO
|
|
19
16
|
# @vimeo = RBVIMEO::Vimeo.new api_key, api_secret
|
20
17
|
# video = RBVIMEO::Video.new 339189, @vimeo
|
21
18
|
def initialize id, vimeo, xml=nil
|
22
|
-
@thumbs =
|
23
|
-
@comments =
|
19
|
+
@thumbs = []
|
20
|
+
@comments = []
|
24
21
|
@id = id
|
22
|
+
@vimeo = vimeo
|
23
|
+
|
25
24
|
url = vimeo.generate_url({"method" => "vimeo.videos.getInfo",
|
26
25
|
"video_id" => id, "api_key" => vimeo.api_key}, "read")
|
27
26
|
unless xml
|
28
27
|
#does not get covered by specs because we get an internal xml file
|
29
|
-
|
28
|
+
xml_doc = Hpricot(open(url))
|
30
29
|
else
|
31
|
-
|
30
|
+
xml_doc = open(xml) {|file| Hpricot(file)}
|
32
31
|
end
|
33
|
-
xml_doc = REXML::Document.new(xml_data)
|
34
32
|
|
35
33
|
return @id = -1 if parse_xml(xml_doc).nil?
|
36
|
-
get_comments id, vimeo, xml
|
37
|
-
|
38
34
|
end
|
39
35
|
|
40
36
|
# Parses data using the xml recieved from the Vimeo REST API
|
41
37
|
# Should not need to be called by anything other than the initialize method
|
42
38
|
def parse_xml xml_doc
|
43
|
-
if xml_doc.
|
39
|
+
if xml_doc.at("title").nil?
|
44
40
|
return nil
|
45
|
-
else
|
46
|
-
@title = xml_doc.elements["rsp/video/title"].text
|
41
|
+
else
|
47
42
|
@id = id
|
48
|
-
@
|
49
|
-
@
|
50
|
-
@
|
51
|
-
@
|
52
|
-
@
|
53
|
-
@
|
54
|
-
@
|
55
|
-
|
43
|
+
@title = xml_doc.at("title").inner_html
|
44
|
+
@caption = xml_doc.at("caption").inner_html
|
45
|
+
@upload_date = xml_doc.at("upload_date").inner_html
|
46
|
+
@likes = xml_doc.at("number_of_likes").inner_html.to_i
|
47
|
+
@plays = xml_doc.at("number_of_plays").inner_html.to_i
|
48
|
+
@width = xml_doc.at("width").inner_html.to_i
|
49
|
+
@height = xml_doc.at("height").inner_html.to_i
|
50
|
+
@num_comments = xml_doc.at("number_of_comments").inner_html.to_i
|
51
|
+
|
56
52
|
@owner = User.new
|
57
|
-
@owner.id = xml_doc.
|
58
|
-
@owner.username =
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
h = thumb.attributes["height"].to_i
|
53
|
+
@owner.id = xml_doc.at("owner").attributes["id"].to_i
|
54
|
+
@owner.username = xml_doc.at("owner").attributes["username"]
|
55
|
+
@owner.fullname = xml_doc.at("owner").attributes["fullname"]
|
56
|
+
|
57
|
+
@url = xml_doc.at("url").inner_html
|
58
|
+
|
59
|
+
(xml_doc/:thumbnail).each do |thumbnail|
|
60
|
+
url = thumbnail.inner_html
|
61
|
+
w = thumbnail.attributes['width'].to_i
|
62
|
+
h = thumbnail.attributes['height'].to_i
|
68
63
|
thumbnail = Thumbnail.new(url, w, h)
|
69
64
|
@thumbs << thumbnail
|
70
65
|
end
|
@@ -77,59 +72,57 @@ module RBVIMEO
|
|
77
72
|
# returns an Array of comments
|
78
73
|
#
|
79
74
|
# To load a movie with vimeo id 339189:
|
80
|
-
#
|
75
|
+
#
|
81
76
|
# comments = video.comments 339189, @vimeo
|
82
|
-
def get_comments
|
83
|
-
comments =
|
84
|
-
url = vimeo.generate_url({"method" => "vimeo.videos.comments.getList",
|
85
|
-
"video_id" => id, "api_key" => vimeo.api_key}, "read")
|
77
|
+
def get_comments xml=nil
|
78
|
+
comments = []
|
79
|
+
url = @vimeo.generate_url({"method" => "vimeo.videos.comments.getList",
|
80
|
+
"video_id" => @id, "api_key" => @vimeo.api_key}, "read")
|
81
|
+
|
86
82
|
unless xml
|
87
|
-
#
|
88
|
-
|
83
|
+
# Does not get covered by specs because we get an internal xml file
|
84
|
+
xml_doc = Hpricot.XML(open(url))
|
89
85
|
else
|
90
|
-
|
86
|
+
xml_doc = open(xml) {|file| Hpricot.XML(file)}
|
91
87
|
end
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
id = comment.attributes[
|
96
|
-
author = comment.attributes[
|
97
|
-
authorname = comment.attributes[
|
98
|
-
date = comment.attributes[
|
99
|
-
url = comment.attributes[
|
100
|
-
|
101
|
-
@portraits =
|
102
|
-
|
103
|
-
portrait_url = thumb.
|
104
|
-
w = thumb.attributes[
|
105
|
-
h = thumb.attributes[
|
88
|
+
|
89
|
+
(xml_doc/:comment).each do |comment|
|
90
|
+
text = comment.children.select{|e| e.text?}.join
|
91
|
+
id = comment.attributes['id'].to_i
|
92
|
+
author = comment.attributes['author']
|
93
|
+
authorname = comment.attributes['authorname']
|
94
|
+
date = comment.attributes['datecreate']
|
95
|
+
url = comment.attributes['permalink']
|
96
|
+
|
97
|
+
@portraits = []
|
98
|
+
(comment/'portraits'/'portrait').each do |thumb|
|
99
|
+
portrait_url = thumb.inner_html
|
100
|
+
w = thumb.attributes['width'].to_i
|
101
|
+
h = thumb.attributes['height'].to_i
|
106
102
|
thumbnail = Thumbnail.new(portrait_url, w, h)
|
107
103
|
@portraits << thumbnail
|
108
104
|
end
|
109
105
|
com = Comment.new(id, author, authorname, date, url, text, @portraits)
|
110
106
|
@comments << com
|
111
107
|
end
|
108
|
+
return self
|
112
109
|
end
|
113
110
|
|
114
111
|
# Returns the code to embed the video
|
115
112
|
def embed width, height
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
string += '<param name="quality" value="best" />'
|
126
|
-
string += '<param name="allowfullscreen" value="false" />'
|
127
|
-
string += '<param name="scale" value="showAll" />'
|
128
|
-
string += '<param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id='
|
129
|
-
string += id + '&server=www.vimeo.com&fullscreen=0&'
|
130
|
-
string += 'show_title=0&show_byline=0&showportrait=0&color=00ADEF" /></object>'
|
113
|
+
string = <<EOF
|
114
|
+
<object type="application/x-shockwave-flash" width=#{width} height=#{height} data="http://www.vimeo.com/moogaloop.swf?clip_id=#{@id}&server=www.vimeo.com&fullscreen=0&show_title=0'&show_byline=0&showportrait=0&color=00ADEF">
|
115
|
+
<param name="quality" value="best" />
|
116
|
+
<param name="allowfullscreen" value="false" />
|
117
|
+
<param name="scale" value="showAll" />
|
118
|
+
<param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=#{@id}&server=www.vimeo.com&fullscreen=0&show_title=0&show_byline=0&showportrait=0&color=00ADEF" /></object>
|
119
|
+
EOF
|
120
|
+
string.gsub("\n", "")
|
121
|
+
end
|
131
122
|
|
132
|
-
|
123
|
+
def comments xml=nil
|
124
|
+
get_comments(xml) if @comments.empty?
|
125
|
+
return @comments
|
133
126
|
end
|
134
127
|
end
|
135
128
|
end
|
data/lib/rbVimeo.rb
CHANGED
@@ -5,7 +5,12 @@
|
|
5
5
|
require 'digest/md5'
|
6
6
|
require 'net/http'
|
7
7
|
require 'rexml/document'
|
8
|
-
|
8
|
+
|
9
|
+
require 'Video'
|
10
|
+
require 'Thumbnail'
|
11
|
+
require 'User'
|
12
|
+
require 'Comment'
|
13
|
+
|
9
14
|
|
10
15
|
module RBVIMEO
|
11
16
|
class Vimeo
|
@@ -14,6 +19,7 @@ module RBVIMEO
|
|
14
19
|
@@API_REST_URL = "http://www.vimeo.com/api/rest"
|
15
20
|
@@API_AUTH_URL = "http://www.vimeo.com/services/auth/"
|
16
21
|
@@API_UPLOAD_URL = "http://www.vimeo.com/services/upload/"
|
22
|
+
|
17
23
|
# api_key and api_secret should both be generated on www.vimeo.com
|
18
24
|
def initialize api_key, api_secret
|
19
25
|
@api_key = api_key
|
@@ -24,12 +30,12 @@ module RBVIMEO
|
|
24
30
|
# "video_id" => "339189", "api_key" => @vimeo.api_key})
|
25
31
|
# This example returns a url to the xml for the Vimeo video with id 339189
|
26
32
|
def generate_url parameters, permissions = nil
|
27
|
-
url = @@API_REST_URL
|
33
|
+
url = "#{@@API_REST_URL}?api_key=#{@api_key}"
|
28
34
|
params = parameters.sort
|
29
35
|
params.each do |param|
|
30
|
-
url += "
|
36
|
+
url += "&#{param[0]}=#{param[1]}" unless param[0].to_s == "api_key"
|
31
37
|
end
|
32
|
-
url += "&api_sig
|
38
|
+
url += "&api_sig=#{generate_signature(parameters)}"
|
33
39
|
return url
|
34
40
|
end
|
35
41
|
|
@@ -51,8 +57,11 @@ module RBVIMEO
|
|
51
57
|
return nil if vid.id == -1
|
52
58
|
return vid
|
53
59
|
end
|
60
|
+
|
61
|
+
# Provides easier access to RBVIMEO::User
|
62
|
+
# user = @vimeo.user
|
54
63
|
def user
|
55
64
|
return User.new
|
56
65
|
end
|
57
66
|
end
|
58
|
-
end
|
67
|
+
end
|
data/spec/Video_spec.rb
CHANGED
@@ -47,7 +47,7 @@ describe Video, "initialization" do
|
|
47
47
|
@vid.comments[0].author.should eql("ctd3")
|
48
48
|
@vid.comments[0].authorname.should eql("CTD3")
|
49
49
|
@vid.comments[0].date.should eql("2007-10-12 17:47:13")
|
50
|
-
@vid.comments[0].url.should eql("http://
|
50
|
+
@vid.comments[0].url.should eql("http://vimeo.com/339189#comment_265313")
|
51
51
|
@vid.comments[0].text.should eql("Sure is! Great changes!")
|
52
52
|
@vid.comments[0].portraits[0].url.should eql("http://80.media.vimeo.com/d1/5/35/44/42/portrait-35444268.jpg")
|
53
53
|
@vid.comments[0].portraits[0].width.should eql(24)
|
data/tasks/ann.rake
CHANGED
@@ -9,12 +9,16 @@ require 'time'
|
|
9
9
|
|
10
10
|
namespace :ann do
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
# A prerequisites task that all other tasks depend upon
|
13
|
+
task :prereqs
|
14
|
+
|
15
|
+
file PROJ.ann.file do
|
16
|
+
ann = PROJ.ann
|
17
|
+
puts "Generating #{ann.file}"
|
18
|
+
File.open(ann.file,'w') do |fd|
|
15
19
|
fd.puts("#{PROJ.name} version #{PROJ.version}")
|
16
20
|
fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
|
17
|
-
fd.puts(" #{PROJ.url}") if PROJ.url
|
21
|
+
fd.puts(" #{PROJ.url}") if PROJ.url.valid?
|
18
22
|
fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
|
19
23
|
fd.puts
|
20
24
|
fd.puts("== DESCRIPTION")
|
@@ -23,23 +27,24 @@ namespace :ann do
|
|
23
27
|
fd.puts
|
24
28
|
fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
|
25
29
|
fd.puts
|
26
|
-
|
30
|
+
ann.paragraphs.each do |p|
|
27
31
|
fd.puts "== #{p.upcase}"
|
28
32
|
fd.puts
|
29
33
|
fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
|
30
34
|
fd.puts
|
31
35
|
end
|
32
|
-
fd.puts
|
36
|
+
fd.puts ann.text if ann.text
|
33
37
|
end
|
34
38
|
end
|
35
39
|
|
36
40
|
desc "Create an announcement file"
|
37
|
-
task :announcement => PROJ.
|
41
|
+
task :announcement => ['ann:prereqs', PROJ.ann.file]
|
38
42
|
|
39
43
|
desc "Send an email announcement"
|
40
|
-
task :email => PROJ.
|
41
|
-
|
42
|
-
|
44
|
+
task :email => ['ann:prereqs', PROJ.ann.file] do
|
45
|
+
ann = PROJ.ann
|
46
|
+
from = ann.email[:from] || PROJ.email
|
47
|
+
to = Array(ann.email[:to])
|
43
48
|
|
44
49
|
### build a mail header for RFC 822
|
45
50
|
rfc822msg = "From: #{from}\n"
|
@@ -49,11 +54,11 @@ namespace :ann do
|
|
49
54
|
rfc822msg << "\n"
|
50
55
|
rfc822msg << "Date: #{Time.new.rfc822}\n"
|
51
56
|
rfc822msg << "Message-Id: "
|
52
|
-
rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{
|
53
|
-
rfc822msg << File.read(
|
57
|
+
rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{ann.email[:domain]}>\n\n"
|
58
|
+
rfc822msg << File.read(ann.file)
|
54
59
|
|
55
60
|
params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
|
56
|
-
|
61
|
+
ann.email[key]
|
57
62
|
end
|
58
63
|
|
59
64
|
params[3] = PROJ.email if params[3].nil?
|
@@ -71,6 +76,6 @@ end # namespace :ann
|
|
71
76
|
desc 'Alias to ann:announcement'
|
72
77
|
task :ann => 'ann:announcement'
|
73
78
|
|
74
|
-
CLOBBER << PROJ.
|
79
|
+
CLOBBER << PROJ.ann.file
|
75
80
|
|
76
81
|
# EOF
|
data/tasks/annotations.rake
CHANGED
data/tasks/bones.rake
CHANGED
@@ -1,40 +1,21 @@
|
|
1
1
|
# $Id$
|
2
2
|
|
3
|
-
|
4
|
-
require 'stringio'
|
3
|
+
if HAVE_BONES
|
5
4
|
|
6
5
|
namespace :bones do
|
7
6
|
|
8
7
|
desc 'Show the PROJ open struct'
|
9
8
|
task :debug do |t|
|
10
|
-
atr = if
|
9
|
+
atr = if t.application.top_level_tasks.length == 2
|
11
10
|
t.application.top_level_tasks.pop
|
12
11
|
end
|
13
|
-
sio = StringIO.new
|
14
|
-
sep = "\n" + ' '*27
|
15
|
-
fmt = "%23s => %s"
|
16
12
|
|
17
|
-
if atr
|
18
|
-
|
19
|
-
sio.seek 0
|
20
|
-
val = sio.read
|
21
|
-
val = val.split("\n").join(sep)
|
22
|
-
|
23
|
-
puts fmt % [atr, val]
|
24
|
-
else
|
25
|
-
h = PROJ.instance_variable_get(:@table)
|
26
|
-
h.keys.map {|k| k.to_s}.sort.each do |k|
|
27
|
-
sio.truncate 0
|
28
|
-
PP.pp(h[k.to_sym], sio, 49)
|
29
|
-
sio.seek 0
|
30
|
-
val = sio.read
|
31
|
-
val = val.split("\n").join(sep)
|
32
|
-
|
33
|
-
puts fmt % [k, val]
|
34
|
-
end
|
35
|
-
end
|
13
|
+
if atr then Bones::Debug.show_attr(PROJ, atr)
|
14
|
+
else Bones::Debug.show PROJ end
|
36
15
|
end
|
37
16
|
|
38
17
|
end # namespace :bones
|
39
18
|
|
19
|
+
end # HAVE_BONES
|
20
|
+
|
40
21
|
# EOF
|
data/tasks/doc.rake
CHANGED
@@ -6,12 +6,12 @@ namespace :doc do
|
|
6
6
|
|
7
7
|
desc 'Generate RDoc documentation'
|
8
8
|
Rake::RDocTask.new do |rd|
|
9
|
-
rd.main = PROJ.
|
10
|
-
rd.rdoc_dir = PROJ.
|
9
|
+
rd.main = PROJ.rdoc.main
|
10
|
+
rd.rdoc_dir = PROJ.rdoc.dir
|
11
11
|
|
12
|
-
incl = Regexp.new(PROJ.
|
13
|
-
excl = Regexp.new(PROJ.
|
14
|
-
files = PROJ.files.find_all do |fn|
|
12
|
+
incl = Regexp.new(PROJ.rdoc.include.join('|'))
|
13
|
+
excl = Regexp.new(PROJ.rdoc.exclude.join('|'))
|
14
|
+
files = PROJ.gem.files.find_all do |fn|
|
15
15
|
case fn
|
16
16
|
when excl; false
|
17
17
|
when incl; true
|
@@ -20,10 +20,10 @@ namespace :doc do
|
|
20
20
|
rd.rdoc_files.push(*files)
|
21
21
|
|
22
22
|
title = "#{PROJ.name}-#{PROJ.version} Documentation"
|
23
|
-
title = "#{PROJ.
|
23
|
+
title = "#{PROJ.rubyforge.name}'s " + title if PROJ.rubyforge.name != title
|
24
24
|
|
25
25
|
rd.options << "-t #{title}"
|
26
|
-
rd.options.concat(PROJ.
|
26
|
+
rd.options.concat(PROJ.rdoc.opts)
|
27
27
|
end
|
28
28
|
|
29
29
|
desc 'Generate ri locally for testing'
|
data/tasks/gem.rake
CHANGED
@@ -4,84 +4,86 @@ require 'rake/gempackagetask'
|
|
4
4
|
|
5
5
|
namespace :gem do
|
6
6
|
|
7
|
-
PROJ.
|
7
|
+
PROJ.gem._spec = Gem::Specification.new do |s|
|
8
8
|
s.name = PROJ.name
|
9
9
|
s.version = PROJ.version
|
10
10
|
s.summary = PROJ.summary
|
11
11
|
s.authors = Array(PROJ.authors)
|
12
12
|
s.email = PROJ.email
|
13
13
|
s.homepage = Array(PROJ.url).first
|
14
|
-
s.rubyforge_project = PROJ.
|
15
|
-
s.post_install_message = PROJ.post_install_message
|
14
|
+
s.rubyforge_project = PROJ.rubyforge.name
|
16
15
|
|
17
16
|
s.description = PROJ.description
|
18
17
|
|
19
|
-
PROJ.dependencies.each do |dep|
|
18
|
+
PROJ.gem.dependencies.each do |dep|
|
20
19
|
s.add_dependency(*dep)
|
21
20
|
end
|
22
21
|
|
23
|
-
s.files = PROJ.files
|
24
|
-
s.executables = PROJ.executables.map {|fn| File.basename(fn)}
|
25
|
-
s.extensions = PROJ.files.grep %r/extconf\.rb$/
|
22
|
+
s.files = PROJ.gem.files
|
23
|
+
s.executables = PROJ.gem.executables.map {|fn| File.basename(fn)}
|
24
|
+
s.extensions = PROJ.gem.files.grep %r/extconf\.rb$/
|
26
25
|
|
27
26
|
s.bindir = 'bin'
|
28
27
|
dirs = Dir["{#{PROJ.libs.join(',')}}"]
|
29
28
|
s.require_paths = dirs unless dirs.empty?
|
30
29
|
|
31
|
-
incl = Regexp.new(PROJ.
|
32
|
-
excl = PROJ.
|
30
|
+
incl = Regexp.new(PROJ.rdoc.include.join('|'))
|
31
|
+
excl = PROJ.rdoc.exclude.dup.concat %w[\.rb$ ^(\.\/|\/)?ext]
|
33
32
|
excl = Regexp.new(excl.join('|'))
|
34
|
-
rdoc_files = PROJ.files.find_all do |fn|
|
33
|
+
rdoc_files = PROJ.gem.files.find_all do |fn|
|
35
34
|
case fn
|
36
35
|
when excl; false
|
37
36
|
when incl; true
|
38
37
|
else false end
|
39
38
|
end
|
40
|
-
s.rdoc_options = PROJ.
|
39
|
+
s.rdoc_options = PROJ.rdoc.opts + ['--main', PROJ.rdoc.main]
|
41
40
|
s.extra_rdoc_files = rdoc_files
|
42
41
|
s.has_rdoc = true
|
43
42
|
|
44
|
-
if test ?f, PROJ.
|
45
|
-
s.test_file = PROJ.
|
43
|
+
if test ?f, PROJ.test.file
|
44
|
+
s.test_file = PROJ.test.file
|
46
45
|
else
|
47
|
-
s.test_files = PROJ.
|
46
|
+
s.test_files = PROJ.test.files.to_a
|
48
47
|
end
|
49
48
|
|
50
49
|
# Do any extra stuff the user wants
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
50
|
+
PROJ.gem.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 # Gem::Specification.new
|
59
|
+
|
60
|
+
# A prerequisites task that all other tasks depend upon
|
61
|
+
task :prereqs
|
60
62
|
|
61
63
|
desc 'Show information about the gem'
|
62
|
-
task :debug do
|
63
|
-
puts PROJ.
|
64
|
+
task :debug => 'gem:prereqs' do
|
65
|
+
puts PROJ.gem._spec.to_ruby
|
64
66
|
end
|
65
67
|
|
66
68
|
pkg = Rake::PackageTask.new(PROJ.name, PROJ.version) do |pkg|
|
67
|
-
pkg.need_tar = PROJ.need_tar
|
68
|
-
pkg.need_zip = PROJ.need_zip
|
69
|
-
pkg.package_files += PROJ.
|
69
|
+
pkg.need_tar = PROJ.gem.need_tar
|
70
|
+
pkg.need_zip = PROJ.gem.need_zip
|
71
|
+
pkg.package_files += PROJ.gem._spec.files
|
70
72
|
end
|
71
73
|
Rake::Task['gem:package'].instance_variable_set(:@full_comment, nil)
|
72
74
|
|
73
|
-
gem_file = if PROJ.
|
75
|
+
gem_file = if PROJ.gem._spec.platform == Gem::Platform::RUBY
|
74
76
|
"#{pkg.package_name}.gem"
|
75
77
|
else
|
76
|
-
"#{pkg.package_name}-#{PROJ.
|
78
|
+
"#{pkg.package_name}-#{PROJ.gem._spec.platform}.gem"
|
77
79
|
end
|
78
80
|
|
79
81
|
desc "Build the gem file #{gem_file}"
|
80
|
-
task :package => "#{pkg.package_dir}/#{gem_file}"
|
82
|
+
task :package => ['gem:prereqs', "#{pkg.package_dir}/#{gem_file}"]
|
81
83
|
|
82
|
-
file "#{pkg.package_dir}/#{gem_file}" => [pkg.package_dir] + PROJ.
|
84
|
+
file "#{pkg.package_dir}/#{gem_file}" => [pkg.package_dir] + PROJ.gem._spec.files do
|
83
85
|
when_writing("Creating GEM") {
|
84
|
-
Gem::Builder.new(PROJ.
|
86
|
+
Gem::Builder.new(PROJ.gem._spec).build
|
85
87
|
verbose(true) {
|
86
88
|
mv gem_file, "#{pkg.package_dir}/#{gem_file}"
|
87
89
|
}
|
@@ -89,21 +91,29 @@ namespace :gem do
|
|
89
91
|
end
|
90
92
|
|
91
93
|
desc 'Install the gem'
|
92
|
-
task :install => [:clobber, :package] do
|
93
|
-
sh "#{SUDO} #{GEM} install pkg/#{PROJ.
|
94
|
+
task :install => [:clobber, 'gem:package'] do
|
95
|
+
sh "#{SUDO} #{GEM} install --local pkg/#{PROJ.gem._spec.full_name}"
|
96
|
+
|
97
|
+
# use this version of the command for rubygems > 1.0.0
|
98
|
+
#sh "#{SUDO} #{GEM} install --no-update-sources pkg/#{PROJ.gem._spec.full_name}"
|
94
99
|
end
|
95
100
|
|
96
101
|
desc 'Uninstall the gem'
|
97
102
|
task :uninstall do
|
98
103
|
installed_list = Gem.source_index.find_name(PROJ.name)
|
99
104
|
if installed_list and installed_list.collect { |s| s.version.to_s}.include?(PROJ.version) then
|
100
|
-
sh "#{SUDO} #{GEM} uninstall
|
105
|
+
sh "#{SUDO} #{GEM} uninstall --version '#{PROJ.version}' --ignore-dependencies --executables #{PROJ.name}"
|
101
106
|
end
|
102
107
|
end
|
103
108
|
|
104
109
|
desc 'Reinstall the gem'
|
105
110
|
task :reinstall => [:uninstall, :install]
|
106
111
|
|
112
|
+
desc 'Cleanup the gem'
|
113
|
+
task :cleanup do
|
114
|
+
sh "#{SUDO} #{GEM} cleanup #{PROJ.gem._spec.name}"
|
115
|
+
end
|
116
|
+
|
107
117
|
end # namespace :gem
|
108
118
|
|
109
119
|
desc 'Alias to gem:package'
|
data/tasks/post_load.rake
CHANGED
@@ -3,14 +3,21 @@
|
|
3
3
|
# This file does not define any rake tasks. It is used to load some project
|
4
4
|
# settings if they are not defined by the user.
|
5
5
|
|
6
|
-
PROJ.
|
7
|
-
PROJ.exclude << "^#{Regexp.escape(PROJ.
|
8
|
-
|
9
|
-
PROJ.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
PROJ.rdoc.exclude << "^#{Regexp.escape(PROJ.manifest_file)}$"
|
7
|
+
PROJ.exclude << ["^#{Regexp.escape(PROJ.ann.file)}$",
|
8
|
+
"^#{Regexp.escape(PROJ.rdoc.dir)}/",
|
9
|
+
"^#{Regexp.escape(PROJ.rcov.dir)}/"]
|
10
|
+
|
11
|
+
flatten_arrays = lambda do |this,os|
|
12
|
+
os.instance_variable_get(:@table).each do |key,val|
|
13
|
+
next if key == :dependencies
|
14
|
+
case val
|
15
|
+
when Array; val.flatten!
|
16
|
+
when OpenStruct; this.call(this,val)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
flatten_arrays.call(flatten_arrays,PROJ)
|
14
21
|
|
15
22
|
PROJ.changes ||= paragraphs_of(PROJ.history_file, 0..1).join("\n\n")
|
16
23
|
|
@@ -18,15 +25,15 @@ PROJ.description ||= paragraphs_of(PROJ.readme_file, 'description').join("\n\n")
|
|
18
25
|
|
19
26
|
PROJ.summary ||= PROJ.description.split('.').first
|
20
27
|
|
21
|
-
PROJ.files ||=
|
28
|
+
PROJ.gem.files ||=
|
22
29
|
if test(?f, PROJ.manifest_file)
|
23
30
|
files = File.readlines(PROJ.manifest_file).map {|fn| fn.chomp.strip}
|
24
31
|
files.delete ''
|
25
32
|
files
|
26
33
|
else [] end
|
27
34
|
|
28
|
-
PROJ.executables ||= PROJ.files.find_all {|fn| fn =~ %r/^bin/}
|
35
|
+
PROJ.gem.executables ||= PROJ.gem.files.find_all {|fn| fn =~ %r/^bin/}
|
29
36
|
|
30
|
-
PROJ.
|
37
|
+
PROJ.rdoc.main ||= PROJ.readme_file
|
31
38
|
|
32
39
|
# EOF
|
data/tasks/rubyforge.rake
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
# $Id$
|
2
1
|
|
3
|
-
if PROJ.
|
2
|
+
if PROJ.rubyforge.name.valid? && HAVE_RUBYFORGE
|
4
3
|
|
5
4
|
require 'rubyforge'
|
6
5
|
require 'rake/contrib/sshpublisher'
|
7
6
|
|
8
7
|
namespace :gem do
|
9
8
|
desc 'Package and upload to RubyForge'
|
10
|
-
task :release => [:clobber, :package] do |t|
|
9
|
+
task :release => [:clobber, 'gem:package'] do |t|
|
11
10
|
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
12
11
|
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
13
|
-
pkg = "pkg/#{PROJ.
|
12
|
+
pkg = "pkg/#{PROJ.gem._spec.full_name}"
|
14
13
|
|
15
14
|
if $DEBUG then
|
16
|
-
puts "release_id = rf.add_release #{PROJ.
|
17
|
-
puts "rf.add_file #{PROJ.
|
15
|
+
puts "release_id = rf.add_release #{PROJ.rubyforge.name.inspect}, #{PROJ.name.inspect}, #{PROJ.version.inspect}, \"#{pkg}.tgz\""
|
16
|
+
puts "rf.add_file #{PROJ.rubyforge.name.inspect}, #{PROJ.name.inspect}, release_id, \"#{pkg}.gem\""
|
18
17
|
end
|
19
18
|
|
20
19
|
rf = RubyForge.new
|
20
|
+
rf.configure rescue nil
|
21
21
|
puts 'Logging in'
|
22
22
|
rf.login
|
23
23
|
|
@@ -25,14 +25,13 @@ namespace :gem do
|
|
25
25
|
c['release_notes'] = PROJ.description if PROJ.description
|
26
26
|
c['release_changes'] = PROJ.changes if PROJ.changes
|
27
27
|
c['preformatted'] = true
|
28
|
-
c['processor_id'] = 8000
|
29
28
|
|
30
|
-
files = [(PROJ.need_tar ? "#{pkg}.tgz" : nil),
|
31
|
-
(PROJ.need_zip ? "#{pkg}.zip" : nil),
|
29
|
+
files = [(PROJ.gem.need_tar ? "#{pkg}.tgz" : nil),
|
30
|
+
(PROJ.gem.need_zip ? "#{pkg}.zip" : nil),
|
32
31
|
"#{pkg}.gem"].compact
|
33
32
|
|
34
33
|
puts "Releasing #{PROJ.name} v. #{PROJ.version}"
|
35
|
-
rf.add_release PROJ.
|
34
|
+
rf.add_release PROJ.rubyforge.name, PROJ.name, PROJ.version, *files
|
36
35
|
end
|
37
36
|
end # namespace :gem
|
38
37
|
|
@@ -45,9 +44,9 @@ namespace :doc do
|
|
45
44
|
)
|
46
45
|
|
47
46
|
host = "#{config['username']}@rubyforge.org"
|
48
|
-
remote_dir = "/var/www/gforge-projects/#{PROJ.
|
49
|
-
remote_dir << PROJ.
|
50
|
-
local_dir = PROJ.
|
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
|
51
50
|
|
52
51
|
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
53
52
|
end
|
data/tasks/setup.rb
CHANGED
@@ -6,94 +6,117 @@ require 'rake/clean'
|
|
6
6
|
require 'fileutils'
|
7
7
|
require 'ostruct'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
PROJ = OpenStruct.new
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
:
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
9
|
+
class OpenStruct; undef :gem; end
|
10
|
+
|
11
|
+
PROJ = OpenStruct.new(
|
12
|
+
# Project Defaults
|
13
|
+
:name => nil,
|
14
|
+
:summary => nil,
|
15
|
+
:description => nil,
|
16
|
+
:changes => nil,
|
17
|
+
:authors => nil,
|
18
|
+
:email => nil,
|
19
|
+
:url => "\000",
|
20
|
+
:version => ENV['VERSION'] || '0.0.0',
|
21
|
+
:exclude => %w(tmp$ bak$ ~$ CVS \.svn/ \.git/ ^pkg/),
|
22
|
+
:release_name => ENV['RELEASE'],
|
23
|
+
|
24
|
+
# System Defaults
|
25
|
+
:ruby_opts => %w(-w),
|
26
|
+
:libs => [],
|
27
|
+
:history_file => 'History.txt',
|
28
|
+
:manifest_file => 'Manifest.txt',
|
29
|
+
:readme_file => 'README.txt',
|
30
|
+
|
31
|
+
# Announce
|
32
|
+
:ann => OpenStruct.new(
|
33
|
+
:file => 'announcement.txt',
|
34
|
+
:text => nil,
|
35
|
+
:paragraphs => [],
|
36
|
+
:email => {
|
37
|
+
:from => nil,
|
38
|
+
:to => %w(ruby-talk@ruby-lang.org),
|
39
|
+
:server => 'localhost',
|
40
|
+
:port => 25,
|
41
|
+
:domain => ENV['HOSTNAME'],
|
42
|
+
:acct => nil,
|
43
|
+
:passwd => nil,
|
44
|
+
:authtype => :plain
|
45
|
+
}
|
46
|
+
),
|
47
|
+
|
48
|
+
# Gem Packaging
|
49
|
+
:gem => OpenStruct.new(
|
50
|
+
:dependencies => [],
|
51
|
+
:executables => nil,
|
52
|
+
:extensions => FileList['ext/**/extconf.rb'],
|
53
|
+
:files => nil,
|
54
|
+
:need_tar => true,
|
55
|
+
:need_zip => false,
|
56
|
+
:extras => {}
|
57
|
+
),
|
58
|
+
|
59
|
+
# File Annotations
|
60
|
+
:notes => OpenStruct.new(
|
61
|
+
:exclude => %w(^tasks/setup\.rb$),
|
62
|
+
:extensions => %w(.txt .rb .erb) << '',
|
63
|
+
:tags => %w(FIXME OPTIMIZE TODO)
|
64
|
+
),
|
65
|
+
|
66
|
+
# Rcov
|
67
|
+
:rcov => OpenStruct.new(
|
68
|
+
:dir => 'coverage',
|
69
|
+
:opts => %w[--sort coverage -T],
|
70
|
+
:threshold => 90.0,
|
71
|
+
:threshold_exact => false
|
72
|
+
),
|
73
|
+
|
74
|
+
# Rdoc
|
75
|
+
:rdoc => OpenStruct.new(
|
76
|
+
:opts => [],
|
77
|
+
:include => %w(^lib/ ^bin/ ^ext/ \.txt$),
|
78
|
+
:exclude => %w(extconf\.rb$),
|
79
|
+
:main => nil,
|
80
|
+
:dir => 'doc',
|
81
|
+
:remote_dir => nil
|
82
|
+
),
|
83
|
+
|
84
|
+
# Rubyforge
|
85
|
+
:rubyforge => OpenStruct.new(
|
86
|
+
:name => "\000"
|
87
|
+
),
|
88
|
+
|
89
|
+
# Rspec
|
90
|
+
:spec => OpenStruct.new(
|
91
|
+
:files => FileList['spec/**/*_spec.rb'],
|
92
|
+
:opts => []
|
93
|
+
),
|
94
|
+
|
95
|
+
# Subversion Repository
|
96
|
+
:svn => OpenStruct.new(
|
97
|
+
:root => nil,
|
98
|
+
:path => '',
|
99
|
+
:trunk => 'trunk',
|
100
|
+
:tags => 'tags',
|
101
|
+
:branches => 'branches'
|
102
|
+
),
|
103
|
+
|
104
|
+
# Test::Unit
|
105
|
+
:test => OpenStruct.new(
|
106
|
+
:files => FileList['test/**/test_*.rb'],
|
107
|
+
:file => 'test/all.rb',
|
108
|
+
:opts => []
|
109
|
+
)
|
110
|
+
)
|
91
111
|
|
92
112
|
# Load the other rake files in the tasks folder
|
93
113
|
rakefiles = Dir.glob('tasks/*.rake').sort
|
94
114
|
rakefiles.unshift(rakefiles.delete('tasks/post_load.rake')).compact!
|
95
115
|
import(*rakefiles)
|
96
116
|
|
117
|
+
# Setup the project libraries
|
118
|
+
%w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
|
119
|
+
|
97
120
|
# Setup some constants
|
98
121
|
WIN32 = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WIN32
|
99
122
|
|
@@ -107,6 +130,7 @@ def quiet( &block )
|
|
107
130
|
ensure
|
108
131
|
STDOUT.reopen io.first
|
109
132
|
STDERR.reopen io.last
|
133
|
+
$stdout, $stderr = STDOUT, STDERR
|
110
134
|
end
|
111
135
|
|
112
136
|
DIFF = if WIN32 then 'diff.exe'
|
@@ -122,6 +146,7 @@ SUDO = if WIN32 then ''
|
|
122
146
|
end
|
123
147
|
|
124
148
|
RCOV = WIN32 ? 'rcov.bat' : 'rcov'
|
149
|
+
RDOC = WIN32 ? 'rdoc.bat' : 'rdoc'
|
125
150
|
GEM = WIN32 ? 'gem.bat' : 'gem'
|
126
151
|
|
127
152
|
%w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
|
@@ -132,6 +157,10 @@ GEM = WIN32 ? 'gem.bat' : 'gem'
|
|
132
157
|
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", false}
|
133
158
|
end
|
134
159
|
end
|
160
|
+
HAVE_SVN = (Dir.entries(Dir.pwd).include?('.svn') and
|
161
|
+
system("svn --version 2>&1 > #{DEV_NULL}"))
|
162
|
+
HAVE_GIT = (Dir.entries(Dir.pwd).include?('.git') and
|
163
|
+
system("git --version 2>&1 > #{DEV_NULL}"))
|
135
164
|
|
136
165
|
# Reads a file at +path+ and spits out an array of the +paragraphs+
|
137
166
|
# specified.
|
@@ -171,7 +200,7 @@ def depend_on( name, version = nil )
|
|
171
200
|
spec = Gem.source_index.find_name(name).last
|
172
201
|
version = spec.version.to_s if version.nil? and !spec.nil?
|
173
202
|
|
174
|
-
PROJ.dependencies << case version
|
203
|
+
PROJ.gem.dependencies << case version
|
175
204
|
when nil; [name]
|
176
205
|
when %r/^\d/; [name, ">= #{version}"]
|
177
206
|
else [name, version] end
|
@@ -226,4 +255,14 @@ def manifest_files
|
|
226
255
|
files.sort!
|
227
256
|
end
|
228
257
|
|
258
|
+
# We need a "valid" method thtat determines if a string is suitable for use
|
259
|
+
# in the gem specification.
|
260
|
+
#
|
261
|
+
class Object
|
262
|
+
def valid?
|
263
|
+
return !(self.empty? or self == "\000") if self.respond_to?(:to_str)
|
264
|
+
return false
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
229
268
|
# EOF
|
data/tasks/spec.rake
CHANGED
@@ -8,16 +8,16 @@ namespace :spec do
|
|
8
8
|
desc 'Run all specs with basic output'
|
9
9
|
Spec::Rake::SpecTask.new(:run) do |t|
|
10
10
|
t.ruby_opts = PROJ.ruby_opts
|
11
|
-
t.spec_opts = PROJ.
|
12
|
-
t.spec_files = PROJ.
|
11
|
+
t.spec_opts = PROJ.spec.opts
|
12
|
+
t.spec_files = PROJ.spec.files
|
13
13
|
t.libs += PROJ.libs
|
14
14
|
end
|
15
15
|
|
16
16
|
desc 'Run all specs with text output'
|
17
17
|
Spec::Rake::SpecTask.new(:specdoc) do |t|
|
18
18
|
t.ruby_opts = PROJ.ruby_opts
|
19
|
-
t.spec_opts = PROJ.
|
20
|
-
t.spec_files = PROJ.
|
19
|
+
t.spec_opts = PROJ.spec.opts + ['--format', 'specdoc']
|
20
|
+
t.spec_files = PROJ.spec.files
|
21
21
|
t.libs += PROJ.libs
|
22
22
|
end
|
23
23
|
|
@@ -25,21 +25,22 @@ namespace :spec do
|
|
25
25
|
desc 'Run all specs with RCov'
|
26
26
|
Spec::Rake::SpecTask.new(:rcov) do |t|
|
27
27
|
t.ruby_opts = PROJ.ruby_opts
|
28
|
-
t.spec_opts = PROJ.
|
29
|
-
t.spec_files = PROJ.
|
28
|
+
t.spec_opts = PROJ.spec.opts
|
29
|
+
t.spec_files = PROJ.spec.files
|
30
30
|
t.libs += PROJ.libs
|
31
31
|
t.rcov = true
|
32
|
-
t.rcov_dir = PROJ.
|
33
|
-
t.rcov_opts = PROJ.
|
32
|
+
t.rcov_dir = PROJ.rcov.dir
|
33
|
+
t.rcov_opts = PROJ.rcov.opts + ['--exclude', 'spec']
|
34
34
|
end
|
35
35
|
|
36
36
|
RCov::VerifyTask.new(:verify) do |t|
|
37
|
-
t.threshold = PROJ.
|
38
|
-
t.index_html = File.join(PROJ.
|
39
|
-
t.require_exact_threshold = PROJ.
|
37
|
+
t.threshold = PROJ.rcov.threshold
|
38
|
+
t.index_html = File.join(PROJ.rcov.dir, 'index.html')
|
39
|
+
t.require_exact_threshold = PROJ.rcov.threshold_exact
|
40
40
|
end
|
41
41
|
|
42
42
|
task :verify => :rcov
|
43
|
+
remove_desc_for_task %w(spec:clobber_rcov)
|
43
44
|
end
|
44
45
|
|
45
46
|
end # namespace :spec
|
@@ -49,8 +50,6 @@ task :spec => 'spec:run'
|
|
49
50
|
|
50
51
|
task :clobber => 'spec:clobber_rcov' if HAVE_RCOV
|
51
52
|
|
52
|
-
remove_desc_for_task %w(spec:clobber_rcov)
|
53
|
-
|
54
53
|
end # if HAVE_SPEC_RAKE_SPECTASK
|
55
54
|
|
56
55
|
# EOF
|
data/tasks/svn.rake
CHANGED
@@ -1,32 +1,36 @@
|
|
1
1
|
# $Id$
|
2
2
|
|
3
|
+
if HAVE_SVN
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
unless PROJ.svn_root
|
5
|
+
unless PROJ.svn.root
|
7
6
|
info = %x/svn info ./
|
8
7
|
m = %r/^Repository Root:\s+(.*)$/.match(info)
|
9
|
-
PROJ.
|
8
|
+
PROJ.svn.root = (m.nil? ? '' : m[1])
|
10
9
|
end
|
11
|
-
PROJ.
|
10
|
+
PROJ.svn.root = File.join(PROJ.svn.root, PROJ.svn.path) unless PROJ.svn.path.empty?
|
12
11
|
|
13
12
|
namespace :svn do
|
14
13
|
|
14
|
+
# A prerequisites task that all other tasks depend upon
|
15
|
+
task :prereqs
|
16
|
+
|
15
17
|
desc 'Show tags from the SVN repository'
|
16
|
-
task :show_tags do |t|
|
17
|
-
tags = %x/svn list #{File.join(PROJ.
|
18
|
+
task :show_tags => 'svn:prereqs' do |t|
|
19
|
+
tags = %x/svn list #{File.join(PROJ.svn.root, PROJ.svn.tags)}/
|
18
20
|
tags.gsub!(%r/\/$/, '')
|
21
|
+
tags = tags.split("\n").sort {|a,b| b <=> a}
|
19
22
|
puts tags
|
20
23
|
end
|
21
24
|
|
22
25
|
desc 'Create a new tag in the SVN repository'
|
23
|
-
task :create_tag do |t|
|
26
|
+
task :create_tag => 'svn:prereqs' do |t|
|
24
27
|
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
25
28
|
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
26
29
|
|
27
|
-
|
30
|
+
svn = PROJ.svn
|
31
|
+
trunk = File.join(svn.root, svn.trunk)
|
28
32
|
tag = "%s-%s" % [PROJ.name, PROJ.version]
|
29
|
-
tag = File.join(
|
33
|
+
tag = File.join(svn.root, svn.tags, tag)
|
30
34
|
msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
|
31
35
|
|
32
36
|
puts "Creating SVN tag '#{tag}'"
|
@@ -39,6 +43,6 @@ end # namespace :svn
|
|
39
43
|
|
40
44
|
task 'gem:release' => 'svn:create_tag'
|
41
45
|
|
42
|
-
end # if PROJ.svn
|
46
|
+
end # if PROJ.svn.path
|
43
47
|
|
44
48
|
# EOF
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbvimeo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Pruitt
|
@@ -9,10 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-10-13 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hpricot
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
16
25
|
description: A ruby wrapper for the Vimeo API
|
17
26
|
email: guitsaru@gmail.com
|
18
27
|
executables:
|
@@ -75,9 +84,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
84
|
requirements: []
|
76
85
|
|
77
86
|
rubyforge_project: rbvimeo
|
78
|
-
rubygems_version: 1.
|
87
|
+
rubygems_version: 1.3.0
|
79
88
|
signing_key:
|
80
89
|
specification_version: 2
|
81
|
-
summary:
|
90
|
+
summary: A ruby wrapper for the Vimeo API
|
82
91
|
test_files: []
|
83
92
|
|