coffee-react 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ require 'coffee_react'
@@ -0,0 +1,47 @@
1
+ require 'rubygems'
2
+ require 'execjs'
3
+
4
+ module CoffeeReact
5
+ Error = ExecJS::Error
6
+ EngineError = ExecJS::RuntimeError
7
+ CompilationError = ExecJS::ProgramError
8
+
9
+ module Source
10
+
11
+ def self.gem_dir
12
+ Gem::Specification.find_by_name('coffee-react').gem_dir
13
+ end
14
+
15
+ def self.path
16
+ @path ||= "#{gem_dir}/coffee-react-transform.js"
17
+ end
18
+
19
+ def self.path=(path)
20
+ @contents = @context = nil
21
+ @path = path
22
+ end
23
+
24
+ def self.contents
25
+ @contents ||= File.read(path)
26
+ end
27
+
28
+ def self.context
29
+ @context ||= ExecJS.compile(contents)
30
+ end
31
+ end
32
+
33
+ class << self
34
+ def engine
35
+ end
36
+
37
+ def engine=(engine)
38
+ end
39
+
40
+
41
+ def transform(script, options = {})
42
+ script = script.read if script.respond_to?(:read)
43
+
44
+ Source.context.call("coffeeReactTransform", script, options)
45
+ end
46
+ end
47
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: coffee-react
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - James Friend
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: execjs
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: |2
42
+ ruby-coffee-react is a bridge to the npm coffee-react-transform module, and can compile Coffeescript also.
43
+ email: james@jsdf.co
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - LICENSE
49
+ - README.md
50
+ - coffee-react-transform.js
51
+ - lib/coffee-react.rb
52
+ - lib/coffee_react.rb
53
+ homepage: http://github.com/jsdf/ruby-coffee-react
54
+ licenses:
55
+ - MIT
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 2.2.2
74
+ signing_key:
75
+ specification_version: 4
76
+ summary: Ruby Coffeescript React CJSX Transformer Compiler
77
+ test_files: []