middleman 2.0.7 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +0 -1
- data/CHANGELOG +8 -0
- data/Gemfile +1 -1
- data/features/data.feature +6 -1
- data/features/markdown.feature +7 -0
- data/features/sprockets.feature +11 -1
- data/features/sprockets_gems.feature +3 -3
- data/fixtures/sprockets-app/source/jquery_include.js +1 -0
- data/fixtures/test-app/config.rb +2 -0
- data/fixtures/test-app/source/data2.html.liquid +1 -0
- data/fixtures/test-app/source/javascripts/multiple_engines.js.coffee.erb +1 -0
- data/fixtures/test-app/source/markdown.html.markdown +1 -0
- data/lib/middleman.rb +0 -6
- data/lib/middleman/base.rb +6 -1
- data/lib/middleman/builder.rb +6 -4
- data/lib/middleman/core_extensions/data.rb +35 -5
- data/lib/middleman/core_extensions/front_matter.rb +9 -2
- data/lib/middleman/core_extensions/sprockets.rb +25 -1
- data/lib/middleman/renderers/markdown.rb +25 -2
- data/lib/middleman/version.rb +1 -1
- data/middleman.gemspec +7 -6
- metadata +112 -251
- data/lib/middleman/vendor/padrino-core-0.10.0/.document +0 -5
- data/lib/middleman/vendor/padrino-core-0.10.0/.gitignore +0 -22
- data/lib/middleman/vendor/padrino-core-0.10.0/LICENSE +0 -20
- data/lib/middleman/vendor/padrino-core-0.10.0/README.rdoc +0 -294
- data/lib/middleman/vendor/padrino-core-0.10.0/Rakefile +0 -5
- data/lib/middleman/vendor/padrino-core-0.10.0/bin/padrino +0 -9
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core.rb +0 -119
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/application.rb +0 -259
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/application/rendering.rb +0 -228
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/application/routing.rb +0 -821
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/application/showexceptions.rb +0 -18
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/caller.rb +0 -45
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/cli/adapter.rb +0 -24
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/cli/base.rb +0 -152
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/cli/console.rb +0 -20
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/cli/rake.rb +0 -24
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/cli/rake_tasks.rb +0 -59
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/command.rb +0 -27
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/images/404.png +0 -0
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/images/500.png +0 -0
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/loader.rb +0 -182
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/cz.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/da.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/de.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/en.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/es.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/fr.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/hu.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/it.yml +0 -37
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/ja.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/nl.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/no.yml +0 -31
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/pl.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/pt_br.yml +0 -37
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/ru.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/tr.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/uk.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/zh_cn.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/locale/zh_tw.yml +0 -30
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/logger.rb +0 -344
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/mounter.rb +0 -192
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/reloader.rb +0 -247
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/router.rb +0 -79
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/server.rb +0 -70
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/support_lite.rb +0 -135
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/tasks.rb +0 -23
- data/lib/middleman/vendor/padrino-core-0.10.0/lib/padrino-core/version.rb +0 -15
- data/lib/middleman/vendor/padrino-core-0.10.0/padrino-core.gemspec +0 -38
- data/lib/middleman/vendor/padrino-core-0.10.0/test/fixtures/apps/.components +0 -6
- data/lib/middleman/vendor/padrino-core-0.10.0/test/fixtures/apps/.gitignore +0 -7
- data/lib/middleman/vendor/padrino-core-0.10.0/test/fixtures/apps/complex.rb +0 -27
- data/lib/middleman/vendor/padrino-core-0.10.0/test/fixtures/apps/simple.rb +0 -33
- data/lib/middleman/vendor/padrino-core-0.10.0/test/fixtures/dependencies/a.rb +0 -9
- data/lib/middleman/vendor/padrino-core-0.10.0/test/fixtures/dependencies/b.rb +0 -4
- data/lib/middleman/vendor/padrino-core-0.10.0/test/fixtures/dependencies/c.rb +0 -1
- data/lib/middleman/vendor/padrino-core-0.10.0/test/fixtures/dependencies/circular/e.rb +0 -13
- data/lib/middleman/vendor/padrino-core-0.10.0/test/fixtures/dependencies/circular/f.rb +0 -2
- data/lib/middleman/vendor/padrino-core-0.10.0/test/fixtures/dependencies/circular/g.rb +0 -2
- data/lib/middleman/vendor/padrino-core-0.10.0/test/fixtures/dependencies/d.rb +0 -4
- data/lib/middleman/vendor/padrino-core-0.10.0/test/helper.rb +0 -101
- data/lib/middleman/vendor/padrino-core-0.10.0/test/test_application.rb +0 -83
- data/lib/middleman/vendor/padrino-core-0.10.0/test/test_core.rb +0 -79
- data/lib/middleman/vendor/padrino-core-0.10.0/test/test_dependencies.rb +0 -44
- data/lib/middleman/vendor/padrino-core-0.10.0/test/test_filters.rb +0 -266
- data/lib/middleman/vendor/padrino-core-0.10.0/test/test_logger.rb +0 -91
- data/lib/middleman/vendor/padrino-core-0.10.0/test/test_mounter.rb +0 -176
- data/lib/middleman/vendor/padrino-core-0.10.0/test/test_reloader_complex.rb +0 -66
- data/lib/middleman/vendor/padrino-core-0.10.0/test/test_reloader_simple.rb +0 -97
- data/lib/middleman/vendor/padrino-core-0.10.0/test/test_rendering.rb +0 -437
- data/lib/middleman/vendor/padrino-core-0.10.0/test/test_router.rb +0 -146
- data/lib/middleman/vendor/padrino-core-0.10.0/test/test_routing.rb +0 -1491
- data/lib/middleman/vendor/padrino-helpers-0.10.0/.document +0 -5
- data/lib/middleman/vendor/padrino-helpers-0.10.0/.gitignore +0 -21
- data/lib/middleman/vendor/padrino-helpers-0.10.0/LICENSE +0 -20
- data/lib/middleman/vendor/padrino-helpers-0.10.0/README.rdoc +0 -239
- data/lib/middleman/vendor/padrino-helpers-0.10.0/Rakefile +0 -5
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers.rb +0 -51
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/asset_tag_helpers.rb +0 -288
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/form_builder/abstract_form_builder.rb +0 -220
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/form_builder/standard_form_builder.rb +0 -43
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/form_helpers.rb +0 -446
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/format_helpers.rb +0 -260
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/cz.yml +0 -103
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/da.yml +0 -91
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/de.yml +0 -78
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/en.yml +0 -103
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/es.yml +0 -103
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/fr.yml +0 -79
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/hu.yml +0 -103
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/it.yml +0 -85
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/ja.yml +0 -103
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/nl.yml +0 -78
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/no.yml +0 -91
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/pl.yml +0 -95
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/pt_br.yml +0 -103
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/ru.yml +0 -103
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/tr.yml +0 -103
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/uk.yml +0 -103
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/zh_cn.yml +0 -103
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/locale/zh_tw.yml +0 -103
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/number_helpers.rb +0 -273
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/output_helpers.rb +0 -128
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/output_helpers/abstract_handler.rb +0 -103
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/output_helpers/erb_handler.rb +0 -79
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/output_helpers/haml_handler.rb +0 -64
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/output_helpers/slim_handler.rb +0 -82
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/render_helpers.rb +0 -40
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/tag_helpers.rb +0 -59
- data/lib/middleman/vendor/padrino-helpers-0.10.0/lib/padrino-helpers/translation_helpers.rb +0 -21
- data/lib/middleman/vendor/padrino-helpers-0.10.0/padrino-helpers.gemspec +0 -27
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/app.rb +0 -73
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/capture_concat.erb +0 -14
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/capture_concat.haml +0 -12
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/capture_concat.slim +0 -13
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/content_for.erb +0 -11
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/content_for.haml +0 -9
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/content_for.slim +0 -9
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/content_tag.erb +0 -11
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/content_tag.haml +0 -9
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/content_tag.slim +0 -9
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/current_engine.erb +0 -5
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/current_engine.haml +0 -5
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/current_engine.slim +0 -5
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/fields_for.erb +0 -20
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/fields_for.haml +0 -15
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/fields_for.slim +0 -15
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/form_for.erb +0 -56
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/form_for.haml +0 -47
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/form_for.slim +0 -47
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/form_tag.erb +0 -56
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/form_tag.haml +0 -45
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/form_tag.slim +0 -45
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/link_to.erb +0 -5
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/link_to.haml +0 -4
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/link_to.slim +0 -4
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/mail_to.erb +0 -3
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/mail_to.haml +0 -3
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/mail_to.slim +0 -3
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/meta_tag.erb +0 -3
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/meta_tag.haml +0 -3
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/meta_tag.slim +0 -3
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/partials/_erb.erb +0 -1
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/partials/_haml.haml +0 -1
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/partials/_slim.slim +0 -1
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/simple_partial.erb +0 -1
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/simple_partial.haml +0 -1
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/markup_app/views/simple_partial.slim +0 -1
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/render_app/app.rb +0 -45
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/render_app/views/current_engine.haml +0 -5
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/render_app/views/current_engines/_erb.erb +0 -1
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/render_app/views/current_engines/_haml.haml +0 -1
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/render_app/views/current_engines/_slim.slim +0 -1
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/render_app/views/erb/test.erb +0 -1
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/render_app/views/explicit_engine.haml +0 -5
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/render_app/views/haml/test.haml +0 -1
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/render_app/views/template/_user.haml +0 -7
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/render_app/views/template/haml_template.haml +0 -1
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/fixtures/render_app/views/template/some_template.haml +0 -2
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/helper.rb +0 -78
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/test_asset_tag_helpers.rb +0 -320
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/test_form_builder.rb +0 -998
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/test_form_helpers.rb +0 -645
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/test_format_helpers.rb +0 -227
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/test_number_helpers.rb +0 -136
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/test_output_helpers.rb +0 -133
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/test_render_helpers.rb +0 -69
- data/lib/middleman/vendor/padrino-helpers-0.10.0/test/test_tag_helpers.rb +0 -100
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2011 Padrino
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,294 +0,0 @@
|
|
1
|
-
= Padrino (padrino-core)
|
2
|
-
|
3
|
-
Padrino is the godfather of Sinatra.
|
4
|
-
|
5
|
-
== Preface
|
6
|
-
|
7
|
-
Padrino is a ruby framework built upon the excellent {Sinatra Microframework}[http://www.sinatrarb.com].
|
8
|
-
Sinatra is a DSL for creating simple web applications in Ruby with speed and minimal effort.
|
9
|
-
This framework tries hard to make it as fun and easy as possible to code much more advanced web applications by
|
10
|
-
building upon the Sinatra philosophies and foundation.
|
11
|
-
|
12
|
-
== Introduction
|
13
|
-
|
14
|
-
Many people love Sinatra's simplicity and lightweight but often quickly come to miss a great deal
|
15
|
-
of functionality provided by other web frameworks such as Rails when building non-trivial applications.
|
16
|
-
|
17
|
-
Our goal with this framework is to match the essence of Sinatra and at the same time create a standard library
|
18
|
-
of tools, helpers and components that will make Sinatra suitable for more complex applications.
|
19
|
-
|
20
|
-
Here is a brief overview of functionality provided by the Padrino framework:
|
21
|
-
|
22
|
-
Agnostic:: Full support for many popular testing, templating, mocking, and data storage choices.
|
23
|
-
Generators:: Create Padrino applications, models, controllers i.e: padrino-gen project.
|
24
|
-
Mountable:: Unlike other ruby frameworks, principally designed for mounting multiple apps.
|
25
|
-
Routing:: Full url named routes, named params, respond_to support, before/after filter support.
|
26
|
-
Tag Helpers:: View helpers such as: tag, content_tag, input_tag.
|
27
|
-
Asset Helpers:: View helpers such as: link_to, image_tag, javascript_include_tag.
|
28
|
-
Form Helpers:: Builder support such as: form_tag, form_for, field_set_tag, text_field.
|
29
|
-
Text Helpers:: Useful formatting like: relative_time_ago, js_escape_html, sanitize_html.
|
30
|
-
Mailer:: Fast and simple delivery support for sending emails (akin to ActionMailer).
|
31
|
-
Admin:: Builtin Admin interface (like Django)
|
32
|
-
Logging:: Provide a unified logger that can interact with your ORM or any library.
|
33
|
-
Reloading:: Automatically reloads server code during development.
|
34
|
-
Localization:: Full support of I18n language localization and can auto-set user’s locale.
|
35
|
-
|
36
|
-
Keep in mind, the user will be able to pull in these components
|
37
|
-
{seperately into existing Sinatra applications}[http://www.padrinorb.com/guides/standalone-usage-in-sinatra]
|
38
|
-
or use them altogether for a comprehensive upgrade to Sinatra (a full-stack Padrino application).
|
39
|
-
|
40
|
-
== Installation
|
41
|
-
|
42
|
-
To install the padrino framework, simply grab the latest version from gemcutter:
|
43
|
-
|
44
|
-
$ sudo gem install padrino
|
45
|
-
|
46
|
-
This will install the necessary padrino gems to get you started.
|
47
|
-
Now you are ready to use this gem to enhance your sinatra projects or to create new Padrino applications.
|
48
|
-
|
49
|
-
For a more detailed look at Padrino installation,
|
50
|
-
check out the {Installation Guide}[http://www.padrinorb.com/guides/installation].
|
51
|
-
|
52
|
-
== Usage
|
53
|
-
|
54
|
-
Padrino is a framework which builds on the existing functionality and Sinatra and provides a variety of
|
55
|
-
additional tools and helpers to build upon that foundation. This README and Padrino documentation in general will focus
|
56
|
-
on the enhancements to the core Sinatra functionality. To use Padrino, one should be familiar with the basic
|
57
|
-
usage of Sinatra itself.
|
58
|
-
|
59
|
-
Please check out the
|
60
|
-
{Understanding Sinatra}[http://www.padrinorb.com/guides/underlying-sinatra-overview] guide
|
61
|
-
to learn more about these fundamentals.
|
62
|
-
|
63
|
-
For information on how to use a specific gem in isolation within an existing Sinatra project, checkout the guide for
|
64
|
-
{Using Padrino in Sinatra}[http://www.padrinorb.com/guides/standalone-usage-in-sinatra].
|
65
|
-
|
66
|
-
== Getting Started
|
67
|
-
|
68
|
-
Once a developer understands Sinatra, Padrino is quite easy to get comfortable with since Padrino is simply a superset
|
69
|
-
of existing Sinatra Functionality! Best way to get started with building Padrino applications is to read following resources:
|
70
|
-
|
71
|
-
* {Blog Tutorial}[http://www.padrinorb.com/guides/blog-tutorial] - Step-by-step guide to building a blog application with Padrino.
|
72
|
-
* {Quick Overview}[http://www.padrinorb.com/guides/basic-projects] - Outlines basic generation commands.
|
73
|
-
* {Padrino Examples}[http://www.padrinorb.com/guides/examples] - List of known Padrino applications which can serve as examples.
|
74
|
-
|
75
|
-
== Enhanced Base Application (padrino-core)
|
76
|
-
|
77
|
-
Sinatra has support for classes which can be extended to create an application: <tt>Sinatra::Base</tt> and <tt>Sinatra::Application</tt>
|
78
|
-
These classes can be extended in order to create a Sinatra web application. These classes provide support for all the basic
|
79
|
-
functionality afforded by Sinatra.
|
80
|
-
|
81
|
-
Padrino has support for an enhanced base application class <tt>Padrino::Application</tt>. <tt>Padrino::Application</tt>
|
82
|
-
expands the capabilities of Sinatra::Application and automatically provides the resulting application access to all of
|
83
|
-
the padrino framework's functionalities.
|
84
|
-
|
85
|
-
=== Simple Application Definition
|
86
|
-
|
87
|
-
Let us first take a look at the simplest possible Padrino application:
|
88
|
-
|
89
|
-
# app.rb
|
90
|
-
PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
|
91
|
-
require 'padrino'
|
92
|
-
Padrino.load!
|
93
|
-
|
94
|
-
class SimpleApp < Padrino::Application
|
95
|
-
get '/' do
|
96
|
-
'Hello world'
|
97
|
-
end
|
98
|
-
|
99
|
-
# and for read better we can divide with controllers
|
100
|
-
controller '/admin' do
|
101
|
-
get '/foo' do
|
102
|
-
'Url is /admin/foo'
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
=== Enhanced Route Definitions and Controllers
|
108
|
-
|
109
|
-
For a complete overview of the Padrino routing and controller system,
|
110
|
-
check out the {Routing and Controller guide}[http://www.padrinorb.com/guides/controllers].
|
111
|
-
|
112
|
-
Suppose we wanted to add additional routes to our Padrino application, and we want to organize the routes
|
113
|
-
within a more structured layout. Simply add a <tt>controllers</tt> or <tt>app/controllers</tt> folder and create a file as such:
|
114
|
-
|
115
|
-
# Simple Example
|
116
|
-
SimpleApp.controllers do
|
117
|
-
get "/test" do
|
118
|
-
"Text to return"
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
You can also do more complex route alias definitions:
|
123
|
-
|
124
|
-
# app/controllers/example.rb
|
125
|
-
SimpleApp.controllers :posts do
|
126
|
-
get :index do
|
127
|
-
...
|
128
|
-
end
|
129
|
-
|
130
|
-
get :show, :with => :id do
|
131
|
-
# url generated is '/posts/show/:id'
|
132
|
-
# access params[:id]
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
as well as mapping the route aliases to an explicit url:
|
137
|
-
|
138
|
-
# app/controllers/example.rb
|
139
|
-
SimpleApp.controllers do
|
140
|
-
get :index, :map => '/index' do
|
141
|
-
...
|
142
|
-
end
|
143
|
-
|
144
|
-
get :account, :map => '/the/accounts/:name/and/:id' do
|
145
|
-
# access params[:name] and params[:index]
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
and even configure the respond_to for each route:
|
150
|
-
|
151
|
-
# app/controllers/example.rb
|
152
|
-
SimpleApp.controllers :admin do
|
153
|
-
get :show, :with => :id, :provides => :js do
|
154
|
-
"Url is /admin/show/#{params[:id]}.#{params[:format]}"
|
155
|
-
end
|
156
|
-
|
157
|
-
get :other, with => [:id, :name], respond_to => [:html, :json] do
|
158
|
-
case content_type
|
159
|
-
when :js then ... end
|
160
|
-
when :json then ... end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
or auto lookup for current locale or content_type
|
166
|
-
|
167
|
-
# app/controllers/example.rb
|
168
|
-
SimpleApp.controllers :admin do
|
169
|
-
get :show, :with => :id, :provides => [html, :js] do
|
170
|
-
render "admin/show"
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
When you visit :+show+ and your I18n.locale == :ru Padrino try to look for "admin/show.ru.js.*" if nothing match that path
|
175
|
-
they try "admin/show.ru.*" then "admin/show.js.*" if none match return "admin/show.erb" (or other engine i.e. haml)
|
176
|
-
|
177
|
-
For a complete overview of the routing and controller system, check out the
|
178
|
-
{Routing and Controller guide}[http://www.padrinorb.com/guides/controllers].
|
179
|
-
|
180
|
-
=== Rendering
|
181
|
-
|
182
|
-
Unlike Sinatra, Padrino supports automatic template lookups such as:
|
183
|
-
|
184
|
-
# searches for 'account/index.{erb,haml,...}
|
185
|
-
render 'account/index'
|
186
|
-
|
187
|
-
This render does not require any template engine to be specified and will choose the first one that is discovered.
|
188
|
-
The existing render function works as well if an engine type should be specified:
|
189
|
-
|
190
|
-
# example.haml
|
191
|
-
render :haml, 'account/index'
|
192
|
-
|
193
|
-
For a complete overview of the Padrino rendering system, check out the
|
194
|
-
{Routing and Controller guide}[http://www.padrinorb.com/guides/controllers].
|
195
|
-
|
196
|
-
=== Layout
|
197
|
-
|
198
|
-
With Padrino you can (like rails do) use for your custom layout, disable it
|
199
|
-
|
200
|
-
class SimpleApp < Padrino::Application
|
201
|
-
|
202
|
-
# Disable layouts
|
203
|
-
disable layout
|
204
|
-
|
205
|
-
# Use the layout located in views/layouts/custom.haml
|
206
|
-
layout :custom
|
207
|
-
|
208
|
-
For a complete overview of the layout functionality,
|
209
|
-
check out the {Routing and Controller guide}[http://www.padrinorb.com/guides/controllers].
|
210
|
-
|
211
|
-
=== Mounting Applications
|
212
|
-
|
213
|
-
Padrino applications are all automatically mountable into other Padrino projects. This means that a given Padrino
|
214
|
-
project directory can easily mount multiple applications. This allows for better organization of complex applications,
|
215
|
-
re-usable applications that can be applied (i.e admin, auth, blog) and even more flexibility.
|
216
|
-
|
217
|
-
You can think of mountable applications as a 'full-featured' merb slice or rails engine. Instead of a separate construct,
|
218
|
-
any application can simply be packaged and mounted into another project.
|
219
|
-
|
220
|
-
Padrino stores application mounting information by default within <tt>config/apps.rb</tt>. This file is intended
|
221
|
-
to keep all information regarding what applications are mounted to which uri's.
|
222
|
-
|
223
|
-
For a complete look at mounting applications within a Padrino project,
|
224
|
-
check out the guide on {Mounting Applications}[http://www.padrinorb.com/guides/mounting-applications].
|
225
|
-
|
226
|
-
=== Auto Load Paths
|
227
|
-
|
228
|
-
Padrino also intelligently supports requiring useful files within your application automatically and provides
|
229
|
-
functionality for easily splitting up your application into separate files. Padrino automatically requires <tt>config/database.rb</tt>
|
230
|
-
as a convention for establishing database connection. Also, any files within the <tt>lib</tt> folder will be required
|
231
|
-
automatically by Padrino.
|
232
|
-
|
233
|
-
For a complete overview of auto-loaded paths within Padrino,
|
234
|
-
check out the {Padrino Development Guide}[http://www.padrinorb.com/guides/development-and-terminal-commands].
|
235
|
-
|
236
|
-
=== Application Logging
|
237
|
-
|
238
|
-
Padrino also supports robust logging capabilities. By default, logging information will
|
239
|
-
go to the STDOUT in development (for use in a console) and in an environment-specific log file <tt>log/development.log</tt>
|
240
|
-
in test and production environments.
|
241
|
-
|
242
|
-
To use the logger within a Padrino application, simply refer to the <tt>logger</tt> method accessible
|
243
|
-
within your app and any controller or views:
|
244
|
-
|
245
|
-
# controllers/example.rb
|
246
|
-
SimpleApp.controllers do
|
247
|
-
get("/test") { logger.info "This is a test" }
|
248
|
-
end
|
249
|
-
|
250
|
-
For a complete overview of Padrino logger functionality, check out the
|
251
|
-
{Padrino Development Guide}[http://www.padrinorb.com/guides/development-and-terminal-commands].
|
252
|
-
|
253
|
-
=== Development Reloader
|
254
|
-
|
255
|
-
Padrino applications also have the enabled ability to automatically reload all changing application files without
|
256
|
-
the need to restart the server. Through the use of a customized Rack middleware, all files on the 'load path'
|
257
|
-
are monitored and reloaded whenever changes are applied.
|
258
|
-
|
259
|
-
This makes rapid development much easier and provides a better alternative to 'shotgun' or 'rerun'
|
260
|
-
which requires the application server to be restarted which makes requests take much longer to complete.
|
261
|
-
|
262
|
-
For a complete overview of code reloading in development,
|
263
|
-
check out the {Padrino Development Guide}[http://www.padrinorb.com/guides/development-and-terminal-commands].
|
264
|
-
|
265
|
-
=== Terminal Commands
|
266
|
-
|
267
|
-
Padrino also comes equipped with multiple useful terminal commands which can be activated to perform
|
268
|
-
common tasks such as starting / stopping the application, executing the unit tests or activating an irb session.
|
269
|
-
|
270
|
-
The following commands are available:
|
271
|
-
|
272
|
-
# starts the app server (non-daemonized)
|
273
|
-
$ padrino start
|
274
|
-
# starts the app server (daemonized) with given port, environment and adapter
|
275
|
-
$ padrino start -d -p 3000 -e development -a thin
|
276
|
-
|
277
|
-
# Stops a daemonized app server
|
278
|
-
$ padrino stop
|
279
|
-
|
280
|
-
# Bootup the Padrino console (irb)
|
281
|
-
$ padrino console
|
282
|
-
|
283
|
-
# Run/List tasks
|
284
|
-
$ padrino rake
|
285
|
-
|
286
|
-
You can also create custom rake tasks as well. Using these commands can simplify common tasks
|
287
|
-
making development that much smoother.
|
288
|
-
|
289
|
-
For a complete overview of Padrino terminal commands, check out the
|
290
|
-
{Padrino Commands Guide}[http://www.padrinorb.com/guides/development-and-terminal-commands].
|
291
|
-
|
292
|
-
== Copyright
|
293
|
-
|
294
|
-
Copyright (c) 2011 Padrino. See LICENSE for details.
|
@@ -1,9 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'rubygems' unless defined?(Gem)
|
3
|
-
require 'bundler/setup' if %w(Gemfile .components).all? { |f| File.exist?(f) }
|
4
|
-
|
5
|
-
padrino_core_path = File.expand_path('../../lib', __FILE__)
|
6
|
-
$:.unshift(padrino_core_path) if File.directory?(padrino_core_path) && !$:.include?(padrino_core_path)
|
7
|
-
|
8
|
-
require 'padrino-core/cli/base'
|
9
|
-
Padrino::Cli::Base.start(ARGV)
|
@@ -1,119 +0,0 @@
|
|
1
|
-
require 'sinatra/base'
|
2
|
-
require 'padrino-core/support_lite' unless defined?(SupportLite)
|
3
|
-
|
4
|
-
FileSet.glob_require('padrino-core/application/*.rb', __FILE__)
|
5
|
-
FileSet.glob_require('padrino-core/*.rb', __FILE__)
|
6
|
-
|
7
|
-
# Defines our Constants
|
8
|
-
PADRINO_ENV = ENV["PADRINO_ENV"] ||= ENV["RACK_ENV"] ||= "development" unless defined?(PADRINO_ENV)
|
9
|
-
PADRINO_ROOT = ENV["PADRINO_ROOT"] ||= File.dirname(Padrino.first_caller) unless defined?(PADRINO_ROOT)
|
10
|
-
|
11
|
-
module Padrino
|
12
|
-
class ApplicationLoadError < RuntimeError #:nodoc:
|
13
|
-
end
|
14
|
-
|
15
|
-
class << self
|
16
|
-
##
|
17
|
-
# Helper method for file references.
|
18
|
-
#
|
19
|
-
# ==== Examples
|
20
|
-
#
|
21
|
-
# # Referencing a file in config called settings.yml
|
22
|
-
# Padrino.root("config", "settings.yml")
|
23
|
-
# # returns PADRINO_ROOT + "/config/setting.yml"
|
24
|
-
#
|
25
|
-
def root(*args)
|
26
|
-
File.expand_path(File.join(PADRINO_ROOT, *args))
|
27
|
-
end
|
28
|
-
|
29
|
-
##
|
30
|
-
# Helper method that return PADRINO_ENV
|
31
|
-
#
|
32
|
-
def env
|
33
|
-
@_env ||= PADRINO_ENV.to_s.downcase.to_sym
|
34
|
-
end
|
35
|
-
|
36
|
-
##
|
37
|
-
# Returns the resulting rack builder mapping each 'mounted' application
|
38
|
-
#
|
39
|
-
def application
|
40
|
-
raise ApplicationLoadError, "At least one app must be mounted!" unless Padrino.mounted_apps && Padrino.mounted_apps.any?
|
41
|
-
router = Padrino::Router.new
|
42
|
-
Padrino.mounted_apps.each { |app| app.map_onto(router) }
|
43
|
-
|
44
|
-
unless middleware.empty?
|
45
|
-
builder = Rack::Builder.new
|
46
|
-
middleware.each { |c,a,b| builder.use(c, *a, &b) }
|
47
|
-
builder.run(router)
|
48
|
-
builder.to_app
|
49
|
-
else
|
50
|
-
router
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
##
|
55
|
-
# Configure Global Project Settings for mounted apps. These can be overloaded
|
56
|
-
# in each individual app's own personal configuration. This can be used like:
|
57
|
-
#
|
58
|
-
# Padrino.configure_apps do
|
59
|
-
# enable :sessions
|
60
|
-
# disable :raise_errors
|
61
|
-
# end
|
62
|
-
#
|
63
|
-
def configure_apps(&block)
|
64
|
-
@_global_configuration = block if block_given?
|
65
|
-
end
|
66
|
-
|
67
|
-
###
|
68
|
-
# Returns project-wide configuration settings
|
69
|
-
# defined in 'configure_apps' block
|
70
|
-
#
|
71
|
-
def apps_configuration
|
72
|
-
@_global_configuration
|
73
|
-
end
|
74
|
-
|
75
|
-
##
|
76
|
-
# Default encoding to UTF8.
|
77
|
-
#
|
78
|
-
def set_encoding
|
79
|
-
if RUBY_VERSION < '1.9'
|
80
|
-
$KCODE='u'
|
81
|
-
else
|
82
|
-
Encoding.default_external = Encoding::UTF_8
|
83
|
-
Encoding.default_internal = nil # Encoding::UTF_8
|
84
|
-
end
|
85
|
-
nil
|
86
|
-
end
|
87
|
-
|
88
|
-
##
|
89
|
-
# Return bundle status :+:locked+ if .bundle/environment.rb exist :+:unlocked if Gemfile exist
|
90
|
-
# otherwise return nil
|
91
|
-
#
|
92
|
-
def bundle
|
93
|
-
return :locked if File.exist?(root('Gemfile.lock'))
|
94
|
-
return :unlocked if File.exist?(root("Gemfile"))
|
95
|
-
end
|
96
|
-
|
97
|
-
##
|
98
|
-
# A Rack::Builder object that allows to add middlewares in front of all
|
99
|
-
# Padrino applications
|
100
|
-
#
|
101
|
-
def middleware
|
102
|
-
@middleware ||= []
|
103
|
-
end
|
104
|
-
|
105
|
-
##
|
106
|
-
# Clears all previously configured middlewares
|
107
|
-
#
|
108
|
-
def clear_middleware!
|
109
|
-
@middleware = []
|
110
|
-
end
|
111
|
-
|
112
|
-
##
|
113
|
-
# Convenience method for adding a Middleware to the whole padrino app.
|
114
|
-
#
|
115
|
-
def use(m, *args, &block)
|
116
|
-
middleware << [m, args, block]
|
117
|
-
end
|
118
|
-
end # self
|
119
|
-
end # Padrino
|