locomotivecms_wagon 1.4.0 → 1.5.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (352) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -0
  3. data/Gemfile +6 -2
  4. data/README.md +7 -1
  5. data/bin/wagon +3 -0
  6. data/generators/blank/Gemfile.tt +1 -3
  7. data/generators/blank/config/site.yml.tt +3 -3
  8. data/generators/bootstrap/config/site.yml.tt +3 -3
  9. data/generators/bootstrap3/Gemfile.tt +1 -3
  10. data/generators/bootstrap3/app/views/pages/index.liquid +21 -63
  11. data/generators/bootstrap3/app/views/pages/index.liquid.haml +15 -57
  12. data/generators/bootstrap3/config/deploy.yml +15 -15
  13. data/generators/bootstrap3/config/site.yml.tt +2 -2
  14. data/generators/bootstrap3/icon.png +0 -0
  15. data/generators/bootstrap3/public/fonts/glyphicons-halflings-regular.eot +0 -0
  16. data/generators/bootstrap3/public/fonts/glyphicons-halflings-regular.svg +201 -200
  17. data/generators/bootstrap3/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  18. data/generators/bootstrap3/public/fonts/glyphicons-halflings-regular.woff +0 -0
  19. data/generators/{bootstrap2/app/content_types → bootstrap3/public/images}/.empty_directory +0 -0
  20. data/generators/bootstrap3/public/javascripts/bootstrap/affix.js +137 -0
  21. data/generators/bootstrap3/public/javascripts/bootstrap/alert.js +88 -0
  22. data/generators/bootstrap3/public/javascripts/bootstrap/button.js +107 -0
  23. data/generators/bootstrap3/public/javascripts/bootstrap/carousel.js +205 -0
  24. data/generators/bootstrap3/public/javascripts/bootstrap/collapse.js +170 -0
  25. data/generators/bootstrap3/public/javascripts/bootstrap/dropdown.js +147 -0
  26. data/generators/bootstrap3/public/javascripts/bootstrap/modal.js +243 -0
  27. data/generators/bootstrap3/public/javascripts/bootstrap/popover.js +110 -0
  28. data/generators/bootstrap3/public/javascripts/bootstrap/scrollspy.js +153 -0
  29. data/generators/bootstrap3/public/javascripts/bootstrap/tab.js +125 -0
  30. data/generators/bootstrap3/public/javascripts/bootstrap/tooltip.js +399 -0
  31. data/generators/bootstrap3/public/javascripts/bootstrap/transition.js +48 -0
  32. data/generators/bootstrap3/public/javascripts/bootstrap.min.js +12 -6
  33. data/generators/bootstrap3/public/stylesheets/application.css +1 -0
  34. data/generators/bootstrap3/public/stylesheets/application.css.scss +8 -0
  35. data/generators/bootstrap3/public/stylesheets/bootstrap/_alerts.scss +67 -0
  36. data/generators/bootstrap3/public/stylesheets/bootstrap/_badges.scss +55 -0
  37. data/generators/bootstrap3/public/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
  38. data/generators/bootstrap3/public/stylesheets/bootstrap/_button-groups.scss +226 -0
  39. data/generators/bootstrap3/public/stylesheets/bootstrap/_buttons.scss +159 -0
  40. data/generators/bootstrap3/public/stylesheets/bootstrap/_carousel.scss +232 -0
  41. data/generators/bootstrap3/public/stylesheets/bootstrap/_close.scss +35 -0
  42. data/generators/bootstrap3/public/stylesheets/bootstrap/_code.scss +63 -0
  43. data/generators/bootstrap3/public/stylesheets/bootstrap/_component-animations.scss +29 -0
  44. data/generators/bootstrap3/public/stylesheets/bootstrap/_dropdowns.scss +213 -0
  45. data/generators/bootstrap3/public/stylesheets/bootstrap/_forms.scss +436 -0
  46. data/generators/bootstrap3/public/stylesheets/bootstrap/_glyphicons.scss +233 -0
  47. data/generators/bootstrap3/public/stylesheets/bootstrap/_grid.scss +84 -0
  48. data/generators/bootstrap3/public/stylesheets/bootstrap/_input-groups.scss +162 -0
  49. data/generators/bootstrap3/public/stylesheets/bootstrap/_jumbotron.scss +44 -0
  50. data/generators/bootstrap3/public/stylesheets/bootstrap/_labels.scss +64 -0
  51. data/generators/bootstrap3/public/stylesheets/bootstrap/_list-group.scss +110 -0
  52. data/generators/bootstrap3/public/stylesheets/bootstrap/_media.scss +56 -0
  53. data/generators/bootstrap3/public/stylesheets/bootstrap/_mixins.scss +947 -0
  54. data/generators/bootstrap3/public/stylesheets/bootstrap/_modals.scss +139 -0
  55. data/generators/bootstrap3/public/stylesheets/bootstrap/_navbar.scss +620 -0
  56. data/generators/bootstrap3/public/stylesheets/bootstrap/_navs.scss +242 -0
  57. data/generators/bootstrap3/public/stylesheets/bootstrap/_normalize.scss +423 -0
  58. data/generators/bootstrap3/public/stylesheets/bootstrap/_pager.scss +55 -0
  59. data/generators/bootstrap3/public/stylesheets/bootstrap/_pagination.scss +88 -0
  60. data/generators/bootstrap3/public/stylesheets/bootstrap/_panels.scss +241 -0
  61. data/generators/bootstrap3/public/stylesheets/bootstrap/_popovers.scss +133 -0
  62. data/generators/bootstrap3/public/stylesheets/bootstrap/_print.scss +101 -0
  63. data/generators/bootstrap3/public/stylesheets/bootstrap/_progress-bars.scss +80 -0
  64. data/generators/bootstrap3/public/stylesheets/bootstrap/_responsive-utilities.scss +74 -0
  65. data/generators/bootstrap3/public/stylesheets/bootstrap/_scaffolding.scss +134 -0
  66. data/generators/bootstrap3/public/stylesheets/bootstrap/_tables.scss +233 -0
  67. data/generators/bootstrap3/public/stylesheets/bootstrap/_theme.scss +247 -0
  68. data/generators/bootstrap3/public/stylesheets/bootstrap/_thumbnails.scss +38 -0
  69. data/generators/bootstrap3/public/stylesheets/bootstrap/_tooltip.scss +95 -0
  70. data/generators/bootstrap3/public/stylesheets/bootstrap/_type.scss +284 -0
  71. data/generators/bootstrap3/public/stylesheets/bootstrap/_utilities.scss +56 -0
  72. data/generators/bootstrap3/public/stylesheets/bootstrap/_variables.scss +833 -0
  73. data/generators/bootstrap3/public/stylesheets/bootstrap/_wells.scss +29 -0
  74. data/generators/bootstrap3/public/stylesheets/bootstrap/bootstrap.css.scss +49 -0
  75. data/generators/bootstrap3/public/stylesheets/bootstrap.css +2035 -3056
  76. data/generators/bootstrap3/public/stylesheets/bootstrap.css.scss +49 -0
  77. data/generators/cloned/Gemfile.tt +1 -3
  78. data/generators/content_type/app/content_types/%slug%.yml.tt +57 -0
  79. data/generators/content_type/data/{%name%.yml.tt → %slug%.yml.tt} +2 -2
  80. data/generators/{bootstrap2 → foundation5}/Gemfile.tt +1 -3
  81. data/generators/{bootstrap2/data → foundation5/app/content_types}/.empty_directory +0 -0
  82. data/generators/{foundation → foundation5}/app/views/pages/404.liquid +1 -4
  83. data/generators/{foundation → foundation5}/app/views/pages/404.liquid.haml +1 -1
  84. data/generators/foundation5/app/views/pages/index.liquid +196 -0
  85. data/generators/foundation5/app/views/pages/index.liquid.haml +157 -0
  86. data/generators/foundation5/config/deploy.yml +15 -0
  87. data/generators/{bootstrap2 → foundation5}/config/site.yml.tt +3 -4
  88. data/generators/{bootstrap2 → foundation5}/config/translations.yml +0 -0
  89. data/generators/{bootstrap2 → foundation5}/config.ru +0 -0
  90. data/generators/{bootstrap2/public/samples → foundation5/data}/.empty_directory +0 -0
  91. data/generators/foundation5/favicon.ico +0 -0
  92. data/generators/foundation5/icon.png +0 -0
  93. data/generators/{foundation/app/content_types → foundation5/public/fonts}/.empty_directory +0 -0
  94. data/generators/{foundation/data → foundation5/public/images}/.empty_directory +0 -0
  95. data/generators/foundation5/public/javascripts/foundation/foundation.abide.js +299 -0
  96. data/generators/foundation5/public/javascripts/foundation/foundation.accordion.js +59 -0
  97. data/generators/foundation5/public/javascripts/foundation/foundation.alert.js +43 -0
  98. data/generators/foundation5/public/javascripts/foundation/foundation.clearing.js +534 -0
  99. data/generators/foundation5/public/javascripts/foundation/foundation.dropdown.js +311 -0
  100. data/generators/foundation5/public/javascripts/foundation/foundation.equalizer.js +74 -0
  101. data/generators/foundation5/public/javascripts/foundation/foundation.interchange.js +331 -0
  102. data/generators/foundation5/public/javascripts/foundation/foundation.joyride.js +843 -0
  103. data/generators/foundation5/public/javascripts/foundation/foundation.js +611 -0
  104. data/generators/foundation5/public/javascripts/foundation/foundation.magellan.js +178 -0
  105. data/generators/foundation5/public/javascripts/foundation/foundation.offcanvas.js +108 -0
  106. data/generators/foundation5/public/javascripts/foundation/foundation.orbit.js +610 -0
  107. data/generators/foundation5/public/javascripts/foundation/foundation.reveal.js +437 -0
  108. data/generators/foundation5/public/javascripts/foundation/foundation.slider.js +199 -0
  109. data/generators/foundation5/public/javascripts/foundation/foundation.tab.js +167 -0
  110. data/generators/foundation5/public/javascripts/foundation/foundation.tooltip.js +298 -0
  111. data/generators/foundation5/public/javascripts/foundation/foundation.topbar.js +425 -0
  112. data/generators/foundation5/public/javascripts/foundation.js +4161 -0
  113. data/generators/foundation5/public/javascripts/foundation.min.js +10 -0
  114. data/generators/{foundation → foundation5}/public/javascripts/vendor/custom.modernizr.js +0 -0
  115. data/generators/foundation5/public/javascripts/vendor/custom.modernizr.min.js +1 -0
  116. data/generators/foundation5/public/javascripts/vendor/fastclick.js +9 -0
  117. data/generators/foundation5/public/javascripts/vendor/fastclick.min.js +11 -0
  118. data/generators/foundation5/public/javascripts/vendor/jquery.autocomplete.js +645 -0
  119. data/generators/foundation5/public/javascripts/vendor/jquery.autocomplete.min.js +1 -0
  120. data/generators/foundation5/public/javascripts/vendor/jquery.cookie.js +8 -0
  121. data/generators/foundation5/public/javascripts/vendor/jquery.cookie.min.js +8 -0
  122. data/generators/foundation5/public/javascripts/vendor/jquery.js +26 -0
  123. data/generators/foundation5/public/javascripts/vendor/jquery.min.js +27 -0
  124. data/generators/foundation5/public/javascripts/vendor/modernizr.js +8 -0
  125. data/generators/foundation5/public/javascripts/vendor/modernizr.min.js +1 -0
  126. data/generators/foundation5/public/javascripts/vendor/placeholder.js +2 -0
  127. data/generators/foundation5/public/javascripts/vendor/placeholder.min.js +1 -0
  128. data/generators/{foundation/public/fonts → foundation5/public/samples}/.empty_directory +0 -0
  129. data/generators/foundation5/public/stylesheets/application.css +2 -0
  130. data/generators/foundation5/public/stylesheets/application.css.scss +3 -0
  131. data/generators/foundation5/public/stylesheets/foundation/_functions.scss +101 -0
  132. data/generators/foundation5/public/stylesheets/foundation/_settings.scss +1296 -0
  133. data/generators/foundation5/public/stylesheets/foundation/components/_accordion.scss +53 -0
  134. data/generators/foundation5/public/stylesheets/foundation/components/_alert-boxes.scss +126 -0
  135. data/generators/foundation5/public/stylesheets/foundation/components/_block-grid.scss +132 -0
  136. data/generators/foundation5/public/stylesheets/foundation/components/_breadcrumbs.scss +127 -0
  137. data/generators/foundation5/public/stylesheets/foundation/components/_button-groups.scss +108 -0
  138. data/generators/foundation5/public/stylesheets/foundation/components/_buttons.scss +222 -0
  139. data/generators/foundation5/public/stylesheets/foundation/components/_clearing.scss +247 -0
  140. data/generators/foundation5/public/stylesheets/foundation/components/_dropdown-buttons.scss +129 -0
  141. data/generators/foundation5/public/stylesheets/foundation/components/_dropdown.scss +248 -0
  142. data/generators/foundation5/public/stylesheets/foundation/components/_flex-video.scss +51 -0
  143. data/generators/foundation5/public/stylesheets/foundation/components/_forms.scss +498 -0
  144. data/generators/foundation5/public/stylesheets/foundation/components/_global.scss +434 -0
  145. data/generators/foundation5/public/stylesheets/foundation/components/_grid.scss +260 -0
  146. data/generators/foundation5/public/stylesheets/foundation/components/_inline-lists.scss +57 -0
  147. data/generators/foundation5/public/stylesheets/foundation/components/_joyride.scss +220 -0
  148. data/generators/foundation5/public/stylesheets/foundation/components/_keystrokes.scss +61 -0
  149. data/generators/foundation5/public/stylesheets/foundation/components/_labels.scss +104 -0
  150. data/generators/foundation5/public/stylesheets/foundation/components/_magellan.scss +34 -0
  151. data/generators/foundation5/public/stylesheets/foundation/components/_offcanvas.scss +356 -0
  152. data/generators/foundation5/public/stylesheets/foundation/components/_orbit.scss +423 -0
  153. data/generators/foundation5/public/stylesheets/foundation/components/_pagination.scss +150 -0
  154. data/generators/foundation5/public/stylesheets/foundation/components/_panels.scss +90 -0
  155. data/generators/foundation5/public/stylesheets/foundation/components/_pricing-tables.scss +150 -0
  156. data/generators/foundation5/public/stylesheets/foundation/components/_progress-bars.scss +79 -0
  157. data/generators/foundation5/public/stylesheets/foundation/components/_range-slider.scss +148 -0
  158. data/generators/foundation5/public/stylesheets/foundation/components/_reveal-new.scss +0 -0
  159. data/generators/foundation5/public/stylesheets/foundation/components/_reveal.scss +216 -0
  160. data/generators/foundation5/public/stylesheets/foundation/components/_side-nav.scss +115 -0
  161. data/generators/foundation5/public/stylesheets/foundation/components/_split-buttons.scss +191 -0
  162. data/generators/foundation5/public/stylesheets/foundation/components/_sub-nav.scss +125 -0
  163. data/generators/foundation5/public/stylesheets/foundation/components/_switch.scss +294 -0
  164. data/generators/foundation5/public/stylesheets/foundation/components/_tables.scss +129 -0
  165. data/generators/foundation5/public/stylesheets/foundation/components/_tabs.scss +109 -0
  166. data/generators/foundation5/public/stylesheets/foundation/components/_thumbs.scss +68 -0
  167. data/generators/foundation5/public/stylesheets/foundation/components/_tooltips.scss +140 -0
  168. data/generators/foundation5/public/stylesheets/foundation/components/_top-bar.scss +659 -0
  169. data/generators/foundation5/public/stylesheets/foundation/components/_type.scss +513 -0
  170. data/generators/foundation5/public/stylesheets/foundation/components/_visibility.scss +408 -0
  171. data/generators/foundation5/public/stylesheets/foundation.css +5398 -0
  172. data/generators/foundation5/public/stylesheets/foundation.css.scss +45 -0
  173. data/generators/foundation5/public/stylesheets/normalize.css +425 -0
  174. data/generators/foundation5/public/stylesheets/normalize.css.scss +425 -0
  175. data/generators/{foundation → line_case}/Gemfile.tt +1 -3
  176. data/generators/line_case/app/content_types/categories.yml +56 -0
  177. data/generators/line_case/app/content_types/emails.yml +35 -0
  178. data/generators/line_case/app/content_types/projects.yml +58 -0
  179. data/generators/{bootstrap2 → line_case}/app/views/pages/404.liquid.haml +3 -2
  180. data/generators/line_case/app/views/pages/email-registered.liquid.haml +13 -0
  181. data/generators/line_case/app/views/pages/index.liquid.haml +110 -0
  182. data/generators/line_case/app/views/pages/projects/content_type_template.liquid.haml +32 -0
  183. data/generators/line_case/app/views/snippets/newsletter_form.liquid.haml +14 -0
  184. data/generators/line_case/app/views/snippets/projects.liquid.haml +17 -0
  185. data/generators/line_case/app/views/snippets/social_links.liquid.haml +19 -0
  186. data/generators/line_case/config/deploy.yml +15 -0
  187. data/generators/{foundation → line_case}/config/site.yml.tt +3 -3
  188. data/generators/{foundation → line_case}/config/translations.yml +0 -0
  189. data/generators/{foundation → line_case}/config.ru +0 -0
  190. data/generators/line_case/data/categories.yml +8 -0
  191. data/generators/line_case/data/emails.yml +2 -0
  192. data/generators/line_case/data/projects.yml +39 -0
  193. data/generators/line_case/icon.png +0 -0
  194. data/generators/line_case/public/images/banner-header.png +0 -0
  195. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.abide.js +0 -0
  196. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.alerts.js +0 -0
  197. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.clearing.js +0 -0
  198. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.cookie.js +0 -0
  199. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.dropdown.js +0 -0
  200. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.forms.js +0 -0
  201. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.interchange.js +0 -0
  202. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.joyride.js +0 -0
  203. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.js +0 -0
  204. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.magellan.js +0 -0
  205. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.orbit.js +0 -0
  206. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.placeholder.js +0 -0
  207. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.reveal.js +0 -0
  208. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.section.js +0 -0
  209. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.tooltips.js +0 -0
  210. data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.topbar.js +0 -0
  211. data/generators/{foundation → line_case}/public/javascripts/foundation.min.js +0 -0
  212. data/generators/line_case/public/javascripts/vendor/custom.modernizr.js +4 -0
  213. data/generators/{foundation → line_case}/public/javascripts/vendor/jquery.js +0 -0
  214. data/generators/{foundation → line_case}/public/javascripts/vendor/zepto.js +0 -0
  215. data/generators/line_case/public/samples/projects/sample.jpeg +0 -0
  216. data/generators/line_case/public/samples/projects/sample2.jpeg +0 -0
  217. data/generators/line_case/public/samples/projects/sample3.jpeg +0 -0
  218. data/generators/line_case/public/samples/projects/sample4.jpeg +0 -0
  219. data/generators/line_case/public/samples/projects/sample5.jpeg +0 -0
  220. data/generators/line_case/public/samples/projects/sample6.jpeg +0 -0
  221. data/generators/line_case/public/samples/projects/sample7.jpeg +0 -0
  222. data/generators/line_case/public/samples/projects/sample8.jpeg +0 -0
  223. data/generators/line_case/public/stylesheets/_variables.css.sass +20 -0
  224. data/generators/line_case/public/stylesheets/foundation/_variables.scss +1290 -0
  225. data/generators/line_case/public/stylesheets/foundation/components/_alert-boxes.scss +107 -0
  226. data/generators/line_case/public/stylesheets/foundation/components/_block-grid.scss +71 -0
  227. data/generators/line_case/public/stylesheets/foundation/components/_breadcrumbs.scss +124 -0
  228. data/generators/line_case/public/stylesheets/foundation/components/_button-groups.scss +89 -0
  229. data/generators/line_case/public/stylesheets/foundation/components/_buttons.scss +230 -0
  230. data/generators/line_case/public/stylesheets/foundation/components/_clearing.scss +227 -0
  231. data/generators/line_case/public/stylesheets/foundation/components/_custom-forms.scss +278 -0
  232. data/generators/line_case/public/stylesheets/foundation/components/_dropdown-buttons.scss +115 -0
  233. data/generators/line_case/public/stylesheets/foundation/components/_dropdown.scss +151 -0
  234. data/generators/line_case/public/stylesheets/foundation/components/_flex-video.scss +46 -0
  235. data/generators/line_case/public/stylesheets/foundation/components/_forms.scss +411 -0
  236. data/generators/line_case/public/stylesheets/foundation/components/_global.scss +366 -0
  237. data/generators/line_case/public/stylesheets/foundation/components/_grid-5.scss +214 -0
  238. data/generators/line_case/public/stylesheets/foundation/components/_grid.scss +188 -0
  239. data/generators/line_case/public/stylesheets/foundation/components/_inline-lists.scss +53 -0
  240. data/generators/line_case/public/stylesheets/foundation/components/_joyride.scss +217 -0
  241. data/generators/line_case/public/stylesheets/foundation/components/_keystrokes.scss +57 -0
  242. data/generators/line_case/public/stylesheets/foundation/components/_labels.scss +85 -0
  243. data/generators/line_case/public/stylesheets/foundation/components/_magellan.scss +23 -0
  244. data/generators/line_case/public/stylesheets/foundation/components/_orbit.scss +340 -0
  245. data/generators/line_case/public/stylesheets/foundation/components/_pagination.scss +140 -0
  246. data/generators/line_case/public/stylesheets/foundation/components/_panels.scss +83 -0
  247. data/generators/line_case/public/stylesheets/foundation/components/_pricing-tables.scss +131 -0
  248. data/generators/line_case/public/stylesheets/foundation/components/_progress-bars.scss +71 -0
  249. data/generators/line_case/public/stylesheets/foundation/components/_reveal.scss +136 -0
  250. data/generators/line_case/public/stylesheets/foundation/components/_section.scss +391 -0
  251. data/generators/line_case/public/stylesheets/foundation/components/_side-nav.scss +69 -0
  252. data/generators/line_case/public/stylesheets/foundation/components/_split-buttons.scss +167 -0
  253. data/generators/line_case/public/stylesheets/foundation/components/_sub-nav.scss +84 -0
  254. data/generators/line_case/public/stylesheets/foundation/components/_switch.scss +266 -0
  255. data/generators/line_case/public/stylesheets/foundation/components/_tables.scss +84 -0
  256. data/generators/line_case/public/stylesheets/foundation/components/_thumbs.scss +53 -0
  257. data/generators/line_case/public/stylesheets/foundation/components/_tooltips.scss +117 -0
  258. data/generators/line_case/public/stylesheets/foundation/components/_top-bar.scss +576 -0
  259. data/generators/line_case/public/stylesheets/foundation/components/_type.scss +435 -0
  260. data/generators/line_case/public/stylesheets/foundation/components/_visibility.scss +322 -0
  261. data/generators/line_case/public/stylesheets/foundation.css.scss +43 -0
  262. data/generators/{foundation → line_case}/public/stylesheets/foundation.min.css +0 -0
  263. data/generators/{foundation/public/stylesheets/normalize.css → line_case/public/stylesheets/normalize.css.scss} +5 -5
  264. data/generators/line_case/public/stylesheets/pages.css.sass +163 -0
  265. data/generators/page/template.liquid.haml.tt +8 -5
  266. data/generators/page/template.liquid.tt +6 -2
  267. data/lib/locomotive/wagon/cli.rb +139 -43
  268. data/lib/locomotive/wagon/generators/content_type.rb +26 -10
  269. data/lib/locomotive/wagon/generators/page.rb +41 -25
  270. data/lib/locomotive/wagon/generators/site/base.rb +53 -0
  271. data/lib/locomotive/wagon/generators/site/blank.rb +9 -2
  272. data/lib/locomotive/wagon/generators/site/bootstrap2.rb +8 -2
  273. data/lib/locomotive/wagon/generators/site/bootstrap3.rb +20 -2
  274. data/lib/locomotive/wagon/generators/site/cloned.rb +4 -0
  275. data/lib/locomotive/wagon/generators/site/{foundation.rb → foundation4.rb} +10 -4
  276. data/lib/locomotive/wagon/generators/site/foundation5.rb +48 -0
  277. data/lib/locomotive/wagon/generators/site/line_case.rb +20 -0
  278. data/lib/locomotive/wagon/generators/site/unzip.rb +10 -2
  279. data/lib/locomotive/wagon/generators/site.rb +48 -2
  280. data/lib/locomotive/wagon/generators/snippet.rb +2 -1
  281. data/lib/locomotive/wagon/liquid/drops/content_types.rb +9 -3
  282. data/lib/locomotive/wagon/liquid/drops/page.rb +9 -1
  283. data/lib/locomotive/wagon/liquid/scopeable.rb +1 -1
  284. data/lib/locomotive/wagon/liquid/tags/fetch_page.rb +41 -0
  285. data/lib/locomotive/wagon/liquid/tags/model_form.rb +67 -0
  286. data/lib/locomotive/wagon/liquid/tags/path_helper.rb +2 -2
  287. data/lib/locomotive/wagon/liquid/tags/with_scope.rb +1 -1
  288. data/lib/locomotive/wagon/listen.rb +18 -10
  289. data/lib/locomotive/wagon/logger.rb +4 -0
  290. data/lib/locomotive/wagon/misc/core_ext.rb +8 -0
  291. data/lib/locomotive/wagon/misc/deployment_connection.rb +120 -0
  292. data/lib/locomotive/wagon/misc/hosting_api.rb +115 -0
  293. data/lib/locomotive/wagon/misc/httparty.rb +2 -0
  294. data/lib/locomotive/wagon/misc/livereload.rb +43 -0
  295. data/lib/locomotive/wagon/misc/mounter.rb +1 -1
  296. data/lib/locomotive/wagon/misc/tcp_port.rb +42 -0
  297. data/lib/locomotive/wagon/misc/thor.rb +15 -0
  298. data/lib/locomotive/wagon/server/entry_submission.rb +69 -38
  299. data/lib/locomotive/wagon/server/middleware.rb +4 -2
  300. data/lib/locomotive/wagon/server/page.rb +2 -2
  301. data/lib/locomotive/wagon/server.rb +11 -7
  302. data/lib/locomotive/wagon/version.rb +1 -1
  303. data/lib/locomotive/wagon.rb +141 -30
  304. data/locomotivecms_wagon.gemspec +7 -6
  305. data/spec/fixtures/default/app/content_types/bands.yml +3 -1
  306. data/spec/fixtures/default/app/views/pages/all.liquid.haml +3 -0
  307. data/spec/fixtures/default/app/views/pages/events.liquid.haml +21 -0
  308. data/spec/fixtures/default/app/views/pages/filtered.liquid.haml +11 -1
  309. data/spec/fixtures/default/app/views/pages/index.liquid.haml +1 -1
  310. data/spec/fixtures/default/data/bands.yml +3 -0
  311. data/spec/integration/server/basic_spec.rb +1 -0
  312. data/spec/integration/server/contact_form_spec.rb +1 -1
  313. data/spec/integration/server/liquid_spec.rb +8 -1
  314. data/spec/integration/server/new_contact_form_spec.rb +67 -0
  315. data/spec/integration/server/with_scope_spec.rb +10 -0
  316. data/spec/spec_helper.rb +3 -0
  317. metadata +339 -144
  318. data/generators/bootstrap2/app/views/pages/404.liquid +0 -13
  319. data/generators/bootstrap2/app/views/pages/index.liquid +0 -98
  320. data/generators/bootstrap2/app/views/pages/index.liquid.haml +0 -80
  321. data/generators/bootstrap2/app/views/snippets/footer.liquid +0 -3
  322. data/generators/bootstrap2/app/views/snippets/footer.liquid.haml +0 -2
  323. data/generators/bootstrap2/config/deploy.yml +0 -15
  324. data/generators/bootstrap2/public/fonts/FontAwesome.otf +0 -0
  325. data/generators/bootstrap2/public/fonts/fontawesome-webfont.eot +0 -0
  326. data/generators/bootstrap2/public/fonts/fontawesome-webfont.svg +0 -399
  327. data/generators/bootstrap2/public/fonts/fontawesome-webfont.ttf +0 -0
  328. data/generators/bootstrap2/public/fonts/fontawesome-webfont.woff +0 -0
  329. data/generators/bootstrap2/public/javascripts/bootstrap.js +0 -2280
  330. data/generators/bootstrap2/public/javascripts/bootstrap.min.js +0 -6
  331. data/generators/bootstrap2/public/stylesheets/application.css.scss +0 -39
  332. data/generators/bootstrap2/public/stylesheets/bootstrap-responsive.css +0 -1109
  333. data/generators/bootstrap2/public/stylesheets/bootstrap-responsive.min.css +0 -9
  334. data/generators/bootstrap2/public/stylesheets/bootstrap.css +0 -5568
  335. data/generators/bootstrap2/public/stylesheets/bootstrap.min.css +0 -9
  336. data/generators/bootstrap2/public/stylesheets/fonts/awesome.css.scss +0 -3
  337. data/generators/bootstrap2/public/stylesheets/fonts/font-awesome-ie7.css +0 -1203
  338. data/generators/bootstrap2/public/stylesheets/fonts/font-awesome-ie7.min.css +0 -384
  339. data/generators/bootstrap2/public/stylesheets/fonts/font-awesome.css +0 -1470
  340. data/generators/bootstrap2/public/stylesheets/fonts/font-awesome.min.css +0 -403
  341. data/generators/bootstrap3/public/javascripts/bootstrap.js +0 -1999
  342. data/generators/bootstrap3/public/stylesheets/bootstrap-theme.css +0 -384
  343. data/generators/bootstrap3/public/stylesheets/bootstrap-theme.min.css +0 -1
  344. data/generators/bootstrap3/public/stylesheets/bootstrap.min.css +0 -9
  345. data/generators/content_type/app/content_types/%name%.yml.tt +0 -58
  346. data/generators/foundation/app/views/pages/index.liquid +0 -150
  347. data/generators/foundation/app/views/pages/index.liquid.haml +0 -125
  348. data/generators/foundation/app/views/snippets/footer.liquid +0 -16
  349. data/generators/foundation/app/views/snippets/footer.liquid.haml +0 -22
  350. data/generators/foundation/config/deploy.yml +0 -15
  351. data/generators/foundation/public/samples/.empty_directory +0 -1
  352. data/generators/foundation/public/stylesheets/foundation.css +0 -4727
