sinatra-partial 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +8 -0
- data/CHANGES.markdown +24 -0
- data/README.markdown +25 -16
- data/examples/app_no_underscores/app.rb +3 -1
- data/examples/app_no_underscores/views/layout.haml +1 -1
- data/examples/app_with_underscores/app.rb +3 -1
- data/examples/app_with_underscores/views/layout.haml +1 -1
- data/examples/app_with_underscores_and_erb/app.rb +4 -2
- data/examples/app_with_underscores_and_erb/views/layout.erb +1 -1
- data/examples/app_with_underscores_and_erb_and_subdirs/app.rb +3 -1
- data/examples/app_with_underscores_and_erb_and_subdirs/views/layout.erb +1 -1
- data/lib/sinatra/partial/version.rb +1 -1
- metadata +3 -2
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGES.markdown
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## v0.3.2 ##
|
2
|
+
|
3
|
+
23rd of August 2012
|
4
|
+
|
5
|
+
* Updated the examples to use a setting instead of a constant (because JRuby didn't like it, and because it is a bit weird).
|
6
|
+
* Ran specs against Rubinius and JRuby(1.9 API) and they passed, so they've been added to the Travis CI as well.
|
7
|
+
* Updated the README to make the build status a bit clearer.
|
8
|
+
|
9
|
+
7th of June 2012
|
10
|
+
|
11
|
+
* Fixes to README.
|
12
|
+
|
13
|
+
----
|
14
|
+
|
15
|
+
|
1
16
|
## v0.3.1 ##
|
2
17
|
|
3
18
|
28th of May 2012
|
@@ -5,6 +20,9 @@
|
|
5
20
|
* Fixed a bug where partials called within a route would not have layout set to false by default. To be honest, I think it's a change in the Sinatra codebase, but it was easily fixed by setting layout to false with the partial method. This does, however, mean that partial can't be called to run a layout, but if you're using it that way then you're using it wrong! Try just calling `haml` or `erb`.
|
6
21
|
* Improved the examples by adding a config.rb and config.ru. Not only does it mean the examples can be run from the command line easier, but I think it's a good way to set up an app to help with testing.
|
7
22
|
|
23
|
+
----
|
24
|
+
|
25
|
+
|
8
26
|
## v0.3.0 ##
|
9
27
|
|
10
28
|
23rd of April 2012
|
@@ -17,6 +35,8 @@
|
|
17
35
|
* Better organised development (at last!)
|
18
36
|
* A Rake file has arrived!
|
19
37
|
|
38
|
+
----
|
39
|
+
|
20
40
|
|
21
41
|
## v0.2.1 ##
|
22
42
|
|
@@ -30,6 +50,8 @@ Sam Elliott provided a lot of helpful code to add in features that were lost fro
|
|
30
50
|
* Examples have been added to the examples directory
|
31
51
|
* The code docs are much more extensive.
|
32
52
|
|
53
|
+
----
|
54
|
+
|
33
55
|
|
34
56
|
## v0.1.1 ##
|
35
57
|
|
@@ -37,6 +59,8 @@ Sam Elliott provided a lot of helpful code to add in features that were lost fro
|
|
37
59
|
|
38
60
|
* Improved the examples in the Readme file. A lot.
|
39
61
|
|
62
|
+
----
|
63
|
+
|
40
64
|
|
41
65
|
## v0.1.0 ##
|
42
66
|
|
data/README.markdown
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
-
[![Build Status for development branch](https://secure.travis-ci.org/yb66/Sinatra-Partial.png?branch=develop)](http://travis-ci.org/yb66/Sinatra-Partial)
|
2
|
-
|
3
1
|
## Sinatra Partial ##
|
4
2
|
|
5
3
|
Partials for Sinatra!
|
6
4
|
|
5
|
+
### Build status ###
|
6
|
+
|
7
|
+
Master branch:
|
8
|
+
[![Build Status](https://secure.travis-ci.org/yb66/Sinatra-Partial.png?branch=master)](http://travis-ci.org/yb66/Sinatra-Partial)
|
9
|
+
|
10
|
+
Develop branch:
|
11
|
+
[![Build Status for development branch](https://secure.travis-ci.org/yb66/Sinatra-Partial.png?branch=develop)](http://travis-ci.org/yb66/Sinatra-Partial)
|
12
|
+
|
7
13
|
### Quick note ###
|
8
14
|
|
9
15
|
If you do decide to use this gem, please let me know if it isn't working for you - make a contribution! Github makes it so simple..! See the Contribution section for more.
|
@@ -26,6 +32,18 @@ So here it is, partials, and that's it.
|
|
26
32
|
|
27
33
|
gem install sinatra-partial
|
28
34
|
|
35
|
+
### Getting started ###
|
36
|
+
|
37
|
+
At the top of your app.rb:
|
38
|
+
|
39
|
+
require 'sinatra/partial'
|
40
|
+
|
41
|
+
For a classic app, that's all you need to do. For a modular app you should register it too:
|
42
|
+
|
43
|
+
class Blah < Sinatra::Base
|
44
|
+
register Sinatra::Partial
|
45
|
+
|
46
|
+
|
29
47
|
### Configuration options ###
|
30
48
|
|
31
49
|
The default templating engine is haml. If you wish to use something else, you can set in the config options:
|
@@ -42,17 +60,6 @@ If you like the Rails convention of adding an underscore to the beginning of a p
|
|
42
60
|
|
43
61
|
Otherwise, the default is for no underscore (if you like Rails you know where to get it;)
|
44
62
|
|
45
|
-
### Getting started ###
|
46
|
-
|
47
|
-
At the top of your app.rb:
|
48
|
-
|
49
|
-
require 'sinatra/partial'
|
50
|
-
|
51
|
-
For a classic app, that's all you need to do. For a modular app you should register it too:
|
52
|
-
|
53
|
-
class Blah < Sinatra::Base
|
54
|
-
register Sinatra::Partial
|
55
|
-
|
56
63
|
|
57
64
|
### Some examples ###
|
58
65
|
|
@@ -85,6 +92,7 @@ or use yard/rdoc to generate them.
|
|
85
92
|
%p
|
86
93
|
Is it worse to be at the bottom or the foot?
|
87
94
|
|
95
|
+
|
88
96
|
#### Local variables ####
|
89
97
|
|
90
98
|
get "/" do
|
@@ -112,10 +120,10 @@ Remember that since this is a helper method it can be called inside routes and v
|
|
112
120
|
Welcome back #{username}
|
113
121
|
|
114
122
|
-# content.haml
|
115
|
-
|
123
|
+
Blah Blah Blah
|
116
124
|
|
117
125
|
-# footer.haml
|
118
|
-
|
126
|
+
You've reached the bottom of the page!
|
119
127
|
|
120
128
|
-# layout.haml
|
121
129
|
%html
|
@@ -184,6 +192,7 @@ Look in the examples directory for some very simple examples.
|
|
184
192
|
|
185
193
|
Thanks to Chris Schneider and Sam Elliott for sharing their code, and for sharing further updates.
|
186
194
|
|
195
|
+
|
187
196
|
### Contributing ###
|
188
197
|
|
189
198
|
Most of all, remember that **any** contribution you can make will be valuable, whether that is putting in a ticket for a feature request (or a bug, but they don't happen here;), cleaning up some grammar, writing some documentation (or even a blog post, let me know!) or a full blooded piece of code - it's **all** welcome and encouraged.
|
@@ -200,9 +209,9 @@ To contribute some code:
|
|
200
209
|
- `git checkout -b kitchen_sink`
|
201
210
|
* Install Bundler.
|
202
211
|
- `gem install bundler -r --no-ri --no-rdoc`
|
203
|
-
- Any further updates needed, just run `bundle install`, it'll remember the rest.
|
204
212
|
* Install gems from Gemfile.
|
205
213
|
- `bundle install --binstubs --path vendor`
|
214
|
+
- Any further updates needed, just run `bundle install`, it'll remember the rest.
|
206
215
|
* Write some specs.
|
207
216
|
* Write some code. (Yes, I believe that is the correct order, and you'll never find me doing any different;)
|
208
217
|
* Write some documentation using Yard comments - see http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
|
@@ -4,7 +4,7 @@
|
|
4
4
|
= partial :meta
|
5
5
|
|
6
6
|
%ul
|
7
|
-
= partial :news, :collection =>
|
7
|
+
= partial :news, :collection => settings.news, :locals => {:klass => {:class => "klassic"}}
|
8
8
|
|
9
9
|
= partial :locality, :locals => Hash[%w{a b c d}.zip(%w{A B C D})]
|
10
10
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
= partial :meta
|
5
5
|
|
6
6
|
%ul
|
7
|
-
= partial :news, :collection =>
|
7
|
+
= partial :news, :collection => settings.news, :locals => {:klass => {:class => "klassic"}}
|
8
8
|
|
9
9
|
= partial :locality, :locals => Hash[%w{a b c d}.zip(%w{A B C D})]
|
10
10
|
|
@@ -8,8 +8,10 @@ module AppWithUnderscoresAndErb
|
|
8
8
|
class App < Sinatra::Base
|
9
9
|
register Sinatra::Partial
|
10
10
|
use WhiteSpaceRemove
|
11
|
-
|
12
|
-
|
11
|
+
|
12
|
+
configure do
|
13
|
+
set :news, ["This", "is", "all", "new"]
|
14
|
+
end
|
13
15
|
|
14
16
|
enable :partial_underscores
|
15
17
|
set :partial_template_engine, :erb
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<%= partial :meta %>
|
5
5
|
|
6
6
|
<ul>
|
7
|
-
<%= partial :news, :collection =>
|
7
|
+
<%= partial :news, :collection => settings.news, :locals => {:klass => {:class => "klassic"}} %>
|
8
8
|
</ul>
|
9
9
|
|
10
10
|
<%= partial( :locality, :locals => Hash[%w{a b c d}.zip(%w{A B C D})]) %>
|
@@ -9,7 +9,9 @@ module AppWithUnderscoresAndErbAndSubdirs
|
|
9
9
|
register Sinatra::Partial
|
10
10
|
use WhiteSpaceRemove
|
11
11
|
|
12
|
-
|
12
|
+
configure do
|
13
|
+
set :news, ["This", "is", "all", "new"]
|
14
|
+
end
|
13
15
|
|
14
16
|
enable :partial_underscores
|
15
17
|
set :partial_template_engine, :erb
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<%= partial :"partials/meta" %>
|
5
5
|
|
6
6
|
<ul>
|
7
|
-
<%= partial :"partials/news", :collection =>
|
7
|
+
<%= partial :"partials/news", :collection => settings.news, :locals => {:klass => {:class => "klassic"}} %>
|
8
8
|
</ul>
|
9
9
|
|
10
10
|
<%= partial( :"partials/locality", :locals => Hash[%w{a b c d}.zip(%w{A B C D})]) %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-partial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-08-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: sinatra
|
@@ -118,3 +118,4 @@ test_files:
|
|
118
118
|
- spec/sinatra_partial_helpers_spec.rb
|
119
119
|
- spec/sinatra_partial_private_spec.rb
|
120
120
|
- spec/spec_helper.rb
|
121
|
+
has_rdoc:
|