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
@@ -5,8 +5,11 @@ module Locomotive
5
5
 
6
6
  class Bootstrap3 < Base
7
7
 
8
+ may_use_haml
9
+ may_use_scss
10
+
8
11
  def choose_haml_over_html
9
- if yes?('Do you prefer HAML templates ?')
12
+ if haml?
10
13
  remove_file File.join(self.destination, 'app/views/pages/index.liquid')
11
14
  remove_file File.join(self.destination, 'app/views/pages/404.liquid')
12
15
  remove_file File.join(self.destination, 'app/views/snippets/footer.liquid')
@@ -17,10 +20,25 @@ module Locomotive
17
20
  end
18
21
  end
19
22
 
23
+ def choose_scss_over_css
24
+ if scss?
25
+ remove_file File.join(self.destination, 'public/stylesheets/application.css')
26
+ remove_file File.join(self.destination, 'public/stylesheets/bootstrap.css')
27
+ else
28
+ remove_dir File.join(self.destination, 'public/stylesheets/bootstrap')
29
+ remove_file File.join(self.destination, 'public/stylesheets/application.css.scss')
30
+ remove_file File.join(self.destination, 'public/stylesheets/bootstrap.css.scss')
31
+ end
32
+ end
33
+
34
+ def bundle_install
35
+ super
36
+ end
37
+
20
38
  end
21
39
 
22
40
  Locomotive::Wagon::Generators::Site.register(:bootstrap3, Bootstrap3, %{
23
- A LocomotiveCMS site powered by Twitter bootstrap (v3.0.0).
41
+ A site powered by Twitter bootstrap (v3.1.1).
24
42
  })
25
43
  end
26
44
  end
@@ -16,6 +16,10 @@ module Locomotive
16
16
  }.merge(self.connection_info))
17
17
  end
18
18
 
19
+ def bundle_install
20
+ super
21
+ end
22
+
19
23
  end
20
24
  end
21
25
  end
@@ -3,10 +3,12 @@ module Locomotive
3
3
  module Generators
4
4
  module Site
5
5
 
