padrino-core 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/padrino-core.rb +4 -4
  3. data/lib/padrino-core/application.rb +6 -195
  4. data/lib/padrino-core/application/application_setup.rb +199 -0
  5. data/lib/padrino-core/application/routing.rb +66 -25
  6. data/lib/padrino-core/cli/base.rb +8 -5
  7. data/lib/padrino-core/cli/rake.rb +12 -9
  8. data/lib/padrino-core/loader.rb +1 -1
  9. data/lib/padrino-core/logger.rb +25 -0
  10. data/lib/padrino-core/mounter.rb +8 -3
  11. data/lib/padrino-core/reloader.rb +2 -2
  12. data/lib/padrino-core/server.rb +50 -17
  13. data/lib/padrino-core/version.rb +1 -1
  14. data/padrino-core.gemspec +2 -10
  15. data/test/fixtures/apps/demo_app.rb +7 -0
  16. data/test/fixtures/apps/demo_demo.rb +7 -0
  17. data/test/helper.rb +6 -37
  18. data/test/test_application.rb +12 -13
  19. data/test/test_core.rb +12 -13
  20. data/test/test_csrf_protection.rb +49 -23
  21. data/test/test_dependencies.rb +7 -7
  22. data/test/test_filters.rb +41 -17
  23. data/test/test_flash.rb +24 -24
  24. data/test/test_locale.rb +1 -1
  25. data/test/test_logger.rb +39 -27
  26. data/test/test_mounter.rb +34 -20
  27. data/test/test_reloader_complex.rb +5 -6
  28. data/test/test_reloader_simple.rb +23 -20
  29. data/test/test_reloader_system.rb +10 -7
  30. data/test/test_restful_routing.rb +1 -1
  31. data/test/test_router.rb +7 -7
  32. data/test/test_routing.rb +177 -141
  33. metadata +14 -53
  34. data/lib/padrino-core/application/rendering.rb +0 -325
  35. data/lib/padrino-core/application/rendering/extensions/erubis.rb +0 -68
  36. data/lib/padrino-core/application/rendering/extensions/haml.rb +0 -29
  37. data/lib/padrino-core/application/rendering/extensions/slim.rb +0 -21
  38. data/lib/padrino-core/locale/cs.yml +0 -33
  39. data/lib/padrino-core/locale/da.yml +0 -33
  40. data/lib/padrino-core/locale/de.yml +0 -33
  41. data/lib/padrino-core/locale/en.yml +0 -33
  42. data/lib/padrino-core/locale/es.yml +0 -33
  43. data/lib/padrino-core/locale/fr.yml +0 -33
  44. data/lib/padrino-core/locale/hu.yml +0 -33
  45. data/lib/padrino-core/locale/it.yml +0 -39
  46. data/lib/padrino-core/locale/ja.yml +0 -33
  47. data/lib/padrino-core/locale/lv.yml +0 -33
  48. data/lib/padrino-core/locale/nl.yml +0 -33
  49. data/lib/padrino-core/locale/no.yml +0 -33
  50. data/lib/padrino-core/locale/pl.yml +0 -33
  51. data/lib/padrino-core/locale/pt_br.yml +0 -39
  52. data/lib/padrino-core/locale/ro.yml +0 -33
  53. data/lib/padrino-core/locale/ru.yml +0 -34
  54. data/lib/padrino-core/locale/sv.yml +0 -33
  55. data/lib/padrino-core/locale/tr.yml +0 -33
  56. data/lib/padrino-core/locale/uk.yml +0 -33
  57. data/lib/padrino-core/locale/zh_cn.yml +0 -33
  58. data/lib/padrino-core/locale/zh_tw.yml +0 -33
  59. data/lib/padrino-core/support_lite.rb +0 -259
  60. data/test/fixtures/apps/.components +0 -6
  61. data/test/fixtures/apps/.gitignore +0 -7
  62. data/test/fixtures/apps/render.rb +0 -13
  63. data/test/fixtures/apps/views/blog/post.erb +0 -1
  64. data/test/fixtures/layouts/layout.erb +0 -1
  65. data/test/mini_shoulda.rb +0 -45
  66. data/test/test_rendering.rb +0 -606
  67. data/test/test_rendering_extensions.rb +0 -14
  68. data/test/test_support_lite.rb +0 -56