@@ -30,34 +30,65 @@ module Locomotive
30
30
 
31
31
  end
32
32
 
33
+ module ForceColor
34
+
35
+ def force_color_if_asked(options)
36
+ if options[:force_color]
37
+ # thor
38
+ require 'locomotive/wagon/misc/thor'
39
+ self.shell = Thor::Shell::ForceColor.new
40
+
41
+ # bypass colorize code
42
+ STDOUT.instance_eval { def isatty; true; end; }
43
+ end
44
+ end
45
+
46
+ end
47
+
33
48
  class Generate < Thor
34
49
 
50
+ include Locomotive::Wagon::CLI::ForceColor
35
51
  include Locomotive::Wagon::CLI::CheckPath
36
52
 
37
53
  class_option :path, aliases: '-p', type: :string, default: '.', optional: true, desc: 'if your LocomotiveCMS site is not in the current path'
38
54
 
39
- desc 'content_type NAME FIELDS', 'Create a content type with NAME as the slug and FIELDS as the list of fields.'
55
+ desc 'content_type SLUG FIELDS', 'Creates a content type with the specified slug and fields.'
56
+ method_option :name, aliases: '-n', type: :string, default: nil, optional: true, desc: 'Name of the content type as it will be displayed in the back-office'
40
57
  long_desc <<-LONGDESC
