nerdEd-visage 0.1.1
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/VERSION.yml +4 -0
- data/bin/visage +60 -0
- data/lib/visage.rb +26 -0
- data/lib/visage/converter.rb +30 -0
- data/lib/visage/iso.rb +24 -0
- metadata +60 -0
data/VERSION.yml
ADDED
data/bin/visage
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
4
|
+
|
5
|
+
help = <<HELP
|
6
|
+
Visage is a simple utility to convert .cdr and .dvdmedia files into .iso files. Visage is dependent on the OS X hdiutil command.
|
7
|
+
|
8
|
+
USAGE: ./visage.rb [options] [path_to_dir]
|
9
|
+
|
10
|
+
OPTIONS:
|
11
|
+
-s -S -source Specifies the directory in which Visage will look for source files, or the filename of a specific source file.
|
12
|
+
If not specified visage will assume the current working directory is its source.
|
13
|
+
|
14
|
+
-d -D -destination Specifies the directory into which Visage will deposit the generates iso(s). If not specifies Visage will use
|
15
|
+
the current working directory.
|
16
|
+
|
17
|
+
-h -H -help Displays help information/examples
|
18
|
+
|
19
|
+
HELP
|
20
|
+
|
21
|
+
require 'rubygems'
|
22
|
+
require 'optiflag'
|
23
|
+
require '../lib/Visage'
|
24
|
+
|
25
|
+
#####################################################
|
26
|
+
# Setup Command Line Options #
|
27
|
+
#####################################################
|
28
|
+
module VisageOptions extend OptiFlagSet
|
29
|
+
optional_flag "source" do
|
30
|
+
alternate_forms "s", "S"
|
31
|
+
default '.'
|
32
|
+
end
|
33
|
+
|
34
|
+
optional_flag "destination" do
|
35
|
+
alternate_forms "d", "D"
|
36
|
+
default '.'
|
37
|
+
end
|
38
|
+
|
39
|
+
optional_switch_flag "help" do
|
40
|
+
alternate_forms "h", "H"
|
41
|
+
end
|
42
|
+
|
43
|
+
optional_switch_flag "version" do
|
44
|
+
alternate_forms "v", "V"
|
45
|
+
end
|
46
|
+
|
47
|
+
and_process!
|
48
|
+
end
|
49
|
+
|
50
|
+
#####################################################
|
51
|
+
# Run #
|
52
|
+
#####################################################
|
53
|
+
if( ARGV.flags.help? )
|
54
|
+
puts help
|
55
|
+
elsif( ARGV.flags.version? )
|
56
|
+
puts Visage.version
|
57
|
+
else
|
58
|
+
converter = Visage::Converter.new( ARGV.flags.source, ARGV.flags.destination )
|
59
|
+
converter.process
|
60
|
+
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,30 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
|
3
|
+
require 'iso'
|
4
|
+
|
5
|
+
module Visage
|
6
|
+
|
7
|
+
class Converter
|
8
|
+
|
9
|
+
def initialize( source, destination )
|
10
|
+
@source = source
|
11
|
+
@destination = destination
|
12
|
+
end
|
13
|
+
|
14
|
+
def process
|
15
|
+
if( Visage.valid_source_file?( @source ) )
|
16
|
+
iso = Visage::ISO.new( @source, @destination )
|
17
|
+
iso.process
|
18
|
+
else
|
19
|
+
Dir.open( @source ).entries.each do | file |
|
20
|
+
if( Visage.valid_source_file?( file ) )
|
21
|
+
iso = Visage::ISO.new( File.join( @source, file ), @destination )
|
22
|
+
iso.process
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/lib/visage/iso.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Visage
|
2
|
+
|
3
|
+
class ISO
|
4
|
+
|
5
|
+
# Initialize the ISO
|
6
|
+
# +options+ is a Hash containing ISO building details
|
7
|
+
#
|
8
|
+
# Returns ISO
|
9
|
+
def initialize( source_file, destination )
|
10
|
+
@source = source_file.gsub( /\s/, '\ ' )
|
11
|
+
@name = File.basename( source_file )
|
12
|
+
@name = @name.sub( /\.cdr|\.dvdmedia/, '' )
|
13
|
+
@name = @name.gsub( /\s/, '\ ' )
|
14
|
+
@destination_file_name = File.join( destination, @name )
|
15
|
+
end
|
16
|
+
|
17
|
+
# Generate the iso file
|
18
|
+
def process
|
19
|
+
puts "hdiutil makehybrid -udf -udf-volume-name #{@name} -o #{@destination_file_name} #{@source}"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nerdEd-visage
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ed Schmalzle
|
8
|
+
- Aaron Kuehler
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-06-12 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description:
|
18
|
+
email: Jonas714@gmail.com
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files: []
|
24
|
+
|
25
|
+
files:
|
26
|
+
- VERSION.yml
|
27
|
+
- bin/visage
|
28
|
+
- lib/visage
|
29
|
+
- lib/visage/converter.rb
|
30
|
+
- lib/visage/iso.rb
|
31
|
+
- lib/visage.rb
|
32
|
+
has_rdoc: true
|
33
|
+
homepage: http://github.com/nerdEd/visage
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options:
|
36
|
+
- --inline-source
|
37
|
+
- --charset=UTF-8
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
version:
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: "0"
|
51
|
+
version:
|
52
|
+
requirements: []
|
53
|
+
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 1.2.0
|
56
|
+
signing_key:
|
57
|
+
specification_version: 3
|
58
|
+
summary: Utility for converting .cdr and .dvdmedia files to .iso files
|
59
|
+
test_files: []
|
60
|
+
|