baren 0.2.1 → 0.2.2
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/CHANGELOG.md +5 -1
- data/lib/baren.rb +9 -2
- data/opt/phantomjs/pjs2png.js.erb +7 -2
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
ChangeLogs
|
2
2
|
==========
|
3
3
|
|
4
|
+
## 0.2.2 (2011-06-08)
|
5
|
+
|
6
|
+
- Raise a kind of Baren::Error instead of hangging up.
|
7
|
+
|
4
8
|
## 0.2.1 (2011-06-05)
|
5
9
|
|
6
|
-
- Let Baren::PjsTemplate works on non-rails environment like sinatra
|
10
|
+
- Let Baren::PjsTemplate works on non-rails environment like sinatra.
|
7
11
|
|
8
12
|
## 0.2.0 (2011-06-02)
|
9
13
|
|
data/lib/baren.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require "tilt"
|
2
2
|
module Baren
|
3
|
+
class Error < Exception; end
|
4
|
+
class ProcessingJsError < Error; end
|
5
|
+
|
3
6
|
class ProcessingJs
|
4
7
|
def self.path
|
5
8
|
File.join(File.dirname(__FILE__), '..', 'vendor', 'assets', 'javascripts', 'processing.min.js')
|
@@ -34,8 +37,12 @@ module Baren
|
|
34
37
|
end
|
35
38
|
`#{cmd}`
|
36
39
|
end
|
37
|
-
|
38
|
-
|
40
|
+
if encodedImage = dataURL[%r"data:image/png;base64,(.*)",1]
|
41
|
+
require "base64"
|
42
|
+
@output ||= Base64.decode64(encodedImage)
|
43
|
+
else
|
44
|
+
raise Baren::ProcessingJsError, dataURL
|
45
|
+
end
|
39
46
|
end
|
40
47
|
end
|
41
48
|
#Tilt.register Baren::PjsTemplate, "pjs"
|
@@ -3,7 +3,12 @@ if (phantom.state.length === 0) {
|
|
3
3
|
phantom.content = '<html><body><script>' + <%= processingjs %> + '</script><canvas id="surface"></canvas></body></html>';
|
4
4
|
} else {
|
5
5
|
var canvas = document.getElementById("surface");
|
6
|
-
|
7
|
-
|
6
|
+
try {
|
7
|
+
new Processing(canvas, <%= pjs %>);
|
8
|
+
console.log(canvas.toDataURL());
|
9
|
+
} catch (e) {
|
10
|
+
//console.log(e.line);
|
11
|
+
console.log(e);
|
12
|
+
}
|
8
13
|
phantom.exit();
|
9
14
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baren
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-06-
|
12
|
+
date: 2011-06-08 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tilt
|
16
|
-
requirement: &
|
16
|
+
requirement: &9055300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '1.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *9055300
|
25
25
|
description: An asset pipeline processor, and a template engine for images.
|
26
26
|
email: hiroshi3110@gmail.com
|
27
27
|
executables: []
|