padrino-admin 0.9.10 → 0.9.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/README.rdoc +1 -1
  2. data/Rakefile +4 -53
  3. data/lib/padrino-admin/access_control.rb +11 -21
  4. data/lib/padrino-admin/generators/admin_app.rb +1 -1
  5. data/lib/padrino-admin/generators/orm.rb +5 -5
  6. data/lib/padrino-admin/generators/templates/account/activerecord.rb.tt +3 -1
  7. data/lib/padrino-admin/generators/templates/account/couchrest.rb.tt +13 -6
  8. data/lib/padrino-admin/generators/templates/account/datamapper.rb.tt +22 -19
  9. data/lib/padrino-admin/generators/templates/account/mongoid.rb.tt +4 -2
  10. data/lib/padrino-admin/generators/templates/account/mongomapper.rb.tt +3 -1
  11. data/lib/padrino-admin/generators/templates/account/sequel.rb.tt +9 -6
  12. data/lib/padrino-admin/generators/templates/app/app.rb +23 -25
  13. data/lib/padrino-admin/generators/templates/app/controllers/base.rb +1 -1
  14. data/lib/padrino-admin/helpers/authentication_helpers.rb +2 -2
  15. data/lib/padrino-admin/locale/admin/cz.yml +16 -0
  16. data/lib/padrino-admin/locale/admin/es.yml +16 -0
  17. data/lib/padrino-admin/locale/admin/tr.yml +16 -0
  18. data/lib/padrino-admin/locale/admin/uk.yml +16 -0
  19. data/lib/padrino-admin/locale/orm/cz.yml +26 -0
  20. data/lib/padrino-admin/locale/orm/da.yml +9 -9
  21. data/lib/padrino-admin/locale/orm/de.yml +15 -15
  22. data/lib/padrino-admin/locale/orm/en.yml +9 -9
  23. data/lib/padrino-admin/locale/orm/es.yml +26 -0
  24. data/lib/padrino-admin/locale/orm/fr.yml +9 -9
  25. data/lib/padrino-admin/locale/orm/it.yml +9 -9
  26. data/lib/padrino-admin/locale/orm/pt_br.yml +9 -9
  27. data/lib/padrino-admin/locale/orm/ru.yml +9 -9
  28. data/lib/padrino-admin/locale/orm/tr.yml +26 -0
  29. data/lib/padrino-admin/locale/orm/uk.yml +26 -0
  30. data/lib/padrino-admin.rb +2 -7
  31. data/padrino-admin.gemspec +17 -128
  32. data/test/fixtures/data_mapper.rb +11 -9
  33. data/test/generators/test_admin_app_generator.rb +1 -1
  34. data/test/generators/test_admin_page_generator.rb +2 -2
  35. data/test/helper.rb +4 -4
  36. data/test/test_admin_application.rb +8 -8
  37. metadata +79 -42
@@ -0,0 +1,26 @@
1
+ es:
2
+ activemodel: &activemodel
3
+ errors:
4
+ messages:
5
+ inclusion: "no está incluido en la lista"
6
+ exclusion: "está reservado"
7
+ invalid: "es inválido"
8
+ confirmation: "no es igual a la confirmación"
9
+ accepted: "debe ser aceptado"
10
+ empty: "no puede estar vacío"
11
+ blank: "no puede estar en blanco"
12
+ too_long: "es demasiado largo (máximo %{count} caracteres)"
13
+ too_short: "es demasiado corto (minimo %{count} caracteres)"
14
+ wrong_length: "tiene una longitud incorrecta (debería tener %{count} caracteres)"
15
+ taken: "ya está tomado"
16
+ not_a_number: "no es un número"
17
+ greater_than: "debe ser mayor a %{count}"
18
+ greater_than_or_equal_to: "debe ser igual o mayor a %{count}"
19
+ equal_to: "debe ser igual a %{count}"
20
+ less_than: "debe ser menor a %{count}"
21
+ less_than_or_equal_to: "debe ser igual o menor a %{count}"
22
+ odd: "debe ser impar"
23
+ even: "debe ser par"
24
+ record_invalid: "Fallo la validación: %{errors}"
25
+ content_type: "formato de archivo no soportado"
26
+ activerecord: *activemodel
@@ -9,18 +9,18 @@ fr:
9
9
  accepted: "doit être accepté"
