rvideo 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/ENV +100 -0
  2. data/ENV2 +129 -0
  3. data/History.txt +3 -0
  4. data/License.txt +20 -0
  5. data/Manifest.txt +44 -0
  6. data/README.txt +91 -0
  7. data/RULES +11 -0
  8. data/Rakefile +163 -0
  9. data/config/boot.rb +16 -0
  10. data/lib/rvideo.rb +19 -0
  11. data/lib/rvideo/errors.rb +21 -0
  12. data/lib/rvideo/inspector.rb +486 -0
  13. data/lib/rvideo/reporter.rb +176 -0
  14. data/lib/rvideo/reporter/views/index.html.erb +27 -0
  15. data/lib/rvideo/reporter/views/report.css +27 -0
  16. data/lib/rvideo/reporter/views/report.html.erb +81 -0
  17. data/lib/rvideo/reporter/views/report.js +9 -0
  18. data/lib/rvideo/tools/abstract_tool.rb +79 -0
  19. data/lib/rvideo/tools/ffmpeg.rb +111 -0
  20. data/lib/rvideo/tools/flvtool2.rb +45 -0
  21. data/lib/rvideo/transcoder.rb +113 -0
  22. data/lib/rvideo/version.rb +9 -0
  23. data/scripts/txt2html +67 -0
  24. data/setup.rb +1585 -0
  25. data/spec/files/kites.mp4 +0 -0
  26. data/spec/fixtures/ffmpeg_builds.yml +28 -0
  27. data/spec/fixtures/files.yml +374 -0
  28. data/spec/fixtures/recipes.yml +6 -0
  29. data/spec/integrations/files/files.yml +361 -0
  30. data/spec/integrations/formats_spec.rb +287 -0
  31. data/spec/integrations/inspection_spec.rb +15 -0
  32. data/spec/integrations/recipes_spec.rb +0 -0
  33. data/spec/integrations/rvideo_spec.rb +17 -0
  34. data/spec/integrations/transcoding_spec.rb +9 -0
  35. data/spec/spec.opts +1 -0
  36. data/spec/spec_helper.rb +11 -0
  37. data/spec/units/abstract_tool_spec.rb +112 -0
  38. data/spec/units/ffmpeg_spec.rb +703 -0
  39. data/spec/units/flvtool2_spec.rb +314 -0
  40. data/spec/units/inspector_spec.rb +41 -0
  41. data/spec/units/transcoder_spec.rb +140 -0
  42. data/website/index.html +219 -0
  43. data/website/index.txt +142 -0
  44. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  45. metadata +94 -0