6
- class Foundation < Base
6
+ class Foundation4 < Base
7
+
8
+ may_use_haml
7
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
- Locomotive::Wagon::Generators::Site.register(:foundation, Foundation, %{
23
- A LocomotiveCMS site powered by Foundation (v4.3.2).
28
+ Locomotive::Wagon::Generators::Site.register(:foundation4, Foundation4, %{
29
+ A site powered by Foundation (v4.3.2).
24
30
  })
25
31
  end
26
32
  end
@@ -0,0 +1,48 @@
1
+ module Locomotive
2
+ module Wagon
3
+ module Generators
4
+ module Site
5
+
6
+ class Foundation5 < Base
7
+
8
+ may_use_haml
9
+ may_use_scss
10
+
11
+ def choose_haml_over_html
12
+ if haml?
13
+ remove_file File.join(self.destination, 'app/views/pages/index.liquid')
14
+ remove_file File.join(self.destination, 'app/views/pages/404.liquid')
15
+ remove_file File.join(self.destination, 'app/views/snippets/footer.liquid')
16
+ else
17
+ remove_file File.join(self.destination, 'app/views/pages/index.liquid.haml')
18
+ remove_file File.join(self.destination, 'app/views/pages/404.liquid.haml')
19
+ remove_file File.join(self.destination, 'app/views/snippets/footer.liquid.haml')
20
+ end
21
+ end
22
+
23
+ def choose_scss_over_css
24
+ if scss?
25
+ remove_file File.join(self.destination, 'public/stylesheets/application.css')
26
+ remove_file File.join(self.destination, 'public/stylesheets/foundation.css')
27
+ remove_file File.join(self.destination, 'public/stylesheets/normalize.css')
28
+ else
29
+ remove_dir File.join(self.destination, 'public/stylesheets/foundation')
30
+ remove_file File.join(self.destination, 'public/stylesheets/application.css.scss')
31
+ remove_file File.join(self.destination, 'public/stylesheets/foundation.css.scss')
32
+ remove_file File.join(self.destination, 'public/stylesheets/normalize.css.scss')
33
+ end
34
+ end
35
+
36
+ def bundle_install
37
+ super
38
+ end
39
+
40
+ end
41
+
42
+ Locomotive::Wagon::Generators::Site.register(:foundation5, Foundation5, %{
43
+ A site powered by Foundation (v5.2.3.0).
44
+ })
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,20 @@
1
+ module Locomotive
2
+ module Wagon
3
+ module Generators
4
+ module Site
5
+
6
+ class LineCase < Base
7
+
8
+ def bundle_install
9
+ super
10
+ end
11
+
12
+ end
13
+
14
+ Locomotive::Wagon::Generators::Site.register(:line_case, LineCase, %{
15
+ A simple portfolio site.
16
+ })
17
+ end
18
+ end
19
+ end
20
+ end
@@ -8,13 +8,17 @@ module Locomotive
8
8
 
9
9
  class Unzip < Base
10
10
 
11
+ class_option :location, type: :string, default: nil, required: false, desc: 'Location of the zip file'
12
+
13
+ @@source_root = nil
14
+
11
15
  def prepare
12
16
  remove_file join('tmp')
13
17
  empty_directory join('tmp')
14
18
  end
15
19
 
16
20
  def ask_for_location
17
- @location = ask('What is the location (on the filesystem or url) of the zip file ?')
21
+ @location = options[:location] || ask('What is the location (on the filesystem or url) of the zip file ?')
18
22
  raise GeneratorException.new('Please enter a location') if @location.blank?
19
23
  end
20
24
 
@@ -55,6 +59,10 @@ module Locomotive
55
59
  directory('.', self.destination, { recursive: true })
56
60
  end
57
61
 
62
+ def bundle_install
63
+ super
64
+ end
65
+
58
66
  def self.source_root
59
67
  # only way to change the source root from the instance
60
68
  @@source_root
@@ -73,7 +81,7 @@ module Locomotive
73
81
  end
74
82
 
75
83
  Locomotive::Wagon::Generators::Site.register(:unzip, Unzip, %{
76
- Unzip a local or remote (http, https, ftp) zipped LocomotiveCMS site.
84
+ Unzip a local or remote (http, https, ftp) zipped site.
77
85
  })
78
86
  end
79
87
  end
@@ -37,6 +37,14 @@ module Locomotive
37
37
  Locomotive::Wagon::Generators::Site::List.instance._list
38
38
  end
39
39
 
40
+ # JSON output of the generators list
41
+ #
42
+ # @return [ String ] The JSON output
43
+ #
44
+ def self.list_to_json
45
+ Locomotive::Wagon::Generators::Site::List.instance.to_json
46
+ end
47
+
40
48
  # Tell if the list of generators is empty or not .
41
49
  #
42
50
  # @return [ Boolean ] True if empty
@@ -84,6 +92,44 @@ module Locomotive
84
92
 
85
93
  self._list.last
86
94
  end
95
+
96
+ # Return the list of site templates in JSON
97
+ #
98
+ # @return [ String ] JSON output
99
+ #
100
+ def to_json
101
+ self._list.map do |template|
102
+ # puts template.klass.class_options.inspect
103
+ # puts class_options_to_json
104
+ path = template.klass.source_root ? File.expand_path(template.klass.source_root) : nil
105
+ icon = path ? File.join(path, 'icon.png') : nil
106
+
107
+ {
108
+ name: template.name,
109
+ description: template.description,
110
+ path: path,
111
+ icon: icon && File.exists?(icon) ? icon : nil,
112
+ options: class_options_to_json(template)
113
+
114
+
115
+ }
116
+ end.to_json
117
+ end
118
+
119
+ protected
120
+
121
+ def class_options_to_json(template)
122
+ [].tap do |list|
123
+ template.klass.class_options.each do |name, option|
124
+ list << {
125
+ name: name,
126
+ label: option.description,
127
+ type: option.type
128
+ }
129
+ end
130
+ end
131
+ end
132
+
87
133
  end
88
134
 
89
135
  end
@@ -94,8 +140,8 @@ end
94
140
 
95
141
  require 'locomotive/wagon/generators/site/base'
96
142
  require 'locomotive/wagon/generators/site/blank'
97
- require 'locomotive/wagon/generators/site/bootstrap2'
143
+ require 'locomotive/wagon/generators/site/line_case'
98
144
  require 'locomotive/wagon/generators/site/bootstrap3'
99
- require 'locomotive/wagon/generators/site/foundation'
145
+ require 'locomotive/wagon/generators/site/foundation5'
100
146
  require 'locomotive/wagon/generators/site/unzip'
101
147
  require 'locomotive/wagon/generators/site/cloned'
@@ -8,10 +8,11 @@ module Locomotive
8
8
  class Snippet < Thor::Group
9
9
 
10
10
  include Thor::Actions
11
+ include Locomotive::Wagon::CLI::ForceColor
11
12
 
12
13
  argument :slug
13
- argument :target_path # path to the site
14
14
  argument :locales
15
+ argument :target_path # path to the site
15
16
 
16
17
  attr_accessor :haml
17
18
 
@@ -24,6 +24,10 @@ module Locomotive
24
24
  self.collection
25
25
  end
26
26
 
27
+ def any
28
+ self.collection.any?
29
+ end
30
+
27
31
  def first
28
32
  self.collection.first
29
33
  end
@@ -100,8 +104,10 @@ module Locomotive
100
104
  return unless @collection.blank?
101
105
 
102
106
  # define the default order_by if not set
103
- if @context['with_scope'] && !@context['with_scope']['order_by'].blank? && !%w(manually position).include?(@content_type.order_by)
104
- @context['with_scope']['order_by'] = @content_type.order_by + '.' + @content_type.order_direction
107
+ if @context['with_scope'] && @context['with_scope']['order_by'].blank? && !%w(manually position).include?(@content_type.order_by)
108
+ field = @content_type.order_by || 'created_at'
109
+ direction = @content_type.order_direction || 'asc'
110
+ @context['with_scope']['order_by'] = "#{field}.#{direction}"
105
111
  end
106
112
 
107
113
  @collection = apply_scope(@content_type.entries)
@@ -110,4 +116,4 @@ module Locomotive
110
116
  end
111
117
  end
112
118
  end
113
- end
119
+ end
@@ -4,9 +4,17 @@ module Locomotive
4
4
  module Drops
5
5
  class Page < Base
6
6
 
7
- delegate :title, :slug, :fullpath, :parent, :depth, :seo_title, :redirect_url, :meta_description, :meta_keywords,
7
+ delegate :slug, :fullpath, :parent, :depth, :seo_title, :redirect_url, :meta_description, :meta_keywords,
8
8
  :templatized?, :published?, :redirect?, :listed?, :handle, to: :@_source
9
9
 
10
+ def title
11
+ if @_source.templatized?
12
+ @context['entry'].try(:_label) || @_source.title
13
+ else
14
+ @_source.title
15
+ end
16
+ end
17
+
10
18
  def children
11
19
  _children = @_source.children || []
12
20
  _children = _children.sort { |a, b| a.position.to_i <=> b.position.to_i }
@@ -36,7 +36,7 @@ module Locomotive
36
36
  def _apply_scope_order(entries, order_by)
37
37
  return entries if order_by.blank?
38
38
 
39
- name, direction = order_by.split.map(&:to_sym)
39
+ name, direction = order_by.split(/[\s\.]/).map(&:to_sym)
40
40
 
41
41
  Locomotive::Wagon::Logger.info "[with_scope] order_by #{name} #{direction || 'asc'}"
42
42
 
@@ -0,0 +1,41 @@
1
+ module Locomotive
2
+ module Wagon
3
+ module Liquid
4
+ module Tags
5
+
6
+ # Fetch a page from its handle and assign it to a liquid variable.
7
+ #
8
+ # Usage:
9
+ #
10
+ # {% fetch_page 'about_us' as a_page %}
11
+ # <p>{{ a_page.title }}</p>
12
+ #
13
+ class FetchPage < ::Liquid::Tag
14
+
15
+ Syntax = /(#{::Liquid::VariableSignature}+)\s+as\s+(#{::Liquid::VariableSignature}+)/
16
+
17
+ def initialize(tag_name, markup, tokens, context)
18
+ if markup =~ Syntax
19
+ @handle = $1
20
+ @var = $2
21
+ else
22
+ raise SyntaxError.new("Syntax Error in 'fetch_page' - Valid syntax: fetch_page page_handle as variable")
23
+ end
24
+
25
+ super
26
+ end
27
+
28
+ def render(context)
29
+ mounting_point = context.registers[:mounting_point]
30
+ context.scopes.last[@var] = mounting_point.pages.values.find { |_page| _page.handle == @handle }
31
+ ''
32
+ end
33
+
34
+ end
35
+
36
+ ::Liquid::Template.register_tag('fetch_page', FetchPage)
37
+ end
38
+
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,67 @@
1
+ module Locomotive
2
+ module Wagon
3
+ module Liquid
4
+ module Tags
5
+
6
+ # Display the form html tag with the appropriate hidden fields in order to create
7
+ # a content entry from a public site.
8
+ # It handles callbacks, csrf and target url out of the box.
9
+ #
10
+ # Usage:
11
+ #
12
+ # {% model_form 'newsletter_addresses' %}
13
+ # <input type='text' name='content[email]' />
14
+ # <input type='submit' value='Add' />
15
+ # {% endform_form %}
16
+ #
17
+ # {% model_form 'newsletter_addresses', class: 'a-css-class', success: 'http://www.google.fr', error: '/error' %}...{% endform_form %}
18
+ #
19
+ class ModelForm < Solid::Block
20
+
21
+ tag_name :model_form
22
+
23
+ def display(*options, &block)
24
+ name = options.shift
25
+ options = options.shift || {}
26
+
27
+ form_attributes = { method: 'POST', enctype: 'multipart/form-data' }.merge(options.slice(:id, :class))
28
+
29
+ html_content_tag :form,
30
+ content_type_html(name) + callbacks_html(options) + yield,
31
+ form_attributes
32
+ end
33
+
34
+ def content_type_html(name)
35
+ html_tag :input, type: 'hidden', name: 'content_type_slug', value: name
36
+ end
37
+
38
+ def callbacks_html(options)
39
+ options.slice(:success, :error).map do |(name, value)|
40
+ html_tag :input, type: 'hidden', name: "#{name}_callback", value: value
41
+ end.join('')
42
+ end
43
+
44
+ private
45
+
46
+ def html_content_tag(name, content, options = {})
47
+ "<#{name} #{inline_options(options)}>#{content}</#{name}>"
48
+ end
49
+
50
+ def html_tag(name, options = {})
51
+ "<#{name} #{inline_options(options)} />"
52
+ end
53
+
54
+ # Write options (Hash) into a string according to the following pattern:
55
+ # <key1>="<value1>", <key2>="<value2", ...etc
56
+ def inline_options(options = {})
57
+ return '' if options.empty?
58
+ (options.stringify_keys.to_a.collect { |a, b| "#{a}=\"#{b}\"" }).join(' ')
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+
65
+ end
66
+ end
67
+ end
@@ -77,7 +77,7 @@ module Locomotive
77
77
  page.fullpath.clone
78
78
  end
79
79
 
80
- fullpath = "#{::I18n.locale}/#{fullpath}" if ::I18n.locale.to_s != mounting_point.default_locale.to_s
80
+ fullpath = "#{locale}/#{fullpath}" if locale.to_s != mounting_point.default_locale.to_s
81
81
 
82
82
  if page.templatized?
83
83
  if page.content_entry._slug.nil?
@@ -95,4 +95,4 @@ module Locomotive
95
95
 
96
96
  end
97
97
  end
98
- end
98
+ end
@@ -31,7 +31,7 @@ module Locomotive
31
31
  when /^\/[^\/]*\/$/ then Regexp.new(value[1..-2])
32
32
  when /^["|'](.+)["|']$/ then $1.gsub(/^["|']/, '').gsub(/["|']$/, '')
33
33
  else
34
- context[value] || value
34
+ context[value].nil? ? value : context[value]
35
35
  end)
36
36
  end
37
37
  end
@@ -10,7 +10,7 @@ module Locomotive::Wagon
10
10
  end
11
11
 
12
12
  def start(reader)
13
- self.reader = reader
13
+ @reader = reader
14
14
 
15
15
  self.definitions.each do |definition|
16
16
  self.apply(definition)
@@ -20,9 +20,10 @@ module Locomotive::Wagon
20
20
  def definitions
21
21
  [
22
22
  ['config', /\.yml/, [:site, :content_types, :pages, :snippets, :content_entries, :translations]],
23
- ['app/views', /\.liquid/, [:pages, :snippets]],
23
+ ['app/views', %r{(pages|snippets)/(.+\.liquid).*}, [:pages, :snippets]],
24
24
  ['app/content_types', /\.yml/, [:content_types, :content_entries]],
25
- ['data', /\.yml/, :content_entries]
25
+ ['data', /\.yml/, :content_entries],
26
+ ['public', %r{((stylesheets|javascripts)/(.+\.(css|js))).*}, []]
26
27
  ]
27
28
  end
28
29
 
@@ -33,12 +34,14 @@ module Locomotive::Wagon
33
34
  resources = [*definition.last]
34
35
  names = resources.map { |n| "\"#{n}\"" }.join(', ')
35
36
 
36
- Locomotive::Wagon::Logger.info "* Reloaded #{names} at #{Time.now}"
37
+ unless resources.empty?
38
+ Locomotive::Wagon::Logger.info "* Reloaded #{names} at #{Time.now}"
37
39
 
38
- begin
39
- reader.reload(resources)
40
- rescue Exception => e
41
- Locomotive::Wagon::MounterException.new('Unable to reload', e)
40
+ begin
41
+ reader.reload(resources)
42
+ rescue Exception => e
43
+ Locomotive::Wagon::MounterException.new('Unable to reload', e)
44
+ end
42
45
  end
43
46
  end
44
47
 
@@ -46,10 +49,15 @@ module Locomotive::Wagon
46
49
  path = File.join(self.reader.mounting_point.path, definition.first)
47
50
  path = File.expand_path(path)
48
51
 
49
- listener = ::Listen.to(path).filter(filter).change(&reloader)
52
+ listener = ::Listen.to(path, only: filter, &reloader)
50
53
 
51
54
  # non blocking listener
52
- listener.start(false)
55
+ listener.start
56
+ end
57
+
58
+ def relative_path(path)
59
+ base_path = self.reader.mounting_point.path
60
+ relative_path = path.sub(base_path, '')
53
61
  end
54
62
 
55
63
  end
@@ -40,6 +40,10 @@ module Locomotive
40
40
  self.instance.setup(path, stdout)
41
41
  end
42
42
 
43
+ def self.close
44
+ self.instance.logger.close
45
+ end
46
+
43
47
  class << self
44
48
  %w(debug info warn error fatal unknown).each do |name|
45
49
  define_method(name) do |message|
@@ -52,3 +52,11 @@ unless Array.instance_methods.include?(:contains?)
52
52
  end
53
53
  end
54
54
 
55
+ unless Integer.instance_methods.include?(:to_datetime)
56
+ class Integer
57
+ def to_datetime
58
+ Time.at(self).to_datetime
59
+ end
60
+ end
61
+ end
62
+
@@ -0,0 +1,120 @@
1
+ require 'locomotive/wagon/misc/hosting_api'
2
+ require 'active_support/core_ext/hash'
3
+ require 'netrc'
4
+ require 'erb'
5
+
6
+ module Locomotive
7
+ module Wagon
8
+
9
+ class DeploymentConnection
10
+
11
+ # Create a connection for the deployment
12
+ # from the path of a Wagon site.
13
+ #
14
+ # @param [ String ] path Path to a Wagon site
15
+ #
16
+ def initialize(path, shell = nil)
17
+ @path = path
18
+ @shell = shell
19
+ end
20
+
21
+ # Retrieve information connection from the
22
+ # config/deploy.yml file and for a specific environment.
23
+ # If the env is hosting and does not have an entry in that file,
24
+ # then it looks for an api key in the ~/.netrc file, assuming
25
+ # that the user authenticates himself previously thanks to the
26
+ # auth wagon command.
27
+ #
28
+ # @param [ String ] env The target environment to deploy the site.
29
+ #
30
+ def get_information(env)
31
+ connection_info = read_from_yaml_file(env)
32
+
33
+ # is the user owns a hosting account, then use his credentials
34
+ # to create a new site.
35
+ if connection_info.nil? && env == 'hosting'
36
+ connection_info = read_from_hosting
37
+ end
38
+
39
+ if connection_info.nil?
40
+ raise "No #{env.to_s} environment found in the config/deploy.yml file"
41
+ end
42
+
43
+ connection_info = connection_info.with_indifferent_access
44
+
45
+ if connection_info[:ssl] && !connection_info[:host].start_with?('https')
46
+ connection_info[:host] = 'https://' + connection_info[:host]
47
+ end
48
+
49
+ connection_info
50
+ end
51
+
52
+ private
53
+
54
+ def deploy_file
55
+ File.join(@path, 'config', 'deploy.yml')
56
+ end
57
+
58
+ def read_from_yaml_file(env)
59
+ # pre-processing: erb code to parse and render?
60
+ parsed_deploy_file = ERB.new(File.open(deploy_file).read).result
61
+
62
+ # finally, get the hash from the YAML file
63
+ environments = YAML::load(parsed_deploy_file)
64
+ (environments.is_a?(Hash) ? environments : {})[env.to_s]
65
+ rescue Exception => e
66
+ raise "Unable to read the config/deploy.yml file (#{e.message})"
67
+ end
68
+
69
+ def read_from_hosting
70
+ hosting_api = new_hosting_api
71
+
72
+ # create the site (READ the site.yml file to get the information)
73
+ site = hosting_api.create_site(site_attributes)
74
+
75
+ if site.success?
76
+ # now we've got the subdomain, build the target host
77
+ host = [site['subdomain'], hosting_api.domain_with_port].join('.')
78
+
79
+ # return the connection information
80
+ { 'host' => host, 'api_key' => hosting_api.api_key }.tap do |hash|
81
+ # add ssl only if it is asked
82
+ hash['ssl'] if hosting_api.ssl?
83
+
84
+ # insert a new entry for hosting env in the current deploy.yml
85
+ File.open(deploy_file, 'a+') do |f|
86
+ f.write({ 'hosting' => hash }.to_yaml.sub(/^---/, ''))
87
+ end
88
+ end
89
+ else
90
+ raise "We were unable to create a new site on the hosting, reason(s): #{site.error_messages.join(', ')}"
91
+ end
92
+ end
93
+
94
+ def new_hosting_api
95
+ Locomotive::HostingAPI.new.tap do |hosting_api|
96
+ netrc = Netrc.read
97
+ email, api_key = netrc[hosting_api.domain_with_port]
98
+
99
+ # get a new auth token for further API calls
100
+ hosting_api.authenticate(api_key: api_key)
101
+ end
102
+ end
103
+
104
+ def config_file
105
+ File.join(@path, 'config', 'site.yml')
106
+ end
107
+
108
+ def site_attributes
109
+ YAML::load(File.read(config_file)).tap do |attributes|
110
+ # ask for the subdomain
111
+ if attributes['subdomain'].blank? && @shell
112
+ attributes['subdomain'] = @shell.ask("Please, what's your subdomain? (leave it blank for a random one)")
113
+ end
114
+ end
115
+ end
116
+
117
+ end
118
+
119
+ end
120
+ end