41
- Create a content type with NAME as the slug and FIELDS as the list of fields.
42
- The fields follows that schema:
58
+ Creates a content type with the specified slug and fields.
59
+
60
+ SLUG should be plural, lowercase, and underscored.
61
+
62
+ FIELDS format: field_1[:TYPE][:LABEL][:REQUIRED][:LOCALIZED][:TARGET_CONTENT_TYPE_SLUG] field_2[:TYPE][:LABEL][:REQUIRED][:LOCALIZED][:TARGET_CONTENT_TYPE_SLUG] ...
43
63
 
44
- field_1[:type][:required] field_2[:type][:required]
64
+ TYPE values: string, text, integer, float, boolean, email, date, date_time, file, tags, select, belongs_to, has_many, or many_to_many. Default is string.
65
+
66
+ To require a field, set REQUIRED to true. The first field is required by default.
67
+
68
+ TARGET_CONTENT_TYPE_SLUG is the slug of the content type used in the relationship.
45
69
 
46
70
  Examples:
47
71
 
48
- * wagon generate content_type songs name:string duration:string
72
+ * wagon generate content_type posts title published_at:date_time:true body:text
49
73
 
50
- * wagon generate content_type posts title body:text:true published_at:date
74
+ * wagon generate content_type products title price:float photo:file category:belongs_to:Category:true:false:main_categories
51
75
  LONGDESC
