coffee-filter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in coffee-filter.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2011 Paul Nicholson
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.
21
+
@@ -0,0 +1,35 @@
1
+ === What is coffee-filter?
2
+ Coffee-filter provides a custom haml filter allowing you to inline coffeescript in your haml templates.
3
+ It was inspired by Ivan Nemytchenko's coffee-haml-filter but I wanted an installable gem and "coffeescript" as the filter name.
4
+
5
+ === Example
6
+ Haml:
7
+
8
+ %div
9
+ stuff
10
+ :coffeescript
11
+ alert 'here'
12
+
13
+ Html:
14
+
15
+ <div>
16
+ stuff
17
+ <script type='text/javascript'>
18
+ //<![CDATA[
19
+ (function() {
20
+ alert('here');
21
+ }).call(this);
22
+
23
+ //]]>
24
+ </script>
25
+ </div>
26
+
27
+ === Installation
28
+ Add the following to your Gemfile:
29
+
30
+ gem 'coffee-filter'
31
+
32
+
33
+ Copyright (c) 2011 Paul Nicholson, released under the MIT license
34
+
35
+
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "coffee-filter/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "coffee-filter"
7
+ s.version = Coffee::Filter::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Paul Nicholson"]
10
+ s.email = ["paul@webpowerdesign.net"]
11
+ s.homepage = "http://github.com/paulnicholson/coffee-filter"
12
+ s.summary = %q{CoffeeFilter is a custom haml filter for rendering coffeescript.}
13
+ s.description = %q{CoffeeFilter is a custom haml filter for rendering coffeescript inside your haml templates. It was inspired by Ivan Nemytchenko's coffee-haml-filter but I wanted an installable gem and coffeescript as the filter name.}
14
+
15
+ s.rubyforge_project = "coffee-filter"
16
+ s.add_dependency('haml', '>= 3.0.18')
17
+ s.add_dependency('coffee-script', '>= 2.2.0')
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+ end
@@ -0,0 +1,6 @@
1
+ require 'coffee-filter/coffeescript'
2
+
3
+ module Coffee
4
+ module Filter
5
+ end
6
+ end
@@ -0,0 +1,20 @@
1
+ module Coffee
2
+ module Filter
3
+ module Coffeescript
4
+ include Haml::Filters::Base
5
+
6
+ lazy_require 'coffee-script'
7
+
8
+ def render_with_options(text, options)
9
+ <<END
10
+ <script type=#{options[:attr_wrapper]}text/javascript#{options[:attr_wrapper]}>
11
+ //<![CDATA[
12
+ #{CoffeeScript.compile(text)}
13
+ //]]>
14
+ </script>
15
+ END
16
+ end
17
+ end
18
+ end
19
+ end
20
+
@@ -0,0 +1,5 @@
1
+ module Coffee
2
+ module Filter
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: coffee-filter
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Paul Nicholson
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-04-29 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: haml
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 3
30
+ - 0
31
+ - 18
32
+ version: 3.0.18
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: coffee-script
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 2
45
+ - 2
46
+ - 0
47
+ version: 2.2.0
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ description: CoffeeFilter is a custom haml filter for rendering coffeescript inside your haml templates. It was inspired by Ivan Nemytchenko's coffee-haml-filter but I wanted an installable gem and coffeescript as the filter name.
51
+ email:
52
+ - paul@webpowerdesign.net
53
+ executables: []
54
+
55
+ extensions: []
56
+
57
+ extra_rdoc_files: []
58
+
59
+ files:
60
+ - .gitignore
61
+ - Gemfile
62
+ - MIT-LICENSE
63
+ - README.rdoc
64
+ - Rakefile
65
+ - coffee-filter.gemspec
66
+ - lib/coffee-filter.rb
67
+ - lib/coffee-filter/coffeescript.rb
68
+ - lib/coffee-filter/version.rb
69
+ has_rdoc: true
70
+ homepage: http://github.com/paulnicholson/coffee-filter
71
+ licenses: []
72
+
73
+ post_install_message:
74
+ rdoc_options: []
75
+
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ segments:
84
+ - 0
85
+ version: "0"
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ segments:
92
+ - 0
93
+ version: "0"
94
+ requirements: []
95
+
96
+ rubyforge_project: coffee-filter
97
+ rubygems_version: 1.3.7
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: CoffeeFilter is a custom haml filter for rendering coffeescript.
101
+ test_files: []
102
+