skim 0.9.3 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a11b26eb9caa17a860be644bd5d9036099b55b7
4
- data.tar.gz: 07d318c21bc64991890c1aba045656936ebc3b5f
3
+ metadata.gz: a470567c16088d62d21e54cdc825aa825b41538f
4
+ data.tar.gz: 73231e1cf365ce5f9a930678a47aa340abda3afd
5
5
  SHA512:
6
- metadata.gz: 6766b13ee4a1ccf20e367627a886386b9a542039c428eaa9ea9d9fc0b9a36eac3c017fefead45542517f0b212234d5bf6f7b301e0de6d4de205b5a29807d130e
7
- data.tar.gz: 33b172e337b5a0140a5be04bbbdfc6fbf8693be3f0e353056aaecd9b6277a727f384653892078f8cb3a2c59eb828cea2912f3d46de00323730219d396e710429
6
+ metadata.gz: 1c654ea0925e2794a43fe1d0e73782e50cab4dd1f61b51fb4a16663a0e8c16519e95d9ee56632d1e9cc5dfa50ae38cb5a679b9ad3b5622efc5533c4a2d029d76
7
+ data.tar.gz: ada8580e4f214e9bdd14c436c582ea5434c1941d4764accde3f649271b3fd60150950a5bb2967dbc7d9b3b64f71724b4f56979c0dfbaf19068a25c483eb51c92
@@ -1,3 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
3
+ - 2.0.0
data/History.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # master
2
2
 
3
+ # 0.10.0
4
+
5
+ * Compatibility with Rails 4.2, Slim 3, and Sprockets 3
6
+
3
7
  # 0.9.3
4
8
 