52
76
  def content_type(name, *fields)
77
+ force_color_if_asked(options)
78
+
53
79
  say('The fields are missing', :red) and return false if fields.empty?
54
80
 
55
81
  if check_path!
56
- Locomotive::Wagon.generate :content_type, name, self.options['path'], fields
82
+ Locomotive::Wagon.generate :content_type, [name, fields, self.options.delete('path')], self.options
57
83
  end
58
84
  end
59
85
 
60
86
  desc 'page FULLPATH', 'Create a page. No need to pass an extension to the FULLPATH arg'
87
+ method_option :title, aliases: '-t', type: 'string', default: nil, desc: 'Title of the page'
88
+ method_option :haml, aliases: '-h', type: 'boolean', default: nil, desc: 'add a HAML extension to the file'
89
+ method_option :listed, aliases: '-l', type: 'boolean', default: false, desc: 'tell if the page is listed in the menu'
90
+ method_option :content_type, aliases: '-c', type: 'string', default: nil, desc: 'tell if the page is a template for a content type'
91
+ method_option :locales, aliases: '-lo', type: 'string', default: nil, desc: 'locales for the various translations'
61
92
  long_desc <<-LONGDESC
62
93
  Create a page. The generator will ask for the extension (liquid or haml) and also
63
94
  if the page is localized or not.
