processingjs 0.0.1

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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in processingjs.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Erik Kallen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ Ruby Processingjs
2
+ =================
3
+
4
+ Ruby Processingjs is a bridge to the official Processingjs compiler.
5
+
6
+ Processingjs.compile File.read("script.pde")
7
+
8
+
9
+ Installation
10
+ ------------
11
+
12
+ gem install processingjs
13
+
14
+
15
+ Dependencies
16
+ ------------
17
+
18
+ This library depends on the `processingjs-source` gem which is
19
+ updated any time a new version of Processingjs is released. (The
20
+ `processingjs-source` gem's version number is synced with each
21
+ official Processingjs release.) This way you can build against
22
+ different versions of Processingjs by requiring the correct version of
23
+ the `processingjs` gem.
24
+
25
+ ### JSON
26
+
27
+ The `json` library is also required but is not explicitly stated as a
28
+ gem dependency. If you're on Ruby 1.8 you'll need to install the
29
+ `json` or `json_pure` gem. On Ruby 1.9, `json` is included in the
30
+ standard library.
31
+
32
+ ### ExecJS
33
+
34
+ The [ExecJS](https://github.com/sstephenson/execjs) library is used to automatically choose the best JavaScript engine for your platform. Check out its [README](https://github.com/sstephenson/execjs/blob/master/README.md) for a complete list of supported engines.
35
+
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,60 @@
1
+ require 'execjs'
2
+ require 'processingjs/source'
3
+
4
+ module Processingjs
5
+ EngineError = ExecJS::RuntimeError
6
+ CompilationError = ExecJS::ProgramError
7
+
8
+ module Source
9
+ def self.path
10
+ @path ||= ENV['PROCESSINGJS_SOURCE_PATH'] || bundled_path
11
+ end
12
+
13
+ def self.path=(path)
14
+ @contents = @version = @bare_option = @context = nil
15
+ @path = path
16
+ end
17
+
18
+ def self.contents
19
+ @contents ||= File.read(path)
20
+ end
21
+
22
+ def self.version
23
+ @version ||= contents[/Processingjs Compiler v([\d.]+)/, 1]
24
+ end
25
+
26
+ def self.bare_option
27
+ @bare_option ||= contents.match(/noWrap/) ? 'noWrap' : 'bare'
28
+ end
29
+
30
+ def self.context
31
+ @context ||= ExecJS.compile(contents)
32
+ end
33
+ end
34
+
35
+ class << self
36
+ def engine
37
+ end
38
+
39
+ def engine=(engine)
40
+ end
41
+
42
+ def version
43
+ Source.version
44
+ end
45
+
46
+ # Compile a script (String or IO) to JavaScript.
47
+ def compile(script, options = {})
48
+ script = script.read if script.respond_to?(:read)
49
+
50
+ if options.key?(:bare)
51
+ elsif options.key?(:no_wrap)
52
+ options[:bare] = options[:no_wrap]
53
+ else
54
+ options[:bare] = false
55
+ end
56
+
57
+ Source.context.call("Processing.compile", script)["sourceCode"]
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,3 @@
1
+ module Processingjs
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/processingjs/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Erik Kallen"]
6
+ gem.email = ["erikkallen@incas3.eu"]
7
+ gem.homepage = "http://github.com/incas3/processingjs"
8
+ gem.summary = "Ruby Processingjs Compiler"
9
+ gem.description = <<-EOS
10
+ Ruby Processingjs is a bridge to the JS Processingjs compiler.
11
+ EOS
12
+
13
+ gem.files = `git ls-files`.split($\)
14
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
15
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
+ gem.name = "processingjs"
17
+ gem.require_paths = ["lib"]
18
+ gem.version = Processingjs::VERSION
19
+
20
+ gem.add_dependency 'processingjs-source'
21
+ gem.add_dependency 'execjs'
22
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: processingjs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Erik Kallen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: processingjs-source
16
+ requirement: &70179074616380 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70179074616380
25
+ - !ruby/object:Gem::Dependency
26
+ name: execjs
27
+ requirement: &70179074615940 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70179074615940
36
+ description: ! ' Ruby Processingjs is a bridge to the JS Processingjs compiler.
37
+
38
+ '
39
+ email:
40
+ - erikkallen@incas3.eu
41
+ executables: []
42
+ extensions: []
43
+ extra_rdoc_files: []
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - LICENSE
48
+ - README.md
49
+ - Rakefile
50
+ - lib/processingjs.rb
51
+ - lib/processingjs/version.rb
52
+ - processingjs.gemspec
53
+ homepage: http://github.com/incas3/processingjs
54
+ licenses: []
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 1.8.11
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: Ruby Processingjs Compiler
77
+ test_files: []