jquery_expand_assets 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ # - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ # - jruby-18mode # JRuby in 1.8 mode
7
+ - jruby-19mode # JRuby in 1.9 mode
8
+ # - rbx-18mode
9
+ - rbx-19mode
10
+ # uncomment this line if your project needs to run something other than `rake`:
11
+ script: bundle exec rake
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # jquery.expand assets
1
+ # jquery.expand assets [![Build Status](https://secure.travis-ci.org/atomicobject/jquery_expand_assets.png)](http://travis-ci.org/atomicobject/jquery_expand_assets)
2
2
 
3
3
  A Sprockets processor that wraps html in a jquery.expand function. It is specifically meant to work within the Rails asset pipeline.
4
4
 
@@ -6,7 +6,7 @@ module JqueryExpandAssets
6
6
  def prepare; end
7
7
 
8
8
  def evaluate(scope, locals, &block)
9
- name = scope.logical_path.sub(/^templates\//, '').sub(%r{/?_(.*)$}, '/\1')
9
+ name = scope.logical_path.sub(/^templates\//, '').sub(%r{/?_?([^/]*)$}, '/\1')
10
10
  <<-COFFEE
11
11
  this.JST ||= {}
12
12
  template = null
@@ -1,3 +1,3 @@
1
1
  module JqueryExpandAssets
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -34,6 +34,24 @@ class JqueryExpandProcessorTest < MiniTest::Unit::TestCase
34
34
  assert_match 'this.JST["users/avatar"]', result
35
35
  end
36
36
 
37
+ def test_handles_template_names_with_embedded_underscores
38
+ result = process filename: 'templates/users/foo_bar_baz_qux_quux'
39
+
40
+ assert_match 'this.JST["users/foo_bar_baz_qux_quux"]', result
41
+ end
42
+
43
+ def test_handles_directory_names_with_embedded_underscores
44
+ result = process filename: 'templates/admin_users/foo_bar_baz_qux_quux'
45
+
46
+ assert_match 'this.JST["admin_users/foo_bar_baz_qux_quux"]', result
47
+ end
48
+
49
+ def test_handles_deep_directory_trees_with_embedded_underscores
50
+ result = process filename: 'templates/stuff_1/admin_users/foo_bar_baz_qux_quux'
51
+
52
+ assert_match 'this.JST["stuff_1/admin_users/foo_bar_baz_qux_quux"]', result
53
+ end
54
+
37
55
  private
38
56
  def process(optz)
39
57
  content, filename = optz.values_at(:content, :filename)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery_expand_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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: 2012-08-24 00:00:00.000000000 Z
12
+ date: 2012-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tilt
@@ -67,6 +67,7 @@ extensions: []
67
67
  extra_rdoc_files: []
68
68
  files:
69
69
  - .gitignore
70
+ - .travis.yml
70
71
  - Gemfile
71
72
  - LICENSE
72
73
  - README.md
@@ -91,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
92
  version: '0'
92
93
  segments:
93
94
  - 0
94
- hash: 1418485936274559627
95
+ hash: -3054462922371063983
95
96
  required_rubygems_version: !ruby/object:Gem::Requirement
96
97
  none: false
97
98
  requirements:
@@ -100,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
101
  version: '0'
101
102
  segments:
102
103
  - 0
103
- hash: 1418485936274559627
104
+ hash: -3054462922371063983
104
105
  requirements: []
105
106
  rubyforge_project:
106
107
  rubygems_version: 1.8.24