@@ -69,9 +100,11 @@ module Locomotive
69
100
  * wagon generate page about_us/me
70
101
  LONGDESC
71
102
  def page(fullpath)
103
+ force_color_if_asked(options)
104
+
72
105
  if path = check_path!
73
- locales = self.site_config(path)['locales']
74
- Locomotive::Wagon.generate :page, fullpath, self.options['path'], locales
106
+ self.options[:default_locales] = self.site_config(path)['locales']
107
+ Locomotive::Wagon.generate :page, [fullpath, self.options.delete('path')], self.options
75
108
  end
76
109
  end
77
110
 
@@ -85,9 +118,11 @@ module Locomotive
85
118
  * wagon generate snippet footer
86
119
  LONGDESC
87
120
  def snippet(slug)
121
+ force_color_if_asked(options)
122
+
88
123
  if path = check_path!
89
124
  locales = self.site_config(path)['locales']
90
- Locomotive::Wagon.generate :snippet, slug, self.options['path'], locales
125
+ Locomotive::Wagon.generate :snippet, [slug, locales, self.options.delete('path')], self.options
91
126
  end
92
127
  end
93
128
 
@@ -109,30 +144,47 @@ module Locomotive
109
144
  class Main < Thor
110
145
 
111
146
  include Locomotive::Wagon::CLI::CheckPath
147
+ include Locomotive::Wagon::CLI::ForceColor
112
148
 
113
- desc 'version', 'Version of the LocomotiveCMS wagon'
149
+ class_option :force_color, type: :boolean, default: false, desc: 'Whether or not to use ANSI color in the output.'
150
+
151
+ desc 'version', 'Version of the LocomotiveCMS Wagon'
114
152
  def version