@@ -1,68 +0,0 @@
1
- begin
2
- require 'erubis'
3
-
4
- module Padrino
5
- module Erubis
6
- ##
7
- # SafeBufferEnhancer is an Erubis Enhancer that compiles templates that
8
- # are fit for using ActiveSupport::SafeBuffer as a Buffer.
9
- #
10
- # @api private
11
- module SafeBufferEnhancer
12
- def add_expr_literal(src, code)
13
- src << " #{@bufvar}.concat((" << code << ').to_s);'
14
- end
15
-
16
- def add_expr_escaped(src, code)
17
- src << " #{@bufvar}.safe_concat " << code << ';'
18
- end
19
-
20
- def add_text(src, text)
21
- src << " #{@bufvar}.safe_concat '" << escape_text(text) << "';" unless text.empty?
22
- end
23
- end
24
-
25
- ##
26
- # SafeBufferTemplate is the classic Erubis template, augmented with
27
- # SafeBufferEnhancer.
28
- #
29
- # @api private
30
- class SafeBufferTemplate < ::Erubis::Eruby
31
- include SafeBufferEnhancer
32
- end
33
-
34
- ##
35
- # Modded ErubisTemplate that doesn't insist in an String as output
36
- # buffer.
37
- #
38
- # @api private
39
- class Template < Tilt::ErubisTemplate
40
- def render(*args)
41
- app = args.first
42
- app_class = app.class
43
- @is_padrino_app = app.kind_of?(Padrino::Application) ||
44
- (app_class.respond_to?(:erb) && app_class.erb[:engine_class] == Padrino::Erubis::SafeBufferTemplate)
45
- super
46
- end
47
-
48
- ##
49
- # In preamble we need a flag `__in_erb_template` and SafeBuffer for padrino apps.
50
- #
51
- def precompiled_preamble(locals)
52
- original = super
53
- return original unless @is_padrino_app
54
- "__in_erb_template = true\n" << original.rpartition("\n").first << "#{@outvar} = _buf = ActiveSupport::SafeBuffer.new\n"
55
- end
56
- end
57
- end
58
- end
59
-
60
- Tilt.prefer(Padrino::Erubis::Template, :erb)
61
-
62
- if defined? Padrino::Rendering
63
- Padrino::Rendering.engine_configurations[:erb] = {
64
- :engine_class => Padrino::Erubis::SafeBufferTemplate,
65
- }
66
- end
67
- rescue LoadError
68
- end
@@ -1,29 +0,0 @@
1
- begin
2
- require 'haml'
3
- require 'haml/helpers/xss_mods'
4
- require 'haml/helpers/action_view_extensions'
5
-
6
- module Haml
7
- module Helpers
8
- include XssMods
9
- include ActionViewExtensions
10
- end
11
-
12
- module Util
13
- def self.rails_xss_safe?
14
- true
15
- end
16
- end
17
- end
18
-
19
- if defined? Padrino::Rendering
20
- Padrino::Rendering.engine_configurations[:haml] = {
21
- :escape_html => true,
22
- }
23
-
24
- class Tilt::HamlTemplate
25
- include Padrino::Rendering::SafeTemplate
26
- end
27
- end
28
- rescue LoadError
29
- end
@@ -1,21 +0,0 @@
1
- begin
2
- require 'slim'
3
-
4
- if defined? Padrino::Rendering
5
- Padrino::Rendering.engine_configurations[:slim] = {
6
- :generator => Temple::Generators::RailsOutputBuffer,
7
- :buffer => "@_out_buf",
8
- :use_html_safe => true,
9
- :disable_capture => true,
10
- }
11
-
12
- class Slim::Template
13
- include Padrino::Rendering::SafeTemplate
14
-
15
- def precompiled_preamble(locals)
16
- "__in_slim_template = true\n" << super
17
- end
18
- end
19
- end
20
- rescue LoadError
21
- end
@@ -1,33 +0,0 @@
1
- cs:
2
- date:
3
- formats:
4
- # Use the strftime parameters for formats.
5
- # When no format has been given, it uses default.
6
- # You can provide other formats here if you like!
7
- default: "%d. %m. %Y"
8
- short: "%d %b"
9
- long: "%d. %B %Y"
10
- only_day: "%e"
11
-
12
- day_names: [Neděle, Pondělí, Úterý, Středa, Čtvrtek, Pátek, Sobota]
13
- abbr_day_names: [Ne, Po, Út, St, Čt, Pá, So]
14
- month_names: [~, Leden, Únor, Březen, Duben, Květen, Červen, Červenec, Srpen, Září, Říjen, Listopad, Prosinec]
15
- abbr_month_names: [~, Led, Úno, Bře, Dub, Kvě, Čvn, Čvc, Srp, Zář, Říj, Lis, Pro]
16
- order:
17
- - day
18
- - month
19
- - year
20
-
21
- time:
22
- formats:
23
- default: "%a %d. %B %Y %H:%M %z"
24
- short: "%d. %m. %H:%M"
25
- long: "%A %d. %B %Y %H:%M"
26
- am: "dop"
27
- pm: "odp"
28
-
29
- support:
30
- array:
31
- words_connector: ", "
32
- two_words_connector: " a "
33
- last_word_connector: " a "
@@ -1,33 +0,0 @@
1
- da:
2
- date:
3
- formats:
4
- # Use the strftime parameters for formats.
5
- # When no format has been given, it uses default.
6
- # You can provide other formats here if you like!
7
- default: "%d.%m.%Y"
8
- short: "%e. %b %Y"
9
- long: "%e. %B %Y"
10
- only_day: "%e"
11
-
12
- day_names: [søndag, mandag, tirsdag, onsdag, torsdag, fredag, lørdag]
13
- abbr_day_names: [sø, ma, ti, 'on', to, fr, lø]
14
- month_names: [~, januar, februar, marts, april, maj, juni, juli, august, september, oktober, november, december]
15
- abbr_month_names: [~, jan, feb, mar, apr, maj, jun, jul, aug, sep, okt, nov, dec]
16
- order:
17
- - day
18
- - month
19
- - year
20
-
21
- time:
22
- formats:
23
- default: "%e. %B %Y, %H:%M"
24
- short: "%e. %b %Y, %H:%M"
25
- long: "%A, %e. %B %Y, %H:%M"
26
- am: ""
27
- pm: ""
28
-
29
- support:
30
- array:
31
- words_connector: ", "
32
- two_words_connector: " og "
33
- last_word_connector: " og "
@@ -1,33 +0,0 @@
1
- de:
2
- date:
3
- formats:
4
- # Benutze die strftime Parameter für die Formatierung
5
- # Wenn keine Formate angegeben werden, wird "default" benutzt.
6
- # Du kannst auch weitere Formate hinzufügen, wenn Du möchtest.
7
- default: "&d.&m.%Y"
8
- short: "%d. %b"
9
- long: "%d. %B %Y"
10
- only_day: "%e"
11
-
12
- day_names: [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag]
13
- abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa]
14
- month_names: [~, Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember]
15
- abbr_month_names: [~, Jan, Feb, Mär, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov, Dez]
16
- order:
17
- - day
18
- - month
19
- - year
20
-
21
- time:
22
- formats:
23
- default: "%a, %d. %b %Y %H:%M:%S %z"
24
- short: "%d. %b %H:%M"
25
- long: "%d. %B %Y %H:%M"
26
- am: "am"
27
- pm: "pm"
28
-
29
- support:
30
- array:
31
- words_connector: ", "
32
- two_words_connector: " und "
33
- last_word_connector: " und "
@@ -1,33 +0,0 @@
1
- en:
2
- date:
3
- formats:
4
- # Use the strftime parameters for formats.
5
- # When no format has been given, it uses default.
6
- # You can provide other formats here if you like!
7
- default: "%Y-%m-%d"
8
- short: "%b %d"
9
- long: "%B %d, %Y"
10
- only_day: "%e"
11
-
12
- day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
13
- abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
14
- month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December]
15
- abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
16
- order:
17
- - year
18
- - month
19
- - day
20
-
21
- time:
22
- formats:
23
- default: "%a, %d %b %Y %H:%M:%S %z"
24
- short: "%d %b %H:%M"
25
- long: "%B %d, %Y %H:%M"
26
- am: "am"
27
- pm: "pm"
28
-
29
- support:
30
- array:
31
- words_connector: ", "
32
- two_words_connector: " and "
33
- last_word_connector: ", and "
@@ -1,33 +0,0 @@
1
- es:
2
- date:
3
- formats:
4
- # Use the strftime parameters for formats.
5
- # When no format has been given, it uses default.
6
- # You can provide other formats here if you like!
7
- default: "%d-%m-%Y"
8
- short: "%b %d"
9
- long: "%B %d, %Y"
10
- only_day: "%e"
11
-
12
- day_names: [Domingo, Lunes, Martes, Miércoles, Jueves, Viernes, Sábado]
13
- abbr_day_names: [Dom, Lun, Mar, Mie, Jue, Vie, Sab]
14
- month_names: [~, Enero, Febrero, Marzo, Abril, Mayo, Junio, Julio, Agosto, Septiembre, Octubre, Noviembre, Diciembre]
15
- abbr_month_names: [~, Ene, Feb, Mar, Abr, May, Jun, Jul, Ago, Sep, Oct, Nov, Dic]
16
- order:
17
- - day
18
- - month
19
- - year
20
-
21
- time:
22
- formats:
23
- default: "%a, %d %b %Y %H:%M:%S %z"
24
- short: "%d %b %H:%M"
25
- long: "%B %d, %Y %H:%M"
26
- am: "am"
27
- pm: "pm"
28
-
29
- support:
30
- array:
31
- words_connector: ", "
32
- two_words_connector: " y "
33
- last_word_connector: ", y "
@@ -1,33 +0,0 @@
1
- fr:
2
- date:
3
- formats:
4
- # Use the strftime parameters for formats.
5
- # When no format has been given, it uses default.
6
- # You can provide other formats here if you like!
7
- default: "%d-%m-%Y"
8
- short: "%b %d"
9
- long: "%B %d, %Y"
10
- only_day: "%e"
11
-
12
- day_names: [Dimanche, Lundi, Mardi, Mercredi, Jeudi, Vendredi, Samedi]
13
- abbr_day_names: [Dim, Lun, Mar, Mer, Jeu, Ven, Sam]
14
- month_names: [~, Janvier, Février, Mars, Avril, Mai, Juin, Juillet, Août, Septembre, Octobre, Novembre, Décembre]
15
- abbr_month_names: [~, Jan, Fev, Mar, Avr, Mai, Jun, Jul, Aou, Sep, Oct, Nov, Dec]
16
- order:
17
- - day
18
- - month
19
- - year
20
-
21
- time:
22
- formats:
23
- default: "%a, %d %b %Y %H:%M:%S %z"
24
- short: "%d %b %H:%M"
25
- long: "%B %d, %Y %H:%M"
26
- am: "am"
27
- pm: "pm"
28
-
29
- support:
30
- array:
31
- words_connector: ", "
32
- two_words_connector: " et "
33
- last_word_connector: ", et "
@@ -1,33 +0,0 @@
1
- hu:
2
- date:
3
- formats:
4
- # Use the strftime parameters for formats.
5
- # When no format has been given, it uses default.
6
- # You can provide other formats here if you like!
7
- default: "%Y-%m-%d"
8
- short: "%b. %d."
9
- long: "%Y. %B %d."
10
- only_day: "%e"
11
-
12
- day_names: [vasárnap, hétfő, kedd, szerda, csütörtök, péntek, szombat]
13
- abbr_day_names: [vas, hét, kedd, sze, csüt, pén, szo]
14
- month_names: [~, január, február, március, április, május, június, július, augusztus, szeptember, oktober, november, december]
15
- abbr_month_names: [~, jan, febr, márc, ápr, máj, jún, júl, aug, szept, okt, nov, dec]
16
- order:
17
- - year
18
- - month
19
- - day
20
-
21
- time:
22
- formats:
23
- default: "%Y. %B %d. %H:%M:%S %z, %A"
24
- short: "%B %d. %H:%M"
25
- long: "%Y. %B %d. %H:%M"
26
- am: "de"
27
- pm: "du"
28
-
29
- support:
30
- array:
31
- words_connector: ", "
32
- two_words_connector: " és "
33
- last_word_connector: " és "
@@ -1,39 +0,0 @@
1
- it:
2
- date:
3
- formats:
4
- # Use the strftime parameters for formats.
5
- # When no format has been given, it uses default.
6
- # You can provide other formats here if you like!
7
- default: "%d-%m-%Y"
8
- short: "%d %b"
9
- long: "%d %B %Y"
10
- only_day: "%e"
11
-
12
- day_names: [Domenica, Lunedì, Martedì, Mercoledì, Giovedì, Venerdì, Sabato]
13
- abbr_day_names: [Dom, Lun, Mar, Mer, Gio, Ven, Sab]
14
- month_names: [~, Gennaio, Febbraio, Marzo, Aprile, Maggio, Giugno, Luglio, Agosto, Settembre, Ottobre, Novembre, Dicembre]
15
- abbr_month_names: [~, Gen, Feb, Mar, Apr, Mag, Giu, Lug, Ago, Set, Ott, Nov, Dic]
16
- order:
17
- - day
18
- - month
19
- - year
20
-
21
- time:
22
- formats:
23
- default: "%a %d %b %Y, %H:%M:%S %z"
24
- time: "%H:%M"
25
- short: "%d %b %H:%M"
26
- long: "%d %B %Y %H:%M"
27
- only_second: "%S"
28
-
29
- datetime:
30
- formats:
31
- default: "%d-%m-%YT%H:%M:%S%Z"
32
-
33
- am: 'am'
34
- pm: 'pm'
35
-
36
- support:
37
- array:
38
- sentence_connector: "e"
39
- skip_last_comma: false
@@ -1,33 +0,0 @@
1
- ja:
2
- date:
3
- formats:
4
- # Use the strftime parameters for formats.
5
- # When no format has been given, it uses default.
6
- # You can provide other formats here if you like!
7
- default: "%Y/%m/%d"
8
- short: "%m/%d"
9
- long: "%Y年%m月%d日"
10
- only_day: "%e"
11
-
12
- day_names: [日曜日, 月曜日, 火曜日, 水曜日, 木曜日, 金曜日, 土曜日]
13
- abbr_day_names: [日, 月, 火, 水, 木, 金, 土]
14
- month_names: [~, 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, 九月, 十月, 十一月, 十二月]
15
- abbr_month_names: [~, 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, 九月, 十月, 十一月, 十二月]
16
- order:
17
- - year
18
- - month
19
- - day
20
-
21
- time:
22
- formats:
23
- default: "%Y/%m/%d %H:%M:%S"
24
- short: "%m/%d %H:%M"
25
- long: "%Y年%m月%d日 %H時%M分%S秒"
26
- am: "午前"
27
- pm: "午後"
28
-
29
- support:
30
- array:
31
- words_connector: ", "
32
- two_words_connector: " と "
33
- last_word_connector: ", と "
@@ -1,33 +0,0 @@
1
- lv:
2
- date:
3
- formats:
4
- # Use the strftime parameters for formats.
5
- # When no format has been given, it uses default.
6
- # You can provide other formats here if you like!
7
- default: "%d.%m.%Y"
8
- short: "%e. %B"
9
- long: "%Y. gada %e. %B"
10
- only_day: "%e"
11
-
12
- day_names: [Svētdiena, Pirmdiena, Otrdiena, Trešdiena, Ceturtdiena, Piektdiena, Sestdiena]
13
- abbr_day_names: [Sv, P, O, T, C, P, S]
14
- month_names: [~, Janvāris, Februāris, Marts, Aprīlis, Maijs, Jūnijs, Jūlijs, Augusts, Septembris, Oktobris, Novembris, Decembris]
15
- abbr_month_names: [~, Janv, Febr, Marts, Apr, Maijs, Jūn, Jūl, Aug, Sept, Okt, Nov, Dec]
16
- order:
17
- - day
18
- - month
19
- - year
20
-
21
- time:
22
- formats:
23
- default: "%Y. gada %e. %B, %H:%M"
24
- short: "%d.%m.%Y, %H:%M"
25
- long: "%Y. gada %e. %B, %H:%M:%S"
26
- am: "priekšpusdiena"
27
- pm: "pēcpusdiena"
28
-
29
- support:
30
- array:
31
- words_connector: ", "
32
- two_words_connector: " un "
33
- last_word_connector: ", un "