tennpipes-su 3.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.rdoc +70 -0
  4. data/Rakefile +22 -0
  5. data/lib/tennpipes-su.rb +35 -0
  6. data/lib/tennpipes-su/access_control.rb +191 -0
  7. data/lib/tennpipes-su/bootstrap-less/alerts.less +67 -0
  8. data/lib/tennpipes-su/bootstrap-less/badges.less +55 -0
  9. data/lib/tennpipes-su/bootstrap-less/bootstrap.less +49 -0
  10. data/lib/tennpipes-su/bootstrap-less/breadcrumbs.less +26 -0
  11. data/lib/tennpipes-su/bootstrap-less/button-groups.less +226 -0
  12. data/lib/tennpipes-su/bootstrap-less/buttons.less +155 -0
  13. data/lib/tennpipes-su/bootstrap-less/carousel.less +232 -0
  14. data/lib/tennpipes-su/bootstrap-less/close.less +33 -0
  15. data/lib/tennpipes-su/bootstrap-less/code.less +63 -0
  16. data/lib/tennpipes-su/bootstrap-less/component-animations.less +29 -0
  17. data/lib/tennpipes-su/bootstrap-less/dropdowns.less +213 -0
  18. data/lib/tennpipes-su/bootstrap-less/font-awesome/bordered-pulled.less +16 -0
  19. data/lib/tennpipes-su/bootstrap-less/font-awesome/core.less +12 -0
  20. data/lib/tennpipes-su/bootstrap-less/font-awesome/fixed-width.less +6 -0
  21. data/lib/tennpipes-su/bootstrap-less/font-awesome/font-awesome.less +17 -0
  22. data/lib/tennpipes-su/bootstrap-less/font-awesome/icons.less +412 -0
  23. data/lib/tennpipes-su/bootstrap-less/font-awesome/larger.less +13 -0
  24. data/lib/tennpipes-su/bootstrap-less/font-awesome/list.less +19 -0
  25. data/lib/tennpipes-su/bootstrap-less/font-awesome/mixins.less +20 -0
  26. data/lib/tennpipes-su/bootstrap-less/font-awesome/path.less +14 -0
  27. data/lib/tennpipes-su/bootstrap-less/font-awesome/rotated-flipped.less +9 -0
  28. data/lib/tennpipes-su/bootstrap-less/font-awesome/spinning.less +30 -0
  29. data/lib/tennpipes-su/bootstrap-less/font-awesome/stacked.less +20 -0
  30. data/lib/tennpipes-su/bootstrap-less/font-awesome/variables.less +381 -0
  31. data/lib/tennpipes-su/bootstrap-less/forms.less +419 -0
  32. data/lib/tennpipes-su/bootstrap-less/glyphicons.less +233 -0
  33. data/lib/tennpipes-su/bootstrap-less/grid.less +100 -0
  34. data/lib/tennpipes-su/bootstrap-less/input-groups.less +157 -0
  35. data/lib/tennpipes-su/bootstrap-less/jumbotron.less +44 -0
  36. data/lib/tennpipes-su/bootstrap-less/labels.less +64 -0
  37. data/lib/tennpipes-su/bootstrap-less/list-group.less +110 -0
  38. data/lib/tennpipes-su/bootstrap-less/media.less +56 -0
  39. data/lib/tennpipes-su/bootstrap-less/mixins.less +926 -0
  40. data/lib/tennpipes-su/bootstrap-less/modals.less +138 -0
  41. data/lib/tennpipes-su/bootstrap-less/navbar.less +616 -0
  42. data/lib/tennpipes-su/bootstrap-less/navs.less +242 -0
  43. data/lib/tennpipes-su/bootstrap-less/normalize.less +423 -0
  44. data/lib/tennpipes-su/bootstrap-less/pager.less +55 -0
  45. data/lib/tennpipes-su/bootstrap-less/pagination.less +88 -0
  46. data/lib/tennpipes-su/bootstrap-less/panels.less +230 -0
  47. data/lib/tennpipes-su/bootstrap-less/popovers.less +133 -0
  48. data/lib/tennpipes-su/bootstrap-less/print.less +101 -0
  49. data/lib/tennpipes-su/bootstrap-less/progress-bars.less +80 -0
  50. data/lib/tennpipes-su/bootstrap-less/responsive-utilities.less +93 -0
  51. data/lib/tennpipes-su/bootstrap-less/scaffolding.less +134 -0
  52. data/lib/tennpipes-su/bootstrap-less/tables.less +233 -0
  53. data/lib/tennpipes-su/bootstrap-less/tennpipes-su.less +18 -0
  54. data/lib/tennpipes-su/bootstrap-less/theme.less +247 -0
  55. data/lib/tennpipes-su/bootstrap-less/thumbnails.less +36 -0
  56. data/lib/tennpipes-su/bootstrap-less/tooltip.less +95 -0
  57. data/lib/tennpipes-su/bootstrap-less/type.less +296 -0
  58. data/lib/tennpipes-su/bootstrap-less/utilities.less +56 -0
  59. data/lib/tennpipes-su/bootstrap-less/variables.less +827 -0
  60. data/lib/tennpipes-su/bootstrap-less/wells.less +29 -0
  61. data/lib/tennpipes-su/generators/actions.rb +78 -0
  62. data/lib/tennpipes-su/generators/admin_app.rb +169 -0
  63. data/lib/tennpipes-su/generators/admin_page.rb +68 -0
  64. data/lib/tennpipes-su/generators/orm.rb +172 -0
  65. data/lib/tennpipes-su/generators/templates/account/activerecord.rb.tt +41 -0
  66. data/lib/tennpipes-su/generators/templates/account/couchrest.rb.tt +67 -0
  67. data/lib/tennpipes-su/generators/templates/account/datamapper.rb.tt +56 -0
  68. data/lib/tennpipes-su/generators/templates/account/dynamoid.rb.tt +55 -0
  69. data/lib/tennpipes-su/generators/templates/account/minirecord.rb.tt +44 -0
  70. data/lib/tennpipes-su/generators/templates/account/mongoid.rb.tt +54 -0
  71. data/lib/tennpipes-su/generators/templates/account/mongomapper.rb.tt +47 -0
  72. data/lib/tennpipes-su/generators/templates/account/ohm.rb.tt +70 -0
  73. data/lib/tennpipes-su/generators/templates/account/seeds.rb.tt +29 -0
  74. data/lib/tennpipes-su/generators/templates/account/sequel.rb.tt +53 -0
  75. data/lib/tennpipes-su/generators/templates/app.rb.tt +42 -0
  76. data/lib/tennpipes-su/generators/templates/app/controllers/base.rb.tt +5 -0
  77. data/lib/tennpipes-su/generators/templates/app/controllers/sessions.rb.tt +29 -0
  78. data/lib/tennpipes-su/generators/templates/assets/images/favicon.ico +0 -0
  79. data/lib/tennpipes-su/generators/templates/assets/images/font/FontAwesome.otf +0 -0
  80. data/lib/tennpipes-su/generators/templates/assets/images/font/fontawesome-webfont.eot +0 -0
  81. data/lib/tennpipes-su/generators/templates/assets/images/font/fontawesome-webfont.svg +414 -0
  82. data/lib/tennpipes-su/generators/templates/assets/images/font/fontawesome-webfont.ttf +0 -0
  83. data/lib/tennpipes-su/generators/templates/assets/images/font/fontawesome-webfont.woff +0 -0
  84. data/lib/tennpipes-su/generators/templates/assets/images/logo.png +0 -0
  85. data/lib/tennpipes-su/generators/templates/assets/javascripts/application.js +118 -0
  86. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/affix.js +137 -0
  87. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/alert.js +88 -0
  88. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/bootstrap.min.js +6 -0
  89. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/button.js +107 -0
  90. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/carousel.js +205 -0
  91. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/collapse.js +170 -0
  92. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/dropdown.js +147 -0
  93. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/modal.js +243 -0
  94. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/popover.js +110 -0
  95. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/scrollspy.js +153 -0
  96. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/tab.js +125 -0
  97. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/tooltip.js +399 -0
  98. data/lib/tennpipes-su/generators/templates/assets/javascripts/bootstrap/transition.js +48 -0
  99. data/lib/tennpipes-su/generators/templates/assets/javascripts/jquery-1.11.0.min.js +4 -0
  100. data/lib/tennpipes-su/generators/templates/assets/stylesheets/application.css +353 -0
  101. data/lib/tennpipes-su/generators/templates/assets/stylesheets/bootstrap.css +4 -0
  102. data/lib/tennpipes-su/generators/templates/assets/stylesheets/fonts/FontAwesome.otf +0 -0
  103. data/lib/tennpipes-su/generators/templates/assets/stylesheets/fonts/fontawesome-webfont.eot +0 -0
  104. data/lib/tennpipes-su/generators/templates/assets/stylesheets/fonts/fontawesome-webfont.svg +414 -0
  105. data/lib/tennpipes-su/generators/templates/assets/stylesheets/fonts/fontawesome-webfont.ttf +0 -0
  106. data/lib/tennpipes-su/generators/templates/assets/stylesheets/fonts/fontawesome-webfont.woff +0 -0
  107. data/lib/tennpipes-su/generators/templates/erb/app/base/index.erb.tt +15 -0
  108. data/lib/tennpipes-su/generators/templates/erb/app/errors/403.erb.tt +3 -0
  109. data/lib/tennpipes-su/generators/templates/erb/app/errors/404.erb.tt +3 -0
  110. data/lib/tennpipes-su/generators/templates/erb/app/errors/500.erb.tt +3 -0
  111. data/lib/tennpipes-su/generators/templates/erb/app/layouts/application.erb.tt +64 -0
  112. data/lib/tennpipes-su/generators/templates/erb/app/layouts/error.erb.tt +23 -0
  113. data/lib/tennpipes-su/generators/templates/erb/app/sessions/new.erb.tt +44 -0
  114. data/lib/tennpipes-su/generators/templates/erb/page/_form.erb.tt +18 -0
  115. data/lib/tennpipes-su/generators/templates/erb/page/edit.erb.tt +10 -0
  116. data/lib/tennpipes-su/generators/templates/erb/page/index.erb.tt +81 -0
  117. data/lib/tennpipes-su/generators/templates/erb/page/new.erb.tt +9 -0
  118. data/lib/tennpipes-su/generators/templates/haml/app/base/index.haml.tt +12 -0
  119. data/lib/tennpipes-su/generators/templates/haml/app/errors/403.haml.tt +3 -0
  120. data/lib/tennpipes-su/generators/templates/haml/app/errors/404.haml.tt +3 -0
  121. data/lib/tennpipes-su/generators/templates/haml/app/errors/500.haml.tt +3 -0
  122. data/lib/tennpipes-su/generators/templates/haml/app/layouts/application.haml.tt +49 -0
  123. data/lib/tennpipes-su/generators/templates/haml/app/layouts/error.haml.tt +18 -0
  124. data/lib/tennpipes-su/generators/templates/haml/app/sessions/new.haml.tt +38 -0
  125. data/lib/tennpipes-su/generators/templates/haml/page/_form.haml.tt +16 -0
  126. data/lib/tennpipes-su/generators/templates/haml/page/edit.haml.tt +8 -0
  127. data/lib/tennpipes-su/generators/templates/haml/page/index.haml.tt +58 -0
  128. data/lib/tennpipes-su/generators/templates/haml/page/new.haml.tt +7 -0
  129. data/lib/tennpipes-su/generators/templates/page/controller.rb.tt +92 -0
  130. data/lib/tennpipes-su/generators/templates/slim/app/base/index.slim.tt +12 -0
  131. data/lib/tennpipes-su/generators/templates/slim/app/errors/403.slim.tt +3 -0
  132. data/lib/tennpipes-su/generators/templates/slim/app/errors/404.slim.tt +3 -0
  133. data/lib/tennpipes-su/generators/templates/slim/app/errors/500.slim.tt +3 -0
  134. data/lib/tennpipes-su/generators/templates/slim/app/layouts/application.slim.tt +48 -0
  135. data/lib/tennpipes-su/generators/templates/slim/app/layouts/error.slim.tt +19 -0
  136. data/lib/tennpipes-su/generators/templates/slim/app/sessions/new.slim.tt +37 -0
  137. data/lib/tennpipes-su/generators/templates/slim/page/_form.slim.tt +16 -0
  138. data/lib/tennpipes-su/generators/templates/slim/page/edit.slim.tt +8 -0
  139. data/lib/tennpipes-su/generators/templates/slim/page/index.slim.tt +56 -0
  140. data/lib/tennpipes-su/generators/templates/slim/page/new.slim.tt +7 -0
  141. data/lib/tennpipes-su/helpers/authentication_helpers.rb +108 -0
  142. data/lib/tennpipes-su/helpers/view_helpers.rb +87 -0
  143. data/lib/tennpipes-su/locale/admin/cs.yml +56 -0
  144. data/lib/tennpipes-su/locale/admin/da.yml +56 -0
  145. data/lib/tennpipes-su/locale/admin/de.yml +56 -0
  146. data/lib/tennpipes-su/locale/admin/en.yml +56 -0
  147. data/lib/tennpipes-su/locale/admin/es.yml +56 -0
  148. data/lib/tennpipes-su/locale/admin/fr.yml +56 -0
  149. data/lib/tennpipes-su/locale/admin/hu.yml +56 -0
  150. data/lib/tennpipes-su/locale/admin/it.yml +56 -0
  151. data/lib/tennpipes-su/locale/admin/ja.yml +57 -0
  152. data/lib/tennpipes-su/locale/admin/lv.yml +56 -0
  153. data/lib/tennpipes-su/locale/admin/nl.yml +56 -0
  154. data/lib/tennpipes-su/locale/admin/no.yml +56 -0
  155. data/lib/tennpipes-su/locale/admin/pl.yml +56 -0
  156. data/lib/tennpipes-su/locale/admin/pt_br.yml +56 -0
  157. data/lib/tennpipes-su/locale/admin/ro.yml +56 -0
  158. data/lib/tennpipes-su/locale/admin/ru.yml +57 -0
  159. data/lib/tennpipes-su/locale/admin/sv.yml +56 -0
  160. data/lib/tennpipes-su/locale/admin/tr.yml +56 -0
  161. data/lib/tennpipes-su/locale/admin/uk.yml +56 -0
  162. data/lib/tennpipes-su/locale/admin/zh_cn.yml +56 -0
  163. data/lib/tennpipes-su/locale/admin/zh_tw.yml +56 -0
  164. data/lib/tennpipes-su/locale/orm/cs.yml +12 -0
  165. data/lib/tennpipes-su/locale/orm/da.yml +12 -0
  166. data/lib/tennpipes-su/locale/orm/de.yml +12 -0
  167. data/lib/tennpipes-su/locale/orm/en.yml +12 -0
  168. data/lib/tennpipes-su/locale/orm/es.yml +12 -0
  169. data/lib/tennpipes-su/locale/orm/fr.yml +12 -0
  170. data/lib/tennpipes-su/locale/orm/hu.yml +12 -0
  171. data/lib/tennpipes-su/locale/orm/it.yml +12 -0
  172. data/lib/tennpipes-su/locale/orm/ja.yml +12 -0
  173. data/lib/tennpipes-su/locale/orm/lv.yml +12 -0
  174. data/lib/tennpipes-su/locale/orm/nl.yml +12 -0
  175. data/lib/tennpipes-su/locale/orm/no.yml +12 -0
  176. data/lib/tennpipes-su/locale/orm/pl.yml +38 -0
  177. data/lib/tennpipes-su/locale/orm/pt_br.yml +12 -0
  178. data/lib/tennpipes-su/locale/orm/ro.yml +12 -0
  179. data/lib/tennpipes-su/locale/orm/ru.yml +12 -0
  180. data/lib/tennpipes-su/locale/orm/sv.yml +12 -0
  181. data/lib/tennpipes-su/locale/orm/tr.yml +12 -0
  182. data/lib/tennpipes-su/locale/orm/uk.yml +12 -0
  183. data/lib/tennpipes-su/locale/orm/zh_cn.yml +12 -0
  184. data/lib/tennpipes-su/locale/orm/zh_tw.yml +12 -0
  185. data/test/fixtures/sequel.rb +72 -0
  186. data/test/generators/test_account_model_generator.rb +108 -0
  187. data/test/generators/test_admin_app_generator.rb +218 -0
  188. data/test/generators/test_admin_page_generator.rb +140 -0
  189. data/test/helper.rb +47 -0
  190. data/test/test_admin_application.rb +271 -0
  191. data/test/test_locale.rb +25 -0
  192. metadata +298 -0
