scorched 0.11 → 0.11.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5471fecce817d61997c06ba5a8b8837192ac675
4
- data.tar.gz: ae192c4683cc8a68820b106932e79b4497320659
3
+ metadata.gz: 215f4c437938c37e309b465ec6fd685887e41fd5
4
+ data.tar.gz: 38795c31fe7f0395a78ebddc403e2fef586dcd9a
5
5
  SHA512:
6
- metadata.gz: 1a53207a5993f65218855fcfb7501c45d0fc0924c3151bfadba17d36bd7b18fa02ece678f30e5c2842db29f88a8818b9b09f8128f971291c6258de1cf40a1480
7
- data.tar.gz: 023d34b537a6b1626800abb434be8672d8e08132ebb5c527d59716b6b1306fda6fea7771e2a279652ce165418dbb7d7dd9436deb2ceedb03ac035adff3a974b0
6
+ metadata.gz: 4117536f2e361a2c432b49386f2def80528340d4d28055a50e5713e316fecdeffd93b2daa843af8dfdb8df447eb38b5379fa7fa7fc4253518ba7ad3129213829
7
+ data.tar.gz: 70dab536b62e324347442e19ca08fc7a13c02e7102d5fcdb051a41e32aa3c3286d008bf3fdea73b0f508360ce5cbc9cb1989d9401e1928b63c3705c2351cd725
@@ -3,6 +3,10 @@ Milestones
3
3
 
4
4
  Changelog
5
5
  ---------
