hdmake 0.0.1-mswin32
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/.gitignore +3 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/hdmake.gemspec +23 -0
- data/lib/hdmake/version.rb +3 -0
- data/lib/hdmake.rb +49 -0
- metadata +84 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/hdmake.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "hdmake/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "hdmake"
|
7
|
+
s.version = Hdmake::VERSION
|
8
|
+
s.platform = 'mswin32'
|
9
|
+
s.authors = ["Tobias Matthies"]
|
10
|
+
s.email = ["me@tobiasmatthies.de"]
|
11
|
+
s.homepage = "http://www.tobiasmatthies.de"
|
12
|
+
s.summary = %q{Simple hdmake wrapper}
|
13
|
+
s.description = %q{Hdmake is a ruby wrapper for Microsofts Hdmake'}
|
14
|
+
|
15
|
+
s.add_development_dependency "rspec", ">= 2.0.0"
|
16
|
+
|
17
|
+
s.rubyforge_project = "hdmake"
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
end
|
data/lib/hdmake.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
module Hdmake
|
2
|
+
|
3
|
+
class PlattformError < RuntimeError; end
|
4
|
+
class ImageNotFoundError < RuntimeError; end
|
5
|
+
class ImageNotReadableError < RuntimeError; end
|
6
|
+
class CommandNotFoundError < RuntimeError; end
|
7
|
+
class CommandNotExecutableError < RuntimeError; end
|
8
|
+
class CommandLineError < RuntimeError; end
|
9
|
+
class NotYetImplementedError < RuntimeError; end
|
10
|
+
|
11
|
+
|
12
|
+
class Image
|
13
|
+
|
14
|
+
DEFAULT_HDMAKE_PATH = 'c:/program files/microsoft research/hd view utilities/hdmake.exe'
|
15
|
+
|
16
|
+
attr :image_path
|
17
|
+
attr :hdmake_path
|
18
|
+
|
19
|
+
|
20
|
+
def initialize(image_path, hdmake_path = DEFAULT_HDMAKE_PATH)
|
21
|
+
@image_path = image_path
|
22
|
+
@hdmake_path = hdmake_path
|
23
|
+
end
|
24
|
+
|
25
|
+
def process(options = nil)
|
26
|
+
raise PlattformError, "RubyHdMake requires Microsoft Windows" if not windows?
|
27
|
+
raise ImageNotFoundError if not File.exists?(@image_path)
|
28
|
+
raise ImageNotReadableError if not File.readable?(@image_path)
|
29
|
+
raise CommandNotFoundError if not File.exists?(@hdmake_path)
|
30
|
+
raise CommandNotExecutableError if not File.executable?(@hdmake_path)
|
31
|
+
output = %x[ #{@hdmake_path} -src #{@image_path} #{options} ]
|
32
|
+
status = $?
|
33
|
+
|
34
|
+
if status.exitstatus == 0
|
35
|
+
output
|
36
|
+
else
|
37
|
+
raise CommandLineError, "Hdmake command (#{cmd.inspect}) failed: #{{:status_code => status, :output => output}.inspect}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def windows?
|
45
|
+
!(Config::CONFIG['host_os'] =~ /mswin|windows|cygwin|mingw/).nil?
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hdmake
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: mswin32
|
11
|
+
authors:
|
12
|
+
- Tobias Matthies
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-01-13 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 2
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
version: 2.0.0
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
description: Hdmake is a ruby wrapper for Microsofts Hdmake'
|
36
|
+
email:
|
37
|
+
- me@tobiasmatthies.de
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
44
|
+
files:
|
45
|
+
- .gitignore
|
46
|
+
- Gemfile
|
47
|
+
- Rakefile
|
48
|
+
- hdmake.gemspec
|
49
|
+
- lib/hdmake.rb
|
50
|
+
- lib/hdmake/version.rb
|
51
|
+
has_rdoc: true
|
52
|
+
homepage: http://www.tobiasmatthies.de
|
53
|
+
licenses: []
|
54
|
+
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
requirements: []
|
77
|
+
|
78
|
+
rubyforge_project: hdmake
|
79
|
+
rubygems_version: 1.3.7
|
80
|
+
signing_key:
|
81
|
+
specification_version: 3
|
82
|
+
summary: Simple hdmake wrapper
|
83
|
+
test_files: []
|
84
|
+
|