visage 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg/
data/README ADDED
@@ -0,0 +1,12 @@
1
+ Visage is a simple utility to convert .cdr and .dvdmedia files into .iso files. Visage is dependent on the OS X hdiutil command.
2
+
3
+ USAGE: ./visage.rb [options] [path_to_dir]
4
+
5
+ OPTIONS:
6
+ -s -S -source Specifies the directory in which Visage will look for source files, or the filename of a specific source file.
7
+ If not specified visage will assume the current working directory is its source.
8
+
9
+ -t -T -target Specifies the directory into which Visage will deposit the generates iso(s). If not specifies Visage will use
10
+ the current working directory.
11
+
12
+ -h -H -help Displays help information/examples
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gemspec|
4
+ gemspec.name = "visage"
5
+ gemspec.summary = "Utility for converting .cdr and .dvdmedia files to .iso files"
6
+ gemspec.email = "Jonas714@gmail.com"
7
+ gemspec.homepage = "http://github.com/nerdEd/visage"
8
+ gemspec.authors = ["Ed Schmalzle", "Aaron Kuehler"]
9
+ end
10
+ rescue LoadError
11
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
12
+ end
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :patch: 5
3
+ :major: 0
4
+ :minor: 2
data/Visage.gemspec ADDED
@@ -0,0 +1,43 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{visage}
5
+ s.version = "0.2.5"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Ed Schmalzle", "Aaron Kuehler"]
9
+ s.date = %q{2009-07-20}
10
+ s.default_executable = %q{visage}
11
+ s.email = %q{Jonas714@gmail.com}
12
+ s.executables = ["visage"]
13
+ s.extra_rdoc_files = [
14
+ "README"
15
+ ]
16
+ s.files = [
17
+ ".gitignore",
18
+ "README",
19
+ "Rakefile",
20
+ "VERSION.yml",
21
+ "Visage.gemspec",
22
+ "bin/visage",
23
+ "lib/visage.rb",
24
+ "lib/visage/converter.rb",
25
+ "lib/visage/iso_generator.rb"
26
+ ]
27
+ s.has_rdoc = true
28
+ s.homepage = %q{http://github.com/nerdEd/visage}
29
+ s.rdoc_options = ["--charset=UTF-8"]
30
+ s.require_paths = ["lib"]
31
+ s.rubygems_version = %q{1.3.2}
32
+ s.summary = %q{Utility for converting .cdr and .dvdmedia files to .iso files}
33
+
34
+ if s.respond_to? :specification_version then
35
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
36
+ s.specification_version = 3
37
+
38
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
39
+ else
40
+ end
41
+ else
42
+ end
43
+ end
data/bin/visage ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
5
+ require 'rubygems'
6
+ require 'optiflag'
7
+ require 'visage'
8
+
9
+ #####################################################
10
+ # Setup Command Line Options #
11
+ #####################################################
12
+ module VisageOptions extend OptiFlagSet
13
+ optional_flag "source" do
14
+ alternate_forms "s", "S"
15
+ description "Specifies the directory in which Visage will look for source files, or the filename of a specific source file. If not specified visage will assume the current working directory is its source."
16
+ default '.'
17
+ end
18
+
19
+ optional_flag "destination" do
20
+ alternate_forms "d", "D"
21
+ description "Specifies the directory into which Visage will deposit the generates iso(s). If not specifies Visage will use the current working directory."
22
+ default '.'
23
+ end
24
+
25
+ optional_switch_flag "version" do
26
+ alternate_forms "v", "V"
27
+ description "Returns version information."
28
+ end
29
+
30
+ optional_switch_flag "test" do
31
+ alternate_forms "t", "T"
32
+ default false
33
+ description "Puts visage into test mode and will only print commands, not run them."
34
+ end
35
+
36
+ and_process!
37
+ end
38
+
39
+ #####################################################
40
+ # Run #
41
+ #####################################################
42
+ if( ARGV.flags.version? )
43
+ puts Visage.version
44
+ else
45
+ converter = Visage::Converter.new( ARGV.flags.source, ARGV.flags.destination, ARGV.flags.test? )
46
+ converter.process
47
+ end
data/lib/visage.rb ADDED
@@ -0,0 +1,26 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ require 'yaml'
4
+
5
+ require 'visage/converter'
6
+
7
+ module Visage
8
+
9
+ # Supported source types
10
+ SOURCE_TYPES = %w[ .dvdmedia .cdr ]
11
+
12
+ def self.valid_source_file?( file )
13
+ Visage::SOURCE_TYPES.each do | source_type |
14
+ if( file.include?( source_type ) )
15
+ return true
16
+ end
17
+ end
18
+ return false
19
+ end
20
+
21
+ def self.version
22
+ yml = YAML.load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml])))
23
+ "#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}"
24
+ end
25
+
26
+ end
@@ -0,0 +1,31 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ require 'iso_generator'
4
+
5
+ module Visage
6
+
7
+ class Converter
8
+
9
+ def initialize( source, destination, test = false )
10
+ @source = source
11
+ @destination = destination
12
+ @test = test
13
+ end
14
+
15
+ def process
16
+ if( Visage.valid_source_file?( @source ) )
17
+ iso = Visage::ISOGenerator.new( @source, @destination )
18
+ iso.process( @test )
19
+ else
20
+ Dir.open( @source ).entries.each do | file |
21
+ if( Visage.valid_source_file?( file ) )
22
+ iso = Visage::ISOGenerator.new( File.join( @source, file ), @destination )
23
+ iso.process( @test )
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,29 @@
1
+ module Visage
2
+
3
+ class ISOGenerator
4
+
5
+ # Initialize the ISOGenerator
6
+ # source_file - source file to be turned into an ISO file
7
+ # destination - file system location where generated ISO will be placed
8
+ def initialize( source_file, destination )
9
+ @source = source_file.gsub( /\s/, '\ ' )
10
+ @name = File.basename( source_file )
11
+ @name = @name.sub( /\.cdr|\.dvdmedia/, '' )
12
+ @name = @name.gsub( /\s/, '\ ' )
13
+ @destination_file_name = File.join( destination, @name )
14
+ @command = "hdiutil makehybrid -udf -udf-volume-name #{@name} -o #{@destination_file_name} #{@source}"
15
+ end
16
+
17
+ # Runs or prints the command that generates an ISO for the source file
18
+ # test - if true only print the command otherwise run the command
19
+ def process( test = false )
20
+ if( test )
21
+ puts @command
22
+ else
23
+ system( @command )
24
+ end
25
+ end
26
+
27
+ end
28
+
29
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: visage
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.5
5
+ platform: ruby
6
+ authors:
7
+ - Ed Schmalzle
8
+ - Aaron Kuehler
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2009-11-16 00:00:00 -05:00
14
+ default_executable: visage
15
+ dependencies: []
16
+
17
+ description:
18
+ email: Jonas714@gmail.com
19
+ executables:
20
+ - visage
21
+ extensions: []
22
+
23
+ extra_rdoc_files:
24
+ - README
25
+ files:
26
+ - .gitignore
27
+ - README
28
+ - Rakefile
29
+ - VERSION.yml
30
+ - Visage.gemspec
31
+ - bin/visage
32
+ - lib/visage.rb
33
+ - lib/visage/converter.rb
34
+ - lib/visage/iso_generator.rb
35
+ has_rdoc: true
36
+ homepage: http://github.com/nerdEd/visage
37
+ licenses: []
38
+
39
+ post_install_message:
40
+ rdoc_options:
41
+ - --charset=UTF-8
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ version:
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
+ requirements: []
57
+
58
+ rubyforge_project:
59
+ rubygems_version: 1.3.5
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: Utility for converting .cdr and .dvdmedia files to .iso files
63
+ test_files: []
64
+