vapid 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.gitmodules +6 -0
- data/.rspec +2 -0
- data/.rubocop.yml +133 -0
- data/.travis.yml +5 -0
- data/Gemfile +10 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/vapid +7 -0
- data/lib/vapid.rb +24 -0
- data/lib/vapid/assets/javascripts/vapid/admin.coffee +2 -0
- data/lib/vapid/assets/stylesheets/vapid/admin.scss +72 -0
- data/lib/vapid/builder.rb +70 -0
- data/lib/vapid/cli.rb +96 -0
- data/lib/vapid/controllers/admin_controller.rb +282 -0
- data/lib/vapid/controllers/project_controller.rb +41 -0
- data/lib/vapid/db/migrate/20170202182310_create_groups.rb +12 -0
- data/lib/vapid/db/migrate/20170202183017_create_records.rb +11 -0
- data/lib/vapid/db/migrate/20170202185150_create_users.rb +11 -0
- data/lib/vapid/directive.rb +168 -0
- data/lib/vapid/directives.rb +30 -0
- data/lib/vapid/directives/audio.rb +27 -0
- data/lib/vapid/directives/group.rb +71 -0
- data/lib/vapid/directives/hide.rb +11 -0
- data/lib/vapid/directives/href.rb +11 -0
- data/lib/vapid/directives/image.rb +14 -0
- data/lib/vapid/directives/richtext.rb +15 -0
- data/lib/vapid/directives/show.rb +11 -0
- data/lib/vapid/directives/text.rb +24 -0
- data/lib/vapid/directives/video.rb +28 -0
- data/lib/vapid/generator_template/.gitignore +21 -0
- data/lib/vapid/generator_template/Gemfile.tt +13 -0
- data/lib/vapid/generator_template/README.md +0 -0
- data/lib/vapid/generator_template/assets/favicon.ico +0 -0
- data/lib/vapid/generator_template/assets/images/.keep +0 -0
- data/lib/vapid/generator_template/assets/javascripts/.keep +0 -0
- data/lib/vapid/generator_template/assets/stylesheets/.keep +0 -0
- data/lib/vapid/generator_template/assets/stylesheets/application.css +120 -0
- data/lib/vapid/generator_template/config.ru +3 -0
- data/lib/vapid/generator_template/config/database.yml +12 -0
- data/lib/vapid/generator_template/config/settings.yml.tt +11 -0
- data/lib/vapid/generator_template/templates/index.html.erb +25 -0
- data/lib/vapid/generator_template/templates/layouts/default.html.erb +22 -0
- data/lib/vapid/models.rb +18 -0
- data/lib/vapid/models/group.rb +36 -0
- data/lib/vapid/models/record.rb +30 -0
- data/lib/vapid/models/user.rb +16 -0
- data/lib/vapid/server.rb +93 -0
- data/lib/vapid/settings.rb +13 -0
- data/lib/vapid/template.rb +79 -0
- data/lib/vapid/template/node.rb +91 -0
- data/lib/vapid/template/parser.rb +50 -0
- data/lib/vapid/vendor/semantic-ui/.versions +4 -0
- data/lib/vapid/vendor/semantic-ui/LICENSE +22 -0
- data/lib/vapid/vendor/semantic-ui/README.md +7 -0
- data/lib/vapid/vendor/semantic-ui/components/accordion.css +252 -0
- data/lib/vapid/vendor/semantic-ui/components/accordion.js +610 -0
- data/lib/vapid/vendor/semantic-ui/components/accordion.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/accordion.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/ad.css +275 -0
- data/lib/vapid/vendor/semantic-ui/components/ad.min.css +10 -0
- data/lib/vapid/vendor/semantic-ui/components/api.js +1167 -0
- data/lib/vapid/vendor/semantic-ui/components/api.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/breadcrumb.css +124 -0
- data/lib/vapid/vendor/semantic-ui/components/breadcrumb.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/button.css +3450 -0
- data/lib/vapid/vendor/semantic-ui/components/button.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/card.css +964 -0
- data/lib/vapid/vendor/semantic-ui/components/card.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/checkbox.css +625 -0
- data/lib/vapid/vendor/semantic-ui/components/checkbox.js +831 -0
- data/lib/vapid/vendor/semantic-ui/components/checkbox.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/checkbox.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/colorize.js +274 -0
- data/lib/vapid/vendor/semantic-ui/components/colorize.min.js +11 -0
- data/lib/vapid/vendor/semantic-ui/components/comment.css +270 -0
- data/lib/vapid/vendor/semantic-ui/components/comment.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/container.css +147 -0
- data/lib/vapid/vendor/semantic-ui/components/container.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/dimmer.css +200 -0
- data/lib/vapid/vendor/semantic-ui/components/dimmer.js +708 -0
- data/lib/vapid/vendor/semantic-ui/components/dimmer.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/dimmer.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/divider.css +260 -0
- data/lib/vapid/vendor/semantic-ui/components/divider.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/dropdown.css +1442 -0
- data/lib/vapid/vendor/semantic-ui/components/dropdown.js +3767 -0
- data/lib/vapid/vendor/semantic-ui/components/dropdown.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/dropdown.min.js +11 -0
- data/lib/vapid/vendor/semantic-ui/components/embed.css +166 -0
- data/lib/vapid/vendor/semantic-ui/components/embed.js +696 -0
- data/lib/vapid/vendor/semantic-ui/components/embed.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/embed.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/feed.css +296 -0
- data/lib/vapid/vendor/semantic-ui/components/feed.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/flag.css +1031 -0
- data/lib/vapid/vendor/semantic-ui/components/flag.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/form.css +1067 -0
- data/lib/vapid/vendor/semantic-ui/components/form.js +1603 -0
- data/lib/vapid/vendor/semantic-ui/components/form.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/form.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/grid.css +2002 -0
- data/lib/vapid/vendor/semantic-ui/components/grid.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/header.css +721 -0
- data/lib/vapid/vendor/semantic-ui/components/header.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/icon.css +3292 -0
- data/lib/vapid/vendor/semantic-ui/components/icon.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/image.css +306 -0
- data/lib/vapid/vendor/semantic-ui/components/image.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/input.css +510 -0
- data/lib/vapid/vendor/semantic-ui/components/input.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/item.css +486 -0
- data/lib/vapid/vendor/semantic-ui/components/item.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/label.css +1307 -0
- data/lib/vapid/vendor/semantic-ui/components/label.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/list.css +951 -0
- data/lib/vapid/vendor/semantic-ui/components/list.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/loader.css +347 -0
- data/lib/vapid/vendor/semantic-ui/components/loader.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/menu.css +2002 -0
- data/lib/vapid/vendor/semantic-ui/components/menu.min.css +1 -0
- data/lib/vapid/vendor/semantic-ui/components/message.css +477 -0
- data/lib/vapid/vendor/semantic-ui/components/message.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/modal.css +502 -0
- data/lib/vapid/vendor/semantic-ui/components/modal.js +913 -0
- data/lib/vapid/vendor/semantic-ui/components/modal.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/modal.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/nag.css +147 -0
- data/lib/vapid/vendor/semantic-ui/components/nag.js +507 -0
- data/lib/vapid/vendor/semantic-ui/components/nag.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/nag.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/popup.css +733 -0
- data/lib/vapid/vendor/semantic-ui/components/popup.js +1475 -0
- data/lib/vapid/vendor/semantic-ui/components/popup.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/popup.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/progress.css +516 -0
- data/lib/vapid/vendor/semantic-ui/components/progress.js +931 -0
- data/lib/vapid/vendor/semantic-ui/components/progress.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/progress.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/rail.css +152 -0
- data/lib/vapid/vendor/semantic-ui/components/rail.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/rating.css +263 -0
- data/lib/vapid/vendor/semantic-ui/components/rating.js +508 -0
- data/lib/vapid/vendor/semantic-ui/components/rating.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/rating.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/reset.css +424 -0
- data/lib/vapid/vendor/semantic-ui/components/reset.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/reveal.css +284 -0
- data/lib/vapid/vendor/semantic-ui/components/reveal.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/search.css +408 -0
- data/lib/vapid/vendor/semantic-ui/components/search.js +1442 -0
- data/lib/vapid/vendor/semantic-ui/components/search.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/search.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/segment.css +798 -0
- data/lib/vapid/vendor/semantic-ui/components/segment.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/shape.css +157 -0
- data/lib/vapid/vendor/semantic-ui/components/shape.js +921 -0
- data/lib/vapid/vendor/semantic-ui/components/shape.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/shape.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/sidebar.css +634 -0
- data/lib/vapid/vendor/semantic-ui/components/sidebar.js +1036 -0
- data/lib/vapid/vendor/semantic-ui/components/sidebar.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/sidebar.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/site.css +160 -0
- data/lib/vapid/vendor/semantic-ui/components/site.js +487 -0
- data/lib/vapid/vendor/semantic-ui/components/site.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/site.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/state.js +708 -0
- data/lib/vapid/vendor/semantic-ui/components/state.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/statistic.css +569 -0
- data/lib/vapid/vendor/semantic-ui/components/statistic.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/step.css +623 -0
- data/lib/vapid/vendor/semantic-ui/components/step.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/sticky.css +78 -0
- data/lib/vapid/vendor/semantic-ui/components/sticky.js +942 -0
- data/lib/vapid/vendor/semantic-ui/components/sticky.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/sticky.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/tab.css +91 -0
- data/lib/vapid/vendor/semantic-ui/components/tab.js +952 -0
- data/lib/vapid/vendor/semantic-ui/components/tab.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/tab.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/table.css +1108 -0
- data/lib/vapid/vendor/semantic-ui/components/table.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/transition.css +1964 -0
- data/lib/vapid/vendor/semantic-ui/components/transition.js +1095 -0
- data/lib/vapid/vendor/semantic-ui/components/transition.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/transition.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/video.css +125 -0
- data/lib/vapid/vendor/semantic-ui/components/video.js +532 -0
- data/lib/vapid/vendor/semantic-ui/components/video.min.css +10 -0
- data/lib/vapid/vendor/semantic-ui/components/video.min.js +11 -0
- data/lib/vapid/vendor/semantic-ui/components/visibility.js +1288 -0
- data/lib/vapid/vendor/semantic-ui/components/visibility.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/visit.js +517 -0
- data/lib/vapid/vendor/semantic-ui/components/visit.min.js +11 -0
- data/lib/vapid/vendor/semantic-ui/package.js +34 -0
- data/lib/vapid/vendor/semantic-ui/package.json +20 -0
- data/lib/vapid/vendor/semantic-ui/semantic.css +36844 -0
- data/lib/vapid/vendor/semantic-ui/semantic.js +22617 -0
- data/lib/vapid/vendor/semantic-ui/semantic.min.css +364 -0
- data/lib/vapid/vendor/semantic-ui/semantic.min.js +19 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.eot +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.otf +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.svg +2671 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.ttf +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.woff +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.woff2 +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/images/flags.png +0 -0
- data/lib/vapid/vendor/trix/.blade.yml +45 -0
- data/lib/vapid/vendor/trix/.github/ISSUE_TEMPLATE.md +13 -0
- data/lib/vapid/vendor/trix/.gitignore +3 -0
- data/lib/vapid/vendor/trix/.ruby-version +1 -0
- data/lib/vapid/vendor/trix/.travis.yml +6 -0
- data/lib/vapid/vendor/trix/CONDUCT.md +79 -0
- data/lib/vapid/vendor/trix/Gemfile +17 -0
- data/lib/vapid/vendor/trix/Gemfile.lock +152 -0
- data/lib/vapid/vendor/trix/LICENSE +20 -0
- data/lib/vapid/vendor/trix/README.md +382 -0
- data/lib/vapid/vendor/trix/assets/index.html +55 -0
- data/lib/vapid/vendor/trix/assets/trix-core.coffee +2 -0
- data/lib/vapid/vendor/trix/assets/trix.coffee +3 -0
- data/lib/vapid/vendor/trix/assets/trix.scss +5 -0
- data/lib/vapid/vendor/trix/assets/trix/banner/index.coffee.erb +3 -0
- data/lib/vapid/vendor/trix/assets/trix/banner/index.scss.erb +3 -0
- data/lib/vapid/vendor/trix/assets/trix/banner/index.txt.erb +3 -0
- data/lib/vapid/vendor/trix/assets/trix/images/README.md +6 -0
- data/lib/vapid/vendor/trix/assets/trix/images/attach.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/bold.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/bullets.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/code.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/heading_1.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/italic.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/link.svg +6 -0
- data/lib/vapid/vendor/trix/assets/trix/images/nesting_level_decrease.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/nesting_level_increase.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/numbers.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/quote.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/redo.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/remove.svg +4 -0
- data/lib/vapid/vendor/trix/assets/trix/images/strike.svg +6 -0
- data/lib/vapid/vendor/trix/assets/trix/images/trash.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/undo.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/attachments.scss +112 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/content.scss +88 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/editor.scss +8 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/icons.scss +14 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/media-queries.scss +7 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/toolbar.scss +194 -0
- data/lib/vapid/vendor/trix/bin/blade +16 -0
- data/lib/vapid/vendor/trix/bin/ci +21 -0
- data/lib/vapid/vendor/trix/bin/rackup +16 -0
- data/lib/vapid/vendor/trix/bin/rake +16 -0
- data/lib/vapid/vendor/trix/bin/release +139 -0
- data/lib/vapid/vendor/trix/bin/setup +69 -0
- data/lib/vapid/vendor/trix/bin/update-status-image +100 -0
- data/lib/vapid/vendor/trix/bower.json +34 -0
- data/lib/vapid/vendor/trix/config.ru +32 -0
- data/lib/vapid/vendor/trix/dist/trix-core.js +11 -0
- data/lib/vapid/vendor/trix/dist/trix.css +286 -0
- data/lib/vapid/vendor/trix/dist/trix.js +20 -0
- data/lib/vapid/vendor/trix/package.json +29 -0
- data/lib/vapid/vendor/trix/polyfills/polyfills.coffee +3 -0
- data/lib/vapid/vendor/trix/polyfills/set.coffee +24 -0
- data/lib/vapid/vendor/trix/polyfills/vendor/CustomElements.js +1029 -0
- data/lib/vapid/vendor/trix/polyfills/vendor/README.md +2 -0
- data/lib/vapid/vendor/trix/polyfills/vendor/promise.js +228 -0
- data/lib/vapid/vendor/trix/src/trix/VERSION +1 -0
- data/lib/vapid/vendor/trix/src/trix/config/block_attributes.coffee +37 -0
- data/lib/vapid/vendor/trix/src/trix/config/css.coffee +12 -0
- data/lib/vapid/vendor/trix/src/trix/config/file_size_formatting.coffee +22 -0
- data/lib/vapid/vendor/trix/src/trix/config/index.coffee +9 -0
- data/lib/vapid/vendor/trix/src/trix/config/lang.coffee +26 -0
- data/lib/vapid/vendor/trix/src/trix/config/selection_elements.coffee +26 -0
- data/lib/vapid/vendor/trix/src/trix/config/serialization.coffee +63 -0
- data/lib/vapid/vendor/trix/src/trix/config/text_attributes.coffee +25 -0
- data/lib/vapid/vendor/trix/src/trix/config/toolbar.coffee +41 -0
- data/lib/vapid/vendor/trix/src/trix/config/undo_interval.coffee +7 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/attachment_editor_controller.coffee +104 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/composition_controller.coffee +117 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/controller.coffee +3 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/editor_controller.coffee +369 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/input/composition_input.coffee +57 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/input_controller.coffee +473 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/toolbar_controller.coffee +173 -0
- data/lib/vapid/vendor/trix/src/trix/core/basic_object.coffee +44 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/element_store.coffee +21 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/hash.coffee +98 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/index.coffee +4 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/object_group.coffee +37 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/object_map.coffee +10 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/arrays.coffee +34 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/config.coffee +23 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/custom_elements.coffee +45 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/dom.coffee +185 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/extend.coffee +4 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/functions.coffee +3 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/global.coffee +23 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/index.coffee +10 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/objects.coffee +11 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/ranges.coffee +33 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/selection.coffee +25 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/strings.coffee +46 -0
- data/lib/vapid/vendor/trix/src/trix/core/index.coffee +4 -0
- data/lib/vapid/vendor/trix/src/trix/core/object.coffee +33 -0
- data/lib/vapid/vendor/trix/src/trix/core/utilities/index.coffee +2 -0
- data/lib/vapid/vendor/trix/src/trix/core/utilities/operation.coffee +37 -0
- data/lib/vapid/vendor/trix/src/trix/core/utilities/utf16_string.coffee +93 -0
- data/lib/vapid/vendor/trix/src/trix/elements/trix_editor_element.coffee +166 -0
- data/lib/vapid/vendor/trix/src/trix/elements/trix_toolbar_element.coffee +28 -0
- data/lib/vapid/vendor/trix/src/trix/index.coffee.erb +14 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/control_element.coffee +60 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/debugger.coffee +104 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/element.coffee +86 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/index.coffee +17 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/polyfills/vendor/details-element-polyfill.js +5 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/debug.jst.eco +17 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/document.jst.eco +33 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/performance.jst.eco +10 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/render.jst.eco +1 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/selection.jst.eco +5 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/undo.jst.eco +13 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/view.coffee +58 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/debug_view.coffee +33 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/document_view.coffee +12 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/performance_view.coffee +51 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/render_view.coffee +21 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/selection_view.coffee +33 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/undo_view.coffee +12 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/deserializer.coffee +55 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/index.coffee +5 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player.coffee +60 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_controller.coffee +43 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_element.coffee +32 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_view.coffee +133 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/recorder.coffee +82 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/recording.coffee +54 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/serializer.coffee +61 -0
- data/lib/vapid/vendor/trix/src/trix/models/attachment.coffee +157 -0
- data/lib/vapid/vendor/trix/src/trix/models/attachment_manager.coffee +24 -0
- data/lib/vapid/vendor/trix/src/trix/models/attachment_piece.coffee +47 -0
- data/lib/vapid/vendor/trix/src/trix/models/block.coffee +230 -0
- data/lib/vapid/vendor/trix/src/trix/models/composition.coffee +521 -0
- data/lib/vapid/vendor/trix/src/trix/models/document.coffee +538 -0
- data/lib/vapid/vendor/trix/src/trix/models/editor.coffee +141 -0
- data/lib/vapid/vendor/trix/src/trix/models/html_parser.coffee +335 -0
- data/lib/vapid/vendor/trix/src/trix/models/line_break_insertion.coffee +31 -0
- data/lib/vapid/vendor/trix/src/trix/models/location_mapper.coffee +156 -0
- data/lib/vapid/vendor/trix/src/trix/models/managed_attachment.coffee +28 -0
- data/lib/vapid/vendor/trix/src/trix/models/piece.coffee +95 -0
- data/lib/vapid/vendor/trix/src/trix/models/point_mapper.coffee +28 -0
- data/lib/vapid/vendor/trix/src/trix/models/selection_manager.coffee +129 -0
- data/lib/vapid/vendor/trix/src/trix/models/splittable_list.coffee +168 -0
- data/lib/vapid/vendor/trix/src/trix/models/string_piece.coffee +49 -0
- data/lib/vapid/vendor/trix/src/trix/models/text.coffee +168 -0
- data/lib/vapid/vendor/trix/src/trix/models/undo_manager.coffee +40 -0
- data/lib/vapid/vendor/trix/src/trix/observers/mutation_observer.coffee +131 -0
- data/lib/vapid/vendor/trix/src/trix/observers/selection_change_observer.coffee +56 -0
- data/lib/vapid/vendor/trix/src/trix/operations/file_verification_operation.coffee +15 -0
- data/lib/vapid/vendor/trix/src/trix/operations/image_preload_operation.coffee +15 -0
- data/lib/vapid/vendor/trix/src/trix/views/attachment_view.coffee +99 -0
- data/lib/vapid/vendor/trix/src/trix/views/block_view.coffee +37 -0
- data/lib/vapid/vendor/trix/src/trix/views/document_view.coffee +68 -0
- data/lib/vapid/vendor/trix/src/trix/views/object_group_view.coffee +23 -0
- data/lib/vapid/vendor/trix/src/trix/views/object_view.coffee +86 -0
- data/lib/vapid/vendor/trix/src/trix/views/piece_view.coffee +97 -0
- data/lib/vapid/vendor/trix/src/trix/views/previewable_attachment_view.coffee +49 -0
- data/lib/vapid/vendor/trix/src/trix/views/text_view.coffee +30 -0
- data/lib/vapid/vendor/trix/test/.gitignore +1 -0
- data/lib/vapid/vendor/trix/test/src/system/attachment_test.coffee +70 -0
- data/lib/vapid/vendor/trix/test/src/system/basic_input_test.coffee +68 -0
- data/lib/vapid/vendor/trix/test/src/system/block_formatting_test.coffee +602 -0
- data/lib/vapid/vendor/trix/test/src/system/caching_test.coffee +21 -0
- data/lib/vapid/vendor/trix/test/src/system/composition_input_test.coffee +138 -0
- data/lib/vapid/vendor/trix/test/src/system/cursor_movement_test.coffee +54 -0
- data/lib/vapid/vendor/trix/test/src/system/custom_element_test.coffee +314 -0
- data/lib/vapid/vendor/trix/test/src/system/html_loading_test.coffee +62 -0
- data/lib/vapid/vendor/trix/test/src/system/html_replacement_test.coffee +101 -0
- data/lib/vapid/vendor/trix/test/src/system/installation_process_test.coffee +59 -0
- data/lib/vapid/vendor/trix/test/src/system/list_formatting_test.coffee +70 -0
- data/lib/vapid/vendor/trix/test/src/system/mutation_input_test.coffee +73 -0
- data/lib/vapid/vendor/trix/test/src/system/pasting_test.coffee +215 -0
- data/lib/vapid/vendor/trix/test/src/system/text_formatting_test.coffee +151 -0
- data/lib/vapid/vendor/trix/test/src/system/undo_test.coffee +48 -0
- data/lib/vapid/vendor/trix/test/src/test.coffee +16 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/assertions.coffee +38 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/editor_helpers.coffee +37 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_empty.jst.eco +1 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_html.jst.eco +2 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_in_table.jst.eco +7 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_block_styles.jst.eco +6 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_bold_styles.jst.eco +7 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_image.jst.eco +2 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_styled_content.jst.eco +7 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_toolbar_and_input.jst.eco +5 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/fixtures.coffee +536 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/logo.png +0 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/index.coffee +18 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/input_helpers.coffee +183 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/selection_helpers.coffee +91 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/test_helpers.coffee +72 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/test_stubs.coffee +31 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/toolbar_helpers.coffee +45 -0
- data/lib/vapid/vendor/trix/test/src/unit/attachment_test.coffee +23 -0
- data/lib/vapid/vendor/trix/test/src/unit/block_test.coffee +22 -0
- data/lib/vapid/vendor/trix/test/src/unit/composition_test.coffee +13 -0
- data/lib/vapid/vendor/trix/test/src/unit/document_test.coffee +11 -0
- data/lib/vapid/vendor/trix/test/src/unit/document_view_test.coffee +6 -0
- data/lib/vapid/vendor/trix/test/src/unit/html_parser_test.coffee +162 -0
- data/lib/vapid/vendor/trix/test/src/unit/location_mapper_test.coffee +185 -0
- data/lib/vapid/vendor/trix/test/src/unit/mutation_observer_test.coffee +84 -0
- data/lib/vapid/vendor/trix/test/src/unit/serialization_test.coffee +7 -0
- data/lib/vapid/vendor/trix/test/src/unit/string_change_summary_test.coffee +57 -0
- data/lib/vapid/vendor/trix/test/src/unit/text_test.coffee +19 -0
- data/lib/vapid/vendor/trix/test/vendor/rangy-core.js +3845 -0
- data/lib/vapid/vendor/trix/test/vendor/rangy-textrange.js +1930 -0
- data/lib/vapid/version.rb +4 -0
- data/lib/vapid/views/admin/install.html.erb +19 -0
- data/lib/vapid/views/admin/login.html.erb +11 -0
- data/lib/vapid/views/admin/overview/index.html.erb +1 -0
- data/lib/vapid/views/admin/records/_form.erb +9 -0
- data/lib/vapid/views/admin/records/edit.html.erb +5 -0
- data/lib/vapid/views/admin/records/index.html.erb +38 -0
- data/lib/vapid/views/admin/records/new.html.erb +3 -0
- data/lib/vapid/views/errors/404.html.erb +1 -0
- data/lib/vapid/views/errors/500.html.erb +1 -0
- data/lib/vapid/views/layouts/admin.html.erb +41 -0
- data/lib/vapid/views/layouts/admin_form.html.erb +22 -0
- data/lib/vapid/views/layouts/error.html.erb +11 -0
- data/vapid.gemspec +48 -0
- metadata +811 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b99f1a8446492ac2d5abf7a36c03ab771bfeff8f
|
4
|
+
data.tar.gz: 58e5c6732a676566be85c7a2d63d04c672d21889
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4a7cae0ccf832297e4c31d15b244817e4aa9248d1bd837b7cbdeea70ffabe7accf90ec2a0d323ef6e9a9ed657e59070de8896aa375769048c06a8d7921e7db2c
|
7
|
+
data.tar.gz: 1fb354a0209079ec0663f468e56654157da5e3351d1d218f7d46142905145231be4b0bbf1f29b5ceb11a5751ce73d06518412c255f01449e1b09c890c8ec8033
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- "**/vendor/**/*"
|
4
|
+
|
5
|
+
Metrics/BlockLength:
|
6
|
+
Exclude:
|
7
|
+
- "vapid.gemspec"
|
8
|
+
- "spec/**/*.rb"
|
9
|
+
|
10
|
+
Metrics/ClassLength:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Metrics/ModuleLength:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
LineLength:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
# Prefer &&/|| over and/or.
|
20
|
+
Style/AndOr:
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
# Do not use braces for hash literals when they are the last argument of a
|
24
|
+
# method call.
|
25
|
+
Style/BracesAroundHashParameters:
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
# Align `when` with `case`.
|
29
|
+
Style/CaseIndentation:
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
# Align comments with method definitions.
|
33
|
+
Style/CommentIndentation:
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
# No extra empty lines.
|
37
|
+
Style/EmptyLines:
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
# In a regular class definition, no empty lines around the body.
|
41
|
+
Style/EmptyLinesAroundClassBody:
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
# In a regular method definition, no empty lines around the body.
|
45
|
+
Style/EmptyLinesAroundMethodBody:
|
46
|
+
Enabled: true
|
47
|
+
|
48
|
+
# In a regular module definition, no empty lines around the body.
|
49
|
+
Style/EmptyLinesAroundModuleBody:
|
50
|
+
Enabled: true
|
51
|
+
|
52
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
53
|
+
Style/HashSyntax:
|
54
|
+
Enabled: true
|
55
|
+
|
56
|
+
# Method definitions after `private` or `protected` isolated calls need one
|
57
|
+
# extra level of indentation.
|
58
|
+
Style/IndentationConsistency:
|
59
|
+
Enabled: true
|
60
|
+
EnforcedStyle: rails
|
61
|
+
|
62
|
+
# Two spaces, no tabs (for indentation).
|
63
|
+
Style/IndentationWidth:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Style/SpaceAfterColon:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
Style/SpaceAfterComma:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Style/SpaceAroundEqualsInParameterDefault:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
Style/SpaceAroundKeyword:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Style/SpaceAroundOperators:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
Style/SpaceBeforeFirstArg:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
# Defining a method with parameters needs parentheses.
|
85
|
+
Style/MethodDefParentheses:
|
86
|
+
Enabled: true
|
87
|
+
|
88
|
+
# Use `foo {}` not `foo{}`.
|
89
|
+
Style/SpaceBeforeBlockBraces:
|
90
|
+
Enabled: true
|
91
|
+
|
92
|
+
# Use `foo { bar }` not `foo {bar}`.
|
93
|
+
Style/SpaceInsideBlockBraces:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
97
|
+
Style/SpaceInsideHashLiteralBraces:
|
98
|
+
Enabled: true
|
99
|
+
|
100
|
+
Style/SpaceInsideParens:
|
101
|
+
Enabled: true
|
102
|
+
|
103
|
+
# Check quotes usage according to lint rule below.
|
104
|
+
Style/StringLiterals:
|
105
|
+
Enabled: true
|
106
|
+
EnforcedStyle: double_quotes
|
107
|
+
|
108
|
+
# Detect hard tabs, no hard tabs.
|
109
|
+
Style/Tab:
|
110
|
+
Enabled: true
|
111
|
+
|
112
|
+
# Blank lines should not have any spaces.
|
113
|
+
Style/TrailingBlankLines:
|
114
|
+
Enabled: true
|
115
|
+
|
116
|
+
# No trailing whitespace.
|
117
|
+
Style/TrailingWhitespace:
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
# Use quotes for string literals when they are enough.
|
121
|
+
Style/UnneededPercentQ:
|
122
|
+
Enabled: true
|
123
|
+
|
124
|
+
# Align `end` with the matching keyword or starting expression except for
|
125
|
+
# assignments, where it should be aligned with the LHS.
|
126
|
+
Lint/EndAlignment:
|
127
|
+
Enabled: true
|
128
|
+
EnforcedStyleAlignWith: variable
|
129
|
+
|
130
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
131
|
+
Lint/RequireParentheses:
|
132
|
+
Enabled: true
|
133
|
+
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Vapid
|
2
|
+
|
3
|
+
The world's dumbest content management system.
|
4
|
+
|
5
|
+
TODO: Fill in the README file
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem install vapid
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
To create a new project:
|
16
|
+
|
17
|
+
$ vapid new /path/to/project
|
18
|
+
$ cd /path/to/project
|
19
|
+
|
20
|
+
Then run the local development server:
|
21
|
+
|
22
|
+
$ vapid server
|
23
|
+
|
24
|
+
Add HTML attributes to describe the editable content:
|
25
|
+
|
26
|
+
```html
|
27
|
+
<h1 vp-text="headline"></h1>
|
28
|
+
```
|
29
|
+
|
30
|
+
When you're ready, run the `build` command. Vapid will look at your project templates, and construct the control panel:
|
31
|
+
|
32
|
+
$ vapid build
|
33
|
+
|
34
|
+
## License
|
35
|
+
|
36
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
37
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "vapid"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/vapid
ADDED
data/lib/vapid.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "vapid/version"
|
2
|
+
|
3
|
+
# Adding a method to Object
|
4
|
+
class Object
|
5
|
+
def blank?
|
6
|
+
respond_to?(:empty?) ? !empty? : !self
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
# Top-level namespace
|
11
|
+
module Vapid
|
12
|
+
autoload :Builder, "vapid/builder"
|
13
|
+
autoload :CLI, "vapid/cli"
|
14
|
+
autoload :Directive, "vapid/directive"
|
15
|
+
autoload :Directives, "vapid/directives"
|
16
|
+
autoload :Models, "vapid/models"
|
17
|
+
autoload :Server, "vapid/server"
|
18
|
+
autoload :Settings, "vapid/settings"
|
19
|
+
autoload :Template, "vapid/template"
|
20
|
+
|
21
|
+
def self.register_directive(name, klass)
|
22
|
+
Directives.register name, klass
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
//= require semantic-ui/components/reset
|
2
|
+
//= require semantic-ui/components/button
|
3
|
+
//= require semantic-ui/components/divider
|
4
|
+
//= require semantic-ui/components/form
|
5
|
+
//= require semantic-ui/components/grid
|
6
|
+
//= require semantic-ui/components/header
|
7
|
+
//= require semantic-ui/components/icon
|
8
|
+
//= require semantic-ui/components/image
|
9
|
+
//= require semantic-ui/components/message
|
10
|
+
//= require semantic-ui/components/menu
|
11
|
+
//= require semantic-ui/components/segment
|
12
|
+
//= require semantic-ui/components/sidebar
|
13
|
+
//= require semantic-ui/components/site
|
14
|
+
//= require semantic-ui/components/table
|
15
|
+
//= require trix/dist/trix
|
16
|
+
//= require_self
|
17
|
+
|
18
|
+
@font-face {
|
19
|
+
font-family: 'Icons';
|
20
|
+
src: url("../../semantic-ui/themes/default/assets/fonts/icons.eot");
|
21
|
+
src: url("../../semantic-ui/themes/default/assets/fonts/icons.eot?#iefix") format('embedded-opentype'),
|
22
|
+
url("../../semantic-ui/themes/default/assets/fonts/icons.woff2") format('woff2'),
|
23
|
+
url("../../semantic-ui/themes/default/assets/fonts/icons.woff") format('woff'),
|
24
|
+
url("../../semantic-ui/themes/default/assets/fonts/icons.ttf") format('truetype'),
|
25
|
+
url("../../semantic-ui/themes/default/assets/fonts/icons.svg#icons") format('svg');
|
26
|
+
font-style: normal;
|
27
|
+
font-weight: normal;
|
28
|
+
font-variant: normal;
|
29
|
+
text-decoration: inherit;
|
30
|
+
text-transform: none;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > .grid {
|
34
|
+
height: 100%;
|
35
|
+
}
|
36
|
+
|
37
|
+
body.admin {
|
38
|
+
.pusher {
|
39
|
+
padding: 1rem 2rem 1rem 17rem;
|
40
|
+
}
|
41
|
+
|
42
|
+
.ui.form {
|
43
|
+
max-width: 40rem;
|
44
|
+
padding-bottom: 5rem;
|
45
|
+
}
|
46
|
+
|
47
|
+
form.ui.button input[type="submit"] {
|
48
|
+
padding: 0;
|
49
|
+
border: none;
|
50
|
+
outline: none;
|
51
|
+
line-height: 1em;
|
52
|
+
background: none;
|
53
|
+
}
|
54
|
+
|
55
|
+
.preview,
|
56
|
+
.destroy {
|
57
|
+
margin-top: 1em;
|
58
|
+
}
|
59
|
+
|
60
|
+
.destroy {
|
61
|
+
input[type=checkbox] {
|
62
|
+
vertical-align: middle;
|
63
|
+
margin-right: 0.5em;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
body.admin_form {
|
69
|
+
.column {
|
70
|
+
max-width: 35em;
|
71
|
+
}
|
72
|
+
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Vapid
|
2
|
+
# Scrapes templates, and builds data models
|
3
|
+
class Builder
|
4
|
+
class << self
|
5
|
+
def build!(template_files, &block)
|
6
|
+
project_tree = build_project_tree(template_files, &block)
|
7
|
+
groups = consolidate_into_groups(project_tree)
|
8
|
+
update_data_model(groups)
|
9
|
+
remove_unused_groups(groups)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def build_project_tree(template_files)
|
15
|
+
template_files.reduce({}) do |project_tree, file|
|
16
|
+
yield file if block_given?
|
17
|
+
project_tree.deep_merge parse_file(file)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def consolidate_into_groups(project_tree)
|
22
|
+
project_tree.each_with_object({}) do |(group_key, field_keys), groups|
|
23
|
+
directive = Directives[:group].new(group_key)
|
24
|
+
group_name = directive.subject
|
25
|
+
groups[group_name] ||= { repeating: false, fields: {} }
|
26
|
+
groups[group_name][:repeating] ||= directive.repeating?
|
27
|
+
groups[group_name][:fields].merge! get_content_fields(field_keys)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def update_data_model(groups)
|
32
|
+
groups.each do |name, attributes|
|
33
|
+
group = Models::Group.named(name) || Models::Group.new(name: name)
|
34
|
+
group.update_attributes attributes
|
35
|
+
prune_orphaned_content(group)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def parse_file(file)
|
40
|
+
html = File.open(file).read
|
41
|
+
Template.new(html).tree
|
42
|
+
end
|
43
|
+
|
44
|
+
def get_content_fields(field_keys)
|
45
|
+
field_keys.each_with_object({}) do |(field_key, field_types), fields|
|
46
|
+
content_type = field_types.reverse.find { |t| content_directives.include?(t) }
|
47
|
+
unless content_type.nil?
|
48
|
+
field_directive = Directives[content_type].new(field_key)
|
49
|
+
fields[field_directive.subject] = content_type
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def prune_orphaned_content(group)
|
55
|
+
group.records.each do |record|
|
56
|
+
record.content.delete_if { |k, _v| !group.fields.include?(k) }
|
57
|
+
record.save
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def remove_unused_groups(used_groups)
|
62
|
+
Models::Group.where.not(name: used_groups.keys).destroy_all
|
63
|
+
end
|
64
|
+
|
65
|
+
def content_directives
|
66
|
+
@content_directives ||= Directives.content_changers.keys
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/vapid/cli.rb
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "guard"
|
3
|
+
require "guard/commander"
|
4
|
+
require "thread"
|
5
|
+
|
6
|
+
module Vapid
|
7
|
+
# Command line interface
|
8
|
+
class CLI < Thor
|
9
|
+
include Thor::Actions
|
10
|
+
default_task :help
|
11
|
+
|
12
|
+
GUARDFILE = %(
|
13
|
+
guard 'livereload' do
|
14
|
+
watch('.cache/livereload.txt')
|
15
|
+
watch(%r{templates/.+})
|
16
|
+
watch(%r{assets/.+})
|
17
|
+
end
|
18
|
+
).freeze
|
19
|
+
|
20
|
+
def self.source_root
|
21
|
+
"#{File.dirname(__FILE__)}/generator_template"
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "new TARGET", "Create a new project in the TARGET directory"
|
25
|
+
map %w(n -n --new) => :new
|
26
|
+
def new(target)
|
27
|
+
say "== Creating a new Vapid project in #{expanded_target(target)}"
|
28
|
+
directory ".", target
|
29
|
+
inside_target(target) do
|
30
|
+
run "bundle install"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "server", "Start the server"
|
35
|
+
map %w(s -s --server) => :server
|
36
|
+
method_option :port, aliases: %w(-p), type: :numeric
|
37
|
+
method_option :bind, aliases: %w(-b), type: :string
|
38
|
+
def server(target = ".")
|
39
|
+
say "== The Vapid server is loading"
|
40
|
+
inside_target(target) do
|
41
|
+
Thread.abort_on_exception = true
|
42
|
+
Thread.new do
|
43
|
+
Server.run! options
|
44
|
+
end
|
45
|
+
|
46
|
+
Guard.start guardfile_contents: GUARDFILE, watchdir: target, no_interactions: true
|
47
|
+
end
|
48
|
+
say "== The Vapid server is now shut down"
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "build", "Updates the data model as described in your templates"
|
52
|
+
map %w(b -b --build) => :build
|
53
|
+
def build(target = ".")
|
54
|
+
inside_target(target) do
|
55
|
+
Models.migrate!
|
56
|
+
ensure_user_exists
|
57
|
+
|
58
|
+
say "== Parsing templates for fields"
|
59
|
+
template_files = Dir[File.join(target, "templates", "**/*")].reject { |f| File.directory? f }
|
60
|
+
Builder.build!(template_files) do |filepath|
|
61
|
+
say " * #{filepath}"
|
62
|
+
end
|
63
|
+
say "== Build complete"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "version", "Show the Vapid version number"
|
68
|
+
map %w(v -v --version) => :version
|
69
|
+
def version
|
70
|
+
say "Vapid #{Vapid::VERSION}"
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def inside_target(target, &block)
|
76
|
+
if !File.exist? File.join(target, "config.ru")
|
77
|
+
say "== Could not find a Vapid project in #{expanded_target(target)}"
|
78
|
+
else
|
79
|
+
FileUtils.mkdir_p File.join(target, ".cache")
|
80
|
+
inside(target, &block)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def expanded_target(target)
|
85
|
+
File.expand_path(target)
|
86
|
+
end
|
87
|
+
|
88
|
+
def ensure_user_exists
|
89
|
+
return if Models::User.any?
|
90
|
+
say "== Creating an admin login"
|
91
|
+
email = ask "What is your email address?", default: "admin@example.com"
|
92
|
+
password = ask "Enter a password:", default: "password", echo: false
|
93
|
+
Models::User.create email: email, password: password
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|