sprockets-coffee-react 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 550c9fc9c09bf09e3d794d930e275cb14ca48545
4
+ data.tar.gz: 52941034b2c8fbe0152c09b6849640222a5a59cc
5
+ SHA512:
6
+ metadata.gz: 0c2399852865c7f7286b86052b186a719cbc04636d9a256d4ce5ccc666857f9e3d0fd1c71364a696a60630d9669a9d80dbf4d460f4135edf525e2384f371edca
7
+ data.tar.gz: 54eb078d246043ecc850bc1747695c52cec57f43e1ff84c1a08fdb24f751f8808eff26e7f1ff55cf05a966fccbe92417d97566852bac660ca7dc84be0d9cb4b2
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 James Friend <james@jsdf.co>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,22 @@
1
+ = sprockets-coffee-react
2
+
3
+ == How to use
4
+
5
+ Add this to your Gemfile:
6
+
7
+ gem 'sprockets-coffee-react'
8
+
9
+ Place a `.js.coffee.cjsx` or a `.js.coffee` file with a `@cjsx` pragma in your assets directory.
10
+
11
+ Require within your <tt>application.js</tt> or somewhere else:
12
+
13
+ //
14
+ //= require my-component
15
+ //
16
+
17
+ Done.
18
+
19
+
20
+ == License
21
+
22
+ Released under the MIT License. See the LICENSE file for further details.
data/Rakefile ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'SprocketsCoffeeReact'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
28
+ require 'rake/testtask'
29
+
30
+ Rake::TestTask.new(:test) do |t|
31
+ t.libs << 'lib'
32
+ t.libs << 'test'
33
+ t.pattern = 'test/**/*_test.rb'
34
+ t.verbose = false
35
+ end
36
+
37
+
38
+ task :default => :test
@@ -0,0 +1,2 @@
1
+ require 'sprockets/coffee-react'
2
+ require 'sprockets/coffee-react/engine'
@@ -0,0 +1,23 @@
1
+ require 'sprockets'
2
+ require 'tilt'
3
+ require 'coffee-react'
4
+
5
+ module Sprockets
6
+ # Preprocessor that runs CJSX source files through coffee-react-transform
7
+ class CoffeeReact < Tilt::Template
8
+ CJSX_EXTENSION = /\.cjsx[^\/]*?$/
9
+ CJSX_PRAGMA = /^\s*#[ \t]*@cjsx/i
10
+
11
+ def prepare
12
+ end
13
+
14
+ def evaluate(scope, locals, &block)
15
+ if scope.pathname.to_s =~ CJSX_EXTENSION || data =~ CJSX_PRAGMA
16
+ ::CoffeeReact.transform(data)
17
+ else
18
+ data
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ require 'sprockets/coffee-react'
2
+
3
+ if defined?(Rails)
4
+ module Sprockets
5
+ class CoffeeReact
6
+ class Engine < ::Rails::Engine
7
+ initializer :setup_coffee_react, :after => "sprockets.environment", :group => :all do |app|
8
+ app.assets.register_preprocessor 'application/javascript', Sprockets::CoffeeReact
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :sprockets-coffee-react do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sprockets-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-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sprockets
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: coffee-react
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.2'
41
+ description: Preprocessor for Coffeescript with React JSX (CJSX). This gem makes it
42
+ easy to integrate this into the Rails asset pipeline or other Sprockets chains.
43
+ email: james@jsdf.co
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - LICENSE
49
+ - README.rdoc
50
+ - Rakefile
51
+ - lib/sprockets-coffee-react.rb
52
+ - lib/sprockets/coffee-react.rb
53
+ - lib/sprockets/coffee-react/engine.rb
54
+ - lib/tasks/sprockets-coffee-react_tasks.rake
55
+ homepage: http://jsdf.co
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.2.2
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Coffeescript with React JSX (CJSX) via Sprockets
79
+ test_files: []