baren 0.1.0 → 0.2.0
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 +11 -0
- data/README.md +18 -8
- data/lib/baren.rb +6 -1
- data/opt/Rakefile +34 -11
- metadata +37 -62
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -6,6 +6,24 @@ Baren generate .png images form .pjs ([Processing.js](http://processingjs.org/)
|
|
6
6
|
- Can be a part of the asset pipeline of Rails 3.1
|
7
7
|
|
8
8
|
|
9
|
+
Prerequisites
|
10
|
+
-------------
|
11
|
+
Baren requires PhantomJS as the Javascript and Canvas engine,
|
12
|
+
and PhantomJS requires QtWebKit.
|
13
|
+
|
14
|
+
### Mac OS X
|
15
|
+
Baren use a binary package of PhantomJS for Mac OS X, so there is no need to do before installing baren.
|
16
|
+
|
17
|
+
### Ubuntu 10.04
|
18
|
+
|
19
|
+
sudo apt-get install curl libqt4-dev qt4-qmake xvfb
|
20
|
+
|
21
|
+
For other linux distributions, please consult with [BuildInstructions - phantomjs](http://code.google.com/p/phantomjs/wiki/BuildInstructions).
|
22
|
+
|
23
|
+
### Windows
|
24
|
+
TBD
|
25
|
+
|
26
|
+
|
9
27
|
Usages
|
10
28
|
------
|
11
29
|
### With Rails 3.1 Asset pipeline
|
@@ -28,14 +46,6 @@ Access http://localhost:3000/assets/reddisc.png (tweak URL for your environment)
|
|
28
46
|
You will see a red circle, and please enjoy with [processing.js API reference](http://processingjs.org/reference).
|
29
47
|
|
30
48
|
|
31
|
-
Caveats
|
32
|
-
-------
|
33
|
-
Baren requires PhantomJS as the Javascript and Canvas engine,
|
34
|
-
but current version of baren gem only install mac version of PhantomJS.
|
35
|
-
If you use other platform, place a binary of phantomjs on {path to baren gem}/opt/phantomjs/bin/phantomjs.
|
36
|
-
I'll support Linux and Windows soon after.
|
37
|
-
|
38
|
-
|
39
49
|
Developer Notes
|
40
50
|
---------------
|
41
51
|
If you didn't install baren as a gem, you will need to install some non-gem prerequisites.
|
data/lib/baren.rb
CHANGED
@@ -27,7 +27,12 @@ module Baren
|
|
27
27
|
dataURL = Tempfile.open("pjs2png") do |f|
|
28
28
|
f.print Tilt.new(PhantomJs.pjs2png_path).render(nil, :pjs => data.inspect, :processingjs => File.read(ProcessingJs.path).inspect)
|
29
29
|
f.flush
|
30
|
-
|
30
|
+
case RUBY_PLATFORM
|
31
|
+
when /linux/
|
32
|
+
cmd = "xvfb-run #{PhantomJs.path} #{f.path}"
|
33
|
+
else
|
34
|
+
cmd = "#{PhantomJs.path} #{f.path}"
|
35
|
+
end
|
31
36
|
`#{cmd}`
|
32
37
|
end
|
33
38
|
require "base64"
|
data/opt/Rakefile
CHANGED
@@ -1,21 +1,23 @@
|
|
1
|
+
# -*- ruby -*-
|
1
2
|
# PhantomJS
|
3
|
+
phantomjs = {
|
4
|
+
:target => "phantomjs/bin/phantomjs",
|
5
|
+
:bindir => "phantomjs/bin",
|
6
|
+
}
|
7
|
+
|
2
8
|
case RUBY_PLATFORM
|
3
9
|
when /darwin/
|
4
|
-
phantomjs
|
5
|
-
:bindir => "phantomjs/bin",
|
6
|
-
:target => "phantomjs/bin/phantomjs",
|
10
|
+
phantomjs.update({
|
7
11
|
:url => "http://phantomjs.googlecode.com/files/phantomjs-1.1.0-macosx-universal.dmg",
|
8
12
|
:archive => "phantomjs/phantomjs-1.1.0-macosx-universal.dmg",
|
9
13
|
:app => "phantomjs/phantomjs.app",
|
10
14
|
:volume => "/Volumes/phantomjs",
|
11
|
-
}
|
12
|
-
|
13
|
-
file phantomjs[:target] => [phantomjs[:app]
|
15
|
+
})
|
16
|
+
|
17
|
+
file phantomjs[:target] => [phantomjs[:app]] do |t|
|
14
18
|
sh "(cd #{t.prerequisites[1]} && ln -s ../#{File.basename(t.prerequisites[0])}/Contents/MacOS/phantomjs phantomjs)"
|
15
19
|
end
|
16
20
|
|
17
|
-
directory File.dirname(phantomjs[:target])
|
18
|
-
|
19
21
|
file phantomjs[:app] => [phantomjs[:archive]] do |t|
|
20
22
|
sh "hdiutil attach #{t.prerequisites[0]}"
|
21
23
|
begin
|
@@ -24,16 +26,37 @@ when /darwin/
|
|
24
26
|
sh "hdiutil detach #{phantomjs[:volume]}"
|
25
27
|
end
|
26
28
|
end
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
when /linux/
|
30
|
+
phantomjs.update({
|
31
|
+
:url => "http://phantomjs.googlecode.com/files/phantomjs-1.1.0-source.tar.gz",
|
32
|
+
:archive => "phantomjs/phantomjs-1.1.0-source.tar.gz",
|
33
|
+
:builddir => "phantomjs/phantomjs-1.1.0-source",
|
34
|
+
:buildbin => "phantomjs/phantomjs-1.1.0-source/bin/phantomjs",
|
35
|
+
})
|
36
|
+
|
37
|
+
file phantomjs[:target] => [phantomjs[:buildbin]] do |t|
|
38
|
+
sh "(cd #{phantomjs[:bindir]} && ln -s ../../#{phantomjs[:buildbin]} phantomjs)"
|
39
|
+
end
|
40
|
+
|
41
|
+
file phantomjs[:buildbin] => [phantomjs[:archive], phantomjs[:builddir]] do |t|
|
42
|
+
sh "(cd #{phantomjs[:builddir]} && tar xzf ../#{File.basename(phantomjs[:archive])} && qmake-qt4 && make)"
|
30
43
|
end
|
44
|
+
|
45
|
+
directory phantomjs[:builddir]
|
31
46
|
else
|
32
47
|
# http://code.google.com/p/phantomjs/downloads/list
|
33
48
|
# http://code.google.com/p/phantomjs/wiki/Installation
|
34
49
|
abort "Your RUBY_PLATFORM (#{RUBY_PLATFORM}) is not supported yet. See http://code.google.com/p/phantomjs/wiki/Installation and help us."
|
35
50
|
end
|
36
51
|
|
52
|
+
file phantomjs[:target] => File.dirname(phantomjs[:target])
|
53
|
+
|
54
|
+
directory File.dirname(phantomjs[:target])
|
55
|
+
|
56
|
+
file phantomjs[:archive] do |t|
|
57
|
+
sh "(cd phantomjs && curl -O #{phantomjs[:url]})"
|
58
|
+
end
|
59
|
+
|
37
60
|
|
38
61
|
# Processing.js
|
39
62
|
processingjs = {
|
metadata
CHANGED
@@ -1,99 +1,74 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: baren
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 0.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Hiroshi Saito
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2011-05-29 00:00:00 +09:00
|
12
|
+
date: 2011-05-31 00:00:00.000000000 +09:00
|
18
13
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
21
16
|
name: railties
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &78401630 !ruby/object:Gem::Requirement
|
24
18
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 3
|
30
|
-
- 1
|
31
|
-
- 0
|
32
|
-
- rc1
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
33
22
|
version: 3.1.0.rc1
|
34
23
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: sprockets
|
38
24
|
prerelease: false
|
39
|
-
|
25
|
+
version_requirements: *78401630
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: sprockets
|
28
|
+
requirement: &78401400 !ruby/object:Gem::Requirement
|
40
29
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
segments:
|
45
|
-
- 2
|
46
|
-
- 0
|
47
|
-
- 0
|
48
|
-
- beta
|
49
|
-
- 8
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
50
33
|
version: 2.0.0.beta.8
|
51
34
|
type: :runtime
|
52
|
-
|
53
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *78401400
|
37
|
+
description: An asset pipeline processor, and a template engine for images.
|
54
38
|
email: hiroshi3110@gmail.com
|
55
39
|
executables: []
|
56
|
-
|
57
|
-
extensions:
|
40
|
+
extensions:
|
58
41
|
- opt/Rakefile
|
59
42
|
extra_rdoc_files: []
|
60
|
-
|
61
|
-
files:
|
43
|
+
files:
|
62
44
|
- README.md
|
45
|
+
- CHANGELOG.md
|
63
46
|
- lib/baren.rb
|
64
47
|
- opt/Rakefile
|
65
48
|
- opt/phantomjs/pjs2png.js.erb
|
66
49
|
has_rdoc: true
|
67
50
|
homepage: http://github.com/hiroshi/baren
|
68
51
|
licenses: []
|
69
|
-
|
70
52
|
post_install_message:
|
71
53
|
rdoc_options: []
|
72
|
-
|
73
|
-
require_paths:
|
54
|
+
require_paths:
|
74
55
|
- lib
|
75
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
57
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
|
81
|
-
|
82
|
-
version: "0"
|
83
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
63
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
- 0
|
90
|
-
version: "0"
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
91
68
|
requirements: []
|
92
|
-
|
93
69
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.
|
70
|
+
rubygems_version: 1.6.2
|
95
71
|
signing_key:
|
96
72
|
specification_version: 3
|
97
73
|
summary: Generate .png form .pjs, processing.js script.
|
98
74
|
test_files: []
|
99
|
-
|