115
153
  require 'locomotive/wagon/version'
116
154
  say Locomotive::Wagon::VERSION
117
155
  end
118
156
 
119
- desc 'init NAME [PATH]', 'Create a brand new LocomotiveCMS site'
120
- method_option :template, aliases: '-t', type: 'string', default: 'blank', desc: 'instead of building from a blank site, you can have a pre-fetched site with form a template (see the templates command)'
121
- method_option :lib, aliases: '-l', type: 'string', desc: 'Path to an external ruby lib or generator'
122
- method_option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'display the full error stack trace if an error occurs'
123
- def init(name, path = '.')
157
+ desc 'auth [EMAIL] [PASSWORD]', 'Log into the LocomotiveHosting platform'
158
+ def auth(email = nil, password = nil)
159
+ say "LocomotiveHosting Sign in/up\n\n", :bold
160
+
161
+ email ||= ask('Enter your e-mail?')
162
+ password ||= ask('Enter your password?')
163
+
164
+ Locomotive::Wagon.authenticate(email, password, shell)
165
+ end
166
+
167
+ desc 'init NAME [PATH] [GENERATOR_OPTIONS]', 'Create a brand new site'
168
+ method_option :template, aliases: '-t', type: 'string', default: 'blank', desc: 'instead of building from a blank site, you can also have a pre-fetched site from a template (see the templates command)'
169
+ method_option :lib, aliases: '-l', type: 'string', desc: 'Path to an external ruby lib or generator'
170
+ method_option :skip_bundle, type: 'boolean', default: false, desc: "Don't run bundle install"
171
+ method_option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'display the full error stack trace if an error occurs'
172
+ def init(name, path = '.', *generator_options)
173
+ force_color_if_asked(options)
124
174
  require 'locomotive/wagon/generators/site'
125
175
  require File.expand_path(options[:lib]) if options[:lib]
126
176
  generator = Locomotive::Wagon::Generators::Site.get(options[:template])
127
177
  if generator.nil?
128
178
  say "Unknown site template '#{options[:template]}'", :red
179
+ exit(1)
129
180
  else
130
181
  begin
131
- if Locomotive::Wagon.init(name, path, generator)
132
- self.print_next_instructions_when_site_created(name, path)
182
+ if Locomotive::Wagon.init(generator.klass, [name, path, options[:skip_bundle].to_s, *generator_options], { force_color: options[:force_color] })
183
+ self.print_next_instructions_when_site_created(name, path, options[:skip_bundle])
133
184
  end
134
185
  rescue GeneratorException => e
135
186
  self.print_exception(e, options[:verbose])
187
+ exit(1)
136
188
  end
137
189
  end
138
190
  end
@@ -149,59 +201,102 @@ module Locomotive
149
201
  end
150
202
  rescue Exception => e
151
203
  self.print_exception(e, options[:verbose])
204
+ exit(1)
152
205
  end
153
206
  end
154
207
 
155
- desc 'generate TYPE ...ARGS', 'Generate resources (content_types, page, snippets) for a LocomotiveCMS site'
208
+ desc 'generate RESOURCE ARGUMENTS', 'Generates a content_type, page, or snippet'
209
+ long_desc <<-LONGDESC
210
+ Generates a content_type, page, or snippet
211
+
212
+ RESOURCE can be set to content_type, page, or snippet.
213
+
214
+ Use wagon generate help [RESOURCE] for usage information and examples.
215
+ LONGDESC
156
216
  subcommand 'generate', Generate
157
217
 
158
218
  desc 'list_templates', 'List all the templates to create either a site or a content type'
159
219
  method_option :lib, aliases: '-l', type: 'string', desc: 'Path to an external ruby lib or generator'
220
+ method_option :json, aliases: '-j', type: :boolean, default: false, desc: 'Output the list in JSON'
160
221
  def list_templates
222
+ force_color_if_asked(options)
161
223
  require 'locomotive/wagon/generators/site'
162
224
  require File.expand_path(options[:lib]) if options[:lib]
163
225
  if Locomotive::Wagon::Generators::Site.empty?
164
226
  say 'No templates', :red
165
- else
227
+ elsif !options[:json]
166
228
  Locomotive::Wagon::Generators::Site.list.each do |info|
167
229
  say info.name, :bold, false
168
230
  say " - #{info.description}" unless info.description.blank?
169
231
  end
232
+ else
233
+ say Locomotive::Wagon::Generators::Site.list_to_json
170
234
  end
171
235
  end
172
236
 
173
- desc 'serve [PATH]', 'Serve a LocomotiveCMS site from the file system'
237
+ desc 'serve [PATH]', 'Serve a site from the file system'
174
238
  method_option :host, aliases: '-h', type: 'string', default: '0.0.0.0', desc: 'The host (address) of the Thin server'
175
239
  method_option :port, aliases: '-p', type: 'string', default: '3333', desc: 'The port of the Thin server'
240
+ method_option :daemonize, aliases: '-d', type: 'boolean', default: false, desc: 'Run daemonized Thin server in the background'
241
+ method_option :live_reload_port, aliases: '-l', type: 'string', default: false, desc: 'Include the Livereload javascript in each page'
242
+ method_option :force, aliases: '-f', type: 'boolean', default: false, desc: 'Stop the current daemonized Thin server if found before starting a new one'
243
+ method_option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'display the full error stack trace if an error occurs'
176
244
  def serve(path = '.')
245
+ parent_pid = Process.pid
246
+ force_color_if_asked(options)
177
247
  if check_path!(path)
178
248
  begin
179
249
  Locomotive::Wagon.serve(path, options)
250
+ rescue SystemExit => e
251
+ if parent_pid == Process.pid
252
+ say "Your site is served now.", :green
253
+ end
254
+ rescue Exception => e
255
+ self.print_exception(e, options[:verbose])
256
+ exit(1)
257
+ end
258
+ end
259
+ end
260
+
261
+ desc 'stop [PATH]', 'Stop serving a site previously launched by the serve command with the -d option'
262
+ def stop(path = '.')
263
+ force_color_if_asked(options)
264
+ if check_path!(path)
265
+ begin
266
+ Locomotive::Wagon.stop(path)
267
+ say "Your site is not served anymore.", :green
180
268
  rescue Exception => e
181
269
  say e.message, :red
270
+ exit(1)
182
271
  end
183
272
  end
184
273
  end
185
274
 
186
- desc 'push ENV [PATH]', 'Push a site to a remote LocomotiveCMS engine'
275
+ desc 'push ENV [PATH]', 'Push a site to a remote LocomotiveCMS Engine'
187
276
  method_option :resources, aliases: '-r', type: 'array', default: nil, desc: 'Only push the resource(s) passed in argument'
188
277
  method_option :force, aliases: '-f', type: 'boolean', default: false, desc: 'Force the push of a resource'
189
278
  method_option :translations, aliases: '-t', type: 'boolean', default: false, desc: 'Push the local translations (by default, they are not)'
190
279
  method_option :data, aliases: '-d', type: 'boolean', default: false, desc: 'Push the content entries and the editable elements (by default, they are not)'
280
+ method_option :shell, type: 'boolean', default: true, desc: 'Use shell to ask for missing connection information like the subdomain (in this case, take a random one)'
191
281
  method_option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'display the full error stack trace if an error occurs'
192
282
  def push(env, path = '.')
