sinatra_more 0.3.41 → 0.3.42
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/.gitignore +25 -0
- data/Gemfile +0 -5
- data/README.rdoc +52 -51
- data/Rakefile +4 -28
- data/lib/sinatra_more/markup_plugin/form_helpers.rb +4 -2
- data/lib/sinatra_more/version.rb +3 -0
- data/sinatra_more.gemspec +28 -276
- data/test/helper.rb +1 -1
- data/test/markup_plugin/test_form_helpers.rb +10 -0
- data/test/test_warden_plugin.rb +11 -11
- metadata +121 -351
- data/Gemfile.lock +0 -51
- data/VERSION +0 -1
- data/test/active_support_helpers.rb +0 -8
data/.gitignore
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.swp
|
15
|
+
|
16
|
+
## PROJECT::GENERAL
|
17
|
+
coverage
|
18
|
+
rdoc
|
19
|
+
pkg
|
20
|
+
|
21
|
+
## PROJECT::SPECIFIC
|
22
|
+
webrat.log
|
23
|
+
tmp/**/*
|
24
|
+
.rvmrc
|
25
|
+
Gemfile.lock
|
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
== Notice
|
4
4
|
|
5
|
-
Worth noting here is that sinatra_more is still undergoing minor bug fixes and I will manage pull requests but
|
5
|
+
Worth noting here is that sinatra_more is still undergoing minor bug fixes and I will manage pull requests but <b>development has stopped</b>. The reason for this is that this project has been superseded by another project called the {Padrino Framework}[http://www.padrinorb.com].
|
6
6
|
|
7
|
-
{Padrino}[http://www.padrinorb.com] is definately the place to look in the future
|
8
|
-
for
|
9
|
-
everything from sinatra_more but is far more ambitious and larger in scope.
|
7
|
+
{Padrino}[http://www.padrinorb.com] is definately the place to look in the future
|
8
|
+
for modular extensions to Sinatra. Note that {Padrino}[http://github.com/padrino/padrino-framework] contains
|
9
|
+
everything from sinatra_more but is far more ambitious and larger in scope.
|
10
10
|
|
11
11
|
Padrino development is already well underway towards a 1.0 release, has a larger number of core developers, and a number of production applications have already been deployed. The idea for Padrino is to start with Sinatra and follow that philosophy but to super-charge the functionality adding support for development code reloading, advanced route definitions, I18n localization support, baked-in orm support, baked-in code generators, multi-app support, admin dashboard, authentication logic, view helpers, and more.
|
12
12
|
|
@@ -24,11 +24,11 @@ The canonical example of how to create an entire simple web application with Sin
|
|
24
24
|
get '/' do
|
25
25
|
'Hello world!'
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
and then to run the application:
|
29
29
|
|
30
30
|
$ ruby myapp.rb
|
31
|
-
|
31
|
+
|
32
32
|
The extreme simplicity of the framework is quite refreshing. I have been using Sinatra a great deal
|
33
33
|
for recent projects. First for small and simple json and xml web services and then even
|
34
34
|
for more complex full-featured applications. This gem represents my attempt to make it as fun and easy
|
@@ -36,12 +36,12 @@ as possible to code increasingly advanced view-heavy web applications in Sinatra
|
|
36
36
|
|
37
37
|
== Introduction
|
38
38
|
|
39
|
-
Note: This library is still experimental and may not be ready for production just yet.
|
39
|
+
Note: This library is still experimental and may not be ready for production just yet.
|
40
40
|
That being said the gem is being actively used on a number of sinatra projects.
|
41
41
|
In addition, the gem has fairly solid test coverage ensuring that everything works as expected.
|
42
42
|
|
43
|
-
This will be a plugin which expands sinatra's capabilities in a variety of ways.
|
44
|
-
Note that all extensions have been created to work with haml, erb, and erubis.
|
43
|
+
This will be a plugin which expands sinatra's capabilities in a variety of ways.
|
44
|
+
Note that all extensions have been created to work with haml, erb, and erubis.
|
45
45
|
This gem is intended to be template-agnostic in providing helpers wherever possible.
|
46
46
|
|
47
47
|
Let me expand briefly on what I want to accomplish with this gem. I love sinatra but if I want to use it
|
@@ -49,8 +49,8 @@ for any non-trivial application I very quickly miss a lot of the extra tools pro
|
|
49
49
|
|
50
50
|
Now the obvious question is "Why not just use rails then?" Well, in many cases that might be the right decision.
|
51
51
|
Still, at least until version 3 comes along, Rails is quite a large framework with a 'take it or leave it' attitude.
|
52
|
-
Personally, I have come to love the spirit of sinatra which acts as a thin wrapper on top of rack
|
53
|
-
often allowing middleware to do most of the work and pulling in additional complexity only as required.
|
52
|
+
Personally, I have come to love the spirit of sinatra which acts as a thin wrapper on top of rack
|
53
|
+
often allowing middleware to do most of the work and pulling in additional complexity only as required.
|
54
54
|
|
55
55
|
My goal with this extension is to match the spirit of Sinatra and at the same time create a standard library
|
56
56
|
of tools, helpers and components that will make Sinatra suitable for more complex applications.
|
@@ -71,13 +71,13 @@ Keep in mind, the user will be able to pull in these components seperately and l
|
|
71
71
|
Please help me brainstorm and fork the project if you have any ideas to contribute.
|
72
72
|
|
73
73
|
== Installation
|
74
|
-
|
74
|
+
|
75
75
|
If you want to use the WardenPlugin component, then the 'warden' gem would need to be installed.
|
76
76
|
|
77
77
|
To install sinatra_more, simply grab the latest version from gemcutter:
|
78
78
|
|
79
79
|
$ sudo gem install sinatra_more
|
80
|
-
|
80
|
+
|
81
81
|
Now you are ready to use this gem in your sinatra project.
|
82
82
|
|
83
83
|
== Usage
|
@@ -85,7 +85,7 @@ Now you are ready to use this gem in your sinatra project.
|
|
85
85
|
This extension can be easily registered into any existing sinatra application. You can require
|
86
86
|
different components based on which pieces are useful for your particular application.
|
87
87
|
|
88
|
-
# app.rb
|
88
|
+
# app.rb
|
89
89
|
require 'sinatra/base'
|
90
90
|
require 'sinatra_more' # or require 'sinatra_more/markup_plugin' for precise inclusion
|
91
91
|
|
@@ -161,7 +161,7 @@ methods should be very familiar to anyone who has used rails view helpers.
|
|
161
161
|
* <tt>javascript_include_tag(*sources)</tt>
|
162
162
|
* Returns an html script tag for each of the sources provided.
|
163
163
|
* <tt>javascript_include_tag 'application', 'special'</tt>
|
164
|
-
|
164
|
+
|
165
165
|
==== Form Helpers
|
166
166
|
|
167
167
|
* <tt>form_tag(url, options={}, &block)</tt>
|
@@ -233,7 +233,7 @@ A form_tag might look like:
|
|
233
233
|
= check_box_tag :confirm_delete
|
234
234
|
- field_set_tag(:class => 'buttons') do
|
235
235
|
= submit_tag "Remove"
|
236
|
-
|
236
|
+
|
237
237
|
==== FormBuilders
|
238
238
|
|
239
239
|
* <tt>form_for(object, url, settings={}, &block)</tt>
|
@@ -278,7 +278,7 @@ The following are fields provided by AbstractFormBuilder that can be used within
|
|
278
278
|
* <tt>f.submit "Update", :class => 'long'</tt>
|
279
279
|
* <tt>image_submit(source, options={})</tt>
|
280
280
|
* <tt>f.image_submit "submit.png", :class => 'long'</tt>
|
281
|
-
|
281
|
+
|
282
282
|
A form_for using these basic fields might look like:
|
283
283
|
|
284
284
|
- form_for @user, '/register', :id => 'register' do |f|
|
@@ -304,7 +304,7 @@ A form_for using these basic fields might look like:
|
|
304
304
|
= location.text_field :city
|
305
305
|
%p
|
306
306
|
= f.submit "Create", :class => 'button'
|
307
|
-
|
307
|
+
|
308
308
|
There is also a StandardFormBuilder which builds on the abstract fields that can be used within a form_for:
|
309
309
|
|
310
310
|
* <tt>text_field_block(field, options={}, label_options={})</tt>
|
@@ -323,7 +323,7 @@ There is also a StandardFormBuilder which builds on the abstract fields that can
|
|
323
323
|
* <tt>submit_block(:username, :class => 'big')</tt>
|
324
324
|
* <tt>image_submit_block(source, options={})</tt>
|
325
325
|
* <tt>image_submit_block('submit.png', :class => 'big')</tt>
|
326
|
-
|
326
|
+
|
327
327
|
A form_for using these standard fields might look like:
|
328
328
|
|
329
329
|
- form_for @user, '/register', :id => 'register' do |f|
|
@@ -366,7 +366,7 @@ The form builder can even be made into the default builder when form_for is invo
|
|
366
366
|
# anywhere in the sinatra application
|
367
367
|
set :default_builder, 'MyCustomFormBuilder'
|
368
368
|
|
369
|
-
And there you have it, a fairly complete form builder solution for sinatra.
|
369
|
+
And there you have it, a fairly complete form builder solution for sinatra.
|
370
370
|
I hope to create or merge in an even better 'default' form_builder in the near future.
|
371
371
|
|
372
372
|
==== Format Helpers
|
@@ -413,31 +413,31 @@ such as partials (with support for :collection) into the templating system.
|
|
413
413
|
Using render plugin helpers is extremely simple. If you want to render an erb template in your view path:
|
414
414
|
|
415
415
|
erb_template 'path/to/my/template'
|
416
|
-
|
416
|
+
|
417
417
|
or using haml templates works just as well:
|
418
418
|
|
419
419
|
haml_template 'path/to/haml/template'
|
420
|
-
|
420
|
+
|
421
421
|
There is also a method which renders the first view matching the path and removes the need to define an engine:
|
422
422
|
|
423
423
|
render_template 'path/to/any/template'
|
424
|
-
|
424
|
+
|
425
425
|
It is worth noting these are mostly for convenience. When I had more complex view files in sinatra, I got tired of writing:
|
426
426
|
|
427
427
|
haml :"the/path/to/file"
|
428
428
|
erb "/path/to/file".to_sym
|
429
|
-
|
429
|
+
|
430
430
|
Finally, we have the all-important partials support for rendering mini-templates onto a page:
|
431
431
|
|
432
432
|
partial 'photo/_item', :object => @photo, :locals => { :foo => 'bar' }
|
433
433
|
partial 'photo/_item', :collection => @photos
|
434
|
-
|
434
|
+
|
435
435
|
This works as you would expect and also supports the collection counter inside the partial <tt>item_counter</tt>
|
436
436
|
|
437
437
|
# /views/photo/_item.haml
|
438
438
|
# Access to collection counter with <partial_name>_counter i.e item_counter
|
439
439
|
# Access the object with the partial_name i.e item
|
440
|
-
|
440
|
+
|
441
441
|
And that concludes the render plugin for now but I am open to adding more methods as time progresses.
|
442
442
|
|
443
443
|
See the wiki article for additional information: <http://wiki.github.com/nesquena/sinatra_more/renderplugin>
|
@@ -463,7 +463,7 @@ provided to make interacting with warden dead simple.
|
|
463
463
|
* Forces a user to return to a fail path unless they are authorized
|
464
464
|
* Used to require a user be authenticated before routing to an action
|
465
465
|
* <tt>must_be_authorized!('/login')</tt>
|
466
|
-
|
466
|
+
|
467
467
|
There are a few configuration options and details you need to be aware of. By default, the WardenPlugin
|
468
468
|
assumes you have a User class which represents the authenticating class type. If your user class has a different
|
469
469
|
name then you need to specify that as follows:
|
@@ -492,7 +492,7 @@ Using this plugin you also do need to define your own routes for managing warden
|
|
492
492
|
authenticate_user!
|
493
493
|
redirect "/dashboard"
|
494
494
|
end
|
495
|
-
|
495
|
+
|
496
496
|
post '/unauthenticated/?' do
|
497
497
|
flash[:notice] = "That username and password are not correct!"
|
498
498
|
status 401
|
@@ -506,9 +506,9 @@ Using this plugin you also do need to define your own routes for managing warden
|
|
506
506
|
|
507
507
|
I was made aware of other sinatra/warden plugins which work very similarly to the system I outline for this plugin.
|
508
508
|
Most notably is the sinatra_warden plugin by Justin Smestad (http://github.com/jsmestad/sinatra_warden)
|
509
|
-
Eventually I plan to vendor that gem or just remove support for this piece of my plugin completely.
|
509
|
+
Eventually I plan to vendor that gem or just remove support for this piece of my plugin completely.
|
510
510
|
|
511
|
-
If anybody has any thoughts on this or the warden integration in general, please let me know.
|
511
|
+
If anybody has any thoughts on this or the warden integration in general, please let me know.
|
512
512
|
Nonetheless, there is a certain convenience for me having access to a plug-and-play warden solution directly from this gem.
|
513
513
|
|
514
514
|
See the wiki article for additional information: <http://wiki.github.com/nesquena/sinatra_more/wardenplugin>
|
@@ -597,22 +597,22 @@ See the wiki article for additional information: <http://wiki.github.com/nesquen
|
|
597
597
|
This component provides Sinatra with an enhanced url routing system which enables named route aliases to be defined
|
598
598
|
and used throughout your application to refer to urls. The benefits of this is that instead of having to hard-code route urls
|
599
599
|
into every area of your application, now we can just define the urls in a single spot and then attach an alias
|
600
|
-
which can be used to refer to the url throughout the rest.
|
600
|
+
which can be used to refer to the url throughout the rest.
|
601
601
|
|
602
602
|
Let's take a look at how to define named route mappings:
|
603
603
|
|
604
604
|
# /app/routes/example.rb
|
605
605
|
require 'sinatra_more'
|
606
|
-
|
606
|
+
|
607
607
|
class RoutingDemo < Sinatra::Application
|
608
|
-
register SinatraMore::RoutingPlugin
|
609
|
-
|
608
|
+
register SinatraMore::RoutingPlugin
|
609
|
+
|
610
610
|
# Define the named route mappings
|
611
611
|
map(:account).to("/the/accounts/:name/and/:id")
|
612
612
|
map(:accounts).to("/the/accounts/index")
|
613
|
-
|
613
|
+
|
614
614
|
# Configure the routes using the named alias
|
615
|
-
get(:account) { "name: params[:name] - id: params[:id]" }
|
615
|
+
get(:account) { "name: params[:name] - id: params[:id]" }
|
616
616
|
get(:accounts) { "I am the body for the url /the/accounts/index" }
|
617
617
|
end
|
618
618
|
|
@@ -635,13 +635,13 @@ The routing system also supports url route configuration namespaces:
|
|
635
635
|
|
636
636
|
# /app/routes/example.rb
|
637
637
|
map(:admin, :show).to("/admin/:id/show")
|
638
|
-
|
638
|
+
|
639
639
|
namespace :admin do
|
640
640
|
get :show do
|
641
641
|
"admin show for #{params[:id]}"
|
642
642
|
end
|
643
643
|
end
|
644
|
-
|
644
|
+
|
645
645
|
You could also define the route aliases themselves using a namespace for convenience:
|
646
646
|
|
647
647
|
# /app/routes/example.rb
|
@@ -649,12 +649,12 @@ You could also define the route aliases themselves using a namespace for conveni
|
|
649
649
|
namespace.map(:show).to("/admin/:id/show")
|
650
650
|
namespace.map(:destroy).to("/admin/:id/destroy")
|
651
651
|
end
|
652
|
-
|
652
|
+
|
653
653
|
namespace :admin do
|
654
654
|
get :show do
|
655
655
|
"admin show for #{params[:id]}"
|
656
656
|
end
|
657
|
-
|
657
|
+
|
658
658
|
get :destroy do
|
659
659
|
"admin destroy for #{params[:id]}"
|
660
660
|
end
|
@@ -665,17 +665,17 @@ You can then reference the urls using the same <tt>url_for</tt> method:
|
|
665
665
|
<%= link_to 'admin page', url_for(:admin, :show, :id => 25) %>
|
666
666
|
<%= link_to 'admin page', url_for(:admin, :update, :id => 25) %>
|
667
667
|
<%= link_to 'admin page', url_for(:admin, :show, :id => 25) %>
|
668
|
-
|
668
|
+
|
669
669
|
You can freely use both named route aliases and traditional Sinatra routes in the same application without conflict.
|
670
670
|
|
671
671
|
See the wiki article for additional information: <http://wiki.github.com/nesquena/sinatra_more/routingplugin>
|
672
|
-
|
672
|
+
|
673
673
|
== Sinatra Generators
|
674
674
|
|
675
675
|
In addition to the support provided above, sinatra_more also comes preloaded with flexible code generators for Sinatra
|
676
676
|
powered in part by the excellent Thor gem (incidentally also used in the Rails 3 generators). These generators are intended
|
677
677
|
to allow for easy code generation both in creating new applications and building on existing ones. The generators have been
|
678
|
-
built to be as library-agnostic as possible, supporting a myriad of test frameworks, js libraries, mocking libraries, etc.
|
678
|
+
built to be as library-agnostic as possible, supporting a myriad of test frameworks, js libraries, mocking libraries, etc.
|
679
679
|
|
680
680
|
The usage for the generator is quite simple:
|
681
681
|
|
@@ -684,19 +684,19 @@ The usage for the generator is quite simple:
|
|
684
684
|
The simplest possible command to generate a base application would be:
|
685
685
|
|
686
686
|
$ sinatra_gen demo_app .
|
687
|
-
|
688
|
-
This would construct a Sinatra application DemoApp (which extends from Sinatra::Application)
|
689
|
-
inside the folder 'demo_app' at our current path. Inside the application there would be configuration and
|
687
|
+
|
688
|
+
This would construct a Sinatra application DemoApp (which extends from Sinatra::Application)
|
689
|
+
inside the folder 'demo_app' at our current path. Inside the application there would be configuration and
|
690
690
|
setup performed for the default components.
|
691
691
|
|
692
692
|
You can also define specific components to be used:
|
693
693
|
|
694
694
|
$ sinatra_gen demo_app . --test=rspec --renderer=haml --mock=rr --script=jquery --orm datamapper
|
695
|
-
|
695
|
+
|
696
696
|
There is also support for aliases for each component within the command:
|
697
697
|
|
698
698
|
$ sinatra_gen demo_app . -t=rspec -r=haml -m=rr -s=jquery -d=datamapper
|
699
|
-
|
699
|
+
|
700
700
|
The available components and their default options are listed below:
|
701
701
|
|
702
702
|
* test: <tt>bacon</tt> (default), <tt>shoulda</tt>, <tt>rspec</tt>, <tt>testspec</tt>, <tt>riot</tt>
|
@@ -713,7 +713,7 @@ The necessary bundler command can be executed automatically through the generato
|
|
713
713
|
or this can be done manually through executing command <tt>gem bundle</tt> in the terminal at the root of the generated application.
|
714
714
|
If not executed manually, the bundling will be performed automatically the first time the application attempts to boot.
|
715
715
|
Note that this command only has to be performed when the application is first generated or when the Gemfile is modified.
|
716
|
-
|
716
|
+
|
717
717
|
The generator framework within sinatra_more is extensible and additional components and tools can be added easily.
|
718
718
|
This would be achieved through forking our project and reading through the code in <tt>/generators/sinatra_generator.rb</tt> and
|
719
719
|
the setup instructions inside the relevant files within <tt>/generators/components/</tt>. We are happy to accept pull requests
|
@@ -727,7 +727,7 @@ We are also planning to add generator actions such as:
|
|
727
727
|
* Migrations generation
|
728
728
|
|
729
729
|
See the wiki article for additional information: <http://wiki.github.com/nesquena/sinatra_more/generator>
|
730
|
-
|
730
|
+
|
731
731
|
== Acknowledgements
|
732
732
|
|
733
733
|
* Thanks to kelredd (http://github.com/kelredd) for the <tt>sinatra_helpers</tt> code that helped me to create erb capture and concat methods.
|
@@ -745,6 +745,7 @@ See the wiki article for additional information: <http://wiki.github.com/nesquen
|
|
745
745
|
* Rob Holland - Added couchrest ORM component to generator
|
746
746
|
* Bill Turner - Added several form builder and helper fixes
|
747
747
|
* Adrian (orangea) - Fixes to content_for and tests
|
748
|
+
* Indrek Juhkam (indrekj) - Support for AS3 and fixes to select_tag
|
748
749
|
|
749
750
|
== Known Issues
|
750
751
|
|
@@ -756,7 +757,7 @@ See the wiki article for additional information: <http://wiki.github.com/nesquen
|
|
756
757
|
* Ruby5 - <http://ruby5.envylabs.com/episodes/24-episode-23-october-30-2009/stories/183-sinatra-more>
|
757
758
|
|
758
759
|
== Note on Patches/Pull Requests
|
759
|
-
|
760
|
+
|
760
761
|
* Fork the project.
|
761
762
|
* Make your feature addition or bug fix.
|
762
763
|
* Add tests for it. This is important so I don't break it in a
|
data/Rakefile
CHANGED
@@ -1,32 +1,8 @@
|
|
1
|
-
# $
|
2
|
-
|
1
|
+
# $ EDIT version.rb, rake release
|
3
2
|
require 'rubygems'
|
4
3
|
require 'rake'
|
5
|
-
|
6
|
-
|
7
|
-
require 'jeweler'
|
8
|
-
Jeweler::Tasks.new do |gem|
|
9
|
-
gem.name = "sinatra_more"
|
10
|
-
gem.summary = "Expands sinatra to allow for complex applications"
|
11
|
-
gem.description = "Expands sinatra with standard helpers and tools to allow for complex applications"
|
12
|
-
gem.email = "nesquena@gmail.com"
|
13
|
-
gem.homepage = "http://github.com/nesquena/sinatra_more"
|
14
|
-
gem.authors = ["Nathan Esquenazi"]
|
15
|
-
gem.add_runtime_dependency "sinatra", ">= 0.9.2"
|
16
|
-
gem.add_runtime_dependency "tilt", ">= 0.2"
|
17
|
-
gem.add_runtime_dependency "thor", ">= 0.11.8"
|
18
|
-
gem.add_runtime_dependency "activesupport", "< 3.0.0"
|
19
|
-
gem.add_runtime_dependency "bundler", ">= 0.9.2"
|
20
|
-
gem.add_development_dependency "haml", ">= 2.2.14"
|
21
|
-
gem.add_development_dependency "shoulda", ">= 2.10.2"
|
22
|
-
gem.add_development_dependency "mocha", ">= 0.9.7"
|
23
|
-
gem.add_development_dependency "rack-test", ">= 0.5.0"
|
24
|
-
gem.add_development_dependency "webrat", ">= 0.5.1"
|
25
|
-
end
|
26
|
-
Jeweler::GemcutterTasks.new
|
27
|
-
rescue LoadError
|
28
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
29
|
-
end
|
4
|
+
require 'bundler'
|
5
|
+
Bundler::GemHelper.install_tasks
|
30
6
|
|
31
7
|
require 'rake/testtask'
|
32
8
|
Rake::TestTask.new(:test) do |test|
|
@@ -58,4 +34,4 @@ Rake::RDocTask.new do |rdoc|
|
|
58
34
|
rdoc.title = "sinatra_more #{version}"
|
59
35
|
rdoc.rdoc_files.include('README*')
|
60
36
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
61
|
-
end
|
37
|
+
end
|
@@ -160,11 +160,13 @@ module SinatraMore
|
|
160
160
|
end
|
161
161
|
|
162
162
|
# Returns the options tags for a select based on the given option items
|
163
|
-
def options_for_select(option_items,
|
163
|
+
def options_for_select(option_items, selected_values=[])
|
164
164
|
return '' if option_items.blank?
|
165
|
+
selected_values = [selected_values].compact unless selected_values.is_a?(Array)
|
165
166
|
option_items.collect { |caption, value|
|
166
167
|
value ||= caption
|
167
|
-
|
168
|
+
selected = selected_values.find {|v| v.to_s =~ /^(#{value}|#{caption})$/}
|
169
|
+
content_tag(:option, caption, :value => value, :selected => !!selected)
|
168
170
|
}.join("\n")
|
169
171
|
end
|
170
172
|
|
data/sinatra_more.gemspec
CHANGED
@@ -1,288 +1,40 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "sinatra_more/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
6
|
s.name = %q{sinatra_more}
|
8
|
-
s.version =
|
7
|
+
s.version = SinatraMore::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
10
|
s.authors = ["Nathan Esquenazi"]
|
12
|
-
s.
|
11
|
+
s.email = %q{nesquena@gmail.com}
|
12
|
+
s.date = %q{2011-02-18}
|
13
13
|
s.default_executable = %q{sinatra_gen}
|
14
14
|
s.description = %q{Expands sinatra with standard helpers and tools to allow for complex applications}
|
15
|
-
s.
|
16
|
-
s.executables = ["sinatra_gen"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE",
|
19
|
-
"README.rdoc",
|
20
|
-
"TODO"
|
21
|
-
]
|
22
|
-
s.files = [
|
23
|
-
".document",
|
24
|
-
"Gemfile",
|
25
|
-
"Gemfile.lock",
|
26
|
-
"IDEAS.md",
|
27
|
-
"LICENSE",
|
28
|
-
"README.rdoc",
|
29
|
-
"ROADMAP",
|
30
|
-
"Rakefile",
|
31
|
-
"TODO",
|
32
|
-
"VERSION",
|
33
|
-
"bin/sinatra_gen",
|
34
|
-
"generators/base_app/.gitignore",
|
35
|
-
"generators/base_app/Gemfile",
|
36
|
-
"generators/base_app/app/.empty_directory",
|
37
|
-
"generators/base_app/app/helpers/.empty_directory",
|
38
|
-
"generators/base_app/app/helpers/view_helpers.rb",
|
39
|
-
"generators/base_app/app/mailers/.empty_directory",
|
40
|
-
"generators/base_app/app/models/.empty_directory",
|
41
|
-
"generators/base_app/app/routes/.empty_directory",
|
42
|
-
"generators/base_app/app/routes/main.rb.tt",
|
43
|
-
"generators/base_app/app/views/.empty_directory",
|
44
|
-
"generators/base_app/config.ru.tt",
|
45
|
-
"generators/base_app/config/boot.rb.tt",
|
46
|
-
"generators/base_app/config/dependencies.rb.tt",
|
47
|
-
"generators/base_app/lib/.empty_directory",
|
48
|
-
"generators/base_app/log/.empty_directory",
|
49
|
-
"generators/base_app/public/images/.empty_directory",
|
50
|
-
"generators/base_app/public/images/.gitignore",
|
51
|
-
"generators/base_app/public/javascripts/.empty_directory",
|
52
|
-
"generators/base_app/public/stylesheets/.empty_directory",
|
53
|
-
"generators/base_app/test/models/.empty_directory",
|
54
|
-
"generators/base_app/test/routes/.empty_directory",
|
55
|
-
"generators/base_app/test/test_config.rb.tt",
|
56
|
-
"generators/base_app/tmp/.empty_directory",
|
57
|
-
"generators/base_app/vendor/gems/.empty_directory",
|
58
|
-
"generators/components/component_actions.rb",
|
59
|
-
"generators/components/files/jquery-1.3.2.min.js",
|
60
|
-
"generators/components/files/lowpro.js",
|
61
|
-
"generators/components/files/prototype.js",
|
62
|
-
"generators/components/files/right-min.js",
|
63
|
-
"generators/components/files/right-olds-min.js",
|
64
|
-
"generators/components/mocks/mocha_mock_gen.rb",
|
65
|
-
"generators/components/mocks/rr_mock_gen.rb",
|
66
|
-
"generators/components/orms/activerecord_orm_gen.rb",
|
67
|
-
"generators/components/orms/couchrest_orm_gen.rb",
|
68
|
-
"generators/components/orms/datamapper_orm_gen.rb",
|
69
|
-
"generators/components/orms/mongomapper_orm_gen.rb",
|
70
|
-
"generators/components/orms/sequel_orm_gen.rb",
|
71
|
-
"generators/components/renderers/erb_renderer_gen.rb",
|
72
|
-
"generators/components/renderers/haml_renderer_gen.rb",
|
73
|
-
"generators/components/scripts/jquery_script_gen.rb",
|
74
|
-
"generators/components/scripts/prototype_script_gen.rb",
|
75
|
-
"generators/components/scripts/rightjs_script_gen.rb",
|
76
|
-
"generators/components/tests/bacon_test_gen.rb",
|
77
|
-
"generators/components/tests/riot_test_gen.rb",
|
78
|
-
"generators/components/tests/rspec_test_gen.rb",
|
79
|
-
"generators/components/tests/shoulda_test_gen.rb",
|
80
|
-
"generators/components/tests/testspec_test_gen.rb",
|
81
|
-
"generators/generator_actions.rb",
|
82
|
-
"generators/skeleton_generator.rb",
|
83
|
-
"lib/sinatra_more.rb",
|
84
|
-
"lib/sinatra_more/mailer_plugin.rb",
|
85
|
-
"lib/sinatra_more/mailer_plugin/mail_object.rb",
|
86
|
-
"lib/sinatra_more/mailer_plugin/mailer_base.rb",
|
87
|
-
"lib/sinatra_more/markup_plugin.rb",
|
88
|
-
"lib/sinatra_more/markup_plugin/asset_tag_helpers.rb",
|
89
|
-
"lib/sinatra_more/markup_plugin/form_builder/abstract_form_builder.rb",
|
90
|
-
"lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb",
|
91
|
-
"lib/sinatra_more/markup_plugin/form_helpers.rb",
|
92
|
-
"lib/sinatra_more/markup_plugin/format_helpers.rb",
|
93
|
-
"lib/sinatra_more/markup_plugin/output_helpers.rb",
|
94
|
-
"lib/sinatra_more/markup_plugin/tag_helpers.rb",
|
95
|
-
"lib/sinatra_more/render_plugin.rb",
|
96
|
-
"lib/sinatra_more/render_plugin/render_helpers.rb",
|
97
|
-
"lib/sinatra_more/routing_plugin.rb",
|
98
|
-
"lib/sinatra_more/routing_plugin/named_route.rb",
|
99
|
-
"lib/sinatra_more/routing_plugin/routing_helpers.rb",
|
100
|
-
"lib/sinatra_more/support_lite.rb",
|
101
|
-
"lib/sinatra_more/warden_plugin.rb",
|
102
|
-
"lib/sinatra_more/warden_plugin/warden_helpers.rb",
|
103
|
-
"sinatra_more.gemspec",
|
104
|
-
"test/active_support_helpers.rb",
|
105
|
-
"test/fixtures/mailer_app/app.rb",
|
106
|
-
"test/fixtures/mailer_app/views/demo_mailer/sample_mail.erb",
|
107
|
-
"test/fixtures/mailer_app/views/sample_mailer/anniversary_message.erb",
|
108
|
-
"test/fixtures/mailer_app/views/sample_mailer/birthday_message.erb",
|
109
|
-
"test/fixtures/markup_app/app.rb",
|
110
|
-
"test/fixtures/markup_app/views/capture_concat.erb",
|
111
|
-
"test/fixtures/markup_app/views/capture_concat.haml",
|
112
|
-
"test/fixtures/markup_app/views/content_for.erb",
|
113
|
-
"test/fixtures/markup_app/views/content_for.haml",
|
114
|
-
"test/fixtures/markup_app/views/content_tag.erb",
|
115
|
-
"test/fixtures/markup_app/views/content_tag.haml",
|
116
|
-
"test/fixtures/markup_app/views/fields_for.erb",
|
117
|
-
"test/fixtures/markup_app/views/fields_for.haml",
|
118
|
-
"test/fixtures/markup_app/views/form_for.erb",
|
119
|
-
"test/fixtures/markup_app/views/form_for.haml",
|
120
|
-
"test/fixtures/markup_app/views/form_tag.erb",
|
121
|
-
"test/fixtures/markup_app/views/form_tag.haml",
|
122
|
-
"test/fixtures/markup_app/views/link_to.erb",
|
123
|
-
"test/fixtures/markup_app/views/link_to.haml",
|
124
|
-
"test/fixtures/markup_app/views/mail_to.erb",
|
125
|
-
"test/fixtures/markup_app/views/mail_to.haml",
|
126
|
-
"test/fixtures/markup_app/views/meta_tag.erb",
|
127
|
-
"test/fixtures/markup_app/views/meta_tag.haml",
|
128
|
-
"test/fixtures/markup_app/views/yield_content.erb",
|
129
|
-
"test/fixtures/markup_app/views/yield_content.haml",
|
130
|
-
"test/fixtures/render_app/app.rb",
|
131
|
-
"test/fixtures/render_app/views/erb/test.erb",
|
132
|
-
"test/fixtures/render_app/views/haml/test.haml",
|
133
|
-
"test/fixtures/render_app/views/template/_user.haml",
|
134
|
-
"test/fixtures/render_app/views/template/haml_template.haml",
|
135
|
-
"test/fixtures/render_app/views/template/some_template.haml",
|
136
|
-
"test/fixtures/routing_app/app.rb",
|
137
|
-
"test/fixtures/routing_app/views/index.haml",
|
138
|
-
"test/fixtures/warden_app/app.rb",
|
139
|
-
"test/fixtures/warden_app/views/dashboard.haml",
|
140
|
-
"test/generators/test_skeleton_generator.rb",
|
141
|
-
"test/helper.rb",
|
142
|
-
"test/mailer_plugin/test_mail_object.rb",
|
143
|
-
"test/mailer_plugin/test_mailer_base.rb",
|
144
|
-
"test/markup_plugin/test_asset_tag_helpers.rb",
|
145
|
-
"test/markup_plugin/test_form_builder.rb",
|
146
|
-
"test/markup_plugin/test_form_helpers.rb",
|
147
|
-
"test/markup_plugin/test_format_helpers.rb",
|
148
|
-
"test/markup_plugin/test_output_helpers.rb",
|
149
|
-
"test/markup_plugin/test_tag_helpers.rb",
|
150
|
-
"test/test_mailer_plugin.rb",
|
151
|
-
"test/test_render_plugin.rb",
|
152
|
-
"test/test_routing_plugin.rb",
|
153
|
-
"test/test_warden_plugin.rb",
|
154
|
-
"vendor/pony/lib/pony.rb",
|
155
|
-
"vendor/pony/spec/base.rb",
|
156
|
-
"vendor/pony/spec/pony_spec.rb"
|
157
|
-
]
|
158
|
-
s.homepage = %q{http://github.com/nesquena/sinatra_more}
|
159
|
-
s.require_paths = ["lib"]
|
160
|
-
s.rubygems_version = %q{1.3.7}
|
161
|
-
s.summary = %q{Expands sinatra to allow for complex applications}
|
162
|
-
s.test_files = [
|
163
|
-
"test/active_support_helpers.rb",
|
164
|
-
"test/fixtures/mailer_app/app.rb",
|
165
|
-
"test/fixtures/markup_app/app.rb",
|
166
|
-
"test/fixtures/render_app/app.rb",
|
167
|
-
"test/fixtures/routing_app/app.rb",
|
168
|
-
"test/fixtures/warden_app/app.rb",
|
169
|
-
"test/generators/test_skeleton_generator.rb",
|
170
|
-
"test/helper.rb",
|
171
|
-
"test/mailer_plugin/test_mail_object.rb",
|
172
|
-
"test/mailer_plugin/test_mailer_base.rb",
|
173
|
-
"test/markup_plugin/test_asset_tag_helpers.rb",
|
174
|
-
"test/markup_plugin/test_form_builder.rb",
|
175
|
-
"test/markup_plugin/test_form_helpers.rb",
|
176
|
-
"test/markup_plugin/test_format_helpers.rb",
|
177
|
-
"test/markup_plugin/test_output_helpers.rb",
|
178
|
-
"test/markup_plugin/test_tag_helpers.rb",
|
179
|
-
"test/test_mailer_plugin.rb",
|
180
|
-
"test/test_render_plugin.rb",
|
181
|
-
"test/test_routing_plugin.rb",
|
182
|
-
"test/test_warden_plugin.rb"
|
183
|
-
]
|
15
|
+
s.summary = s.description
|
184
16
|
|
185
|
-
|
186
|
-
|
187
|
-
|
17
|
+
s.add_dependency "sinatra", ">= 0.9.2"
|
18
|
+
s.add_dependency "tilt", ">= 0.2"
|
19
|
+
s.add_dependency "thor", ">= 0.11.8"
|
20
|
+
s.add_dependency "activesupport"
|
21
|
+
s.add_dependency "bundler", ">= 0.9.2"
|
22
|
+
s.add_development_dependency "haml", ">= 2.2.14"
|
23
|
+
s.add_development_dependency "shoulda", ">= 2.10.2"
|
24
|
+
s.add_development_dependency "mocha", ">= 0.9.7"
|
25
|
+
s.add_development_dependency "rack-test", ">= 0.5.0"
|
26
|
+
s.add_development_dependency "webrat", ">= 0.5.1"
|
27
|
+
s.add_development_dependency "jeweler"
|
28
|
+
s.add_development_dependency "builder"
|
29
|
+
s.add_development_dependency "tmail"
|
30
|
+
s.add_development_dependency "xml-simple"
|
31
|
+
s.add_development_dependency "warden"
|
188
32
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
s.add_runtime_dependency(%q<sinatra_more>, [">= 0"])
|
196
|
-
s.add_development_dependency(%q<haml>, [">= 2.2.14"])
|
197
|
-
s.add_development_dependency(%q<shoulda>, [">= 2.10.2"])
|
198
|
-
s.add_development_dependency(%q<mocha>, [">= 0.9.7"])
|
199
|
-
s.add_development_dependency(%q<rack-test>, [">= 0.5.0"])
|
200
|
-
s.add_development_dependency(%q<webrat>, [">= 0.5.1"])
|
201
|
-
s.add_development_dependency(%q<haml>, [">= 2.2.14"])
|
202
|
-
s.add_development_dependency(%q<shoulda>, [">= 2.10.2"])
|
203
|
-
s.add_development_dependency(%q<mocha>, [">= 0.9.7"])
|
204
|
-
s.add_development_dependency(%q<rack-test>, [">= 0.5.0"])
|
205
|
-
s.add_development_dependency(%q<webrat>, [">= 0.5.1"])
|
206
|
-
s.add_development_dependency(%q<haml>, [">= 2.2.14"])
|
207
|
-
s.add_development_dependency(%q<shoulda>, [">= 2.10.2"])
|
208
|
-
s.add_development_dependency(%q<mocha>, [">= 0.9.7"])
|
209
|
-
s.add_development_dependency(%q<rack-test>, [">= 0.5.0"])
|
210
|
-
s.add_development_dependency(%q<webrat>, [">= 0.5.1"])
|
211
|
-
s.add_runtime_dependency(%q<sinatra>, [">= 0.9.2"])
|
212
|
-
s.add_runtime_dependency(%q<tilt>, [">= 0.2"])
|
213
|
-
s.add_runtime_dependency(%q<thor>, [">= 0.11.8"])
|
214
|
-
s.add_runtime_dependency(%q<activesupport>, ["< 3.0.0"])
|
215
|
-
s.add_runtime_dependency(%q<bundler>, [">= 0.9.2"])
|
216
|
-
s.add_development_dependency(%q<haml>, [">= 2.2.14"])
|
217
|
-
s.add_development_dependency(%q<shoulda>, [">= 2.10.2"])
|
218
|
-
s.add_development_dependency(%q<mocha>, [">= 0.9.7"])
|
219
|
-
s.add_development_dependency(%q<rack-test>, [">= 0.5.0"])
|
220
|
-
s.add_development_dependency(%q<webrat>, [">= 0.5.1"])
|
221
|
-
else
|
222
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
223
|
-
s.add_dependency(%q<builder>, [">= 0"])
|
224
|
-
s.add_dependency(%q<xml-simple>, [">= 0"])
|
225
|
-
s.add_dependency(%q<warden>, [">= 0"])
|
226
|
-
s.add_dependency(%q<tmail>, [">= 0"])
|
227
|
-
s.add_dependency(%q<sinatra_more>, [">= 0"])
|
228
|
-
s.add_dependency(%q<haml>, [">= 2.2.14"])
|
229
|
-
s.add_dependency(%q<shoulda>, [">= 2.10.2"])
|
230
|
-
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
231
|
-
s.add_dependency(%q<rack-test>, [">= 0.5.0"])
|
232
|
-
s.add_dependency(%q<webrat>, [">= 0.5.1"])
|
233
|
-
s.add_dependency(%q<haml>, [">= 2.2.14"])
|
234
|
-
s.add_dependency(%q<shoulda>, [">= 2.10.2"])
|
235
|
-
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
236
|
-
s.add_dependency(%q<rack-test>, [">= 0.5.0"])
|
237
|
-
s.add_dependency(%q<webrat>, [">= 0.5.1"])
|
238
|
-
s.add_dependency(%q<haml>, [">= 2.2.14"])
|
239
|
-
s.add_dependency(%q<shoulda>, [">= 2.10.2"])
|
240
|
-
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
241
|
-
s.add_dependency(%q<rack-test>, [">= 0.5.0"])
|
242
|
-
s.add_dependency(%q<webrat>, [">= 0.5.1"])
|
243
|
-
s.add_dependency(%q<sinatra>, [">= 0.9.2"])
|
244
|
-
s.add_dependency(%q<tilt>, [">= 0.2"])
|
245
|
-
s.add_dependency(%q<thor>, [">= 0.11.8"])
|
246
|
-
s.add_dependency(%q<activesupport>, ["< 3.0.0"])
|
247
|
-
s.add_dependency(%q<bundler>, [">= 0.9.2"])
|
248
|
-
s.add_dependency(%q<haml>, [">= 2.2.14"])
|
249
|
-
s.add_dependency(%q<shoulda>, [">= 2.10.2"])
|
250
|
-
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
251
|
-
s.add_dependency(%q<rack-test>, [">= 0.5.0"])
|
252
|
-
s.add_dependency(%q<webrat>, [">= 0.5.1"])
|
253
|
-
end
|
254
|
-
else
|
255
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
256
|
-
s.add_dependency(%q<builder>, [">= 0"])
|
257
|
-
s.add_dependency(%q<xml-simple>, [">= 0"])
|
258
|
-
s.add_dependency(%q<warden>, [">= 0"])
|
259
|
-
s.add_dependency(%q<tmail>, [">= 0"])
|
260
|
-
s.add_dependency(%q<sinatra_more>, [">= 0"])
|
261
|
-
s.add_dependency(%q<haml>, [">= 2.2.14"])
|
262
|
-
s.add_dependency(%q<shoulda>, [">= 2.10.2"])
|
263
|
-
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
264
|
-
s.add_dependency(%q<rack-test>, [">= 0.5.0"])
|
265
|
-
s.add_dependency(%q<webrat>, [">= 0.5.1"])
|
266
|
-
s.add_dependency(%q<haml>, [">= 2.2.14"])
|
267
|
-
s.add_dependency(%q<shoulda>, [">= 2.10.2"])
|
268
|
-
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
269
|
-
s.add_dependency(%q<rack-test>, [">= 0.5.0"])
|
270
|
-
s.add_dependency(%q<webrat>, [">= 0.5.1"])
|
271
|
-
s.add_dependency(%q<haml>, [">= 2.2.14"])
|
272
|
-
s.add_dependency(%q<shoulda>, [">= 2.10.2"])
|
273
|
-
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
274
|
-
s.add_dependency(%q<rack-test>, [">= 0.5.0"])
|
275
|
-
s.add_dependency(%q<webrat>, [">= 0.5.1"])
|
276
|
-
s.add_dependency(%q<sinatra>, [">= 0.9.2"])
|
277
|
-
s.add_dependency(%q<tilt>, [">= 0.2"])
|
278
|
-
s.add_dependency(%q<thor>, [">= 0.11.8"])
|
279
|
-
s.add_dependency(%q<activesupport>, ["< 3.0.0"])
|
280
|
-
s.add_dependency(%q<bundler>, [">= 0.9.2"])
|
281
|
-
s.add_dependency(%q<haml>, [">= 2.2.14"])
|
282
|
-
s.add_dependency(%q<shoulda>, [">= 2.10.2"])
|
283
|
-
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
284
|
-
s.add_dependency(%q<rack-test>, [">= 0.5.0"])
|
285
|
-
s.add_dependency(%q<webrat>, [">= 0.5.1"])
|
286
|
-
end
|
33
|
+
s.rubyforge_project = "sinatra_more"
|
34
|
+
|
35
|
+
s.files = `git ls-files`.split("\n")
|
36
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
37
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
38
|
+
s.require_paths = ["lib"]
|
287
39
|
end
|
288
40
|
|