10
10
  empty: "ne peux pas être vide"
11
11
  blank: "ne peux pas être vide"
12
- too_long: "est trop long (le maximum est de {{count}} caractères)"
13
- too_short: "est trop court (le minimum est de {{count}} caractères)"
14
- wrong_length: "n'est pas de bonne longueur (devrait être long de {{count}} caractères)"
12
+ too_long: "est trop long (le maximum est de %{count} caractères)"
13
+ too_short: "est trop court (le minimum est de %{count} caractères)"
14
+ wrong_length: "n'est pas de bonne longueur (devrait être long de %{count} caractères)"
15
15
  taken: "n'est pas disponible"
16
16
  not_a_number: "n'est pas un nombre"
17
- greater_than: "doit être supèrieur à {{count}}"
18
- greater_than_or_equal_to: "doit être supèrieur ou égal à {{count}}"
19
- equal_to: "doit être égal à {{count}}"
20
- less_than: "doit être infèrieur à {{count}}"
21
- less_than_or_equal_to: "doit être infèrieur ou égal à {{count}}"
17
+ greater_than: "doit être supèrieur à %{count}"
18
+ greater_than_or_equal_to: "doit être supèrieur ou égal à %{count}"
19
+ equal_to: "doit être égal à %{count}"
20
+ less_than: "doit être infèrieur à %{count}"
21
+ less_than_or_equal_to: "doit être infèrieur ou égal à %{count}"
22
22
  odd: "doit être impair"
23
23
  even: "doit être pair"
24
- record_invalid: "La validation a échoué: {{errors}}"
24
+ record_invalid: "La validation a échoué: %{errors}"
25
25
  content_type: "format de fichier non pris en charge"
26
26
  activerecord: *activemodel
@@ -9,18 +9,18 @@ it:
9
9
  accepted: "deve essere accettata"
10
10
  empty: "non può essere vuoto"
11
11
  blank: "non può essere lasciato in bianco"
12
- too_long: "è troppo lungo (il massimo è {{count}} lettere)"
13
- too_short: "è troppo corto (il minimo è {{count}} lettere)"
14
- wrong_length: "è della lunghezza sbagliata (deve essere di {{count}} lettere)"
12
+ too_long: "è troppo lungo (il massimo è %{count} lettere)"
13
+ too_short: "è troppo corto (il minimo è %{count} lettere)"
14
+ wrong_length: "è della lunghezza sbagliata (deve essere di %{count} lettere)"
15
15
  taken: "è già in uso"
16
16
  not_a_number: "non è un numero"
17
- greater_than: "deve essere superiore a {{count}}"
18
- greater_than_or_equal_to: "deve essere superiore o uguale a {{count}}"
19
- equal_to: "deve essere uguale a {{count}}"
20
- less_than: "deve essere meno di {{count}}"
21
- less_than_or_equal_to: "deve essere meno o uguale a {{count}}"
17
+ greater_than: "deve essere superiore a %{count}"
18
+ greater_than_or_equal_to: "deve essere superiore o uguale a %{count}"
19
+ equal_to: "deve essere uguale a %{count}"
20
+ less_than: "deve essere meno di %{count}"
21
+ less_than_or_equal_to: "deve essere meno o uguale a %{count}"
22
22
  odd: "deve essere dispari"
23
23
  even: "deve essere pari"
24
- record_invalid: "Validazione fallita: {{errors}}"
24
+ record_invalid: "Validazione fallita: %{errors}"
25
25
  content_type: "il seguente tipo di file non è supportato"
26
26
  activerecord: *activemodel
@@ -9,18 +9,18 @@ pt_br:
9
9
  accepted: "deve ser aceita"
10
10
  empty: "não pode estar vazio"
11
11
  blank: "não pode ser deixado em branco"
12
- too_long: "é longo demais (o máximo são {{count}} letras)"
13
- too_short: "é curto demais (o mínimo são {{count}} letras)"
14
- wrong_length: "o comprimento está errado (deve ser de {{count}} letras)"
12
+ too_long: "é longo demais (o máximo são %{count} letras)"
13
+ too_short: "é curto demais (o mínimo são %{count} letras)"
14
+ wrong_length: "o comprimento está errado (deve ser de %{count} letras)"
15
15
  taken: "já está em uso"