283
+ force_color_if_asked(options)
284
+
193
285
  if check_path!(path)
194
- if connection_info = self.retrieve_connection_info(env, path)
286
+ if connection_info = self.retrieve_connection_info(env, path, options[:shell])
195
287
  begin
196
288
  Locomotive::Wagon.push(path, connection_info, options)
197
289
  rescue Exception => e
198
290
  self.print_exception(e, options[:verbose])
291
+ exit(1)
199
292
  end
293
+ else
294
+ exit(1)
200
295
  end
201
296
  end
202
297
  end
203
298
 
204
- desc 'pull ENV [PATH]', 'Pull a site from a remote LocomotiveCMS engine'
299
+ desc 'pull ENV [PATH]', 'Pull a site from a remote LocomotiveCMS Engine'
205
300
  method_option :resources, aliases: '-r', type: 'array', default: nil, desc: 'Only pull the resource(s) passed in argument'
206
301
  method_option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'display the full error stack trace if an error occurs'
207
302
  def pull(env, path = '.')
@@ -211,12 +306,13 @@ module Locomotive
211
306
  Locomotive::Wagon.pull(path, connection_info, options)
212
307
  rescue Exception => e
213
308
  self.print_exception(e, options[:verbose])
309
+ exit(1)
214
310
  end
215
311
  end
216
312
  end
217
313
  end
218
314
 
219
- desc 'destroy ENV [PATH]', 'Destroy a remote LocomotiveCMS engine'
315
+ desc 'destroy ENV [PATH]', 'Destroy a remote LocomotiveCMS Engine'
220
316
  def destroy(env, path = '.')
221
317
  if check_path!(path)
222
318
  if connection_info = self.retrieve_connection_info(env, path)
@@ -224,6 +320,7 @@ module Locomotive
224
320
  Locomotive::Wagon.destroy(path, connection_info)
225
321
  else
226
322
  say 'The destroy operation has been cancelled', :red
323
+ exit(1)
227
324
  end
228
325
  end
229
326
  end
@@ -235,11 +332,17 @@ module Locomotive
235
332
  #
236
333
  # @param [ String ] name The name of the site
237
334
  # @param [ String ] path The path of the local site
335
+ # @param [ Boolean ] skip_bundle Do not run bundle install
238
336
  #
239
- def print_next_instructions_when_site_created(name, path)
337
+ def print_next_instructions_when_site_created(name, path, skip_bundle)
240
338
  say "\nCongratulations, your site \"#{name}\" has been created successfully !", :green
241
339
  say 'Next steps:', :bold
242
- say "\tcd #{path}/#{name}\n\tbundle install\n\tbundle exec wagon serve\n\topen http://0.0.0.0:3333"
340
+
341
+ next_instructions = "\tcd #{path}/#{name}\n\t"
342
+ next_instructions += "bundle install\n\t" unless skip_bundle
343
+ next_instructions += "#{'bundle exec ' unless skip_bundle}wagon serve\n\topen http://0.0.0.0:3333"
344
+
345
+ say next_instructions
243
346
  end
244
347
 
245
348
  # Print the exception.
@@ -259,33 +362,26 @@ module Locomotive
259
362
  #
260
363
  # @param [ String ] env The environment (development, staging, production, ...etc)
261
364
  # @param [ String ] path The path of the local site
365
+ # @param [ Boolean ] use_shell True by default, use it to ask for missing information (subdomain for instance)
262
366
  #
263
367
  # @return [ Hash ] The information of the connection or nil if errors
264
368
  #
265
- def retrieve_connection_info(env, path)
266
- require 'active_support/core_ext/hash'
267
- require 'erb'
268
- connection_info = nil
369
+ def retrieve_connection_info(env, path, use_shell = true)
370
+ require 'locomotive/wagon/misc/deployment_connection'
371
+
269
372
  begin
270
- path_to_deploy_file = File.join(path, 'config', 'deploy.yml')
271
- env_parsed_deploy_file = ERB.new(File.open(path_to_deploy_file).read).result
272
- connection_info = YAML::load(env_parsed_deploy_file)[env.to_s].with_indifferent_access
373
+ service = Locomotive::Wagon::DeploymentConnection.new(path, use_shell ? shell : nil)
273
374
 
274
- if connection_info[:ssl] && !connection_info[:host].start_with?('https')
275
- connection_info[:host] = 'https://' + connection_info[:host]
276
- end
375
+ service.get_information(env)
277
376
 
278
- if connection_info.nil?
279
- raise "No #{env.to_s} environment found in the config/deploy.yml file"
280
- end
281
377
  rescue Exception => e
282
- say "Unable to read the information about the remote LocomotiveCMS site (#{e.message})", :red
378
+ self.print_exception(e, options[:verbose])
379
+ nil
283
380
  end
284
- connection_info
285
381
  end
286
382
 
287
383
  end
288
384
 
289
385
  end
290
386
  end
291
- end
387
+ end
@@ -10,14 +10,16 @@ module Locomotive
10
10
  class ContentType < Thor::Group
11
11
 
12
12
  include Thor::Actions
13
+ include Locomotive::Wagon::CLI::ForceColor
13
14
 
14
- argument :name
15
- argument :target_path
15
+ argument :slug
16
16
  argument :fields
17
+ argument :target_path
17
18
 
18
19
  def copy_sources
19
20
  directory('.', target_path, { recursive: true }, {
20
- name: self.name,
21
+ name: name,
22
+ slug: slug,
21
23
  fields: extract_fields(fields)
22
24
  })
23
25
  end
@@ -28,15 +30,29 @@ module Locomotive
28
30
 
29
31
  protected
30
32
 
33
+ def name
34
+ options['name'] || slug.humanize
35
+ end
36
+
31
37
  def extract_fields(fields)
32
38
  fields.map do |raw_attributes|
33
- name, type, required = raw_attributes.split(':')
34
-
35
- OpenStruct.new({
36
- name: name,
37
- type: type || 'string',
38
- required: %w(true required).include?(required)
39
- })
39
+ name, type, label, required, localized, target_content_type_slug = raw_attributes.split(':')
40
+
41
+ OpenStruct.new(
42
+ name: name,
43
+ label: label || name.humanize,
44
+ type: type || 'string',
45
+ required: %w(true required).include?(required),
46
+ localized: %w(true required).include?(localized)
47
+ ).tap do |field|
48
+ if %w(belongs_to has_many many_to_many).include?(type)
49
+ field.class_name = target_content_type_slug
50
+
51
+ inverse_of = type == 'belongs_to' ? target_content_type_slug.singularize : target_content_type_slug
52
+
53
+ field.inverse_of = inverse_of
54
+ end
55
+ end
40
56
  end
41
57
  end
42
58
 
@@ -8,40 +8,29 @@ module Locomotive
8
8
  class Page < Thor::Group
9
9
 
10
10
  include Thor::Actions
11
+ include Locomotive::Wagon::CLI::ForceColor
11
12
 
12
13
  argument :slug
13
14
  argument :target_path # path to the site
14
- argument :locales
15
-
16
- attr_accessor :haml
17
-
18
- def ask_for_haml
19
- self.haml = yes?('Do you prefer a HAML template ?')
20
- end
21
-
22
- def apply_locales?
23
- self.locales.shift # remove the default locale
24
-
25
- unless self.locales.empty?
26
- unless yes?('Do you want to generate templates for each locale ?')
27
- self.locales = []
28
- end
29
- end
30
- end
31
15
 
