coffee_short_get 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/coffee_short_get.gemspec +3 -3
- data/lib/coffee_short_get.rb +29 -19
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/coffee_short_get.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "coffee_short_get"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mike Harris"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-08-30"
|
13
13
|
s.description = "coffee_short_get"
|
14
14
|
s.email = "mharris717@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.homepage = "http://github.com/mharris717/coffee_short_get"
|
34
34
|
s.licenses = ["MIT"]
|
35
35
|
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = "1.8.
|
36
|
+
s.rubygems_version = "1.8.25"
|
37
37
|
s.summary = "coffee_short_get"
|
38
38
|
|
39
39
|
if s.respond_to? :specification_version then
|
data/lib/coffee_short_get.rb
CHANGED
@@ -1,12 +1,6 @@
|
|
1
|
-
class
|
2
|
-
|
3
|
-
body
|
4
|
-
|
5
|
-
if context.pathname.to_s =~ /coffee/
|
6
|
-
require 'pp'
|
7
|
-
pp context
|
8
|
-
pp locals
|
9
|
-
|
1
|
+
class CoffeeParse
|
2
|
+
class << self
|
3
|
+
def parse(body)
|
10
4
|
body = body.gsub(/@\$(\w+)/) do |str|
|
11
5
|
var = str[2..-1]
|
12
6
|
"@get('#{var}')"
|
@@ -15,22 +9,38 @@ class CoffeeGetAccess < Sprockets::Processor
|
|
15
9
|
var = str[2..-1]
|
16
10
|
".get('#{var}')"
|
17
11
|
end
|
12
|
+
body
|
18
13
|
end
|
19
|
-
|
20
|
-
body
|
21
14
|
end
|
22
15
|
end
|
23
16
|
|
24
|
-
|
25
|
-
class
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
17
|
+
if defined?(Sprockets)
|
18
|
+
class CoffeeGetAccess < Sprockets::Processor
|
19
|
+
def evaluate(context,locals)
|
20
|
+
body = data
|
21
|
+
|
22
|
+
if context.pathname.to_s =~ /coffee/
|
23
|
+
body = CoffeeParse.parse(body)
|
24
|
+
end
|
25
|
+
|
26
|
+
body
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
module CoffeePreExt
|
33
|
+
class << self
|
34
|
+
def registered(app)
|
35
|
+
app.after_configuration do
|
36
|
+
sprockets.register_preprocessor 'application/javascript', CoffeeGetAccess
|
37
|
+
end
|
30
38
|
end
|
39
|
+
alias :included :registered
|
31
40
|
end
|
32
|
-
alias :included :registered
|
33
41
|
end
|
34
42
|
end
|
35
43
|
|
36
|
-
|
44
|
+
if defined?(Middleman)
|
45
|
+
::Middleman::Extensions.register :coffee_short_get, CoffeePreExt
|
46
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffee_short_get
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
110
|
version: '0'
|
111
111
|
segments:
|
112
112
|
- 0
|
113
|
-
hash: -
|
113
|
+
hash: -326950251335307325
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
none: false
|
116
116
|
requirements:
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 1.8.
|
122
|
+
rubygems_version: 1.8.25
|
123
123
|
signing_key:
|
124
124
|
specification_version: 3
|
125
125
|
summary: coffee_short_get
|