16
16
  not_a_number: "não é um número"
17
- greater_than: "deve ser maior que {{count}}"
18
- greater_than_or_equal_to: "deve ser maior ou igual a {{count}}"
19
- equal_to: "deve ser igual a {{count}}"
20
- less_than: "deve ser menor que {{count}}"
21
- less_than_or_equal_to: "deve ser menor ou igual a {{count}}"
17
+ greater_than: "deve ser maior que %{count}"
18
+ greater_than_or_equal_to: "deve ser maior ou igual a %{count}"
19
+ equal_to: "deve ser igual a %{count}"
20
+ less_than: "deve ser menor que %{count}"
21
+ less_than_or_equal_to: "deve ser menor ou igual a %{count}"
22
22
  odd: "deve ser ímpar"
23
23
  even: "deve ser par"
24
- record_invalid: "Falha na validação: {{errors}}"
24
+ record_invalid: "Falha na validação: %{errors}"
25
25
  content_type: "o seguinte tipo de arquivo não é suportado"
26
26
  activerecord: *activemodel
@@ -9,18 +9,18 @@ ru:
9
9
  accepted: "должно быть принято"
10
10
  empty: "не может быть пустым"
11
11
  blank: "не может быть пустым"
12
- too_long: "превышает длину (максимум {{count}} символов)"
13
- too_short: "недостатночной длины (минимум {{count}} символов)"
14
- wrong_length: "неправильной длины (должно быть {{count}} символов)"
12
+ too_long: "превышает длину (максимум %{count} символов)"
13
+ too_short: "недостатночной длины (минимум %{count} символов)"
14
+ wrong_length: "неправильной длины (должно быть %{count} символов)"
15
15
  taken: "уже занят"
16
16
  not_a_number: "не число"
17
- greater_than: "должно быть больше {{count}}"
18
- greater_than_or_equal_to: "должно быть не менее {{count}}"
19
- equal_to: "должно быть равно {{count}}"
20
- less_than: "должно быть меньше {{count}}"
21
- less_than_or_equal_to: "должно быть не более {{count}}"
17
+ greater_than: "должно быть больше %{count}"
18
+ greater_than_or_equal_to: "должно быть не менее %{count}"
19
+ equal_to: "должно быть равно %{count}"
20
+ less_than: "должно быть меньше %{count}"
21
+ less_than_or_equal_to: "должно быть не более %{count}"
22
22
  odd: "должно быть нечетным"
23
23
  even: "должно быть четным"
24
- record_invalid: "Проверка не удалась: {{errors}}"
24
+ record_invalid: "Проверка не удалась: %{errors}"
25
25
  content_type: "формат файла не поддерживается"
26
26
  activerecord: *activemodel