32
16
  def create_page
33
- extension = self.haml ? 'liquid.haml' : 'liquid'
17
+ extension = haml? ? 'liquid.haml' : 'liquid'
18
+
19
+ segments = self.slug.split('/').find_all { |segment| segment != '' }
20
+ max_segments = segments.size
34
21
 
35
- segments = self.slug.split('/')
36
22
  while segment = segments.pop do
37
- options = { slug: segment, translated: false }
38
- file_path = File.join(pages_path, segments, segment)
23
+ _options = self.page_options(slug: segment, translated: false)
24
+ file_path = File.join(pages_path, segments, segment)
25
+
26
+ # the content type option is never deleted for the first segment (the requested template)
27
+ _options.delete(:content_type) unless segments.size == (max_segments - 1)
39
28
 
40
- template "template.#{extension}.tt", "#{file_path}.#{extension}", options
29
+ template "template.#{extension}.tt", "#{file_path}.#{extension}", _options
41
30
 
42
- self.locales.each do |locale|
43
- options[:translated] = true
44
- template "template.#{extension}.tt", "#{file_path}.#{locale}.#{extension}", options
31
+ self.other_locales.each do |locale|
32
+ _options[:translated] = true
33
+ template "template.#{extension}.tt", "#{file_path}.#{locale}.#{extension}", _options
45
34
  end
46
35
  end
47
36
  end
@@ -52,10 +41,37 @@ module Locomotive
52
41
 
53
42
  protected
54
43
 
44
+ def haml?
45
+ if options[:haml].nil?
46
+ yes?('Do you prefer a HAML template ?')
47
+ else
48
+ options[:haml]
49
+ end
50
+ end
51
+
55
52
  def pages_path
56
53
  File.join(target_path, 'app', 'views', 'pages')
57
54
  end
58
55
 
56
+ def page_options(base = {})
57
+ base.merge({
58
+ title: options[:title] || base[:slug].humanize,
59
+ listed: options[:listed],
60
+ content_type: options[:content_type]
61
+ })
62
+ end
63
+
64
+ def other_locales
65
+ locales = options[:default_locales]
66
+ locales.shift
67
+
68
+ # #1 default: [fr, en, es], asked: [en, de], result => [en]
69
+ # #2 default: [fr, en, de], asked: [es], result => []
70
+ # #1 default: [fr, en, es], asked: [fr, en, es], result => [en, es]
71
+
72
+ locales & (options[:locales] || [])
73
+ end
74
+
59
75
  end
60
76
 
61
77
  end
@@ -1,6 +1,7 @@
1
1
  require 'thor/group'
2
2
  require 'active_support'
3
3
  require 'active_support/core_ext'
4
+ require 'active_support/core_ext/string/inflections'
4
5
 
5
6
  module Locomotive
6
7
  module Wagon
@@ -10,9 +11,11 @@ module Locomotive
10
11
  class Base < Thor::Group
11
12
 
12
13
  include Thor::Actions
14
+ include Locomotive::Wagon::CLI::ForceColor
13
15
 
14
16
  argument :name
15
17
  argument :target_path
18
+ argument :skip_bundle
16
19
 
17
20
  def copy_sources
18
21
  directory('.', self.destination, { recursive: true }, {
@@ -21,14 +24,64 @@ module Locomotive
21
24
  })
22
25
  end
23
26
 
27
+ def comment_gemfile
28
+ return unless skip_bundle?
29
+
30
+ gsub_file File.join(self.destination, 'Gemfile'), /^(.*)$/ do |match|
31
+ "# #{match}"
32
+ end
33
+ end
34
+
24
35
  def self.source_root
25
36
  File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..', 'generators', self.name.demodulize.underscore)
26
37
  end
27
38
 
39
+ def self.may_use_haml
40
+ class_option :haml, type: :boolean, default: nil, required: false, desc: 'Use HAML templates?'
41
+ end
42
+
43
+ def self.may_use_scss
44
+ class_option :scss, type: :boolean, default: nil, required: false, desc: 'Use SCSS stylesheets?'
45
+ end
46
+
47
+ protected
48
+
28
49
  def destination
29
50
  File.join(target_path, name)
30
51
  end
31
52
 
53
+ def haml?
54
+ if options[:haml].nil?
55
+ yes?('Do you prefer HAML templates?')
56
+ else
57
+ options[:haml]
58
+ end
59
+ end
60
+
61
+ def scss?
62
+ if options[:scss].nil?
63
+ yes?('Do you prefer SCSS stylesheets?')
64
+ else
65
+ options[:scss]
66
+ end
67
+ end
68
+
69
+ def skip_bundle?
70
+ [true, 'true'].include?(skip_bundle)
71
+ end
72
+
73
+ def bundle_install
74
+ return if skip_bundle?
75
+
76
+ FileUtils.cd self.destination
77
+
78
+ say_status :run, "bundle install"
79
+
80
+ ENV['BUNDLE_GEMFILE'] = nil
81
+
82
+ print `"#{Gem.ruby}" -rubygems "#{Gem.bin_path('bundler', 'bundle')}" install`
83
+ end
84
+
32
85
  end
33
86
 
34
87
  end
@@ -5,8 +5,10 @@ module Locomotive
5
5
 
6
6
  class Blank < Base
7
7
 
8
+ may_use_haml
9
+
8
10
  def choose_haml_over_html
9
- if yes?('Do you prefer HAML templates ?')
11
+ if haml?
10
12
  remove_file File.join(self.destination, 'app/views/pages/index.liquid')
11
13
  remove_file File.join(self.destination, 'app/views/pages/404.liquid')
12
14
  else
@@ -14,10 +16,15 @@ module Locomotive
14
16
  remove_file File.join(self.destination, 'app/views/pages/404.liquid.haml')
15
17
  end
16
18
  end
19
+
20
+ def bundle_install
21
+ super
22
+ end
23
+
17
24
  end
18
25
 
19
26
  Locomotive::Wagon::Generators::Site.register(:blank, Blank, %{
20
- A blank LocomotiveCMS site with the minimal files.
27
+ A blank site with the minimal files.
21
28
  })
22
29
  end
23
30
  end
@@ -5,8 +5,10 @@ module Locomotive
5
5
 
6
6
  class Bootstrap2 < Base
7
7
 
8
+ may_use_haml
9
+
8
10
  def choose_haml_over_html
9
- if yes?('Do you prefer HAML templates ?')
11
+ if haml?
10
12
  remove_file File.join(self.destination, 'app/views/pages/index.liquid')
11
13
  remove_file File.join(self.destination, 'app/views/pages/404.liquid')
12
14
  remove_file File.join(self.destination, 'app/views/snippets/footer.liquid')
@@ -17,10 +19,14 @@ module Locomotive
17
19
  end
18
20
  end
19
21
 
22
+ def bundle_install
23
+ super
24
+ end
25
+
20
26
  end
21
27
 
22
28
  Locomotive::Wagon::Generators::Site.register(:bootstrap2, Bootstrap2, %{
23
- A LocomotiveCMS site with Twitter Bootstrap (v2.3.2) and Font Awesome (v3.2.1).
29
+ A site with Twitter Bootstrap (v2.3.2) and Font Awesome (v3.2.1).
24
30
  })
25
31
  end
26
32
  end