6
+ ### v0.11.1
7
+ * Fixed issue where multiple nested render calls would incorrectly render the layout (issue #9).
8
+ * Bumped Tilt dependancy to v1.4 and removed work-around for Tilt encoding issue.
9
+
6
10
  ### v0.11
7
11
  * Route wildcards '*' and '**' (and their named equivalents) now match zero or more characters, instead of one or more. This means `/*` will now match both `/` and `/about` for example.
8
12
  * Conditions can now be inverted by appending an exclamation mark to the condition, e.g. `method!: 'GET'` matches all HTTP methods, excluding GET.
@@ -19,7 +19,7 @@ Route Helpers
19
19
  -------------
20
20
  Adding mappings manually can be a little verbose and painful, which is why Scorched includes a bunch of route helpers which are used in most code examples.
21
21
 
22
- The main route helper which all others delegate to, is the `route` class method. Here's what it looks like in both it's simple and advance form:
22
+ The main route helper which all others delegate to, is the `route` class method. Here's what it looks like in both it's simple and advance forms:
23
23
 
24
24
  ```ruby
25
25
  route '/' do
@@ -53,10 +53,10 @@ Patterns can be defined as either a String or Regexp.
53
53
  ###String Patterns
54
54
  String patterns are compiled into Regexp patterns corresponding to the following rules:
55
55
 
56
- * `*` - Matches all characters excluding the forward slash.
57
- * `**` - Matches all characters including the forward slash.
58
- * `:param` - Same as `*` except the capture is named to whatever the string following the single-colon is.
59
- * `::param` - Same as `**` except the capture is named to whatever the string following the double-colon is.
56
+ * `*` - Matches zero or more characters, excluding the forward slash.
57
+ * `**` - Matches zero or more characters, including the forward slash.
58
+ * `:param` - Same as `*` except the capture is named to whatever the string following the single-colon.
59
+ * `::param` - Same as `**` except the capture is named to whatever the string following the double-colon.
60
60
  * `$` - If placed at the end of a pattern, the pattern only matches if it matches the entire path. For patterns defined using the route helpers, e.g. `Controller.route`, `Controller.get`, this is implied.
61
61
 
62
62
  ###Regex Patterns
@@ -65,7 +65,7 @@ Regex patterns offer more power and flexibility than string patterns (naturally)
65
65
 
66
66
  Conditions
67
67
  ----------
68
- Conditions are essentially just pre-requisites that must be met before a mapping is invoked to handle the current request. They're implemented as `Proc` objects which take a single argument, and return true if the condition is satisfied, or false otherwise. Scorched comes with a number of pre-defined conditions included, many of which are provided by _rack-accept_ - one of the few dependancies of Scorched.
68
+ Conditions are essentially just pre-requisites that must be met before a mapping is invoked to handle the current request. They're implemented as `Proc` objects which take a single argument, and return true if the condition is satisfied, or false otherwise. Scorched comes with a number of pre-defined conditions included, some of which use functionality provided by _rack-accept_ - one of the few dependancies of Scorched.
69
69
 
70
70
  * `:charset` - Character sets accepted by the client.
71
71
  * `:config` - Takes a hash, each element of which must match the value of the corresponding config option.
@@ -80,6 +80,8 @@ Conditions are essentially just pre-requisites that must be met before a mapping
80
80
  * `:user_agent` - The user agent string provided with the request. Takes a Regexp or String.
81
81
  * `:status` - The response status of the request. Intended for use by _after_ filters.
82
82
 
83
+ As of v0.11, Scorched also supports inverted/negated conditions by adding a trailing exclamation mark. For example, a route with the condition `method!: 'GET'` will match any HTTP request except for `GET` requests.
84
+
83
85
  Like configuration options, conditions are implemented using the `Scorched::Options` class, so they're inherited and can be overridden by child classes. You may easily add your own conditions as the example below demonstrates.
84
86
 
85
87
  ```ruby
@@ -400,7 +400,7 @@ module Scorched
400
400
  file = File.join(dir, file) if dir
401
401
  # Tilt still has unresolved file encoding issues. Until that's fixed, we read the file manually.
402
402
  template_cache.fetch(:file, tilt_engine, file, tilt_options) do
403
- tilt_engine.new(nil, nil, tilt_options) { File.read(file) }
403
+ tilt_engine.new(file, nil, tilt_options)
404
404
  end
405
405
  else
406
406
  template_cache.fetch(:string, tilt_engine, string_or_file, tilt_options) do
@@ -410,10 +410,11 @@ module Scorched
410
410
 
411
411
  # The following chunk of code is responsible for preventing the rendering of layouts within views.
412
412
  begin
413
+ original_no_default_layout = @_no_default_layout
413
414
  @_no_default_layout = true
414
415
  output = template.render(self, locals, &block)
415
416
  ensure
416
- @_no_default_layout = false
417
+ @_no_default_layout = original_no_default_layout
417
418
  end
418
419
 
419
420
  if layout
@@ -1,3 +1,3 @@
1
1
  module Scorched
2
- VERSION = '0.11'
2
+ VERSION = '0.11.1'
3
3
  end
@@ -15,7 +15,7 @@ Gem::Specification.new 'scorched', Scorched::VERSION do |s|
15
15
 
16
16
  s.add_dependency 'rack', '~> 1.4'
17
17
  s.add_dependency 'rack-accept', '~> 0.4'
18
- s.add_dependency 'tilt', '~> 1.3'
18
+ s.add_dependency 'tilt', '~> 1.4'
19
19
  s.add_development_dependency 'rack-test', '~> 0.6'
20
20
  s.add_development_dependency 'rspec', '~> 2.9'
21
21
  end
@@ -715,6 +715,10 @@ module Scorched
715
715
  File.open('views/temp.str', 'w') { |f| f.write 'hello world' }
716
716
  end
717
717
 
718
+ after(:all) {
719
+ File.unlink 'views/temp.str'
720
+ }
721
+
718
722
  it "can cache templates" do
719
723
  app.config[:cache_templates] = true
720
724
  app.get('/') { render :'temp.str' }
@@ -890,7 +894,7 @@ module Scorched
890
894
  app.get('/') do
891
895
  render :composer
892
896
  end
893
- rt.get('/').body.should == '({1 for none})'
897
+ rt.get('/').body.should == '({1 for none}{1 for none})'
894
898
  end
895
899
 
896
900
  it "can pass local variables through to view" do
@@ -1 +1 @@
1
- {<%= render :partial %>}
1
+ {<%= render :partial %>}{<%= render :partial %>}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scorched
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.11'
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Wardrop
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-23 00:00:00.000000000 Z
11
+ date: 2013-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: '1.4'
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
- version: '1.3'
54
+ version: '1.4'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rack-test
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  version: '0'
155
155
  requirements: []
156
156
  rubyforge_project:
157
- rubygems_version: 2.0.0
157
+ rubygems_version: 2.0.3
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: Light-weight, DRY as a desert, web framework for Ruby