@@ -0,0 +1,26 @@
1
+ tr:
2
+ activemodel: &activemodel
3
+ errors:
4
+ messages:
5
+ inclusion: "listede yok"
6
+ exclusion: "ayrılmış"
7
+ invalid: "geçerli değil"
8
+ confirmation: "onaylananla uyuşmuyor"
9
+ accepted: "kabul edilmeli"
10
+ empty: "boş olamaz"
11
+ blank: "boş bırakılamaz"
12
+ too_long: "uzun (en fazla %{count} karakter)"
13
+ too_short: "kısa (en az %{count} karakter)"
14
+ wrong_length: "yanlış uzunluk (%{count} karakter olmalı)"
15
+ taken: "zaten alınmış"
16
+ not_a_number: "sayı değil"
17
+ greater_than: "%{count}'den büyük olmalı"
18
+ greater_than_or_equal_to: "%{count}'den büyük veya eşit olmalı"
19
+ equal_to: "%{count}'e eşit olmalı"
20
+ less_than: "%{count}'den küçük olmalı"
21
+ less_than_or_equal_to: "%{count}'den küçük veya eşit olmalı"
22
+ odd: "tek olmalı"
23
+ even: "çift olmalı"
24
+ record_invalid: "Doğrulama gerçekleşmedi: %{errors}"
25
+ content_type: "Dosya biçimi desteklenmiyor"
26
+ activerecord: *activemodel
@@ -0,0 +1,26 @@
1
+ uk:
2
+ activemodel: &activemodel
3
+ errors:
4
+ messages:
5
+ inclusion: "не входить у список"
6
+ exclusion: "зарезервовано"
7
+ invalid: "недійсний"
8
+ confirmation: "не збігається з підтвердженням"
9
+ accepted: "повинно бути прийняте"
10
+ empty: "не може бути порожнім"
11
+ blank: "не може бути порожнім"
12
+ too_long: "занадто довгий (максимум %{count} символів)"
13
+ too_short: "занадто короткий(мінімум %{count} символів)"
14
+ wrong_length: "неправильної довжини (повинно бути %{count} символів)"
15
+ taken: "вже зайнятий"
16
+ not_a_number: "не число"
17
+ greater_than: "повинно бути більше %{count}"
18
+ greater_than_or_equal_to: "повинно бути не менше %{count}"
19
+ equal_to: "повинно дорівнювати %{count}"
20
+ less_than: "повинно бути менше %{count}"
21
+ less_than_or_equal_to: "повинно бути не більше %{count}"
22
+ odd: "повинно бути непарним"
23
+ even: "повинно бути парним"
24
+ record_invalid: "Перевірка не вдалася: %{errors}"
25
+ content_type: "формат файлу не підтримується"
26
+ activerecord: *activemodel
data/lib/padrino-admin.rb CHANGED
@@ -2,8 +2,8 @@ require 'padrino-core'
2
2
  require 'padrino-gen'
3
3
  require 'padrino-helpers'
4
4
 
5
- Dir[File.dirname(__FILE__) + '/padrino-admin/*.rb'].each { |file| require file }
6
- Dir[File.dirname(__FILE__) + '/padrino-admin/{helpers,utils}/*.rb'].each { |file| require file }
5
+ FileSet.glob_require('padrino-admin/*.rb', __FILE__)
6
+ FileSet.glob_require('padrino-admin/{helpers,utils}/*.rb', __FILE__)
7
7
 
8
8
  module Padrino
9
9
  ##
@@ -22,11 +22,6 @@ end
22
22
  #
23
23
  String.send(:include, Padrino::Admin::Utils::Crypt)
24
24
 
25
- ##
26
- # We need to add to Padrino::Application a +access_control+ class
27
- #
28
- Padrino::Application.extend(Padrino::Admin::AccessControl::ClassMethods)
29
-
30
25
  ##
31
26
  # Load our Padrino::Admin locales
32
27
  #
@@ -1,135 +1,24 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
1
+ require File.expand_path("../../padrino-core/lib/padrino-core/version.rb", __FILE__)
2
+ require 'rubygems'
3
+ require 'bundler'
5
4
 
6
5
  Gem::Specification.new do |s|
7
6
  s.name = %q{padrino-admin}
8
- s.version = "0.9.10"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
7
+ s.rubyforge_project = %q{padrino-admin}
11
8
  s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
12
- s.date = %q{2010-04-22}
13
- s.description = %q{Admin View for Padrino applications}
14
9
  s.email = %q{padrinorb@gmail.com}
