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 CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "coffee_short_get"
8
- s.version = "0.1.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-05-31"
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.23"
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
@@ -1,12 +1,6 @@
1
- class CoffeeGetAccess < Sprockets::Processor
2
- def evaluate(context,locals)
3
- body = data
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
- module CoffeePreExt
25
- class << self
26
- def registered(app)
27
- puts "registered"
28
- app.after_configuration do
29
- sprockets.register_preprocessor 'application/javascript', CoffeeGetAccess
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
- ::Middleman::Extensions.register :coffee_short_get, CoffeePreExt
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.1.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-05-31 00:00:00.000000000 Z
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: -1506104154640935418
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.23
122
+ rubygems_version: 1.8.25
123
123
  signing_key:
124
124
  specification_version: 3
125
125
  summary: coffee_short_get