5
9
  * Manually append assets path if Rails not available (#33)
data/README.md CHANGED
@@ -7,15 +7,8 @@ Sprockets-based asset pipeline.
7
7
 
8
8
  # Usage
9
9
 
10
- `gem install skim`, or add `skim` to your `Gemfile` in the `:assets` group:
11
-
12
- ```ruby
13
- group :assets do
14
- gem 'skim'
15
- end
16
- ```
17
-
18
- Create template files with the extension `.jst.skim`. For example, `test.jst.skim`:
10
+ `gem install skim`, or add `skim` to your `Gemfile`. Create template files with the extension
11
+ `.jst.skim`. For example, `test.jst.skim`:
19
12
 
20
13
  ```jade
21
14
  p Hello #{@world}!
@@ -14,25 +14,26 @@ module Skim
14
14
  :default_tag => 'div',
15
15
  :use_asset => false
16
16
 
17
- filter :Encoding, :encoding
17
+ filter :Encoding
18
18
  filter :RemoveBOM
19
- use Slim::Parser, :file, :tabsize, :shortcut, :default_tag
20
- use Slim::Embedded, :enable_engines, :disable_engines, :pretty
19
+ use Slim::Parser
20
+ use Slim::Embedded
21
21
  use Skim::Interpolation
22
- use Slim::Splat::Filter, :merge_attrs, :attr_quote, :sort_attrs, :default_tag, :hyphen_attrs
23
- use Skim::Controls, :disable_capture
24
- html :AttributeSorter, :sort_attrs
25
- use Temple::CoffeeScript::AttributeMerger, :merge_attrs
26
- use Skim::CodeAttributes, :merge_attrs
22
+ use Slim::Splat::Filter
23
+ use Skim::Controls
24
+ html :AttributeSorter
25
+ html :AttributeMerger
26
+ use Temple::CoffeeScript::AttributeMerger
27
+ use Skim::CodeAttributes
27
28
  use(:AttributeRemover) { Temple::CoffeeScript::AttributeRemover.new(:remove_empty_attrs => options[:merge_attrs].keys)}
28
- html :Pretty, :format, :attr_quote, :pretty, :indent, :js_wrapper
29
- use Temple::HTML::Fast, :format, :attr_quote
30
- use Temple::CoffeeScript::Filters::Escapable, :use_html_safe, :disable_escape
29
+ html :Pretty
30
+ use Temple::HTML::Fast
31
+ use Temple::CoffeeScript::Filters::Escapable
31
32
  use Temple::CoffeeScript::Filters::ControlFlow
32
33
  filter :MultiFlattener
33
34
  use(:Optimizer) { Temple::Filters::StaticMerger.new }
34
35
  use :Generator do
35
- options[:generator].new(options.to_hash.reject {|k,v| !options[:generator].default_options.valid_keys.include?(k) })
36
+ options[:generator].new(options.to_hash.reject {|k,v| !options[:generator].options.valid_keys.include?(k) })
36
37
  end
37
38
  end
38
39
  end
@@ -1,3 +1,3 @@
1
1
  module Skim
2
- VERSION = "0.9.3"
2
+ VERSION = "0.10.0"
3
3
  end
@@ -17,14 +17,15 @@ Sprockets-based asset pipeline.}
17
17
  gem.require_paths = ["lib"]
18
18
  gem.version = Skim::VERSION
19
19
 
20
- gem.add_dependency "slim", "~> 2.0.0"
20
+ gem.add_dependency "slim", '>= 3.0'
21
21
  gem.add_dependency "coffee-script"
22
22
  gem.add_dependency "coffee-script-source", ">= 1.2.0"
23
- gem.add_dependency "sprockets"
23
+ gem.add_dependency "sprockets", ">= 2", "< 4"
24
24
 
25
25
  gem.add_development_dependency "rake"
26
+ gem.add_development_dependency "pry"
26
27
  gem.add_development_dependency "execjs"
27
- gem.add_development_dependency "minitest-reporters", "~> 0.10"
28
+ gem.add_development_dependency "minitest-reporters"
28
29
  gem.add_development_dependency "therubyracer"
29
- gem.add_development_dependency "libv8", "3.11.8.17"
30
+ gem.add_development_dependency "libv8", "~> 3.16.14.0"
30
31
  end
@@ -1,9 +1,10 @@
1
1
  require "rubygems"
2
- require "minitest/unit"
2
+ require "minitest/autorun"
3
3
  require "minitest/reporters"
4
4
  require "skim"
5
5
  require "coffee_script"
6
6
  require "execjs"
7
+ require "pry"
7
8
 
8
9
  if ENV["RM_INFO"] || ENV["TEAMCITY_VERSION"]
9
10
  MiniTest::Reporters.use! MiniTest::Reporters::RubyMineReporter.new
@@ -11,9 +12,9 @@ else
11
12
  MiniTest::Reporters.use! MiniTest::Reporters::ProgressReporter.new
12
13
  end
13
14
 
14
- MiniTest::Unit.autorun
15
+ Minitest.autorun
15
16
 
16
- class TestSkim < MiniTest::Unit::TestCase
17
+ class TestSkim < Minitest::Test
17
18
  def context_source
18
19
  File.read(File.expand_path("../context.coffee", __FILE__))
19
20
  end
@@ -48,7 +49,7 @@ class TestSkim < MiniTest::Unit::TestCase
48
49
  "var template = #{compile(source, options)}",
49
50
  "var evaluate = function () { return template(context); }"
50
51
  ]
51
- if Skim::Engine.default_options[:use_asset]
52
+ if Skim::Engine.options[:use_asset]
52
53
  code.unshift skim_source
53
54
  end
54
55
 
@@ -68,10 +69,10 @@ class TestSkim < MiniTest::Unit::TestCase
68
69
  yield
69
70
 
70
71
  begin
71
- Skim::Engine.default_options[:use_asset] = true
72
+ Skim::Engine.options[:use_asset] = true
72
73
  yield
73
74
  ensure
74
- Skim::Engine.default_options[:use_asset] = false
75
+ Skim::Engine.options[:use_asset] = false
75
76
  end
76
77
  end
77
78
 
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestAttributeMerger < MiniTest::Unit::TestCase
3
+ class TestAttributeMerger < Minitest::Test
4
4
  def call(expr)
5
5
  Temple::CoffeeScript::AttributeMerger.new.call(expr)
6
6
  end
@@ -4,8 +4,7 @@ class TestSkimCodeBlocks < TestSkim
4
4
  def test_render_with_output_code_block
5
5
  source = %q{
6
6
  p
7
- = @callback "Hello Ruby!", ->
8
- | Hello from within a block!
7
+ = @callback "Hello Ruby!", -> 'Hello from within a block!'
9
8
  }
10
9
 
11
10
  assert_html '<p>Hello Ruby! Hello from within a block! Hello Ruby!</p>', source
@@ -14,8 +13,7 @@ p
14
13
  def test_render_with_output_code_within_block
15
14
  source = %q{
16
15
  p
17
- = @callback "Hello Ruby!", =>
18
- = @callback "Hello from within a block!"
16
+ = @callback "Hello Ruby!", => @callback "Hello from within a block!"
19
17
  }
20
18
 
21
19
  assert_html '<p>Hello Ruby! Hello from within a block! Hello Ruby!</p>', source
@@ -24,9 +22,7 @@ p
24
22
  def test_render_with_output_code_within_block_2
25
23
  source = %q{
26
24
  p
27
- = @callback "Hello Ruby!", =>
28
- = @callback "Hello from within a block!", =>
29
- = @callback "And another one!"
25
+ = @callback "Hello Ruby!", => @callback "Hello from within a block!", => @callback "And another one!"
30
26
  }
31
27
 
32
28
  assert_html '<p>Hello Ruby! Hello from within a block! And another one! Hello from within a block! Hello Ruby!</p>', source
@@ -35,9 +31,7 @@ p
35
31
  def test_output_block_with_arguments
36
32
  source = %q{
37
33
  p
38
- = @define_macro 'person', (first_name, last_name) =>
39
- .first_name = first_name
40
- .last_name = last_name
34
+ = @define_macro 'person', (first_name, last_name) => "<div class=\"first_name\">#{first_name}</div><div class=\"last_name\">#{last_name}</div>"
41
35
  == @call_macro 'person', 'John', 'Doe'
42
36
  == @call_macro 'person', 'Max', 'Mustermann'
43
37
  }
@@ -87,9 +81,7 @@ p
87
81
 
88
82
  def test_captured_code_block_with_conditional
89
83
  source = %q{
90
- = @callback "Hello Ruby!", ->
91
- - if true
92
- | Hello from within a block!
84
+ = @callback "Hello Ruby!", -> 'Hello from within a block!' if true
93
85
  }
94
86
 
95
87
  assert_html 'Hello Ruby! Hello from within a block! Hello Ruby!', source
@@ -13,7 +13,7 @@ p
13
13
  def test_render_with_trailing_whitespace
14
14
  source = %q{
15
15
  p
16
- =' @hello_world()
16
+ => @hello_world()
17
17
  }
18
18
 
19
19
  assert_html '<p>Hello World from @env </p>', source
@@ -21,7 +21,7 @@ p
21
21
 
22
22
  def test_render_with_trailing_whitespace_after_tag
23
23
  source = %q{
24
- p=' @hello_world()
24
+ p=> @hello_world()
25
25
  }
26
26
 
27
27
  assert_html '<p>Hello World from @env</p> ', source
@@ -30,7 +30,7 @@ p=' @hello_world()
30
30
  def test_no_escape_render_with_trailing_whitespace
31
31
  source = %q{
32
32
  p
33
- ==' @hello_world()
33
+ ==> @hello_world()
34
34
  }
35
35
 
36
36
  assert_html '<p>Hello World from @env </p>', source
@@ -38,7 +38,7 @@ p
38
38
 
39
39
  def test_no_escape_render_with_trailing_whitespace_after_tag
40
40
  source = %q{
41
- p==' @hello_world()
41
+ p==> @hello_world()
42
42
  }
43
43
 
44
44
  assert_html '<p>Hello World from @env</p> ', source
@@ -38,8 +38,7 @@ p class="#{x}" test #{content}
38
38
 
39
39
  def test_html_nested_escaping
40
40
  source = %q{
41
- = @callback "Test", ->
42
- | escaped &
41
+ = @callback "Test", -> 'escaped &'
43
42
  }
44
43
  with_and_without_asset do
45
44
  assert_html 'Test escaped &amp; Test', source
@@ -358,7 +358,7 @@ p<id="marvin"
358
358
  class="martian"
359
359
  data-info="Illudium Q-36"> = @output_number()
360
360
  }
361
- Slim::Parser::DELIMS.each do |k,v|
361
+ Slim::Parser.options[:attr_list_delims].each do |k,v|
362
362
  str = source.sub('<',k).sub('>',v)
363
363
  assert_html '<p class="martian" data-info="Illudium Q-36" id="marvin">1337</p>', str
364
364
  end
@@ -370,7 +370,7 @@ p<id="marvin"
370
370
  class="martian"
371
371
  data-info="Illudium Q-36"> THE space modulator
372
372
  }
373
- Slim::Parser::DELIMS.each do |k,v|
373
+ Slim::Parser.options[:attr_list_delims].each do |k,v|
374
374
  str = source.sub('<',k).sub('>',v)
375
375
  assert_html '<p class="martian" data-info="Illudium Q-36" id="marvin">THE space modulator</p>', str
376
376
  end
@@ -383,7 +383,7 @@ p<id="marvin"
383
383
  data-info="Illudium Q-36">
384
384
  | THE space modulator
385
385
  }
386
- Slim::Parser::DELIMS.each do |k,v|
386
+ Slim::Parser.options[:attr_list_delims].each do |k,v|
387
387
  str = source.sub('<',k).sub('>',v)
388
388
  assert_html '<p class="martian" data-info="Illudium Q-36" id="marvin">THE space modulator</p>', str
389
389
  end
@@ -396,7 +396,7 @@ p<id=@id_helper()
396
396
  data-info="Illudium Q-36">
397
397
  | THE space modulator
398
398
  }
399
- Slim::Parser::DELIMS.each do |k,v|
399
+ Slim::Parser.options[:attr_list_delims].each do |k,v|
400
400
  str = source.sub('<',k).sub('>',v)
401
401
  assert_html '<p class="martian" data-info="Illudium Q-36" id="notice">THE space modulator</p>', str
402
402
  end
@@ -410,7 +410,7 @@ p<id=@id_helper()
410
410
  span.emphasis THE
411
411
  | space modulator
412
412
  }
413
- Slim::Parser::DELIMS.each do |k,v|
413
+ Slim::Parser.options[:attr_list_delims].each do |k,v|
414
414
  str = source.sub('<',k).sub('>',v)
415
415
  assert_html '<p class="martian" data-info="Illudium Q-36" id="notice"><span class="emphasis">THE</span> space modulator</p>', str
416
416
  end
@@ -423,7 +423,7 @@ li< id="myid"
423
423
  data-info="myinfo">
424
424
  a href="link" My Link
425
425
  }
426
- Slim::Parser::DELIMS.each do |k,v|
426
+ Slim::Parser.options[:attr_list_delims].each do |k,v|
427
427
  str = source.sub('<',k).sub('>',v)
428
428
  assert_html '<li class="myclass" data-info="myinfo" id="myid"><a href="link">My Link</a></li>', str
429
429
  end
@@ -11,11 +11,11 @@ class TestSkimTemplate < TestSkim
11
11
  end
12
12
 
13
13
  def test_sprockets_integration_with_asset
14
- Skim::Engine.default_options[:use_asset] = true
14
+ Skim::Engine.options[:use_asset] = true
15
15
  compiled = ExecJS.compile(skim_source + ";" + asset_source('test.js'))
16
16
  assert_equal "<p>Hello World, meet Skim</p>", compiled.eval("JST.test({name: 'Skim'})")
17
17
  ensure
18
- Skim::Engine.default_options[:use_asset] = false
18
+ Skim::Engine.options[:use_asset] = false
19
19
  end
20
20
 
21
21
  def test_sprockets_require_directive
@@ -38,10 +38,10 @@ this.Skim =
38
38
  if string.skimSafe or not /[&<>\"]/.test(string)
39
39
  return string
40
40
 
41
- @safe ('' + string)
41
+ @safe(('' + string)
42
42
  .replace(/&/g, '&amp;')
43
43
  .replace(/</g, '&lt;')
44
44
  .replace(/>/g, '&gt;')
45
- .replace(/"/g, '&quot;')
45
+ .replace(/"/g, '&quot;'))
46
46
 
47
47
  block.call(context)
metadata CHANGED
@@ -1,141 +1,161 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Firebaugh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-02 00:00:00.000000000 Z
11
+ date: 2015-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slim
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coffee-script
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coffee-script-source
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.2.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.2.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sprockets
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '2'
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: '4'
62
65
  type: :runtime
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
66
- - - '>='
69
+ - - ">="
67
70
  - !ruby/object:Gem::Version
68
- version: '0'
71
+ version: '2'
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '4'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: rake
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - '>='
79
+ - - ">="
74
80
  - !ruby/object:Gem::Version
75
81
  version: '0'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
- - - '>='
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: pry
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
81
101
  - !ruby/object:Gem::Version
82
102
  version: '0'
83
103
  - !ruby/object:Gem::Dependency
84
104
  name: execjs
85
105
  requirement: !ruby/object:Gem::Requirement
86
106
  requirements:
87
- - - '>='
107
+ - - ">="
88
108
  - !ruby/object:Gem::Version
89
109
  version: '0'
90
110
  type: :development
91
111
  prerelease: false
92
112
  version_requirements: !ruby/object:Gem::Requirement
93
113
  requirements:
94
- - - '>='
114
+ - - ">="
95
115
  - !ruby/object:Gem::Version
96
116
  version: '0'
97
117
  - !ruby/object:Gem::Dependency
98
118
  name: minitest-reporters
99
119
  requirement: !ruby/object:Gem::Requirement
100
120
  requirements:
101
- - - ~>
121
+ - - ">="
102
122
  - !ruby/object:Gem::Version
103
- version: '0.10'
123
+ version: '0'
104
124
  type: :development
105
125
  prerelease: false
106
126
  version_requirements: !ruby/object:Gem::Requirement
107
127
  requirements:
108
- - - ~>
128
+ - - ">="
109
129
  - !ruby/object:Gem::Version
110
- version: '0.10'
130
+ version: '0'
111
131
  - !ruby/object:Gem::Dependency
112
132
  name: therubyracer
113
133
  requirement: !ruby/object:Gem::Requirement
114
134
  requirements:
115
- - - '>='
135
+ - - ">="
116
136
  - !ruby/object:Gem::Version
117
137
  version: '0'
118
138
  type: :development
119
139
  prerelease: false
120
140
  version_requirements: !ruby/object:Gem::Requirement
121
141
  requirements:
122
- - - '>='
142
+ - - ">="
123
143
  - !ruby/object:Gem::Version
124
144
  version: '0'
125
145
  - !ruby/object:Gem::Dependency
126
146
  name: libv8
127
147
  requirement: !ruby/object:Gem::Requirement
128
148
  requirements:
129
- - - '='
149
+ - - "~>"
130
150
  - !ruby/object:Gem::Version
131
- version: 3.11.8.17
151
+ version: 3.16.14.0
132
152
  type: :development
133
153
  prerelease: false
134
154
  version_requirements: !ruby/object:Gem::Requirement
135
155
  requirements:
136
- - - '='
156
+ - - "~>"
137
157
  - !ruby/object:Gem::Version
138
- version: 3.11.8.17
158
+ version: 3.16.14.0
139
159
  description: Fat-free client-side templates with Slim and CoffeeScript
140
160
  email:
141
161
  - john.firebaugh@gmail.com
@@ -143,8 +163,8 @@ executables: []
143
163
  extensions: []
144
164
  extra_rdoc_files: []
145
165
  files:
146
- - .gitignore
147
- - .travis.yml
166
+ - ".gitignore"
167
+ - ".travis.yml"
148
168
  - Gemfile
149
169
  - History.md
150
170
  - LICENSE
@@ -192,17 +212,17 @@ require_paths:
192
212
  - lib
193
213
  required_ruby_version: !ruby/object:Gem::Requirement
194
214
  requirements:
195
- - - '>='
215
+ - - ">="
196
216
  - !ruby/object:Gem::Version
197
217
  version: '0'
198
218
  required_rubygems_version: !ruby/object:Gem::Requirement
199
219
  requirements:
200
- - - '>='
220
+ - - ">="
201
221
  - !ruby/object:Gem::Version
202
222
  version: '0'
203
223
  requirements: []
204
224
  rubyforge_project:
205
- rubygems_version: 2.0.3
225
+ rubygems_version: 2.4.5
206
226
  signing_key:
207
227
  specification_version: 4
208
228
  summary: Take the fat out of your client-side templates with Skim. Skim is the Slim