hdmake 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ .rspec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in hdmake.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
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 = Gem::Platform::RUBY
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
@@ -0,0 +1,3 @@
1
+ module Hdmake
2
+ VERSION = "0.0.1"
3
+ 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
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Hdmake do
4
+ pending "..."
5
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ RSpec.configure do |config|
5
+
6
+ end
metadata ADDED
@@ -0,0 +1,87 @@
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: ruby
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
+ - spec/hdmake_spec.rb
52
+ - spec/spec_helper.rb
53
+ has_rdoc: true
54
+ homepage: http://www.tobiasmatthies.de
55
+ licenses: []
56
+
57
+ post_install_message:
58
+ rdoc_options: []
59
+
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ requirements: []
79
+
80
+ rubyforge_project: hdmake
81
+ rubygems_version: 1.3.7
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: Simple hdmake wrapper
85
+ test_files:
86
+ - spec/hdmake_spec.rb
87
+ - spec/spec_helper.rb