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.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/Gemfile +6 -2
- data/README.md +7 -1
- data/bin/wagon +3 -0
- data/generators/blank/Gemfile.tt +1 -3
- data/generators/blank/config/site.yml.tt +3 -3
- data/generators/bootstrap/config/site.yml.tt +3 -3
- data/generators/bootstrap3/Gemfile.tt +1 -3
- data/generators/bootstrap3/app/views/pages/index.liquid +21 -63
- data/generators/bootstrap3/app/views/pages/index.liquid.haml +15 -57
- data/generators/bootstrap3/config/deploy.yml +15 -15
- data/generators/bootstrap3/config/site.yml.tt +2 -2
- data/generators/bootstrap3/icon.png +0 -0
- data/generators/bootstrap3/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/generators/bootstrap3/public/fonts/glyphicons-halflings-regular.svg +201 -200
- data/generators/bootstrap3/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/generators/bootstrap3/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/generators/{bootstrap2/app/content_types → bootstrap3/public/images}/.empty_directory +0 -0
- data/generators/bootstrap3/public/javascripts/bootstrap/affix.js +137 -0
- data/generators/bootstrap3/public/javascripts/bootstrap/alert.js +88 -0
- data/generators/bootstrap3/public/javascripts/bootstrap/button.js +107 -0
- data/generators/bootstrap3/public/javascripts/bootstrap/carousel.js +205 -0
- data/generators/bootstrap3/public/javascripts/bootstrap/collapse.js +170 -0
- data/generators/bootstrap3/public/javascripts/bootstrap/dropdown.js +147 -0
- data/generators/bootstrap3/public/javascripts/bootstrap/modal.js +243 -0
- data/generators/bootstrap3/public/javascripts/bootstrap/popover.js +110 -0
- data/generators/bootstrap3/public/javascripts/bootstrap/scrollspy.js +153 -0
- data/generators/bootstrap3/public/javascripts/bootstrap/tab.js +125 -0
- data/generators/bootstrap3/public/javascripts/bootstrap/tooltip.js +399 -0
- data/generators/bootstrap3/public/javascripts/bootstrap/transition.js +48 -0
- data/generators/bootstrap3/public/javascripts/bootstrap.min.js +12 -6
- data/generators/bootstrap3/public/stylesheets/application.css +1 -0
- data/generators/bootstrap3/public/stylesheets/application.css.scss +8 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_alerts.scss +67 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_badges.scss +55 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_button-groups.scss +226 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_buttons.scss +159 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_carousel.scss +232 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_close.scss +35 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_code.scss +63 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_component-animations.scss +29 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_dropdowns.scss +213 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_forms.scss +436 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_glyphicons.scss +233 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_grid.scss +84 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_input-groups.scss +162 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_jumbotron.scss +44 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_labels.scss +64 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_list-group.scss +110 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_media.scss +56 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_mixins.scss +947 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_modals.scss +139 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_navbar.scss +620 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_navs.scss +242 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_normalize.scss +423 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_pager.scss +55 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_pagination.scss +88 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_panels.scss +241 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_popovers.scss +133 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_print.scss +101 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_progress-bars.scss +80 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_responsive-utilities.scss +74 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_scaffolding.scss +134 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_tables.scss +233 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_theme.scss +247 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_thumbnails.scss +38 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_tooltip.scss +95 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_type.scss +284 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_utilities.scss +56 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_variables.scss +833 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/_wells.scss +29 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap/bootstrap.css.scss +49 -0
- data/generators/bootstrap3/public/stylesheets/bootstrap.css +2035 -3056
- data/generators/bootstrap3/public/stylesheets/bootstrap.css.scss +49 -0
- data/generators/cloned/Gemfile.tt +1 -3
- data/generators/content_type/app/content_types/%slug%.yml.tt +57 -0
- data/generators/content_type/data/{%name%.yml.tt → %slug%.yml.tt} +2 -2
- data/generators/{bootstrap2 → foundation5}/Gemfile.tt +1 -3
- data/generators/{bootstrap2/data → foundation5/app/content_types}/.empty_directory +0 -0
- data/generators/{foundation → foundation5}/app/views/pages/404.liquid +1 -4
- data/generators/{foundation → foundation5}/app/views/pages/404.liquid.haml +1 -1
- data/generators/foundation5/app/views/pages/index.liquid +196 -0
- data/generators/foundation5/app/views/pages/index.liquid.haml +157 -0
- data/generators/foundation5/config/deploy.yml +15 -0
- data/generators/{bootstrap2 → foundation5}/config/site.yml.tt +3 -4
- data/generators/{bootstrap2 → foundation5}/config/translations.yml +0 -0
- data/generators/{bootstrap2 → foundation5}/config.ru +0 -0
- data/generators/{bootstrap2/public/samples → foundation5/data}/.empty_directory +0 -0
- data/generators/foundation5/favicon.ico +0 -0
- data/generators/foundation5/icon.png +0 -0
- data/generators/{foundation/app/content_types → foundation5/public/fonts}/.empty_directory +0 -0
- data/generators/{foundation/data → foundation5/public/images}/.empty_directory +0 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.abide.js +299 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.accordion.js +59 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.alert.js +43 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.clearing.js +534 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.dropdown.js +311 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.equalizer.js +74 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.interchange.js +331 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.joyride.js +843 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.js +611 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.magellan.js +178 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.offcanvas.js +108 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.orbit.js +610 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.reveal.js +437 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.slider.js +199 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.tab.js +167 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.tooltip.js +298 -0
- data/generators/foundation5/public/javascripts/foundation/foundation.topbar.js +425 -0
- data/generators/foundation5/public/javascripts/foundation.js +4161 -0
- data/generators/foundation5/public/javascripts/foundation.min.js +10 -0
- data/generators/{foundation → foundation5}/public/javascripts/vendor/custom.modernizr.js +0 -0
- data/generators/foundation5/public/javascripts/vendor/custom.modernizr.min.js +1 -0
- data/generators/foundation5/public/javascripts/vendor/fastclick.js +9 -0
- data/generators/foundation5/public/javascripts/vendor/fastclick.min.js +11 -0
- data/generators/foundation5/public/javascripts/vendor/jquery.autocomplete.js +645 -0
- data/generators/foundation5/public/javascripts/vendor/jquery.autocomplete.min.js +1 -0
- data/generators/foundation5/public/javascripts/vendor/jquery.cookie.js +8 -0
- data/generators/foundation5/public/javascripts/vendor/jquery.cookie.min.js +8 -0
- data/generators/foundation5/public/javascripts/vendor/jquery.js +26 -0
- data/generators/foundation5/public/javascripts/vendor/jquery.min.js +27 -0
- data/generators/foundation5/public/javascripts/vendor/modernizr.js +8 -0
- data/generators/foundation5/public/javascripts/vendor/modernizr.min.js +1 -0
- data/generators/foundation5/public/javascripts/vendor/placeholder.js +2 -0
- data/generators/foundation5/public/javascripts/vendor/placeholder.min.js +1 -0
- data/generators/{foundation/public/fonts → foundation5/public/samples}/.empty_directory +0 -0
- data/generators/foundation5/public/stylesheets/application.css +2 -0
- data/generators/foundation5/public/stylesheets/application.css.scss +3 -0
- data/generators/foundation5/public/stylesheets/foundation/_functions.scss +101 -0
- data/generators/foundation5/public/stylesheets/foundation/_settings.scss +1296 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_accordion.scss +53 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_alert-boxes.scss +126 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_block-grid.scss +132 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_breadcrumbs.scss +127 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_button-groups.scss +108 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_buttons.scss +222 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_clearing.scss +247 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_dropdown-buttons.scss +129 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_dropdown.scss +248 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_flex-video.scss +51 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_forms.scss +498 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_global.scss +434 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_grid.scss +260 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_inline-lists.scss +57 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_joyride.scss +220 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_keystrokes.scss +61 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_labels.scss +104 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_magellan.scss +34 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_offcanvas.scss +356 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_orbit.scss +423 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_pagination.scss +150 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_panels.scss +90 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_pricing-tables.scss +150 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_progress-bars.scss +79 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_range-slider.scss +148 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_reveal-new.scss +0 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_reveal.scss +216 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_side-nav.scss +115 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_split-buttons.scss +191 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_sub-nav.scss +125 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_switch.scss +294 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_tables.scss +129 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_tabs.scss +109 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_thumbs.scss +68 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_tooltips.scss +140 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_top-bar.scss +659 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_type.scss +513 -0
- data/generators/foundation5/public/stylesheets/foundation/components/_visibility.scss +408 -0
- data/generators/foundation5/public/stylesheets/foundation.css +5398 -0
- data/generators/foundation5/public/stylesheets/foundation.css.scss +45 -0
- data/generators/foundation5/public/stylesheets/normalize.css +425 -0
- data/generators/foundation5/public/stylesheets/normalize.css.scss +425 -0
- data/generators/{foundation → line_case}/Gemfile.tt +1 -3
- data/generators/line_case/app/content_types/categories.yml +56 -0
- data/generators/line_case/app/content_types/emails.yml +35 -0
- data/generators/line_case/app/content_types/projects.yml +58 -0
- data/generators/{bootstrap2 → line_case}/app/views/pages/404.liquid.haml +3 -2
- data/generators/line_case/app/views/pages/email-registered.liquid.haml +13 -0
- data/generators/line_case/app/views/pages/index.liquid.haml +110 -0
- data/generators/line_case/app/views/pages/projects/content_type_template.liquid.haml +32 -0
- data/generators/line_case/app/views/snippets/newsletter_form.liquid.haml +14 -0
- data/generators/line_case/app/views/snippets/projects.liquid.haml +17 -0
- data/generators/line_case/app/views/snippets/social_links.liquid.haml +19 -0
- data/generators/line_case/config/deploy.yml +15 -0
- data/generators/{foundation → line_case}/config/site.yml.tt +3 -3
- data/generators/{foundation → line_case}/config/translations.yml +0 -0
- data/generators/{foundation → line_case}/config.ru +0 -0
- data/generators/line_case/data/categories.yml +8 -0
- data/generators/line_case/data/emails.yml +2 -0
- data/generators/line_case/data/projects.yml +39 -0
- data/generators/line_case/icon.png +0 -0
- data/generators/line_case/public/images/banner-header.png +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.abide.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.alerts.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.clearing.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.cookie.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.dropdown.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.forms.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.interchange.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.joyride.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.magellan.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.orbit.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.placeholder.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.reveal.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.section.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.tooltips.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation/foundation.topbar.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/foundation.min.js +0 -0
- data/generators/line_case/public/javascripts/vendor/custom.modernizr.js +4 -0
- data/generators/{foundation → line_case}/public/javascripts/vendor/jquery.js +0 -0
- data/generators/{foundation → line_case}/public/javascripts/vendor/zepto.js +0 -0
- data/generators/line_case/public/samples/projects/sample.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample2.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample3.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample4.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample5.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample6.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample7.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample8.jpeg +0 -0
- data/generators/line_case/public/stylesheets/_variables.css.sass +20 -0
- data/generators/line_case/public/stylesheets/foundation/_variables.scss +1290 -0
- data/generators/line_case/public/stylesheets/foundation/components/_alert-boxes.scss +107 -0
- data/generators/line_case/public/stylesheets/foundation/components/_block-grid.scss +71 -0
- data/generators/line_case/public/stylesheets/foundation/components/_breadcrumbs.scss +124 -0
- data/generators/line_case/public/stylesheets/foundation/components/_button-groups.scss +89 -0
- data/generators/line_case/public/stylesheets/foundation/components/_buttons.scss +230 -0
- data/generators/line_case/public/stylesheets/foundation/components/_clearing.scss +227 -0
- data/generators/line_case/public/stylesheets/foundation/components/_custom-forms.scss +278 -0
- data/generators/line_case/public/stylesheets/foundation/components/_dropdown-buttons.scss +115 -0
- data/generators/line_case/public/stylesheets/foundation/components/_dropdown.scss +151 -0
- data/generators/line_case/public/stylesheets/foundation/components/_flex-video.scss +46 -0
- data/generators/line_case/public/stylesheets/foundation/components/_forms.scss +411 -0
- data/generators/line_case/public/stylesheets/foundation/components/_global.scss +366 -0
- data/generators/line_case/public/stylesheets/foundation/components/_grid-5.scss +214 -0
- data/generators/line_case/public/stylesheets/foundation/components/_grid.scss +188 -0
- data/generators/line_case/public/stylesheets/foundation/components/_inline-lists.scss +53 -0
- data/generators/line_case/public/stylesheets/foundation/components/_joyride.scss +217 -0
- data/generators/line_case/public/stylesheets/foundation/components/_keystrokes.scss +57 -0
- data/generators/line_case/public/stylesheets/foundation/components/_labels.scss +85 -0
- data/generators/line_case/public/stylesheets/foundation/components/_magellan.scss +23 -0
- data/generators/line_case/public/stylesheets/foundation/components/_orbit.scss +340 -0
- data/generators/line_case/public/stylesheets/foundation/components/_pagination.scss +140 -0
- data/generators/line_case/public/stylesheets/foundation/components/_panels.scss +83 -0
- data/generators/line_case/public/stylesheets/foundation/components/_pricing-tables.scss +131 -0
- data/generators/line_case/public/stylesheets/foundation/components/_progress-bars.scss +71 -0
- data/generators/line_case/public/stylesheets/foundation/components/_reveal.scss +136 -0
- data/generators/line_case/public/stylesheets/foundation/components/_section.scss +391 -0
- data/generators/line_case/public/stylesheets/foundation/components/_side-nav.scss +69 -0
- data/generators/line_case/public/stylesheets/foundation/components/_split-buttons.scss +167 -0
- data/generators/line_case/public/stylesheets/foundation/components/_sub-nav.scss +84 -0
- data/generators/line_case/public/stylesheets/foundation/components/_switch.scss +266 -0
- data/generators/line_case/public/stylesheets/foundation/components/_tables.scss +84 -0
- data/generators/line_case/public/stylesheets/foundation/components/_thumbs.scss +53 -0
- data/generators/line_case/public/stylesheets/foundation/components/_tooltips.scss +117 -0
- data/generators/line_case/public/stylesheets/foundation/components/_top-bar.scss +576 -0
- data/generators/line_case/public/stylesheets/foundation/components/_type.scss +435 -0
- data/generators/line_case/public/stylesheets/foundation/components/_visibility.scss +322 -0
- data/generators/line_case/public/stylesheets/foundation.css.scss +43 -0
- data/generators/{foundation → line_case}/public/stylesheets/foundation.min.css +0 -0
- data/generators/{foundation/public/stylesheets/normalize.css → line_case/public/stylesheets/normalize.css.scss} +5 -5
- data/generators/line_case/public/stylesheets/pages.css.sass +163 -0
- data/generators/page/template.liquid.haml.tt +8 -5
- data/generators/page/template.liquid.tt +6 -2
- data/lib/locomotive/wagon/cli.rb +139 -43
- data/lib/locomotive/wagon/generators/content_type.rb +26 -10
- data/lib/locomotive/wagon/generators/page.rb +41 -25
- data/lib/locomotive/wagon/generators/site/base.rb +53 -0
- data/lib/locomotive/wagon/generators/site/blank.rb +9 -2
- data/lib/locomotive/wagon/generators/site/bootstrap2.rb +8 -2
- data/lib/locomotive/wagon/generators/site/bootstrap3.rb +20 -2
- data/lib/locomotive/wagon/generators/site/cloned.rb +4 -0
- data/lib/locomotive/wagon/generators/site/{foundation.rb → foundation4.rb} +10 -4
- data/lib/locomotive/wagon/generators/site/foundation5.rb +48 -0
- data/lib/locomotive/wagon/generators/site/line_case.rb +20 -0
- data/lib/locomotive/wagon/generators/site/unzip.rb +10 -2
- data/lib/locomotive/wagon/generators/site.rb +48 -2
- data/lib/locomotive/wagon/generators/snippet.rb +2 -1
- data/lib/locomotive/wagon/liquid/drops/content_types.rb +9 -3
- data/lib/locomotive/wagon/liquid/drops/page.rb +9 -1
- data/lib/locomotive/wagon/liquid/scopeable.rb +1 -1
- data/lib/locomotive/wagon/liquid/tags/fetch_page.rb +41 -0
- data/lib/locomotive/wagon/liquid/tags/model_form.rb +67 -0
- data/lib/locomotive/wagon/liquid/tags/path_helper.rb +2 -2
- data/lib/locomotive/wagon/liquid/tags/with_scope.rb +1 -1
- data/lib/locomotive/wagon/listen.rb +18 -10
- data/lib/locomotive/wagon/logger.rb +4 -0
- data/lib/locomotive/wagon/misc/core_ext.rb +8 -0
- data/lib/locomotive/wagon/misc/deployment_connection.rb +120 -0
- data/lib/locomotive/wagon/misc/hosting_api.rb +115 -0
- data/lib/locomotive/wagon/misc/httparty.rb +2 -0
- data/lib/locomotive/wagon/misc/livereload.rb +43 -0
- data/lib/locomotive/wagon/misc/mounter.rb +1 -1
- data/lib/locomotive/wagon/misc/tcp_port.rb +42 -0
- data/lib/locomotive/wagon/misc/thor.rb +15 -0
- data/lib/locomotive/wagon/server/entry_submission.rb +69 -38
- data/lib/locomotive/wagon/server/middleware.rb +4 -2
- data/lib/locomotive/wagon/server/page.rb +2 -2
- data/lib/locomotive/wagon/server.rb +11 -7
- data/lib/locomotive/wagon/version.rb +1 -1
- data/lib/locomotive/wagon.rb +141 -30
- data/locomotivecms_wagon.gemspec +7 -6
- data/spec/fixtures/default/app/content_types/bands.yml +3 -1
- data/spec/fixtures/default/app/views/pages/all.liquid.haml +3 -0
- data/spec/fixtures/default/app/views/pages/events.liquid.haml +21 -0
- data/spec/fixtures/default/app/views/pages/filtered.liquid.haml +11 -1
- data/spec/fixtures/default/app/views/pages/index.liquid.haml +1 -1
- data/spec/fixtures/default/data/bands.yml +3 -0
- data/spec/integration/server/basic_spec.rb +1 -0
- data/spec/integration/server/contact_form_spec.rb +1 -1
- data/spec/integration/server/liquid_spec.rb +8 -1
- data/spec/integration/server/new_contact_form_spec.rb +67 -0
- data/spec/integration/server/with_scope_spec.rb +10 -0
- data/spec/spec_helper.rb +3 -0
- metadata +339 -144
- data/generators/bootstrap2/app/views/pages/404.liquid +0 -13
- data/generators/bootstrap2/app/views/pages/index.liquid +0 -98
- data/generators/bootstrap2/app/views/pages/index.liquid.haml +0 -80
- data/generators/bootstrap2/app/views/snippets/footer.liquid +0 -3
- data/generators/bootstrap2/app/views/snippets/footer.liquid.haml +0 -2
- data/generators/bootstrap2/config/deploy.yml +0 -15
- data/generators/bootstrap2/public/fonts/FontAwesome.otf +0 -0
- data/generators/bootstrap2/public/fonts/fontawesome-webfont.eot +0 -0
- data/generators/bootstrap2/public/fonts/fontawesome-webfont.svg +0 -399
- data/generators/bootstrap2/public/fonts/fontawesome-webfont.ttf +0 -0
- data/generators/bootstrap2/public/fonts/fontawesome-webfont.woff +0 -0
- data/generators/bootstrap2/public/javascripts/bootstrap.js +0 -2280
- data/generators/bootstrap2/public/javascripts/bootstrap.min.js +0 -6
- data/generators/bootstrap2/public/stylesheets/application.css.scss +0 -39
- data/generators/bootstrap2/public/stylesheets/bootstrap-responsive.css +0 -1109
- data/generators/bootstrap2/public/stylesheets/bootstrap-responsive.min.css +0 -9
- data/generators/bootstrap2/public/stylesheets/bootstrap.css +0 -5568
- data/generators/bootstrap2/public/stylesheets/bootstrap.min.css +0 -9
- data/generators/bootstrap2/public/stylesheets/fonts/awesome.css.scss +0 -3
- data/generators/bootstrap2/public/stylesheets/fonts/font-awesome-ie7.css +0 -1203
- data/generators/bootstrap2/public/stylesheets/fonts/font-awesome-ie7.min.css +0 -384
- data/generators/bootstrap2/public/stylesheets/fonts/font-awesome.css +0 -1470
- data/generators/bootstrap2/public/stylesheets/fonts/font-awesome.min.css +0 -403
- data/generators/bootstrap3/public/javascripts/bootstrap.js +0 -1999
- data/generators/bootstrap3/public/stylesheets/bootstrap-theme.css +0 -384
- data/generators/bootstrap3/public/stylesheets/bootstrap-theme.min.css +0 -1
- data/generators/bootstrap3/public/stylesheets/bootstrap.min.css +0 -9
- data/generators/content_type/app/content_types/%name%.yml.tt +0 -58
- data/generators/foundation/app/views/pages/index.liquid +0 -150
- data/generators/foundation/app/views/pages/index.liquid.haml +0 -125
- data/generators/foundation/app/views/snippets/footer.liquid +0 -16
- data/generators/foundation/app/views/snippets/footer.liquid.haml +0 -22
- data/generators/foundation/config/deploy.yml +0 -15
- data/generators/foundation/public/samples/.empty_directory +0 -1
- data/generators/foundation/public/stylesheets/foundation.css +0 -4727
data/lib/locomotive/wagon/cli.rb
CHANGED
@@ -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
|
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
|
-
|
42
|
-
|
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
|
-
|
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
|
72
|
+
* wagon generate content_type posts title published_at:date_time:true body:text
|
49
73
|
|
50
|
-
* wagon generate content_type
|
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
|
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
|
-
|
74
|
-
Locomotive::Wagon.generate :page, fullpath, self.options
|
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
|
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
|
-
|
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 '
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
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,
|
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
|
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
|
-
|
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
|
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
|
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
|
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
|
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
|
-
|
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 '
|
267
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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 :
|
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:
|
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:
|
37
|
-
|
38
|
-
|
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 =
|
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
|
-
|
38
|
-
file_path
|
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}",
|
29
|
+
template "template.#{extension}.tt", "#{file_path}.#{extension}", _options
|
41
30
|
|
42
|
-
self.
|
43
|
-
|
44
|
-
template "template.#{extension}.tt", "#{file_path}.#{locale}.#{extension}",
|
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
|
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
|
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
|
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
|
29
|
+
A site with Twitter Bootstrap (v2.3.2) and Font Awesome (v3.2.1).
|
24
30
|
})
|
25
31
|
end
|
26
32
|
end
|