rbvimeo 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/tasks/setup.rb ADDED
@@ -0,0 +1,229 @@
1
+ # $Id$
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+ require 'rake/clean'
6
+ require 'fileutils'
7
+ require 'ostruct'
8
+
9
+ ENV['VERSION'] = '0.1.0'
10
+
11
+ PROJ = OpenStruct.new
12
+
13
+ PROJ.name = 'rbvimeo'
14
+ PROJ.summary = 'Ruby Wrapper for the Vimeo API'
15
+ PROJ.description = nil
16
+ PROJ.changes = nil
17
+ PROJ.authors = 'guitsaru'
18
+ PROJ.email = 'guitsaru@gmail.com'
19
+ PROJ.url = nil
20
+ PROJ.version = ENV['VERSION'] || '0.1.0'
21
+ PROJ.rubyforge_name = 'rbvimeo'
22
+ PROJ.exclude = %w(tmp$ bak$ ~$ CVS .svn/ ^pkg/ ^doc/ .git/)
23
+ PROJ.release_name = ENV['RELEASE']
24
+ PROJ.history_file = 'History.txt'
25
+ PROJ.manifest_file = 'Manifest.txt'
26
+ PROJ.readme_file = 'README.txt'
27
+
28
+ # Rspec
29
+ PROJ.specs = FileList['spec/**/*_spec.rb']
30
+ PROJ.spec_opts = []
31
+
32
+ # Test::Unit
33
+ PROJ.tests = FileList['test/**/test_*.rb']
34
+ PROJ.test_file = 'test/all.rb'
35
+ PROJ.test_opts = []
36
+
37
+ # Rcov
38
+ PROJ.rcov_dir = 'coverage'
39
+ PROJ.rcov_opts = %w[--sort coverage -T]
40
+ PROJ.rcov_threshold = 90.0
41
+ PROJ.rcov_threshold_exact = false
42
+
43
+ # Rdoc
44
+ PROJ.rdoc_opts = []
45
+ PROJ.rdoc_include = %w(^lib/ ^bin/ ^ext/ .txt$)
46
+ PROJ.rdoc_exclude = %w(extconf.rb$)
47
+ PROJ.rdoc_main = nil
48
+ PROJ.rdoc_dir = 'doc'
49
+ PROJ.rdoc_remote_dir = nil
50
+
51
+ # Extensions
52
+ PROJ.extensions = FileList['ext/**/extconf.rb']
53
+ PROJ.ruby_opts = %w(-w)
54
+ PROJ.libs = []
55
+ %w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
56
+
57
+ # Gem Packaging
58
+ PROJ.files = nil
59
+ PROJ.executables = nil
60
+ PROJ.dependencies = []
61
+ PROJ.need_tar = true
62
+ PROJ.need_zip = false
63
+ PROJ.post_install_message = nil
64
+
65
+ # File Annotations
66
+ PROJ.annotation_exclude = %w(^tasks/setup.rb$)
67
+ PROJ.annotation_extensions = %w(.txt .rb .erb) << ''
68
+ PROJ.annotation_tags = %w(FIXME OPTIMIZE TODO)
69
+
70
+ # Subversion Repository
71
+ PROJ.svn = false
72
+ PROJ.svn_root = nil
73
+ PROJ.svn_trunk = 'trunk'
74
+ PROJ.svn_tags = 'tags'
75
+ PROJ.svn_branches = 'branches'
76
+
77
+ # Announce
78
+ PROJ.ann_file = 'announcement.txt'
79
+ PROJ.ann_text = nil
80
+ PROJ.ann_paragraphs = []
81
+ PROJ.ann_email = {
82
+ :from => nil,
83
+ :to => %w(ruby-talk@ruby-lang.org),
84
+ :server => 'localhost',
85
+ :port => 25,
86
+ :domain => ENV['HOSTNAME'],
87
+ :acct => nil,
88
+ :passwd => nil,
89
+ :authtype => :plain
90
+ }
91
+
92
+ # Load the other rake files in the tasks folder
93
+ rakefiles = Dir.glob('tasks/*.rake').sort
94
+ rakefiles.unshift(rakefiles.delete('tasks/post_load.rake')).compact!
95
+ import(*rakefiles)
96
+
97
+ # Setup some constants
98
+ WIN32 = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WIN32
99
+
100
+ DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
101
+
102
+ def quiet( &block )
103
+ io = [STDOUT.dup, STDERR.dup]
104
+ STDOUT.reopen DEV_NULL
105
+ STDERR.reopen DEV_NULL
106
+ block.call
107
+ ensure
108
+ STDOUT.reopen io.first
109
+ STDERR.reopen io.last
110
+ end
111
+
112
+ DIFF = if WIN32 then 'diff.exe'
113
+ else
114
+ if quiet {system "gdiff", __FILE__, __FILE__} then 'gdiff'
115
+ else 'diff' end
116
+ end unless defined? DIFF
117
+
118
+ SUDO = if WIN32 then ''
119
+ else
120
+ if quiet {system 'which sudo'} then 'sudo'
121
+ else '' end
122
+ end
123
+
124
+ RCOV = WIN32 ? 'rcov.bat' : 'rcov'
125
+ GEM = WIN32 ? 'gem.bat' : 'gem'
126
+
127
+ %w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
128
+ begin
129
+ require lib
130
+ Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
131
+ rescue LoadError
132
+ Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", false}
133
+ end
134
+ end
135
+
136
+ # Reads a file at +path+ and spits out an array of the +paragraphs+
137
+ # specified.
138
+ #
139
+ # changes = paragraphs_of('History.txt', 0..1).join("\n\n")
140
+ # summary, *description = paragraphs_of('README.txt', 3, 3..8)
141
+ #
142
+ def paragraphs_of( path, *paragraphs )
143
+ title = String === paragraphs.first ? paragraphs.shift : nil
144
+ ary = File.read(path).delete("\r").split(/\n\n+/)
145
+
146
+ result = if title
147
+ tmp, matching = [], false
148
+ rgxp = %r/^=+\s*#{Regexp.escape(title)}/i
149
+ paragraphs << (0..-1) if paragraphs.empty?
150
+
151
+ ary.each do |val|
152
+ if val =~ rgxp
153
+ break if matching
154
+ matching = true
155
+ rgxp = %r/^=+/i
156
+ elsif matching
157
+ tmp << val
158
+ end
159
+ end
160
+ tmp
161
+ else ary end
162
+
163
+ result.values_at(*paragraphs)
164
+ end
165
+
166
+ # Adds the given gem _name_ to the current project's dependency list. An
167
+ # optional gem _version_ can be given. If omitted, the newest gem version
168
+ # will be used.
169
+ #
170
+ def depend_on( name, version = nil )
171
+ spec = Gem.source_index.find_name(name).last
172
+ version = spec.version.to_s if version.nil? and !spec.nil?
173
+
174
+ PROJ.dependencies << case version
175
+ when nil; [name]
176
+ when %r/^\d/; [name, ">= #{version}"]
177
+ else [name, version] end
178
+ end
179
+
180
+ # Adds the given arguments to the include path if they are not already there
181
+ #
182
+ def ensure_in_path( *args )
183
+ args.each do |path|
184
+ path = File.expand_path(path)
185
+ $:.unshift(path) if test(?d, path) and not $:.include?(path)
186
+ end
187
+ end
188
+
189
+ # Find a rake task using the task name and remove any description text. This
190
+ # will prevent the task from being displayed in the list of available tasks.
191
+ #
192
+ def remove_desc_for_task( names )
193
+ Array(names).each do |task_name|
194
+ task = Rake.application.tasks.find {|t| t.name == task_name}
195
+ next if task.nil?
196
+ task.instance_variable_set :@comment, nil
197
+ end
198
+ end
199
+
200
+ # Change working directories to _dir_, call the _block_ of code, and then
201
+ # change back to the original working directory (the current directory when
202
+ # this method was called).
203
+ #
204
+ def in_directory( dir, &block )
205
+ curdir = pwd
206
+ begin
207
+ cd dir
208
+ return block.call
209
+ ensure
210
+ cd curdir
211
+ end
212
+ end
213
+
214
+ # Scans the current working directory and creates a list of files that are
215
+ # candidates to be in the manifest.
216
+ #
217
+ def manifest_files
218
+ files = []
219
+ exclude = Regexp.new(PROJ.exclude.join('|'))
220
+ Find.find '.' do |path|
221
+ path.sub! %r/^(\.\/|\/)/o, ''
222
+ next unless test ?f, path
223
+ next if path =~ exclude
224
+ files << path
225
+ end
226
+ files.sort!
227
+ end
228
+
229
+ # EOF
data/tasks/spec.rake ADDED
@@ -0,0 +1,56 @@
1
+ # $Id$
2
+
3
+ if HAVE_SPEC_RAKE_SPECTASK
4
+ require 'spec/rake/verify_rcov'
5
+
6
+ namespace :spec do
7
+
8
+ desc 'Run all specs with basic output'
9
+ Spec::Rake::SpecTask.new(:run) do |t|
10
+ t.ruby_opts = PROJ.ruby_opts
11
+ t.spec_opts = PROJ.spec_opts
12
+ t.spec_files = PROJ.specs
13
+ t.libs += PROJ.libs
14
+ end
15
+
16
+ desc 'Run all specs with text output'
17
+ Spec::Rake::SpecTask.new(:specdoc) do |t|
18
+ t.ruby_opts = PROJ.ruby_opts
19
+ t.spec_opts = PROJ.spec_opts + ['--format', 'specdoc']
20
+ t.spec_files = PROJ.specs
21
+ t.libs += PROJ.libs
22
+ end
23
+
24
+ if HAVE_RCOV
25
+ desc 'Run all specs with RCov'
26
+ Spec::Rake::SpecTask.new(:rcov) do |t|
27
+ t.ruby_opts = PROJ.ruby_opts
28
+ t.spec_opts = PROJ.spec_opts
29
+ t.spec_files = PROJ.specs
30
+ t.libs += PROJ.libs
31
+ t.rcov = true
32
+ t.rcov_dir = PROJ.rcov_dir
33
+ t.rcov_opts = PROJ.rcov_opts + ['--exclude', 'spec']
34
+ end
35
+
36
+ RCov::VerifyTask.new(:verify) do |t|
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
+ end
41
+
42
+ task :verify => :rcov
43
+ end
44
+
45
+ end # namespace :spec
46
+
47
+ desc 'Alias to spec:run'
48
+ task :spec => 'spec:run'
49
+
50
+ task :clobber => 'spec:clobber_rcov' if HAVE_RCOV
51
+
52
+ remove_desc_for_task %w(spec:clobber_rcov)
53
+
54
+ end # if HAVE_SPEC_RAKE_SPECTASK
55
+
56
+ # EOF
data/tasks/svn.rake ADDED
@@ -0,0 +1,44 @@
1
+ # $Id$
2
+
3
+
4
+ if PROJ.svn and system("svn --version 2>&1 > #{DEV_NULL}")
5
+
6
+ unless PROJ.svn_root
7
+ info = %x/svn info ./
8
+ m = %r/^Repository Root:\s+(.*)$/.match(info)
9
+ PROJ.svn_root = (m.nil? ? '' : m[1])
10
+ end
11
+ PROJ.svn_root = File.join(PROJ.svn_root, PROJ.svn) if String === PROJ.svn
12
+
13
+ namespace :svn do
14
+
15
+ desc 'Show tags from the SVN repository'
16
+ task :show_tags do |t|
17
+ tags = %x/svn list #{File.join(PROJ.svn_root, PROJ.svn_tags)}/
18
+ tags.gsub!(%r/\/$/, '')
19
+ puts tags
20
+ end
21
+
22
+ desc 'Create a new tag in the SVN repository'
23
+ task :create_tag do |t|
24
+ v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
25
+ abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
26
+
27
+ trunk = File.join(PROJ.svn_root, PROJ.svn_trunk)
28
+ tag = "%s-%s" % [PROJ.name, PROJ.version]
29
+ tag = File.join(PROJ.svn_root, PROJ.svn_tags, tag)
30
+ msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
31
+
32
+ puts "Creating SVN tag '#{tag}'"
33
+ unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
34
+ abort "Tag creation failed"
35
+ end
36
+ end
37
+
38
+ end # namespace :svn
39
+
40
+ task 'gem:release' => 'svn:create_tag'
41
+
42
+ end # if PROJ.svn
43
+
44
+ # EOF
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rbvimeo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Matt Pruitt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-04-11 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: A ruby wrapper for the Vimeo API
17
+ email: guitsaru@gmail.com
18
+ executables:
19
+ - rbVimeo
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - History.txt
24
+ - README.txt
25
+ - bin/rbVimeo
26
+ files:
27
+ - History.txt
28
+ - Manifest.txt
29
+ - README.txt
30
+ - Rakefile
31
+ - bin/rbVimeo
32
+ - lib/rbVimeo.rb
33
+ - lib/Comment.rb
34
+ - lib/Thumbnail.rb
35
+ - lib/User.rb
36
+ - lib/Video.rb
37
+ - spec/rbVimeo_spec.rb
38
+ - spec/sample_test_settings.yml
39
+ - spec/Video_spec.rb
40
+ - spec/XML/339189.comments.xml
41
+ - spec/XML/339189.xml
42
+ - spec/XML/not_found.xml
43
+ - spec/spec_helper.rb
44
+ - tasks/ann.rake
45
+ - tasks/annotations.rake
46
+ - tasks/bones.rake
47
+ - tasks/doc.rake
48
+ - tasks/gem.rake
49
+ - tasks/manifest.rake
50
+ - tasks/post_load.rake
51
+ - tasks/rubyforge.rake
52
+ - tasks/setup.rb
53
+ - tasks/spec.rake
54
+ - tasks/svn.rake
55
+ has_rdoc: true
56
+ homepage: www.guitsaru.com
57
+ post_install_message:
58
+ rdoc_options:
59
+ - --main
60
+ - README.txt
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ version:
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ requirements: []
76
+
77
+ rubyforge_project: rbvimeo
78
+ rubygems_version: 1.1.0
79
+ signing_key:
80
+ specification_version: 2
81
+ summary: Ruby Wrapper for the Vimeo API
82
+ test_files: []
83
+