data/ENV ADDED
@@ -0,0 +1,100 @@
1
+ RVideo is only as good as the tools it uses. To make the best use of RVideo, follow these instructions.
2
+
3
+ 1. First, install dependencies.
4
+
5
+ wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/all-20061022.tar.bz2 (Mencoder complete codec pack)
6
+ wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz (LAME mp3 encoder)
7
+ a (Ogg)
8
+ sudo gem install flvtool2 (flvtool2 flv packager)
9
+
10
+ unzip...
11
+
12
+ svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
13
+ svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
14
+
15
+ -. Move mplayer codecs.
16
+
17
+ sudo mkdir /usr/local/lib/codecs/
18
+ mv essential-20061022/* /usr/local/lib/codecs/
19
+ chmod -R 755 /usr/local/lib/codecs/
20
+
21
+ 3. Build
22
+ add /usr/local/lib to /etc/ld.so.conf
23
+ yum install libncurses-devel
24
+
25
+ For most:
26
+ ./configure --enable-shared
27
+ make
28
+ sudo make install
29
+
30
+ FAAC
31
+ -- sudo yum install automake, autoconf, libtool, m4, gcc-c++
32
+ sh bootstrap
33
+ ./configure
34
+ make
35
+ sudo make install
36
+
37
+ FAAD
38
+ (report of bugs - http://www.webhostingtalk.com/archive/index.php/t-565563.html and http://wiki.linuxfromscratch.org/blfs/wiki/faad2)
39
+
40
+ sed -i 's/ /\t/' Makefile.am &&
41
+ sed -i 's/NULL/0/' common/mp4v2/{mp4property.h,rtphint.h} &&
42
+ sed -i '/dd(m/ s/^v/static v/' common/mp4ff/mp4ffint.h
43
+ autoreconf -vif
44
+ ./configure && make && sudo make install
45
+ (maybe add --mp4v2 to ./configure?)
46
+
47
+ XVID
48
+ wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
49
+ ./configure etc. from within xvid/build/generic
50
+
51
+ A52
52
+ wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
53
+ ./configure etc.
54
+
55
+ AMR
56
+ ???
57
+ wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-700.zip
58
+ wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-700.zip
59
+ cd ffmpeg/libavcodec/
60
+ mkdir amr_float
61
+ mkdir amrwb_float
62
+ cd amr_float
63
+ unzip ../../../26104-700.zip
64
+ unzip 26104-700_ANSI_C_source_code.zip
65
+ cd ../amrwb_float/
66
+ unzip ../../../26204-700.zip
67
+ unzip 26204-700_ANSI-C_source_code.zip
68
+ ** not working.
69
+
70
+ X264
71
+ svn co svn://svn.videolan.org/x264/trunk x264
72
+ sudo yum install yasm # for mmx/sse - not sure if these are supported
73
+ ./configure --enable-pthread --enable-shared # error adding --enable-mp4-output
74
+ make && sudo make install
75
+
76
+ FFMPEG
77
+ ./configure --enable-libmp3lame --enable-libogg --enable-libvorbis --enable-liba52 --enable-libxvid --enable-libfaac --enable-libfaad --enable-libx264 --enable-xvid --enable-pp --enable-shared --enable-gpl
78
+
79
+ Sources:
80
+ http://vexxhost.com/blog/2007/03/03/installing-ffmpeg-ffmpeg-php-mplayer-mencoder-flv2tool-lame-mp3-encoder-libogg-%E2%80%93-the-easy-way/
81
+ http://cihilt.com/book/export/html/49
82
+
83
+ TODO
84
+ wget http://downloads.xiph.org/releases/flac/flac-1.2.0.tar.gz (FLAC) *
85
+ faac
86
+ faad
87
+ xvid
88
+ x264
89
+ mp4box
90
+ wget http://downloads.xiph.org/releases/theora/libtheora-1.0alpha7.tar.bz2 (theora) *
91
+ wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz (Vorbis) (Gives error - LD_LIBRARY_PATH something)
92
+
93
+ liba52 dlopened no
94
+ libamr-nb support no
95
+ libamr-wb support no
96
+ libdc1394 support no
97
+ libfaad dlopened no
98
+ libgsm enabled no
99
+ libnut enabled no
100
+ libtheora enabled no
data/ENV2 ADDED
@@ -0,0 +1,129 @@
1
+ adduser rvideo
2
+ (add rvideo to sudoers)
3
+ su - rvideo
4
+ mkdir src
5
+ cd src
6
+
7
+ sudo apt-get update (necessary?)
8
+ sudo apt-get install automake
9
+ sudo apt-get install autoconf
10
+ sudo apt-get install libtool
11
+ sudo apt-get install m4
12
+ sudo apt-get install g++ (gcc-c++ in fedora?) # not in OS X - xcode instead?
13
+ sudo apt-get install yasm
14
+
15
+ wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/all-20061022.tar.bz2
16
+ wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
17
+ wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
18
+ wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
19
+ wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
20
+ wget http://downloads.sourceforge.net/faac/faac-1.25.tar.gz
21
+ wget http://downloads.sourceforge.net/faac/faad2-2.5.tar.gz
22
+ wget http://downloads.xiph.org/releases/theora/libtheora-1.0alpha7.tar.bz2
23
+ wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
24
+ wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.0.tar.bz2
25
+ wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.2.tar.bz2
26
+
27
+ sudo gem install flvtool2
28
+
29
+ svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
30
+ svn co svn://svn.videolan.org/x264/trunk x264
31
+
32
+ tar xzvf a52dec-0.7.4.tar.gz
33
+ tar xzvf faac-1.25.tar.gz
34
+ tar xzvf faad2-2.5.tar.gz
35
+ tar xzvf lame-3.97.tar.gz
36
+ tar xzvf xvidcore-1.1.3.tar.gz
37
+ tar xzvf libogg-1.1.3.tar.gz
38
+ tar xjvf all-20061022.tar.bz2
39
+ tar xjvf libtheora-1.0alpha7.tar.bz2
40
+ tar xjvf amrnb-7.0.0.0.tar.bz2
41
+ tar xjvf amrwb-7.0.0.2.tar.bz2
42
+
43
+ sudo mkdir /usr/local/lib/codecs
44
+ sudo mv all-20061022/* /usr/local/lib/codecs
45
+ sudo chmod -R 755 /usr/local/lib/codecs/
46
+
47
+ echo /usr/local/lib >>/etc/ld.so.conf # not OS X
48
+ sudo ldconfig -v # not OS X
49
+
50
+ cd libogg-1.1.3
51
+ ./configure --enable-shared && make && sudo make install
52
+ cd ..
53
+
54
+ cd libvorbis-1.2.0
55
+ ./configure --enable-shared && make && sudo make install
56
+ cd ..
57
+ :3
58
+ cd libtheora-1.0alpha7
59
+ ./configure --enable-shared && make && sudo make install
60
+ cd ..
61
+
62
+ cd faac
63
+ # PATCH as described at http://research.m1stereo.tv/wiki/index.php/Build_video_enc_env#faac
64
+ autoreconf -vif
65
+ ./configure --with-mp4v2 && make && sudo make install
66
+ cd ..
67
+
68
+ cd faad2
69
+
70
+ # OS X -
71
+ # Patch as per darwinports version
72
+ # Comment out #define HAS_LRINTF block in common.h (including lrintf method definition)
73
+
74
+ # PATCH as described at (Linux) http://research.m1stereo.tv/wiki/index.php/Build_video_enc_env#faad2
75
+ autoreconf -vif
76
+ ./configure && make && sudo make install
77
+ cd ..
78
+
79
+ cd xvidcore/build/generic
80
+ # OS X (see http://rob.opendot.cl/index.php/useful-stuff/xvid-with-asm-on-os-x/)
81
+ ./configure --enable-macosx_module
82
+ Edit build/generic/platform.inc and ADD the flags shown below:
83
+ "-undefined suppress" to SPECIFIC_CFLAGS
84
+ "-f macho -DPREFIX" to AFLAGS (so it reads AFLAGS="AFLAGS=-I$(<D)/ -f macho -DPREFIX")
85
+ "-read_only_relocs suppress" to SPECIFIC_LDFLAGS
86
+
87
+ # Linux
88
+ ./configure && make && sudo make install
89
+ cd ../../..
90
+
91
+ cd a52dec-0.7.4
92
+ ./configure --enable-shared=yes && make && sudo make install
93
+ cd ..
94
+
95
+ cd lame-3.97
96
+ ./configure && make && sudo make install
97
+ cd ..
98
+
99
+ cd x264
100
+ ./configure --enable-pthread && make && sudo make install
101
+ cd ..
102
+
103
+ cd amrnb-7.0.0.0/
104
+ ./configure && make && sudo make install
105
+ cd ..
106
+
107
+ cd amrwb-7.0.0.0/
108
+ ./configure && make && sudo make install
109
+ cd ..
110
+
111
+ cd ffmpeg
112
+ # apply patch from http://research.m1stereo.tv/wiki/index.php/Build_video_enc_env - though use libfaad.c, not faad.c
113
+ ./configure --enable-libmp3lame --enable-libogg --enable-libvorbis --enable-liba52 --enable-libxvid --enable-libfaac --enable-libfaad --enable-libx264 --enable-libxvid --enable-pp --enable-shared --enable-gpl --enable-libtheora --enable-libfaadbin --enable-liba52bin --enable-libamr_nb --enable-libamr_wb
114
+ make && sudo make install
115
+ cd ..
116
+
117
+
118
+ NOT EXECUTED
119
+ apt-get install libncurses-devel (names of yum packages)
120
+ svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
121
+ twolame
122
+ flac
123
+ speex
124
+ libdv
125
+ libmad
126
+ libmpeg2
127
+ mpeg4ip
128
+
129
+ http://graphics.cs.uni-sb.de/NMM/Download/external/nmm-1.0.0/external-libraries-optional/mpeg2dec-0.4.0b.tar.gz
@@ -0,0 +1,3 @@
1
+ == 0.8.0 2007-09-27
2
+
3
+ * Major rewrite of RVideo.
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2007 Jonathan Dahl and Slantwise Design
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.
@@ -0,0 +1,44 @@
1
+ ENV
2
+ ENV2
3
+ History.txt
4
+ License.txt
5
+ Manifest.txt
6
+ README.txt
7
+ RULES
8
+ Rakefile
9
+ config/boot.rb
10
+ lib/rvideo.rb
11
+ lib/rvideo/errors.rb
12
+ lib/rvideo/inspector.rb
13
+ lib/rvideo/reporter.rb
14
+ lib/rvideo/reporter/views/index.html.erb
15
+ lib/rvideo/reporter/views/report.css
16
+ lib/rvideo/reporter/views/report.html.erb
17
+ lib/rvideo/reporter/views/report.js
18
+ lib/rvideo/tools/abstract_tool.rb
19
+ lib/rvideo/tools/ffmpeg.rb
20
+ lib/rvideo/tools/flvtool2.rb
21
+ lib/rvideo/transcoder.rb
22
+ lib/rvideo/version.rb
23
+ scripts/txt2html
24
+ setup.rb
25
+ spec/files/kites.mp4
26
+ spec/fixtures/ffmpeg_builds.yml
27
+ spec/fixtures/files.yml
28
+ spec/fixtures/recipes.yml
29
+ spec/integrations/files/files.yml
30
+ spec/integrations/formats_spec.rb
31
+ spec/integrations/inspection_spec.rb
32
+ spec/integrations/recipes_spec.rb
33
+ spec/integrations/rvideo_spec.rb
34
+ spec/integrations/transcoding_spec.rb
35
+ spec/spec.opts
36
+ spec/spec_helper.rb
37
+ spec/units/abstract_tool_spec.rb
38
+ spec/units/ffmpeg_spec.rb
39
+ spec/units/flvtool2_spec.rb
40
+ spec/units/inspector_spec.rb
41
+ spec/units/transcoder_spec.rb
42
+ website/index.html
43
+ website/index.txt
44
+ website/javascripts/rounded_corners_lite.inc.js
@@ -0,0 +1,91 @@
1
+ RVideo
2
+
3
+ RVideo allows you to inspect and process video files.
4
+
5
+
6
+ Installation is a little involved. First, install the gem:
7
+
8
+ sudo gem install rvideo
9
+
10
+ Next, install ffmpeg and (possibly) other related libraries. This is
11
+ documented elsewhere on the web, and can be a headache. If you are on OS X,
12
+ the Darwinports build is reasonably good (though not perfect). Install with:
13
+
14
+ sudo port install ffmpeg
15
+
16
+ Or, for a better build (recommended), add additional video- and audio-related
17
+ libraries, like this:
18
+
19
+ sudo port install ffmpeg +lame +libogg +vorbis +faac +faad +xvid +x264 +a52
20
+
21
+ Most package management systems include a build of ffmpeg, but many include a
22
+ poor build. So you may need to compile from scratch.
23
+
24
+ If you want to create Flash Video files, also install flvtool2:
25
+
26
+ sudo gem install flvtool2
27
+
28
+ Once ffmpeg and RVideo are installed, you're set.
29
+
30
+ To inspect a file, initialize an RVideo file inspector object. See the
31
+ documentation for details.
32
+
33
+ A few examples:
34
+
35
+ file = RVideo::Inspector.new(:file => "#{APP_ROOT}/files/input.mp4")
36
+
37
+ file = RVideo::Inspector.new(:raw_response => @existing_response)
38
+
39
+ file = RVideo::Inspector.new(:file => "#{APP_ROOT}/files/input.mp4",
40
+ :ffmpeg_binary => "#{APP_ROOT}/bin/ffmpeg")
41
+
42
+ file.fps # "29.97"
43
+ file.duration # "00:05:23.4"
44
+
45
+ To transcode a video, initialize a Transcoder object.
46
+
47
+ transcoder = RVideo::Transcoder.new
48
+
49
+ Then pass a command and valid options to the execute method
50
+
51
+ recipe = "ffmpeg -i $input_file$ -ar 22050 -ab 64 -f flv -r 29.97 -s"
52
+ recipe += " $resolution$ -y $output_file$"
53
+ recipe += "\nflvtool2 -U $output_file$"
54
+ begin
55
+ transcoder.execute(recipe, {:input_file => "/path/to/input.mp4",
56
+ :output_file => "/path/to/output.flv", :resolution => "640x360"})
57
+ rescue TranscoderError => e
58
+ puts "Unable to transcode file: #{e.class} - #{e.message}"
59
+ end
60
+
61
+ If the job succeeds, you can access the metadata of the input and output
62
+ files with:
63
+
64
+ transcoder.original # RVideo::Inspector object
65
+ transcoder.processed # RVideo::Inspector object
66
+
67
+ If the transcoding succeeds, the file may still have problems. RVideo
68
+ will populate an errors array if the duration of the processed video
69
+ differs from the duration of the original video, or if the processed
70
+ file is unreadable.
71
+
72
+ Thanks to Peter Boling for early work on RVideo.
73
+
74
+ Contribute to RVideo! If you want to help out, there are a few things you can
75
+ do.
76
+
77
+ - Use, test, and submit bugs/patches
78
+ - We need a RVideo::Tools::Mencoder class to add mencoder support.
79
+ - Other tool classes would be great - On2, mp4box, Quicktime (?), etc.
80
+ - Submit other fixes, features, optimizations, and refactorings
81
+
82
+ If RVideo is useful to you, you may also be interested in RMovie, another Ruby
83
+ video library. See http://rmovie.rubyforge.org/ for more.
84
+
85
+ Finally, watch for Spinoza, a commercial video transcoder built by Slantwise
86
+ Design. Spinoza uses RVideo for its video processing, but adds file queuing,
87
+ distributed transcoding, a web-based transcoder dashboard, and more. See
88
+ http://spinoza.tv or http://slantwisedesign.com for more.
89
+
90
+ Copyright (c) 2007 Jonathan Dahl and Slantwise Design. Released under the MIT
91
+ license.
data/RULES ADDED
@@ -0,0 +1,11 @@
1
+ Collection of transcoding edge cases and rules
2
+ ------------------------
3
+
4
+ * mpeg4 output errors out if frame rate is not supplied
5
+
6
+ [mpeg4 @ 0x149e810]timebase not supported by mpeg 4 standard
7
+ Error while opening codec for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
8
+
9
+ Solution: provide a frame rate with -r (any frame rate will do)
10
+
11
+
@@ -0,0 +1,163 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'rake/packagetask'
6
+ require 'rake/gempackagetask'
7
+ require 'rake/rdoctask'
8
+ require 'rake/contrib/rubyforgepublisher'
9
+ require 'fileutils'
10
+ require 'hoe'
11
+ begin
12
+ require 'spec/rake/spectask'
13
+ rescue LoadError
14
+ puts 'To use rspec for testing you must install rspec gem:'
15
+ puts '$ sudo gem install rspec'
16
+ exit
17
+ end
18
+
19
+ include FileUtils
20
+ require File.join(File.dirname(__FILE__), 'lib', 'rvideo', 'version')
21
+
22
+ AUTHOR = 'Jonathan Dahl (Slantwise Design)' # can also be an array of Authors
23
+ EMAIL = "jon@slantwisedesign.com"
24
+ DESCRIPTION = "Video transcoding library"
25
+ GEM_NAME = 'rvideo' # what ppl will type to install your gem
26
+
27
+ @config_file = "~/.rubyforge/user-config.yml"
28
+ @config = nil
29
+ def rubyforge_username
30
+ unless @config
31
+ begin
32
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
33
+ rescue
34
+ puts <<-EOS
35
+ ERROR: No rubyforge config file found: #{@config_file}"
36
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
37
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
38
+ EOS
39
+ exit
40
+ end
41
+ end
42
+ @rubyforge_username ||= @config["username"]
43
+ end
44
+
45
+ RUBYFORGE_PROJECT = 'rvideo' # The unix name for your project
46
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
47
+ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
48
+
49
+ NAME = "rvideo"
50
+ REV = nil
51
+ # UNCOMMENT IF REQUIRED:
52
+ # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
53
+ VERS = Rvideo::VERSION::STRING + (REV ? ".#{REV}" : "")
54
+ CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
55
+ RDOC_OPTS = ['--quiet', '--title', 'rvideo documentation',
56
+ "--opname", "index.html",
57
+ "--line-numbers",
58
+ "--main", "README",
59
+ "--inline-source"]
60
+
61
+ class Hoe
62
+ def extra_deps
63
+ @extra_deps.reject { |x| Array(x).first == 'hoe' }
64
+ end
65
+ end
66
+
67
+ # Generate all the Rake tasks
68
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
69
+ hoe = Hoe.new(GEM_NAME, VERS) do |p|
70
+ p.author = AUTHOR
71
+ p.description = DESCRIPTION
72
+ p.email = EMAIL
73
+ p.summary = DESCRIPTION
74
+ p.url = HOMEPATH
75
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
76
+ p.test_globs = ["test/**/test_*.rb"]
77
+ p.clean_globs |= CLEAN #An array of file patterns to delete on clean.
78
+
79
+ # == Optional
80
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
81
+ #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
82
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
83
+ end
84
+
85
+ CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
86
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
87
+ hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
88
+
89
+ desc 'Generate website files'
90
+ task :website_generate do
91
+ Dir['website/**/*.txt'].each do |txt|
92
+ sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
93
+ end
94
+ end
95
+
96
+ desc 'Upload website files to rubyforge'
97
+ task :website_upload do
98
+ host = "#{rubyforge_username}@rubyforge.org"
99
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
100
+ local_dir = 'website'
101
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
102
+ end
103
+
104
+ desc 'Generate and upload website files'
105
+ task :website => [:website_generate, :website_upload, :publish_docs]
106
+
107
+ desc 'Release the website and new gem version'
108
+ task :deploy => [:check_version, :website, :release] do
109
+ puts "Remember to create SVN tag:"
110
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
111
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
112
+ puts "Suggested comment:"
113
+ puts "Tagging release #{CHANGES}"
114
+ end
115
+
116
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
117
+ task :local_deploy => [:website_generate, :install_gem]
118
+
119
+ task :check_version do
120
+ unless ENV['VERSION']
121
+ puts 'Must pass a VERSION=x.y.z release version'
122
+ exit
123
+ end
124
+ unless ENV['VERSION'] == VERS
125
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
126
+ exit
127
+ end
128
+ end
129
+
130
+ #require 'rake'
131
+ #require 'spec/rake/spectask'
132
+ require File.dirname(__FILE__) + '/lib/rvideo'
133
+
134
+ desc "Creates a HTML report using the recipes in report/recipes and files in report/input_files"
135
+ task(:report) do
136
+ require 'rvideo/reporter'
137
+ RVideo::Reporter.run
138
+ end
139
+
140
+ namespace :spec do
141
+ desc "Run Unit Specs"
142
+ Spec::Rake::SpecTask.new("units") do |t|
143
+ t.spec_files = FileList['spec/units/**/*.rb']
144
+ end
145
+
146
+ desc "Run Integration Specs"
147
+ Spec::Rake::SpecTask.new("integrations") do |t|
148
+ t.spec_files = FileList['spec/integrations/**/*.rb']
149
+ end
150
+ end
151
+
152
+ #desc "Process kites.mp4"
153
+ #task(:transcode) do
154
+ # RVideo::Transcoder.logger = Logger.new(STDOUT)
155
+ #
156
+ # r = RVideo::Recipe.new
157
+ # r.load("#{FIXTURE_PATH}/recipes.yml")
158
+ # r.find(:simple_avi)
159
+ # transcoder = RVideo::Transcoder.new
160
+ # transcoder.execute(r.command, {:input_file => "#{TEST_FILE_PATH}/kites.mp4", :output_file => "#{TEMP_PATH}/kites-transcoded.avi", :resolution => "320x240"})
161
+ # puts transcoder.executed_commands.inspect
162
+ #end
163
+