@@ -0,0 +1,12 @@
1
+ ja:
2
+ ohm:
3
+ errors:
4
+ messages:
5
+ format: "は、不正な値です"
6
+ not_present: "は、空欄であってはなりません"
7
+ not_numeric: "は、数字である必要があります"
8
+ not_url: "は、不正な値です"
9
+ not_email: "は、不正な値です"
10
+ not_valid: "は、次の値のうちどれかでなければなりません:"
11
+ not_in_range: "は、次の値のうちどれかでなければなりません:"
12
+ not_decimal: "は、不正な値です"
@@ -0,0 +1,12 @@
1
+ lv:
2
+ ohm:
3
+ errors:
4
+ messages:
5
+ format: "nav derīgs"
6
+ not_present: "ir jābūt aizpildītam"
7
+ not_numeric: "nav skaitlis"
8
+ not_url: "nav derīgs"
9
+ not_email: "nav derīgs"
10
+ not_valid: "nav iekļauts sarakstā"
11
+ not_in_range: "nav iekļauts sarakstā"
12
+ not_decimal: "nav derīgs"
@@ -0,0 +1,12 @@
1
+ nl:
2
+ ohm:
3
+ errors:
4
+ messages:
5
+ format: "is ongeldig"
6
+ not_present: "moet opgegeven zijn"
7
+ not_numeric: "is geen getal"
8
+ not_url: "is ongeldig"
9
+ not_email: "is ongeldig"
10
+ not_valid: "is niet in de lijst opgenomen"
11
+ not_in_range: "is niet in de lijst opgenomen"
12
+ not_decimal: "is ongeldig"
@@ -0,0 +1,12 @@
1
+ "no":
2
+ ohm:
3
+ errors:
4
+ messages:
5
+ format: "er ikke gyldig"
6
+ not_present: "kan ikke være blank"
7
+ not_numeric: "er ikke et tall"
8
+ not_url: "er ikke gyldig"
9
+ not_email: "er ikke gyldig"
10
+ not_valid: "finnes ikke i listen"
11
+ not_in_range: "finnes ikke i listen"
12
+ not_decimal: "er ikke gyldig"
@@ -0,0 +1,38 @@
1
+ pl:
2
+ activemodel: &activemodel
3
+ errors:
4
+ messages:
5
+ inclusion: "nie znajduje się na liście dopuszczalnych wartości"
6
+ exclusion: "znajduje się na liście zabronionych wartości"
7
+ invalid: "jest nieprawidłowe"
8
+ confirmation: "nie zgadza się z potwierdzeniem"
9
+ accepted: "musi być zaakceptowane"
10
+ empty: "nie może być puste"
11
+ blank: "nie może być puste"
12
+ too_long: "jest za długie (maksymalnie %{count} znaków)"
13
+ too_short: "jest za krótkie (minimalnie %{count} znaków)"
14
+ wrong_length: "jest nieprawidłowej długości (powinna wynosić %{count} znaków)"
15
+ taken: "zostało już zajęte"
16
+ not_a_number: "nie jest liczbą"
17
+ not_an_integer: "nie jest liczbą całkowitą"
18
+ greater_than: "musi być większe niż %{count}"
19
+ greater_than_or_equal_to: "musi być większe lub równe %{count}"
20
+ equal_to: "musi być równe %{count}"
21
+ less_than: "musi być mniejsze niż %{count}"
22
+ less_than_or_equal_to: "musi być mniejsze lub równe %{count}"
23
+ odd: "musi być nieparzyste"
24
+ even: "musi być parzyste"
25
+ record_invalid: "Negatywne sprawdzenie poprawności: %{errors}"
26
+ content_type: "nieodozwolony format pliku"
27
+ activerecord: *activemodel
28
+ ohm:
29
+ errors:
30
+ messages:
31
+ format: "jest nieprawidłowe"
32
+ not_present: "nie może być puste"
33
+ not_numeric: "nie jest liczbą"
34
+ not_url: "jest nieprawidłowe"
35
+ not_email: "jest nieprawidłowe"
36
+ not_valid: "nie znajduje się na liście dopuszczalnych wartości"
37
+ not_in_range: "nie znajduje się na liście dopuszczalnych wartości"
38
+ not_decimal: "jest nieprawidłowe"
@@ -0,0 +1,12 @@
1
+ pt_br:
2
+ ohm:
3
+ errors:
4
+ messages:
5
+ format: "não é válido"
6
+ not_present: "não pode ser deixado em branco"
7
+ not_numeric: "não é um número"
8
+ not_url: "não é válido"
9
+ not_email: "não é válido"
10
+ not_valid: "não está incluído na lista"
11
+ not_in_range: "não está incluído na lista"
12
+ not_decimal: "não é válido"
@@ -0,0 +1,12 @@
1
+ ro:
2
+ ohm:
3
+ errors:
4
+ messages:
5
+ format: "nu este valid"
6
+ not_present: "nu poate fi gol"
7
+ not_numeric: "nu este un număr"
8
+ not_url: "nu este valid"
9
+ not_email: "nu este valid"
10
+ not_valid: "nu este inclus în listă"
11
+ not_in_range: "nu este inclus în listă"
12
+ not_decimal: "nu este valid"
@@ -0,0 +1,12 @@
1
+ ru:
2
+ ohm:
3
+ errors:
4
+ messages:
5
+ format: "неправильный"
6
+ not_present: "не может быть пустым"
7
+ not_numeric: "не число"
8
+ not_url: "неправильный"
9
+ not_email: "неправильный"
10
+ not_valid: "не входит в список"
11
+ not_in_range: "не входит в список"
12
+ not_decimal: "неправильный"
@@ -0,0 +1,12 @@
1
+ sv:
2
+ ohm:
3
+ errors:
4
+ messages:
5
+ format: "är ogiltig"
6
+ not_present: "kan inte vara blankt"
7
+ not_numeric: "är inte ett tal"
8
+ not_url: "är ogiltig"
9
+ not_email: "är ogiltig"
10
+ not_valid: "är inte inkluderad i listan"
11
+ not_in_range: "är inte inkluderad i listan"
12
+ not_decimal: "är ogiltig"
@@ -0,0 +1,12 @@
1
+ tr:
2
+ ohm:
3
+ errors:
4
+ messages:
5
+ format: "geçerli değil"
6
+ not_present: "boş bırakılamaz"
7
+ not_numeric: "sayı değil"
8
+ not_url: "geçerli değil"
9
+ not_email: "geçerli değil"
10
+ not_valid: "listede yok"
11
+ not_in_range: "listede yok"
12
+ not_decimal: "geçerli değil"
@@ -0,0 +1,12 @@
1
+ uk:
2
+ ohm:
3
+ errors:
4
+ messages:
5
+ format: "недійсний"
6
+ not_present: "не може бути порожнім"
7
+ not_numeric: "не число"
8
+ not_url: "недійсний"
9
+ not_email: "недійсний"
10
+ not_valid: "не входить у список"
11
+ not_in_range: "не входить у список"
12
+ not_decimal: "недійсний"
@@ -0,0 +1,12 @@
1
+ zh_cn:
2
+ ohm:
3
+ errors:
4
+ messages:
5
+ format: "是无效的"
6
+ not_present: "不能是空白字元"
7
+ not_numeric: "不是数字"
8
+ not_url: "是无效的"
9
+ not_email: "是无效的"
10
+ not_valid: "没有包含在列表中"
11
+ not_in_range: "没有包含在列表中"
12
+ not_decimal: "是无效的"
@@ -0,0 +1,12 @@
1
+ zh_tw:
2
+ ohm:
3
+ errors:
4
+ messages:
5
+ format: "是無效的"
6
+ not_present: "不能是空白字元"
7
+ not_numeric: "不是數字"
8
+ not_url: "是無效的"
9
+ not_email: "是無效的"
10
+ not_valid: "沒有包含在列表中"
11
+ not_in_range: "沒有包含在列表中"
12
+ not_decimal: "是無效的"
@@ -0,0 +1,72 @@
1
+ require 'digest/sha1'
2
+ require 'sequel'
3
+
4
+ Sequel::Model.plugin(:schema)
5
+
6
+ Sequel::Model.db =
7
+ if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
8
+ require 'jdbc/sqlite3'
9
+ Sequel.connect("jdbc:sqlite::memory:")
10
+ else
11
+ require 'sqlite3'
12
+ Sequel.sqlite(":memory:")
13
+ end
14
+
15
+ Sequel.extension :migration
16
+ migration = Sequel.migration do
17
+ up do
18
+ create_table :accounts do
19
+ primary_key :id
20
+ String :name
21
+ String :surname
22
+ String :email
23
+ String :crypted_password
24
+ String :role
25
+ end
26
+
27
+ create_table :categories do
28
+ primary_key :id
29
+ foreign_key :account_id
30
+ String :name
31
+ end
32
+ end
33
+
34
+ down do
35
+ drop_table :accounts
36
+ end
37
+ end
38
+
39
+ migration.apply(Sequel::Model.db, :up)
40
+
41
+ # Fake Category Model
42
+ class Category < Sequel::Model
43
+ many_to_one :account
44
+ end
45
+
46
+ # Fake Account Model
47
+ class Account < Sequel::Model
48
+ attr_accessor :password, :password_confirmation
49
+
50
+ one_to_many :categories
51
+
52
+ def self.admin; first(:role => "admin"); end
53
+ def self.editor; first(:role => "editor"); end
54
+
55
+ ##
56
+ # Replace ActiveRecord method.
57
+ #
58
+ def self.find_by_id(id)
59
+ self[id] rescue nil
60
+ end
61
+ end
62
+
63
+ # We build some fake accounts
64
+ admin = Account.create(:name => "DAddYE", :role => "admin", :email => "d.dagostino@lipsiasoft.com",
65
+ :password => "some", :password_confirmation => "some")
66
+ editor = Account.create(:name => "Dexter", :role => "editor", :email => "editor@lipsiasoft.com",
67
+ :password => "some", :password_confirmation => "some")
68
+
69
+ %w(News Press HowTo).each do |c|
70
+ admin.add_category(:name => c)
71
+ editor.add_category(:name => c)
72
+ end
@@ -0,0 +1,108 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../helper')
2
+
3
+ describe "AccountModelGenerator" do
4
+ before do
5
+ @apptmp = "#{Dir.tmpdir}/tennpipes-tests/#{SecureRandom.hex}"
6
+ %x[mkdir -p #{@apptmp}]
7
+ end
8
+
9
+ after do
10
+ %[rm -rf #{@apptmp}]
11
+ end
12
+
13
+ describe 'activerecord' do
14
+ before do
15
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=activerecord') }
16
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
17
+ @model = "#{@apptmp}/sample_project/models/account.rb"
18
+ end
19
+
20
+ it 'should be an activerecord model instance' do
21
+ assert_match_in_file(/class Account < ActiveRecord::Base/m, @model)
22
+ end
23
+ end
24
+
25
+ describe 'minirecord' do
26
+ before do
27
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=minirecord') }
28
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
29
+ @model = "#{@apptmp}/sample_project/models/account.rb"
30
+ end
31
+
32
+ it 'should be an activerecord model instance' do
33
+ assert_match_in_file(/class Account < ActiveRecord::Base/m, @model)
34
+ end
35
+ end
36
+
37
+ describe 'datamapper' do
38
+ before do
39
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=datamapper') }
40
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
41
+ @model = "#{@apptmp}/sample_project/models/account.rb"
42
+ end
43
+
44
+ it 'should include the datamapper resource' do
45
+ assert_match_in_file(/include DataMapper::Resource/m, @model)
46
+ end
47
+ end
48
+
49
+ describe 'mongoid' do
50
+ before do
51
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=mongoid') }
52
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
53
+ @model = "#{@apptmp}/sample_project/models/account.rb"
54
+ end
55
+
56
+ it 'should include the mongoid document' do
57
+ assert_match_in_file(/include Mongoid::Document/m, @model)
58
+ end
59
+ end
60
+
61
+ describe 'mongomapper' do
62
+ before do
63
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=mongomapper') }
64
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
65
+ @model = "#{@apptmp}/sample_project/models/account.rb"
66
+ end
67
+
68
+ it 'should include the mongomapper document' do
69
+ assert_match_in_file(/include MongoMapper::Document/m, @model)
70
+ end
71
+ end
72
+
73
+ describe 'ohm' do
74
+ before do
75
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=ohm') }
76
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
77
+ @model = "#{@apptmp}/sample_project/models/account.rb"
78
+ end
79
+
80
+ it 'should be an ohm model instance' do
81
+ assert_match_in_file(/class Account < Ohm::Model/m, @model)
82
+ end
83
+ end
84
+
85
+ describe 'sequel' do
86
+ before do
87
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=sequel') }
88
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
89
+ @model = "#{@apptmp}/sample_project/models/account.rb"
90
+ end
91
+
92
+ it 'should be a sequel model instance' do
93
+ assert_match_in_file(/class Account < Sequel::Model/m, @model)
94
+ end
95
+ end
96
+
97
+ describe 'couchrest' do
98
+ before do
99
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=couchrest') }
100
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
101
+ @model = "#{@apptmp}/sample_project/models/account.rb"
102
+ end
103
+
104
+ it 'should be a couchrest model instance' do
105
+ assert_match_in_file(/class Account < CouchRest::Model::Base/m, @model)
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,218 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../helper')
2
+
3
+ describe "AdminAppGenerator" do
4
+ before do
5
+ @apptmp = "#{Dir.tmpdir}/tennpipes-tests/#{SecureRandom.hex}"
6
+ `mkdir -p #{@apptmp}`
7
+ end
8
+
9
+ after do
10
+ `rm -rf #{@apptmp}`
11
+ end
12
+
13
+ describe 'the admin app generator' do
14
+ before do
15
+ # Account gets created by Datamapper's migration and then gets
16
+ # rejected by model generator as already defined
17
+ Object.send(:remove_const, :Account) if defined?(Account)
18
+ end
19
+
20
+ it 'should fail outside app root' do
21
+ out, err = capture_io { generate(:admin_app, "-r=#{@apptmp}") }
22
+ assert_match(/not at the root/, out)
23
+ assert_no_file_exists("#{@apptmp}/admin")
24
+ end
25
+
26
+ it "should fail if we don't specify an orm on the project" do
27
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-e=haml') }
28
+ assert_raises(SystemExit) { @out, @err = capture_io { generate(:admin_app, "-r=#{@apptmp}/sample_project") } }
29
+ end
30
+
31
+ it "should store and apply session_secret" do
32
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=datamapper','-e=haml') }
33
+ assert_match_in_file(/set :session_secret, '[0-9A-z]*'/, "#{@apptmp}/sample_project/config/apps.rb")
34
+ end
35
+
36
+ it "should generate the admin app" do
37
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=activerecord') }
38
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
39
+ assert_dir_exists("#{@apptmp}/sample_project")
40
+ assert_dir_exists("#{@apptmp}/sample_project/admin")
41
+ assert_file_exists("#{@apptmp}/sample_project/admin/app.rb")
42
+ assert_dir_exists("#{@apptmp}/sample_project/admin/controllers")
43
+ assert_file_exists("#{@apptmp}/sample_project/admin/controllers/accounts.rb")
44
+ assert_file_exists("#{@apptmp}/sample_project/admin/controllers/base.rb")
45
+ assert_file_exists("#{@apptmp}/sample_project/admin/controllers/sessions.rb")
46
+ assert_dir_exists("#{@apptmp}/sample_project/admin/views")
47
+ assert_dir_exists("#{@apptmp}/sample_project/public/admin")
48
+ assert_dir_exists("#{@apptmp}/sample_project/public/admin/stylesheets")
49
+ assert_file_exists("#{@apptmp}/sample_project/public/admin/stylesheets/application.css")
50
+ assert_file_exists("#{@apptmp}/sample_project/public/admin/stylesheets/bootstrap.css")
51
+ assert_file_exists("#{@apptmp}/sample_project/public/admin/javascripts/application.js")
52
+ assert_file_exists("#{@apptmp}/sample_project/public/admin/javascripts/jquery-1.11.0.min.js")
53
+ assert_file_exists("#{@apptmp}/sample_project/models/account.rb")
54
+ assert_file_exists("#{@apptmp}/sample_project/db/seeds.rb")
55
+ assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
56
+ assert_match_in_file 'Tennpipes.mount("SampleProject::Admin", :app_file => Tennpipes.root(\'admin/app.rb\')).to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
57
+ assert_match_in_file 'module SampleProject', "#{@apptmp}/sample_project/admin/app.rb"
58
+ assert_match_in_file 'class Admin < Tennpipes::Application', "#{@apptmp}/sample_project/admin/app.rb"
59
+ assert_match_in_file 'role.project_module :accounts, \'/accounts\'', "#{@apptmp}/sample_project/admin/app.rb"
60
+ end
61
+
62
+ it "should generate the master app" do
63
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=activerecord') }
64
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project", '--admin-name=master') }
65
+ assert_file_exists("#{@apptmp}/sample_project/master/app.rb")
66
+ end
67
+
68
+ # users can override certain templates from a generators/templates folder in the destination_root
69
+ it "should use custom generator templates from the project root, if they exist" do
70
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=activerecord') }
71
+ custom_template_path = "#{@apptmp}/sample_project/generators/templates/slim/app/layouts/"
72
+ `mkdir -p #{custom_template_path} && echo "h1 = 'Hello, custom generator' " > #{custom_template_path}application.slim.tt`
73
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
74
+ assert_match_in_file(/Hello, custom generator/, "#{@apptmp}/sample_project/admin/views/layouts/application.slim")
75
+ end
76
+
77
+ it "should generate the admin app under a different folder" do
78
+ # TODO FIXME Implement option --admin_root or something. See https://github.com/tennpipes/tennpipes-framework/issues/854#issuecomment-14749356
79
+ skip
80
+ end
81
+
82
+ describe "renderers" do
83
+ it 'should correctly generate a new tennpipes admin application with haml renderer (default)' do
84
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=activerecord', '-e=haml') }
85
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
86
+ assert_dir_exists("#{@apptmp}/sample_project/admin/views")
87
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/_form.haml")
88
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/edit.haml")
89
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/index.haml")
90
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/new.haml")
91
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.haml")
92
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.haml")
93
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.haml")
94
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/layouts/application.haml")
95
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.haml")
96
+ end
97
+
98
+ it 'should correctly generate a new tennpipes admin application with erb renderer' do
99
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=activerecord', '-e=erb') }
100
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
101
+ assert_dir_exists("#{@apptmp}/sample_project/admin/views")
102
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/_form.erb")
103
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/edit.erb")
104
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/index.erb")
105
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/new.erb")
106
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.erb")
107
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.erb")
108
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.erb")
109
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/layouts/application.erb")
110
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.erb")
111
+ end
112
+
113
+ it 'should correctly generate a new tennpipes admin application with slim renderer' do
114
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=activerecord', '-e=slim') }
115
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
116
+ assert_dir_exists("#{@apptmp}/sample_project/admin/views")
117
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/_form.slim")
118
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/edit.slim")
119
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/index.slim")
120
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/new.slim")
121
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.slim")
122
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.slim")
123
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.slim")
124
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/layouts/application.slim")
125
+ assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.slim")
126
+ end
127
+ end
128
+
129
+ it 'should correctly generate a new tennpipes admin application with a custom model' do
130
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=activerecord', '-e=slim') }
131
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project", '-m=User') }
132
+ assert_no_match_in_file(/[^_]account/i, "#{@apptmp}/sample_project/admin/controllers/users.rb")
133
+ assert_match_in_file(/[^_]user/i, "#{@apptmp}/sample_project/admin/controllers/users.rb")
134
+ assert_no_match_in_file(/[^_]account/i, "#{@apptmp}/sample_project/admin/views/users/_form.slim")
135
+ assert_match_in_file(/[^_]user/i, "#{@apptmp}/sample_project/admin/views/users/_form.slim")
136
+ assert_no_match_in_file(/[^_]account/i, "#{@apptmp}/sample_project/admin/views/users/edit.slim")
137
+ assert_match_in_file(/[^_]user/i, "#{@apptmp}/sample_project/admin/views/users/edit.slim")
138
+ assert_no_match_in_file(/[^_]account/i, "#{@apptmp}/sample_project/admin/views/users/index.slim")
139
+ assert_match_in_file(/[^_]user/i, "#{@apptmp}/sample_project/admin/views/users/index.slim")
140
+ assert_no_match_in_file(/[^_]account/i, "#{@apptmp}/sample_project/admin/views/users/new.slim")
141
+ assert_match_in_file(/[^_]user/i, "#{@apptmp}/sample_project/admin/views/users/new.slim")
142
+ assert_no_match_in_file(/Account/, "#{@apptmp}/sample_project/models/user.rb")
143
+ assert_match_in_file(/User/, "#{@apptmp}/sample_project/models/user.rb")
144
+ assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_users.rb")
145
+ assert_no_match_in_file(/[^_]account/i, "#{@apptmp}/sample_project/db/migrate/001_create_users.rb")
146
+ assert_match_in_file 'role.project_module :users, \'/users\'', "#{@apptmp}/sample_project/admin/app.rb"
147
+ end
148
+
149
+ it 'should correctly generate a new tennpipes admin application with model in non-default application path' do
150
+ # TODO FIXME What's the use case here? Clarify.
151
+ # Remember that --root/-r in the admin_app generator refers to the project's location, not the admin's location
152
+ # inside it. See https://github.com/tennpipes/tennpipes-framework/issues/854#issuecomment-14749356
153
+ skip
154
+ # capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=activerecord', '-e=haml') }
155
+ # capture_io { generate(:admin_app,"-a=/admin", "--root=#{@apptmp}/sample_project") }
156
+ # assert_dir_exists("#{@apptmp}/sample_project")
157
+ # assert_dir_exists("#{@apptmp}/sample_project/admin")
158
+ # assert_file_exists("#{@apptmp}/sample_project/admin/app.rb")
159
+ # assert_file_exists("#{@apptmp}/sample_project/admin/controllers")
160
+ # assert_file_exists("#{@apptmp}/sample_project/admin/controllers/accounts.rb")
161
+ # assert_file_exists("#{@apptmp}/sample_project/admin/controllers/base.rb")
162
+ # assert_file_exists("#{@apptmp}/sample_project/admin/controllers/sessions.rb")
163
+ # assert_dir_exists("#{@apptmp}/sample_project/admin/views")
164
+ # assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/_form.haml")
165
+ # assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/edit.haml")
166
+ # assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/index.haml")
167
+ # assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/new.haml")
168
+ # assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.haml")
169
+ # assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.haml")
170
+ # assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.haml")
171
+ # assert_file_exists("#{@apptmp}/sample_project/admin/views/layouts/application.haml")
172
+ # assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.haml")
173
+ # assert_dir_exists("#{@apptmp}/sample_project/public/admin")
174
+ # assert_dir_exists("#{@apptmp}/sample_project/public/admin/stylesheets")
175
+ # assert_file_exists("#{@apptmp}/sample_project/models/account.rb")
176
+ # assert_no_file_exists("#{@apptmp}/sample_project/models/account.rb")
177
+ # assert_file_exists("#{@apptmp}/sample_project/db/seeds.rb")
178
+ # assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
179
+ # assert_match_in_file 'role.project_module :accounts, \'/accounts\'', "#{@apptmp}/sample_project/admin/app.rb"
180
+ end
181
+
182
+ describe "activerecord middleware" do
183
+ it 'should add it for #activerecord' do
184
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=activerecord', '-e=haml') }
185
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
186
+ assert_match_in_file(/ use ActiveRecord::ConnectionAdapters::ConnectionManagemen/m, "#{@apptmp}/sample_project/admin/app.rb")
187
+ end
188
+
189
+ it 'should add it #minirecord' do
190
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=minirecord', '-e=haml') }
191
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
192
+ assert_match_in_file(/ use ActiveRecord::ConnectionAdapters::ConnectionManagemen/m, "#{@apptmp}/sample_project/admin/app.rb")
193
+ end
194
+
195
+ it 'should not add it for #datamapper' do
196
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=datamapper', '-e=haml') }
197
+ capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
198
+ assert_no_match_in_file(/ use ActiveRecord::ConnectionAdapters::ConnectionManagemen/m, "#{@apptmp}/sample_project/admin/app.rb")
199
+ end
200
+ end
201
+
202
+ it 'should not conflict with existing seeds file' do
203
+ capture_io { generate(:project, 'sample_project', '-e=slim', "--root=#{@apptmp}", '-d=activerecord', '-e=erb') }
204
+
205
+ # Add seeds file
206
+ FileUtils.mkdir_p @apptmp + '/sample_project/db' unless File.exist?(@apptmp + '/sample_project/db')
207
+ File.open(@apptmp + '/sample_project/db/seeds.rb', 'w+') do |seeds_rb|
208
+ seeds_rb.puts "# Old Seeds Content"
209
+ end
210
+
211
+ out, err = capture_io { generate(:admin_app, "--root=#{@apptmp}/sample_project") }
212
+ refute_match /Overwrite\s.*?\/db\/seeds.rb/, out
213
+
214
+ assert_file_exists "#{@apptmp}/sample_project/db/seeds.old"
215
+ assert_match_in_file 'Account.new(', "#{@apptmp}/sample_project/db/seeds.rb"
216
+ end
217
+ end
218
+ end