shaderize 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/shaderize/scaffold.rb +19 -3
- data/lib/shaderize/version.rb +1 -1
- metadata +7 -7
data/lib/shaderize/scaffold.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'mustache'
|
3
|
+
require 'digest/sha1'
|
3
4
|
|
4
5
|
|
5
6
|
module Shaderize
|
@@ -34,9 +35,9 @@ module Shaderize
|
|
34
35
|
source_mtime = [mtime(template), shaders_mtime, mtime(__FILE__)].max
|
35
36
|
target = File.join(output_dir, File.basename(template, File.extname(template)))
|
36
37
|
target_mtime = mtime(target)
|
37
|
-
|
38
|
-
|
39
|
-
File.open(target, "w") {|f| f.write(
|
38
|
+
target_data = Mustache.render(File.read(template), :shaders => shaders.values)
|
39
|
+
if source_mtime > target_mtime or different?(target, target_data)
|
40
|
+
File.open(target, "w") {|f| f.write(target_data) }
|
40
41
|
puts "Shaderized: #{File.basename(target)}"
|
41
42
|
end
|
42
43
|
end
|
@@ -52,6 +53,21 @@ module Shaderize
|
|
52
53
|
0
|
53
54
|
end
|
54
55
|
|
56
|
+
def self.hash(filename)
|
57
|
+
hash = Digest::SHA1.new
|
58
|
+
open(filename, "r") do |io|
|
59
|
+
until io.eof
|
60
|
+
hash.update(io.readpartial(1024))
|
61
|
+
end
|
62
|
+
end
|
63
|
+
hash.hexdigest
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.different?(filename, contents)
|
67
|
+
return true if File.size(filename) != contents.size
|
68
|
+
hash(filename) != Digest::SHA1.hexdigest(contents)
|
69
|
+
end
|
70
|
+
|
55
71
|
end
|
56
72
|
end
|
57
73
|
|
data/lib/shaderize/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shaderize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-08-25 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70268563501660 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70268563501660
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mustache
|
27
|
-
requirement: &
|
27
|
+
requirement: &70268563501040 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70268563501040
|
36
36
|
description: A utility to help scaffold code from OpenGL ES 2 shaders.
|
37
37
|
email:
|
38
38
|
- pbhogan@gmail.com
|
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
66
|
version: '0'
|
67
67
|
segments:
|
68
68
|
- 0
|
69
|
-
hash:
|
69
|
+
hash: -1177528489724511482
|
70
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
71
|
none: false
|
72
72
|
requirements:
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
version: '0'
|
76
76
|
segments:
|
77
77
|
- 0
|
78
|
-
hash:
|
78
|
+
hash: -1177528489724511482
|
79
79
|
requirements: []
|
80
80
|
rubyforge_project: shaderize
|
81
81
|
rubygems_version: 1.8.8
|