15
- s.extra_rdoc_files = [
16
- "README.rdoc"
17
- ]
18
- s.files = [
19
- ".document",
20
- ".gitignore",
21
- "LICENSE",
22
- "README.rdoc",
23
- "Rakefile",
24
- "lib/padrino-admin.rb",
25
- "lib/padrino-admin/access_control.rb",
26
- "lib/padrino-admin/generators/actions.rb",
27
- "lib/padrino-admin/generators/admin_app.rb",
28
- "lib/padrino-admin/generators/admin_page.rb",
29
- "lib/padrino-admin/generators/orm.rb",
30
- "lib/padrino-admin/generators/templates/account/activerecord.rb.tt",
31
- "lib/padrino-admin/generators/templates/account/couchrest.rb.tt",
32
- "lib/padrino-admin/generators/templates/account/datamapper.rb.tt",
33
- "lib/padrino-admin/generators/templates/account/mongoid.rb.tt",
34
- "lib/padrino-admin/generators/templates/account/mongomapper.rb.tt",
35
- "lib/padrino-admin/generators/templates/account/seeds.rb.tt",
36
- "lib/padrino-admin/generators/templates/account/sequel.rb.tt",
37
- "lib/padrino-admin/generators/templates/app/app.rb",
38
- "lib/padrino-admin/generators/templates/app/controllers/base.rb",
39
- "lib/padrino-admin/generators/templates/app/controllers/sessions.rb",
40
- "lib/padrino-admin/generators/templates/assets/stylesheets/base.css",
41
- "lib/padrino-admin/generators/templates/assets/stylesheets/themes/amro/style.css",
42
- "lib/padrino-admin/generators/templates/assets/stylesheets/themes/bec-green/style.css",
43
- "lib/padrino-admin/generators/templates/assets/stylesheets/themes/bec/style.css",
44
- "lib/padrino-admin/generators/templates/assets/stylesheets/themes/blue/style.css",
45
- "lib/padrino-admin/generators/templates/assets/stylesheets/themes/default/style.css",
46
- "lib/padrino-admin/generators/templates/assets/stylesheets/themes/djime-cerulean/style.css",
47
- "lib/padrino-admin/generators/templates/assets/stylesheets/themes/kathleene/style.css",
48
- "lib/padrino-admin/generators/templates/assets/stylesheets/themes/olive/style.css",
49
- "lib/padrino-admin/generators/templates/assets/stylesheets/themes/orange/style.css",
50
- "lib/padrino-admin/generators/templates/assets/stylesheets/themes/reidb-greenish/style.css",
51
- "lib/padrino-admin/generators/templates/assets/stylesheets/themes/ruby/style.css",
52
- "lib/padrino-admin/generators/templates/assets/stylesheets/themes/warehouse/style.css",
53
- "lib/padrino-admin/generators/templates/erb/app/base/_sidebar.erb.tt",
54
- "lib/padrino-admin/generators/templates/erb/app/base/index.erb.tt",
55
- "lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt",
56
- "lib/padrino-admin/generators/templates/erb/app/sessions/new.erb.tt",
57
- "lib/padrino-admin/generators/templates/erb/page/_form.erb.tt",
58
- "lib/padrino-admin/generators/templates/erb/page/edit.erb.tt",
59
- "lib/padrino-admin/generators/templates/erb/page/index.erb.tt",
60
- "lib/padrino-admin/generators/templates/erb/page/new.erb.tt",
61
- "lib/padrino-admin/generators/templates/haml/app/base/_sidebar.haml.tt",
62
- "lib/padrino-admin/generators/templates/haml/app/base/index.haml.tt",
63
- "lib/padrino-admin/generators/templates/haml/app/layouts/application.haml.tt",
64
- "lib/padrino-admin/generators/templates/haml/app/sessions/new.haml.tt",
65
- "lib/padrino-admin/generators/templates/haml/page/_form.haml.tt",
66
- "lib/padrino-admin/generators/templates/haml/page/edit.haml.tt",
67
- "lib/padrino-admin/generators/templates/haml/page/index.haml.tt",
68
- "lib/padrino-admin/generators/templates/haml/page/new.haml.tt",
69
- "lib/padrino-admin/generators/templates/page/controller.rb.tt",
70
- "lib/padrino-admin/helpers/authentication_helpers.rb",
71
- "lib/padrino-admin/helpers/view_helpers.rb",
72
- "lib/padrino-admin/locale/admin/da.yml",
73
- "lib/padrino-admin/locale/admin/de.yml",
74
- "lib/padrino-admin/locale/admin/en.yml",
75
- "lib/padrino-admin/locale/admin/fr.yml",
76
- "lib/padrino-admin/locale/admin/it.yml",
77
- "lib/padrino-admin/locale/admin/pt_br.yml",
78
- "lib/padrino-admin/locale/admin/ru.yml",
79
- "lib/padrino-admin/locale/orm/da.yml",
80
- "lib/padrino-admin/locale/orm/de.yml",
81
- "lib/padrino-admin/locale/orm/en.yml",
82
- "lib/padrino-admin/locale/orm/fr.yml",
83
- "lib/padrino-admin/locale/orm/it.yml",
84
- "lib/padrino-admin/locale/orm/pt_br.yml",
85
- "lib/padrino-admin/locale/orm/ru.yml",
86
- "lib/padrino-admin/utils/crypt.rb",
87
- "padrino-admin.gemspec",
88
- "test/fixtures/data_mapper.rb",
89
- "test/generators/test_admin_app_generator.rb",
90
- "test/generators/test_admin_page_generator.rb",
91
- "test/helper.rb",
92
- "test/test_admin_application.rb"
93
- ]
10
+ s.summary = %q{Admin Dashboard for Padrino}
94
11
  s.homepage = %q{http://github.com/padrino/padrino-framework/tree/master/padrino-admin}
12
+ s.description = %q{Admin View for Padrino applications}
13
+ s.required_rubygems_version = ">= 1.3.6"
14
+ s.version = Padrino.version
15
+ s.date = Time.now.strftime("%Y-%m-%d")
16
+ s.extra_rdoc_files = Dir["*.rdoc"]
17
+ s.files = %w(.document .gitignore LICENSE README.rdoc Rakefile padrino-admin.gemspec) + Dir.glob("{bin,lib,test}/**/*")
95
18
  s.rdoc_options = ["--charset=UTF-8"]
96
- s.require_paths = ["lib"]
97
- s.rubyforge_project = %q{padrino-admin}
98
- s.rubygems_version = %q{1.3.6}
99
- s.summary = %q{Admin Dashboard for Padrino}
100
-
101
- if s.respond_to? :specification_version then
102
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
103
- s.specification_version = 3
104
-
105
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
106
- s.add_runtime_dependency(%q<padrino-core>, ["= 0.9.10"])
107
- s.add_runtime_dependency(%q<padrino-gen>, ["= 0.9.10"])
108
- s.add_runtime_dependency(%q<padrino-helpers>, ["= 0.9.10"])
109
- s.add_development_dependency(%q<haml>, [">= 2.2.1"])
110
- s.add_development_dependency(%q<shoulda>, [">= 0"])
111
- s.add_development_dependency(%q<mocha>, [">= 0.9.7"])
112
- s.add_development_dependency(%q<rack-test>, [">= 0.5.0"])
113
- s.add_development_dependency(%q<webrat>, [">= 0.5.1"])
114
- else
115
- s.add_dependency(%q<padrino-core>, ["= 0.9.10"])
116
- s.add_dependency(%q<padrino-gen>, ["= 0.9.10"])
117
- s.add_dependency(%q<padrino-helpers>, ["= 0.9.10"])
118
- s.add_dependency(%q<haml>, [">= 2.2.1"])
119
- s.add_dependency(%q<shoulda>, [">= 0"])
120
- s.add_dependency(%q<mocha>, [">= 0.9.7"])
121
- s.add_dependency(%q<rack-test>, [">= 0.5.0"])
122
- s.add_dependency(%q<webrat>, [">= 0.5.1"])
123
- end
124
- else
125
- s.add_dependency(%q<padrino-core>, ["= 0.9.10"])
126
- s.add_dependency(%q<padrino-gen>, ["= 0.9.10"])
127
- s.add_dependency(%q<padrino-helpers>, ["= 0.9.10"])
128
- s.add_dependency(%q<haml>, [">= 2.2.1"])
129
- s.add_dependency(%q<shoulda>, [">= 0"])
130
- s.add_dependency(%q<mocha>, [">= 0.9.7"])
131
- s.add_dependency(%q<rack-test>, [">= 0.5.0"])
132
- s.add_dependency(%q<webrat>, [">= 0.5.1"])
133
- end
134
- end
135
-
19
+ s.require_path = 'lib'
20
+ s.add_runtime_dependency(%q<padrino-core>, ["= #{Padrino.version}"])
21
+ s.add_runtime_dependency(%q<padrino-gen>, ["= #{Padrino.version}"])
22
+ s.add_runtime_dependency(%q<padrino-helpers>, ["= #{Padrino.version}"])
23
+ s.add_bundler_dependencies :development
24
+ end
@@ -1,6 +1,8 @@
1
1
  require 'dm-core'
2
+ require 'dm-migrations'
2
3
  require 'dm-validations'
3
4
  require 'dm-aggregates'
5
+ require 'digest/sha1'
4
6
 
5
7
  DataMapper.setup(:default, 'sqlite3::memory:')
6
8
 
@@ -28,15 +30,15 @@ class Account
28
30
  property :role, String
29
31
 
30
32
  # Validations
31
- validates_present :email, :role
32
- validates_present :password, :if => :password_required
33
- validates_present :password_confirmation, :if => :password_required
34
- validates_length :password, :min => 4, :max => 40, :if => :password_required
35
- validates_is_confirmed :password, :if => :password_required
36
- validates_length :email, :min => 3, :max => 100
37
- validates_is_unique :email, :case_sensitive => false
38
- validates_format :email, :with => :email_address
39
- validates_format :role, :with => /[A-Za-z]/
33
+ validates_presence_of :email, :role
34
+ validates_presence_of :password, :if => :password_required
35
+ validates_presence_of :password_confirmation, :if => :password_required
36
+ validates_length_of :password, :min => 4, :max => 40, :if => :password_required
37
+ validates_confirmation_of :password, :if => :password_required
38
+ validates_length_of :email, :min => 3, :max => 100
39
+ validates_uniqueness_of :email, :case_sensitive => false
40
+ validates_format_of :email, :with => :email_address
41
+ validates_format_of :role, :with => /[A-Za-z]/
40
42
 
41
43
  has n, :categories
42
44
  def self.admin; first(:role => "admin"); end
@@ -25,7 +25,7 @@ class TestAdminAppGenerator < Test::Unit::TestCase
25
25
  end
26
26
 
27
27
  should 'correctyl generate a new padrino admin application with default renderer' do
28
- assert_nothing_raised { silence_logger { generate(:project, 'sample_project', '--root=/tmp', '-d=activerecord') } }
28
+ assert_nothing_raised { silence_logger { generate(:project, 'sample_project', '--root=/tmp', '-d=activerecord', '-e=haml') } }
29
29
  assert_nothing_raised { silence_logger { generate(:admin_app, '--root=/tmp/sample_project') } }
30
30
  assert_file_exists('/tmp/sample_project')
31
31
  assert_file_exists('/tmp/sample_project/admin')
@@ -33,7 +33,7 @@ class TestAdminPageGenerator < Test::Unit::TestCase
33
33
  end
34
34
 
35
35
  should 'correctly generate a new padrino admin application default renderer' do
36
- silence_logger { generate(:project, 'sample_project', '--root=/tmp', '-d=datamapper') }
36
+ silence_logger { generate(:project, 'sample_project', '--root=/tmp', '-d=datamapper','-e=haml') }
37
37
  silence_logger { generate(:admin_app, '--root=/tmp/sample_project') }
38
38
  silence_logger { generate(:model, 'person', "name:string", "age:integer", "email:string", '-root=/tmp/sample_project') }
39
39
  silence_logger { generate(:admin_page, 'person', '--root=/tmp/sample_project') }
@@ -67,7 +67,7 @@ class TestAdminPageGenerator < Test::Unit::TestCase
67
67
  end
68
68
 
69
69
  should 'correctly generate a new padrino admin application with multiple models' do
70
- silence_logger { generate(:project, 'sample_project', '--root=/tmp', '-d=datamapper') }
70
+ silence_logger { generate(:project, 'sample_project', '--root=/tmp', '-d=datamapper','-e=haml') }
71
71
  silence_logger { generate(:admin_app, '--root=/tmp/sample_project') }
72
72
  silence_logger { generate(:model, 'person', "name:string", "age:integer", "email:string", '-root=/tmp/sample_project') }
73
73
  silence_logger { generate(:model, 'page', "name:string", "body:string", '-root=/tmp/sample_project') }
data/test/helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  ENV['PADRINO_ENV'] = 'test'
2
2
  PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
3
3
 
4
- require 'rubygems'
4
+ require File.expand_path('../../../load_paths', __FILE__)
5
5
  require 'test/unit'
6
6
  require 'rack/test'
7
7
  require 'rack'
@@ -15,7 +15,7 @@ require 'thor/group'
15
15
  end
16
16
  end
17
17
 
18
- require 'padrino-core/support_lite'
18
+ require 'padrino-core/support_lite' unless defined?(SupportLite)
19
19
  require 'padrino-admin'
20
20
 
21
21
  Padrino::Generators.load_components!
@@ -54,13 +54,13 @@ class Test::Unit::TestCase
54
54
  def mock_app(base=Padrino::Application, &block)
55
55
  @app = Sinatra.new(base, &block)
56
56
  @app.send :include, Test::Unit::Assertions
57
- @app.use Rack::Session::Cookie if Sinatra::VERSION =~ /0\.9\.\d+/ # Need this because Sinatra 0.9.x have use Rack::Session::Cookie if sessions? && !test?
57
+ @app.register Padrino::Helpers
58
58
  end
59
59
 
60
60
  def app
61
61
  Rack::Lint.new(@app)
62
62
  end
63
-
63
+
64
64
  # generate(:admin_app, '-r=/tmp/sample_project')
65
65
  def generate(name, *params)
66
66
  "Padrino::Generators::#{name.to_s.camelize}".constantize.start(params)
@@ -8,7 +8,7 @@ class TestAdminApplication < Test::Unit::TestCase
8
8
 
9
9
  should 'require correctly login' do
10
10
  mock_app do
11
- enable :authentication
11
+ register Padrino::Admin::AccessControl
12
12
 
13
13
  # Do a simple mapping
14
14
  access_control.roles_for :any do |role|
@@ -35,7 +35,7 @@ class TestAdminApplication < Test::Unit::TestCase
35
35
  should 'set basic roles with store location and login page' do
36
36
  mock_app do
37
37
  set :app_name, :basic_app
38
- enable :authentication
38
+ register Padrino::Admin::AccessControl
39
39
  enable :store_location
40
40
  set :login_page, "/login"
41
41
 
@@ -69,7 +69,7 @@ class TestAdminApplication < Test::Unit::TestCase
69
69
 
70
70
  should 'set advanced roles with store location and login page' do
71
71
  mock_app do
72
- enable :authentication
72
+ register Padrino::Admin::AccessControl
73
73
 
74
74
  access_control.roles_for :any do |role|
75
75
  role.protect "/"
@@ -96,7 +96,7 @@ class TestAdminApplication < Test::Unit::TestCase
96
96
  assert access_control.allowed?(Account.editor, "/posts")
97
97
 
98
98
  # Prepare a basic page
99
- get "/login/(:role)" do
99
+ get "/login(/:role)" do
100
100
  set_current_account(Account.send(params[:role])) if params[:role]
101
101
  "logged as #{params[:role] || "any"}"
102
102
  end
@@ -106,7 +106,7 @@ class TestAdminApplication < Test::Unit::TestCase
106
106
  get "/posts" do; "posts"; end
107
107
  end
108
108
 
109
- get "/login/"
109
+ get "/login"
110
110
  assert_equal "logged as any", body
111
111
 
112
112
  get "/any"
@@ -145,7 +145,7 @@ class TestAdminApplication < Test::Unit::TestCase
145
145
 
146
146
  should 'emulate an ecommerce app' do
147
147
  mock_app do
148
- enable :authentication
148
+ register Padrino::Admin::AccessControl
149
149
 
150
150
  access_control.roles_for :any do |role|
151
151
  role.protect "/cart"
@@ -195,7 +195,7 @@ class TestAdminApplication < Test::Unit::TestCase
195
195
 
196
196
  should 'check access control helper' do
197
197
  mock_app do
198
- enable :authentication
198
+ register Padrino::Admin::AccessControl
199
199
 
200
200
  access_control.roles_for :any do |role|
201
201
  role.project_module :foo, "/foo"
@@ -243,4 +243,4 @@ class TestAdminApplication < Test::Unit::TestCase
243
243
  get "/modules"
244
244
  assert_equal "admin => /admin", body
245
245
  end
246
- end
246
+ end unless RUBY_PLATFORM =~ /java/ # DM seems to have some problems on JRuby