lanes 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.jshintrc +3 -0
- data/Gemfile +9 -0
- data/Guardfile +15 -0
- data/LICENSE-MIT.txt +21 -0
- data/README.md +15 -0
- data/Rakefile +74 -0
- data/bin/lanes +5 -0
- data/client/images/ajax-loader.gif +0 -0
- data/client/images/dataTables/Sorting icons.psd +0 -0
- data/client/images/dataTables/back_disabled.png +0 -0
- data/client/images/dataTables/back_enabled.png +0 -0
- data/client/images/dataTables/back_enabled_hover.png +0 -0
- data/client/images/dataTables/favicon.ico +0 -0
- data/client/images/dataTables/forward_disabled.png +0 -0
- data/client/images/dataTables/forward_enabled.png +0 -0
- data/client/images/dataTables/forward_enabled_hover.png +0 -0
- data/client/images/dataTables/loading-background.png +0 -0
- data/client/images/dataTables/sort_asc.png +0 -0
- data/client/images/dataTables/sort_asc_disabled.png +0 -0
- data/client/images/dataTables/sort_both.png +0 -0
- data/client/images/dataTables/sort_desc.png +0 -0
- data/client/images/dataTables/sort_desc_disabled.png +0 -0
- data/client/images/logo-sm.png +0 -0
- data/client/javascripts/component/Base.coffee +39 -0
- data/client/javascripts/component/ChoicesInput.coffee +47 -0
- data/client/javascripts/component/Grid.coffee +199 -0
- data/client/javascripts/component/ModalDialog.coffee +44 -0
- data/client/javascripts/component/PopOver.coffee +52 -0
- data/client/javascripts/component/RadioGroup.coffee +59 -0
- data/client/javascripts/component/RecordFinder.coffee +143 -0
- data/client/javascripts/component/SelectField.coffee +43 -0
- data/client/javascripts/component/TaggedField.coffee +27 -0
- data/client/javascripts/component/grid/Editor.coffee +65 -0
- data/client/javascripts/component/grid/PopOverEditor.coffee +29 -0
- data/client/javascripts/component/grid/RowEditor.coffee +31 -0
- data/client/javascripts/component/grid/popover-editor.html +18 -0
- data/client/javascripts/component/grid/row-editor.html +16 -0
- data/client/javascripts/component/grid.html +4 -0
- data/client/javascripts/component/index.js +5 -0
- data/client/javascripts/component/modal.html +17 -0
- data/client/javascripts/component/popover.html +5 -0
- data/client/javascripts/component/record-finder/clause.skr +35 -0
- data/client/javascripts/component/record-finder/dialog.skr +4 -0
- data/client/javascripts/component/record-finder/field.skr +8 -0
- data/client/javascripts/data/Bootstrap.coffee +8 -0
- data/client/javascripts/data/ChangeSet.coffee +50 -0
- data/client/javascripts/data/Collection.coffee +111 -0
- data/client/javascripts/data/Config.coffee +15 -0
- data/client/javascripts/data/Model.coffee +269 -0
- data/client/javascripts/data/PubSub.coffee +68 -0
- data/client/javascripts/data/Query.coffee +184 -0
- data/client/javascripts/data/Roles.coffee +91 -0
- data/client/javascripts/data/Screens.coffee +157 -0
- data/client/javascripts/data/Sync.coffee +62 -0
- data/client/javascripts/data/User.coffee +70 -0
- data/client/javascripts/data/index.js +7 -0
- data/client/javascripts/data/mixins/HasCodeField.coffee +13 -0
- data/client/javascripts/extension/Base.coffee +9 -0
- data/client/javascripts/extension/Extensions.coffee +17 -0
- data/client/javascripts/extension/GlAccounts.coffee +9 -0
- data/client/javascripts/extension/index.js +6 -0
- data/client/javascripts/extension/load.js.erb +3 -0
- data/client/javascripts/lanes-complete.js +3 -0
- data/client/javascripts/lanes-workspace.js +1 -0
- data/client/javascripts/lib/MakeBaseClass.coffee +55 -0
- data/client/javascripts/lib/ModuleSupport.coffee +22 -0
- data/client/javascripts/lib/Templates.coffee +47 -0
- data/client/javascripts/lib/create-namespace.js +0 -0
- data/client/javascripts/lib/debounce.coffee +15 -0
- data/client/javascripts/lib/defer.coffee +7 -0
- data/client/javascripts/lib/el.js +115 -0
- data/client/javascripts/lib/index.js +9 -0
- data/client/javascripts/lib/loader.coffee +95 -0
- data/client/javascripts/lib/namespace.coffee +9 -0
- data/client/javascripts/lib/noConflict.coffee +14 -0
- data/client/javascripts/lib/promise_helpers.coffee +4 -0
- data/client/javascripts/lib/results.coffee +15 -0
- data/client/javascripts/lib/underscore.inflection.js +210 -0
- data/client/javascripts/lib/utilFunctions.coffee +51 -0
- data/client/javascripts/plugins/ResizeSensor.js +144 -0
- data/client/javascripts/plugins/index.js +4 -0
- data/client/javascripts/plugins/overlay.coffee +41 -0
- data/client/javascripts/plugins/trigger.coffee +15 -0
- data/client/javascripts/vendor/bootstrap/affix.js +142 -0
- data/client/javascripts/vendor/bootstrap/alert.js +92 -0
- data/client/javascripts/vendor/bootstrap/button.js +110 -0
- data/client/javascripts/vendor/bootstrap/carousel.js +223 -0
- data/client/javascripts/vendor/bootstrap/collapse.js +170 -0
- data/client/javascripts/vendor/bootstrap/dropdown.js +151 -0
- data/client/javascripts/vendor/bootstrap/modal.js +280 -0
- data/client/javascripts/vendor/bootstrap/popover.js +113 -0
- data/client/javascripts/vendor/bootstrap/scrollspy.js +170 -0
- data/client/javascripts/vendor/bootstrap/tab.js +128 -0
- data/client/javascripts/vendor/bootstrap/tooltip.js +457 -0
- data/client/javascripts/vendor/bootstrap/transition.js +59 -0
- data/client/javascripts/vendor/dataTables/dataTables.bootstrap.js +156 -0
- data/client/javascripts/vendor/dataTables/dataTables.scroller.js +1185 -0
- data/client/javascripts/vendor/dataTables/datatables.responsive.js +666 -0
- data/client/javascripts/vendor/dataTables/index.js +2 -0
- data/client/javascripts/vendor/dataTables/jquery.dataTables.js +14380 -0
- data/client/javascripts/vendor/jquery-2.js +9190 -0
- data/client/javascripts/vendor/jquery.tap.js +401 -0
- data/client/javascripts/vendor/magicsuggest.js +1565 -0
- data/client/javascripts/vendor/message-bus.js +285 -0
- data/client/javascripts/vendor/modern-stack.js +14 -0
- data/client/javascripts/vendor/packaged.js +13769 -0
- data/client/javascripts/view/Assets.coffee +9 -0
- data/client/javascripts/view/Base.coffee +231 -0
- data/client/javascripts/view/FormBindings.coffee +98 -0
- data/client/javascripts/view/Functions.coffee +13 -0
- data/client/javascripts/view/Helpers.coffee +77 -0
- data/client/javascripts/view/InterfaceState.coffee +88 -0
- data/client/javascripts/view/Keys.coffee +59 -0
- data/client/javascripts/view/ModelObserver.coffee +31 -0
- data/client/javascripts/view/ModelUpdate.coffee +8 -0
- data/client/javascripts/view/PubSub.coffee +29 -0
- data/client/javascripts/view/RenderContext.coffee +32 -0
- data/client/javascripts/view/SaveNotify.coffee +30 -0
- data/client/javascripts/view/Screen.coffee +30 -0
- data/client/javascripts/view/TimedHighlight.coffee +38 -0
- data/client/javascripts/view/TimedMask.coffee +65 -0
- data/client/javascripts/view/_button.html +3 -0
- data/client/javascripts/view/_toolbar.html +27 -0
- data/client/javascripts/view/index.js +10 -0
- data/client/javascripts/view/mixins/ScreenChangeListener.coffee +43 -0
- data/client/javascripts/view/model-update.html +13 -0
- data/client/javascripts/view/screen-definitions.js.erb +7 -0
- data/client/javascripts/workspace/ActiveScreensSwitcher.coffee +117 -0
- data/client/javascripts/workspace/Instance.es6 +60 -0
- data/client/javascripts/workspace/Layout.coffee +18 -0
- data/client/javascripts/workspace/LoginDialog.coffee +33 -0
- data/client/javascripts/workspace/Navbar.coffee +44 -0
- data/client/javascripts/workspace/Pages.coffee +46 -0
- data/client/javascripts/workspace/ScreensMenu.coffee +126 -0
- data/client/javascripts/workspace/index.js +12 -0
- data/client/javascripts/workspace/layout.html +4 -0
- data/client/javascripts/workspace/login-dialog.html +16 -0
- data/client/javascripts/workspace/menu.html +356 -0
- data/client/javascripts/workspace/menu_toggle.html +9 -0
- data/client/javascripts/workspace/navbar.html +19 -0
- data/client/javascripts/workspace/pages.html +6 -0
- data/client/javascripts/workspace/screens-menu.html +11 -0
- data/client/javascripts/workspace/screens-switcher.html +7 -0
- data/client/javascripts/workspace/tab.html +0 -0
- data/client/screens/user-management/UserEditScreen.coffee +21 -0
- data/client/screens/user-management/UserManagement.coffee +24 -0
- data/client/screens/user-management/grid-popover-editor.html +33 -0
- data/client/screens/user-management/index.css +4 -0
- data/client/screens/user-management/index.js +2 -0
- data/client/screens/user-management/user-management-styles.scss +7 -0
- data/client/screens/user-management/user-management.html +8 -0
- data/client/stylesheets/compoonents/all.scss +6 -0
- data/client/stylesheets/compoonents/changes-notification.scss +44 -0
- data/client/stylesheets/compoonents/grid-editors.scss +65 -0
- data/client/stylesheets/compoonents/grid.scss +301 -0
- data/client/stylesheets/compoonents/modal-dialog.scss +23 -0
- data/client/stylesheets/compoonents/record-finder.scss +71 -0
- data/client/stylesheets/compoonents/suggest.scss +266 -0
- data/client/stylesheets/fonts/icomoon.eot +0 -0
- data/client/stylesheets/fonts/icomoon.svg +160 -0
- data/client/stylesheets/fonts/icomoon.ttf +0 -0
- data/client/stylesheets/fonts/icomoon.woff +0 -0
- data/client/stylesheets/fonts/selection.json +3565 -0
- data/client/stylesheets/fonts/style.css +451 -0
- data/client/stylesheets/fonts.scss +38 -0
- data/client/stylesheets/forms.scss +75 -0
- data/client/stylesheets/index.css +4 -0
- data/client/stylesheets/keybindings.scss +6 -0
- data/client/stylesheets/lanes-workspace.scss +17 -0
- data/client/stylesheets/layout.scss +272 -0
- data/client/stylesheets/plugins/all.scss +2 -0
- data/client/stylesheets/plugins/overlay.scss +63 -0
- data/client/stylesheets/plugins/resize-sensor.scss +24 -0
- data/client/stylesheets/screens.scss +66 -0
- data/client/stylesheets/tabs.scss +148 -0
- data/client/stylesheets/vendor/bootstrap/_alerts.scss +68 -0
- data/client/stylesheets/vendor/bootstrap/_badges.scss +57 -0
- data/client/stylesheets/vendor/bootstrap/_breadcrumbs.scss +26 -0
- data/client/stylesheets/vendor/bootstrap/_button-groups.scss +240 -0
- data/client/stylesheets/vendor/bootstrap/_buttons.scss +157 -0
- data/client/stylesheets/vendor/bootstrap/_carousel.scss +243 -0
- data/client/stylesheets/vendor/bootstrap/_close.scss +35 -0
- data/client/stylesheets/vendor/bootstrap/_code.scss +68 -0
- data/client/stylesheets/vendor/bootstrap/_component-animations.scss +35 -0
- data/client/stylesheets/vendor/bootstrap/_dropdowns.scss +215 -0
- data/client/stylesheets/vendor/bootstrap/_forms.scss +538 -0
- data/client/stylesheets/vendor/bootstrap/_glyphicons.scss +237 -0
- data/client/stylesheets/vendor/bootstrap/_grid.scss +84 -0
- data/client/stylesheets/vendor/bootstrap/_input-groups.scss +166 -0
- data/client/stylesheets/vendor/bootstrap/_jumbotron.scss +48 -0
- data/client/stylesheets/vendor/bootstrap/_labels.scss +66 -0
- data/client/stylesheets/vendor/bootstrap/_list-group.scss +132 -0
- data/client/stylesheets/vendor/bootstrap/_media.scss +56 -0
- data/client/stylesheets/vendor/bootstrap/_mixins.scss +39 -0
- data/client/stylesheets/vendor/bootstrap/_modals.scss +150 -0
- data/client/stylesheets/vendor/bootstrap/_navbar.scss +659 -0
- data/client/stylesheets/vendor/bootstrap/_navs.scss +242 -0
- data/client/stylesheets/vendor/bootstrap/_normalize.scss +425 -0
- data/client/stylesheets/vendor/bootstrap/_pager.scss +55 -0
- data/client/stylesheets/vendor/bootstrap/_pagination.scss +88 -0
- data/client/stylesheets/vendor/bootstrap/_panels.scss +243 -0
- data/client/stylesheets/vendor/bootstrap/_popovers.scss +133 -0
- data/client/stylesheets/vendor/bootstrap/_print.scss +101 -0
- data/client/stylesheets/vendor/bootstrap/_progress-bars.scss +105 -0
- data/client/stylesheets/vendor/bootstrap/_responsive-embed.scss +34 -0
- data/client/stylesheets/vendor/bootstrap/_responsive-utilities.scss +174 -0
- data/client/stylesheets/vendor/bootstrap/_scaffolding.scss +150 -0
- data/client/stylesheets/vendor/bootstrap/_tables.scss +233 -0
- data/client/stylesheets/vendor/bootstrap/_theme.scss +258 -0
- data/client/stylesheets/vendor/bootstrap/_thumbnails.scss +38 -0
- data/client/stylesheets/vendor/bootstrap/_tooltip.scss +95 -0
- data/client/stylesheets/vendor/bootstrap/_type.scss +304 -0
- data/client/stylesheets/vendor/bootstrap/_utilities.scss +57 -0
- data/client/stylesheets/vendor/bootstrap/_variables.scss +850 -0
- data/client/stylesheets/vendor/bootstrap/_wells.scss +29 -0
- data/client/stylesheets/vendor/bootstrap/bootstrap.scss +50 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_alerts.scss +14 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_background-variant.scss +11 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_border-radius.scss +18 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_buttons.scss +50 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_center-block.scss +7 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_clearfix.scss +22 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_forms.scss +84 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_gradients.scss +58 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_grid-framework.scss +81 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_grid.scss +122 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_hide-text.scss +21 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_image.scss +34 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_labels.scss +12 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_list-group.scss +31 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_nav-divider.scss +10 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_opacity.scss +8 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_pagination.scss +23 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_panels.scss +24 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_progress-bar.scss +10 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_reset-filter.scss +8 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_resize.scss +6 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_responsive-visibility.scss +21 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_size.scss +10 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_tab-focus.scss +9 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_table-row.scss +28 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_text-emphasis.scss +11 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_text-overflow.scss +8 -0
- data/client/stylesheets/vendor/bootstrap/mixins/_vendor-prefixes.scss +219 -0
- data/client/stylesheets/vendor/bootstrap-custom-grid.scss +85 -0
- data/client/stylesheets/vendor/bootstrap-custom-modals.scss +150 -0
- data/client/stylesheets/vendor/bootstrap.scss +69 -0
- data/client/stylesheets/vendor/dataTables.scss +4 -0
- data/config/database.yml +9 -0
- data/config/puma.rb +7 -0
- data/config.ru +4 -0
- data/db/migrate/20140615031600_create_hip_users.rb +17 -0
- data/db/seed.rb +37 -0
- data/foo/Gemfile +5 -0
- data/foo/Guardfile +13 -0
- data/foo/foo/Gemfile +5 -0
- data/foo/foo/lib/foo.rb +7 -0
- data/foo/lib/foo/version.rb +3 -0
- data/foo/lib/foo.rb +8 -0
- data/lanes.gemspec +54 -0
- data/lib/generators/lanes/migrations/install_generator.rb +42 -0
- data/lib/lanes/access/locked_fields.rb +43 -0
- data/lib/lanes/access/role.rb +58 -0
- data/lib/lanes/access/role_collection.rb +75 -0
- data/lib/lanes/access/roles/administrator.rb +25 -0
- data/lib/lanes/access/roles/support.rb +13 -0
- data/lib/lanes/access/user_maint_screen.rb +32 -0
- data/lib/lanes/access.rb +50 -0
- data/lib/lanes/api/asset_pipeline.rb +59 -0
- data/lib/lanes/api/authentication_helper.rb +21 -0
- data/lib/lanes/api/authentication_provider.rb +45 -0
- data/lib/lanes/api/controller.rb +290 -0
- data/lib/lanes/api/default_routes.rb +35 -0
- data/lib/lanes/api/eco.js +516 -0
- data/lib/lanes/api/error_formatter.rb +37 -0
- data/lib/lanes/api/helper_methods.rb +32 -0
- data/lib/lanes/api/javascript_processor.rb +116 -0
- data/lib/lanes/api/pub_sub.rb +33 -0
- data/lib/lanes/api/request_wrapper.rb +42 -0
- data/lib/lanes/api/root.rb +103 -0
- data/lib/lanes/api/skr_templates.rb +60 -0
- data/lib/lanes/api/test_specs.rb +59 -0
- data/lib/lanes/api/updates.rb +38 -0
- data/lib/lanes/api.rb +27 -0
- data/lib/lanes/cli.rb +13 -0
- data/lib/lanes/concerns/all.rb +16 -0
- data/lib/lanes/concerns/api_path.rb +21 -0
- data/lib/lanes/concerns/association_extensions.rb +85 -0
- data/lib/lanes/concerns/attr_accessor_with_default.rb +62 -0
- data/lib/lanes/concerns/code_identifier.rb +43 -0
- data/lib/lanes/concerns/export_associations.rb +52 -0
- data/lib/lanes/concerns/export_join_tables.rb +39 -0
- data/lib/lanes/concerns/export_methods.rb +104 -0
- data/lib/lanes/concerns/export_scope.rb +66 -0
- data/lib/lanes/concerns/exported_limit_evaluator.rb +17 -0
- data/lib/lanes/concerns/immutable_model.rb +32 -0
- data/lib/lanes/concerns/locked_fields.rb +84 -0
- data/lib/lanes/concerns/pub_sub.rb +105 -0
- data/lib/lanes/concerns/queries.rb +20 -0
- data/lib/lanes/concerns/random_hash_code.rb +40 -0
- data/lib/lanes/concerns/sanitize_api_data.rb +15 -0
- data/lib/lanes/concerns/set_attribute_data.rb +154 -0
- data/lib/lanes/concerns/track_modifications.rb +51 -0
- data/lib/lanes/concerns/visible_id_identifier.rb +53 -0
- data/lib/lanes/configuration.rb +85 -0
- data/lib/lanes/db/migration_helpers.rb +178 -0
- data/lib/lanes/db/migrations.rb +13 -0
- data/lib/lanes/db/seed.rb +27 -0
- data/lib/lanes/db.rb +86 -0
- data/lib/lanes/environment.rb +19 -0
- data/lib/lanes/extension.rb +72 -0
- data/lib/lanes/generators/app/Gemfile +5 -0
- data/lib/lanes/generators/app/Guardfile +13 -0
- data/lib/lanes/generators/app/Rakefile +9 -0
- data/lib/lanes/generators/app/config/database.yml +9 -0
- data/lib/lanes/generators/app/config.ru +4 -0
- data/lib/lanes/generators/app/lib/main_class/version.rb +3 -0
- data/lib/lanes/generators/app/lib/main_class.rb +8 -0
- data/lib/lanes/generators/app.rb +36 -0
- data/lib/lanes/guard_tasks.rb +44 -0
- data/lib/lanes/logger.rb +37 -0
- data/lib/lanes/model.rb +26 -0
- data/lib/lanes/numbers.rb +72 -0
- data/lib/lanes/rails_engine.rb +5 -0
- data/lib/lanes/screens.rb +126 -0
- data/lib/lanes/spec_asset_expander.rb +43 -0
- data/lib/lanes/strings.rb +56 -0
- data/lib/lanes/user.rb +127 -0
- data/lib/lanes/validators/all.rb +2 -0
- data/lib/lanes/validators/email.rb +17 -0
- data/lib/lanes/validators/set.rb +18 -0
- data/lib/lanes/version.rb +5 -0
- data/lib/lanes.rb +22 -0
- data/npm-build/README +1 -0
- data/npm-build/compile.coffee +15 -0
- data/npm-build/package.json +59 -0
- data/npm-build/shims/underscore.js +1416 -0
- data/npm-build/template.js +33 -0
- data/public/javascripts/jasmine_examples/Player.js +22 -0
- data/public/javascripts/jasmine_examples/Song.js +7 -0
- data/spec/api/javascript_processor_spec.rb +107 -0
- data/spec/api/user_spec.rb +52 -0
- data/spec/client/component/ChoicesInputSpec.coffee +12 -0
- data/spec/client/component/foo_spec.coffee +4 -0
- data/spec/client/foo_spec.js +0 -0
- data/spec/client/jasmine_examples/PlayerSpec.js +0 -0
- data/spec/client/support/jasmine.yml +128 -0
- data/spec/client/support/jasmine_helper.rb +15 -0
- data/spec/concerns/api_path_spec.rb +14 -0
- data/spec/concerns/association_extensions_spec.rb +30 -0
- data/spec/concerns/attr_accessor_with_default_spec.rb +57 -0
- data/spec/concerns/code_identifier_spec.rb +45 -0
- data/spec/concerns/export_associations_spec.rb +7 -0
- data/spec/concerns/export_methods_spec.rb +43 -0
- data/spec/concerns/export_scope_spec.rb +15 -0
- data/spec/concerns/exported_limits_spec.rb +47 -0
- data/spec/concerns/pub_sub_spec.rb +83 -0
- data/spec/concerns/set_attribute_data_spec.rb +66 -0
- data/spec/configuration_spec.rb +26 -0
- data/spec/fixtures/lanes/users.yml +13 -0
- data/spec/helpers/.gitkeep +0 -0
- data/spec/helpers/SpecHelper.js +18 -0
- data/spec/locked_fields_spec.rb +27 -0
- data/spec/numbers_spec.rb +26 -0
- data/spec/role_collection_spec.rb +19 -0
- data/spec/spec_helper.rb +163 -0
- data/spec/strings_spec.rb +41 -0
- data/spec/testing_models.rb +54 -0
- data/spec/user_role_spec.rb +7 -0
- data/spec/user_spec.rb +53 -0
- data/tasks/migrations.rake +22 -0
- data/tasks/publish.rake +8 -0
- data/views/index.erb +29 -0
- data/views/specs.erb +25 -0
- data/yard_ext/all.rb +9 -0
- data/yard_ext/code_identifier_handler.rb +33 -0
- data/yard_ext/concern_meta_methods.rb +60 -0
- data/yard_ext/config_options.rb +27 -0
- data/yard_ext/exported_scope.rb +4 -0
- data/yard_ext/immutable_handler.rb +17 -0
- data/yard_ext/json_attr_accessor.rb +22 -0
- data/yard_ext/locked_fields_handler.rb +21 -0
- data/yard_ext/templates/default/layout/html/layout.erb +20 -0
- data/yard_ext/templates/default/method_details/html/github_link.erb +1 -0
- data/yard_ext/templates/default/method_details/setup.rb +3 -0
- data/yard_ext/validators.rb +1 -0
- data/yard_ext/visible_id_handler.rb +38 -0
- metadata +772 -0
@@ -0,0 +1,516 @@
|
|
1
|
+
/**
|
2
|
+
* Eco Compiler v1.1.0-rc-3
|
3
|
+
* http://github.com/sstephenson/eco
|
4
|
+
*
|
5
|
+
* Copyright (c) 2011 Sam Stephenson
|
6
|
+
* Released under the MIT License
|
7
|
+
*/
|
8
|
+
this.eco = (function(modules) {
|
9
|
+
return function require(name) {
|
10
|
+
var fn, module = {id: name, exports: {}};
|
11
|
+
if (fn = modules[name]) {
|
12
|
+
fn(module, require, module.exports);
|
13
|
+
return module.exports;
|
14
|
+
} else {
|
15
|
+
throw 'Cannot find module \'' + name + '\'';
|
16
|
+
}
|
17
|
+
};
|
18
|
+
})({
|
19
|
+
'eco': function(module, require, exports) {
|
20
|
+
// Generated by CoffeeScript 1.6.3
|
21
|
+
(function() {
|
22
|
+
var compile, eco, precompile, preprocess, _ref;
|
23
|
+
|
24
|
+
_ref = require("./compiler"), compile = _ref.compile, precompile = _ref.precompile;
|
25
|
+
|
26
|
+
preprocess = require("./preprocessor").preprocess;
|
27
|
+
|
28
|
+
module.exports = eco = function(source) {
|
29
|
+
var _base;
|
30
|
+
if (eco.cache) {
|
31
|
+
return (_base = eco.cache)[source] != null ? (_base = eco.cache)[source] : _base[source] = compile(source);
|
32
|
+
} else {
|
33
|
+
return compile(source);
|
34
|
+
}
|
35
|
+
};
|
36
|
+
|
37
|
+
eco.cache = {};
|
38
|
+
|
39
|
+
eco.preprocess = preprocess;
|
40
|
+
|
41
|
+
eco.precompile = precompile;
|
42
|
+
|
43
|
+
eco.compile = compile;
|
44
|
+
|
45
|
+
eco.render = function(source, data) {
|
46
|
+
return (eco(source))(data);
|
47
|
+
};
|
48
|
+
|
49
|
+
if (require.extensions) {
|
50
|
+
require.extensions[".eco"] = function(module, filename) {
|
51
|
+
var source;
|
52
|
+
source = require("fs").readFileSync(filename, "utf-8");
|
53
|
+
return module._compile("module.exports = " + (precompile(source)), filename);
|
54
|
+
};
|
55
|
+
}
|
56
|
+
|
57
|
+
}).call(this);
|
58
|
+
|
59
|
+
},
|
60
|
+
'./compiler': function(module, require, exports) {
|
61
|
+
// Generated by CoffeeScript 1.6.3
|
62
|
+
(function() {
|
63
|
+
var CoffeeScript, indent, precompile, preprocess;
|
64
|
+
|
65
|
+
CoffeeScript = require("coffee-script");
|
66
|
+
|
67
|
+
preprocess = require("./preprocessor").preprocess;
|
68
|
+
|
69
|
+
indent = require("./util").indent;
|
70
|
+
|
71
|
+
exports.precompile = precompile = function(source, functions_ns, helpers) {
|
72
|
+
var script;
|
73
|
+
if (helpers == null) {
|
74
|
+
helpers = "ECO";
|
75
|
+
}
|
76
|
+
script = CoffeeScript.compile(preprocess(source), {
|
77
|
+
noWrap: true
|
78
|
+
});
|
79
|
+
return "function(__obj) {\n if (!__obj) __obj = {};\n var __out = [],\n __capture = " + functions_ns + ".capture(__out),__sanitize = " + functions_ns + ".sanitize,\n __safe, __objSafe = __obj.safe, __escape = __obj.escape,__safe = __obj.safe = " + functions_ns + ".safe,\n __escape = __obj.escape = " + functions_ns + ".escape, h = " + helpers + ";\n (function() {\n " + (indent(script, 4)) + "\n }).call(__obj);\n __obj.safe = __objSafe, __obj.escape = __escape;\n return __out.join('');\n}";
|
80
|
+
};
|
81
|
+
|
82
|
+
exports.compile = function(source) {
|
83
|
+
return new Function("return " + (precompile(source)))();
|
84
|
+
};
|
85
|
+
|
86
|
+
}).call(this);
|
87
|
+
|
88
|
+
},
|
89
|
+
'./preprocessor': function(module, require, exports) {
|
90
|
+
// Generated by CoffeeScript 1.6.3
|
91
|
+
(function() {
|
92
|
+
var Preprocessor, Scanner, util;
|
93
|
+
|
94
|
+
Scanner = require("./scanner");
|
95
|
+
|
96
|
+
util = require("./util");
|
97
|
+
|
98
|
+
module.exports = Preprocessor = (function() {
|
99
|
+
Preprocessor.preprocess = function(source) {
|
100
|
+
var preprocessor;
|
101
|
+
preprocessor = new Preprocessor(source);
|
102
|
+
return preprocessor.preprocess();
|
103
|
+
};
|
104
|
+
|
105
|
+
function Preprocessor(source) {
|
106
|
+
this.scanner = new Scanner(source);
|
107
|
+
this.output = "";
|
108
|
+
this.level = 0;
|
109
|
+
this.options = {};
|
110
|
+
this.captures = [];
|
111
|
+
}
|
112
|
+
|
113
|
+
Preprocessor.prototype.preprocess = function() {
|
114
|
+
var _this = this;
|
115
|
+
while (!this.scanner.done) {
|
116
|
+
this.scanner.scan(function(token) {
|
117
|
+
return _this[token[0]].apply(_this, token.slice(1));
|
118
|
+
});
|
119
|
+
}
|
120
|
+
return this.output;
|
121
|
+
};
|
122
|
+
|
123
|
+
Preprocessor.prototype.record = function(line) {
|
124
|
+
this.output += util.repeat(" ", this.level);
|
125
|
+
return this.output += line + "\n";
|
126
|
+
};
|
127
|
+
|
128
|
+
Preprocessor.prototype.printString = function(string) {
|
129
|
+
if (string.length) {
|
130
|
+
return this.record("__out.push " + (util.inspectString(string)));
|
131
|
+
}
|
132
|
+
};
|
133
|
+
|
134
|
+
Preprocessor.prototype.beginCode = function(options) {
|
135
|
+
return this.options = options;
|
136
|
+
};
|
137
|
+
|
138
|
+
Preprocessor.prototype.recordCode = function(code) {
|
139
|
+
if (code !== "end") {
|
140
|
+
if (this.options.print) {
|
141
|
+
if (this.options.safe) {
|
142
|
+
return this.record("__out.push " + code);
|
143
|
+
} else {
|
144
|
+
return this.record("__out.push __sanitize " + code);
|
145
|
+
}
|
146
|
+
} else {
|
147
|
+
return this.record(code);
|
148
|
+
}
|
149
|
+
}
|
150
|
+
};
|
151
|
+
|
152
|
+
Preprocessor.prototype.indent = function(capture) {
|
153
|
+
this.level++;
|
154
|
+
if (capture) {
|
155
|
+
this.record("__capture " + capture);
|
156
|
+
this.captures.unshift(this.level);
|
157
|
+
return this.indent();
|
158
|
+
}
|
159
|
+
};
|
160
|
+
|
161
|
+
Preprocessor.prototype.dedent = function() {
|
162
|
+
this.level--;
|
163
|
+
if (this.level < 0) {
|
164
|
+
this.fail("unexpected dedent");
|
165
|
+
}
|
166
|
+
if (this.captures[0] === this.level) {
|
167
|
+
this.captures.shift();
|
168
|
+
return this.dedent();
|
169
|
+
}
|
170
|
+
};
|
171
|
+
|
172
|
+
Preprocessor.prototype.fail = function(message) {
|
173
|
+
throw "Parse error on line " + this.scanner.lineNo + ": " + message;
|
174
|
+
};
|
175
|
+
|
176
|
+
return Preprocessor;
|
177
|
+
|
178
|
+
})();
|
179
|
+
|
180
|
+
}).call(this);
|
181
|
+
|
182
|
+
},
|
183
|
+
'./scanner': function(module, require, exports) {
|
184
|
+
// Generated by CoffeeScript 1.6.3
|
185
|
+
(function() {
|
186
|
+
var Scanner, StringScanner, trim;
|
187
|
+
|
188
|
+
StringScanner = require("strscan").StringScanner;
|
189
|
+
|
190
|
+
trim = require("./util").trim;
|
191
|
+
|
192
|
+
module.exports = Scanner = (function() {
|
193
|
+
Scanner.modePatterns = {
|
194
|
+
data: /(.*?)(<%%|%%>|<%\s*(\#)|<%(([=-])?)|\n|$)/,
|
195
|
+
code: /(.*?)((((:|(->|=>))\s*))?%>|\n|$)/,
|
196
|
+
comment: /(.*?)(%>|\n|$)/
|
197
|
+
};
|
198
|
+
|
199
|
+
Scanner.dedentablePattern = /^(end|when|else|catch|finally)(?:\W|$)/;
|
200
|
+
|
201
|
+
Scanner.scan = function(source) {
|
202
|
+
var scanner, tokens;
|
203
|
+
tokens = [];
|
204
|
+
scanner = new Scanner(source);
|
205
|
+
while (!scanner.done) {
|
206
|
+
scanner.scan(function(token) {
|
207
|
+
return tokens.push(token);
|
208
|
+
});
|
209
|
+
}
|
210
|
+
return tokens;
|
211
|
+
};
|
212
|
+
|
213
|
+
function Scanner(source) {
|
214
|
+
this.source = source.replace(/\r\n?/g, "\n");
|
215
|
+
this.scanner = new StringScanner(this.source);
|
216
|
+
this.mode = "data";
|
217
|
+
this.buffer = "";
|
218
|
+
this.lineNo = 1;
|
219
|
+
this.done = false;
|
220
|
+
}
|
221
|
+
|
222
|
+
Scanner.prototype.scan = function(callback) {
|
223
|
+
if (this.done) {
|
224
|
+
return callback();
|
225
|
+
} else if (this.scanner.hasTerminated()) {
|
226
|
+
this.done = true;
|
227
|
+
switch (this.mode) {
|
228
|
+
case "data":
|
229
|
+
return callback(["printString", this.flush()]);
|
230
|
+
case "code":
|
231
|
+
return callback(["fail", "unexpected end of template"]);
|
232
|
+
}
|
233
|
+
} else {
|
234
|
+
this.advance();
|
235
|
+
switch (this.mode) {
|
236
|
+
case "data":
|
237
|
+
return this.scanData(callback);
|
238
|
+
case "code":
|
239
|
+
return this.scanCode(callback);
|
240
|
+
case "comment":
|
241
|
+
return this.scanComment(callback);
|
242
|
+
}
|
243
|
+
}
|
244
|
+
};
|
245
|
+
|
246
|
+
Scanner.prototype.advance = function() {
|
247
|
+
this.scanner.scanUntil(Scanner.modePatterns[this.mode]);
|
248
|
+
this.buffer += this.scanner.getCapture(0);
|
249
|
+
this.tail = this.scanner.getCapture(1);
|
250
|
+
this.comment = this.scanner.getCapture(2);
|
251
|
+
this.directive = this.scanner.getCapture(4);
|
252
|
+
return this.arrow = this.scanner.getCapture(5);
|
253
|
+
};
|
254
|
+
|
255
|
+
Scanner.prototype.scanData = function(callback) {
|
256
|
+
if (this.tail === "<%%") {
|
257
|
+
this.buffer += "<%";
|
258
|
+
return this.scan(callback);
|
259
|
+
} else if (this.tail === "%%>") {
|
260
|
+
this.buffer += "%>";
|
261
|
+
return this.scan(callback);
|
262
|
+
} else if (this.tail === "\n") {
|
263
|
+
this.buffer += this.tail;
|
264
|
+
this.lineNo++;
|
265
|
+
return this.scan(callback);
|
266
|
+
} else if (this.tail) {
|
267
|
+
callback(["printString", this.flush()]);
|
268
|
+
if (this.comment) {
|
269
|
+
return this.mode = "comment";
|
270
|
+
} else {
|
271
|
+
this.mode = "code";
|
272
|
+
return callback([
|
273
|
+
"beginCode", {
|
274
|
+
print: this.directive != null,
|
275
|
+
safe: this.directive === "-"
|
276
|
+
}
|
277
|
+
]);
|
278
|
+
}
|
279
|
+
}
|
280
|
+
};
|
281
|
+
|
282
|
+
Scanner.prototype.scanCode = function(callback) {
|
283
|
+
var code;
|
284
|
+
if (this.tail === "\n") {
|
285
|
+
return callback(["fail", "unexpected newline in code block"]);
|
286
|
+
} else if (this.tail) {
|
287
|
+
this.mode = "data";
|
288
|
+
code = trim(this.flush());
|
289
|
+
if (this.arrow) {
|
290
|
+
code += " " + this.arrow;
|
291
|
+
}
|
292
|
+
if (this.isDedentable(code)) {
|
293
|
+
callback(["dedent"]);
|
294
|
+
}
|
295
|
+
callback(["recordCode", code]);
|
296
|
+
if (this.directive) {
|
297
|
+
return callback(["indent", this.arrow]);
|
298
|
+
}
|
299
|
+
}
|
300
|
+
};
|
301
|
+
|
302
|
+
Scanner.prototype.scanComment = function(callback) {
|
303
|
+
if (this.tail === "\n") {
|
304
|
+
return callback(["fail", "unexpected newline in code block"]);
|
305
|
+
} else if (this.tail) {
|
306
|
+
this.mode = "data";
|
307
|
+
return this.buffer = "";
|
308
|
+
}
|
309
|
+
};
|
310
|
+
|
311
|
+
Scanner.prototype.flush = function() {
|
312
|
+
var buffer;
|
313
|
+
buffer = this.buffer;
|
314
|
+
this.buffer = "";
|
315
|
+
return buffer;
|
316
|
+
};
|
317
|
+
|
318
|
+
Scanner.prototype.isDedentable = function(code) {
|
319
|
+
return code.match(Scanner.dedentablePattern);
|
320
|
+
};
|
321
|
+
|
322
|
+
return Scanner;
|
323
|
+
|
324
|
+
})();
|
325
|
+
|
326
|
+
}).call(this);
|
327
|
+
|
328
|
+
},
|
329
|
+
'./util': function(module, require, exports) {
|
330
|
+
// Generated by CoffeeScript 1.6.3
|
331
|
+
(function() {
|
332
|
+
var repeat, specialCharacters;
|
333
|
+
|
334
|
+
exports.repeat = repeat = function(string, count) {
|
335
|
+
return Array(count + 1).join(string);
|
336
|
+
};
|
337
|
+
|
338
|
+
exports.indent = function(string, width) {
|
339
|
+
var line, lines, space;
|
340
|
+
space = repeat(" ", width);
|
341
|
+
lines = (function() {
|
342
|
+
var _i, _len, _ref, _results;
|
343
|
+
_ref = string.split("\n");
|
344
|
+
_results = [];
|
345
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
346
|
+
line = _ref[_i];
|
347
|
+
_results.push(space + line);
|
348
|
+
}
|
349
|
+
return _results;
|
350
|
+
})();
|
351
|
+
return lines.join("\n");
|
352
|
+
};
|
353
|
+
|
354
|
+
exports.trim = function(string) {
|
355
|
+
return string.replace(/^\s+/, "").replace(/\s+$/, "");
|
356
|
+
};
|
357
|
+
|
358
|
+
specialCharacters = {
|
359
|
+
'\\': '\\\\',
|
360
|
+
'\b': '\\b',
|
361
|
+
'\f': '\\f',
|
362
|
+
'\n': '\\n',
|
363
|
+
'\r': '\\r',
|
364
|
+
'\t': '\\t'
|
365
|
+
};
|
366
|
+
|
367
|
+
exports.inspectString = function(string) {
|
368
|
+
var contents;
|
369
|
+
contents = string.replace(/[\x00-\x1f\\]/g, function(character) {
|
370
|
+
var code;
|
371
|
+
if (character in specialCharacters) {
|
372
|
+
return specialCharacters[character];
|
373
|
+
} else {
|
374
|
+
code = character.charCodeAt(0).toString(16);
|
375
|
+
if (code.length === 1) {
|
376
|
+
code = "0" + code;
|
377
|
+
}
|
378
|
+
return "\\u00" + code;
|
379
|
+
}
|
380
|
+
});
|
381
|
+
return "'" + contents.replace(/'/g, '\\\'') + "'";
|
382
|
+
};
|
383
|
+
|
384
|
+
}).call(this);
|
385
|
+
|
386
|
+
},
|
387
|
+
'strscan': function(module, require, exports) {
|
388
|
+
(function() {
|
389
|
+
var StringScanner;
|
390
|
+
((typeof exports !== "undefined" && exports !== null) ? exports : this).StringScanner = (function() {
|
391
|
+
StringScanner = function(source) {
|
392
|
+
this.source = source.toString();
|
393
|
+
this.reset();
|
394
|
+
return this;
|
395
|
+
};
|
396
|
+
StringScanner.prototype.scan = function(regexp) {
|
397
|
+
var matches;
|
398
|
+
return (matches = regexp.exec(this.getRemainder())) && matches.index === 0 ? this.setState(matches, {
|
399
|
+
head: this.head + matches[0].length,
|
400
|
+
last: this.head
|
401
|
+
}) : this.setState([]);
|
402
|
+
};
|
403
|
+
StringScanner.prototype.scanUntil = function(regexp) {
|
404
|
+
var matches;
|
405
|
+
if (matches = regexp.exec(this.getRemainder())) {
|
406
|
+
this.setState(matches, {
|
407
|
+
head: this.head + matches.index + matches[0].length,
|
408
|
+
last: this.head
|
409
|
+
});
|
410
|
+
return this.source.slice(this.last, this.head);
|
411
|
+
} else {
|
412
|
+
return this.setState([]);
|
413
|
+
}
|
414
|
+
};
|
415
|
+
StringScanner.prototype.scanChar = function() {
|
416
|
+
return this.scan(/[\s\S]/);
|
417
|
+
};
|
418
|
+
StringScanner.prototype.skip = function(regexp) {
|
419
|
+
if (this.scan(regexp)) {
|
420
|
+
return this.match.length;
|
421
|
+
}
|
422
|
+
};
|
423
|
+
StringScanner.prototype.skipUntil = function(regexp) {
|
424
|
+
if (this.scanUntil(regexp)) {
|
425
|
+
return this.head - this.last;
|
426
|
+
}
|
427
|
+
};
|
428
|
+
StringScanner.prototype.check = function(regexp) {
|
429
|
+
var matches;
|
430
|
+
return (matches = regexp.exec(this.getRemainder())) && matches.index === 0 ? this.setState(matches) : this.setState([]);
|
431
|
+
};
|
432
|
+
StringScanner.prototype.checkUntil = function(regexp) {
|
433
|
+
var matches;
|
434
|
+
if (matches = regexp.exec(this.getRemainder())) {
|
435
|
+
this.setState(matches);
|
436
|
+
return this.source.slice(this.head, this.head + matches.index + matches[0].length);
|
437
|
+
} else {
|
438
|
+
return this.setState([]);
|
439
|
+
}
|
440
|
+
};
|
441
|
+
StringScanner.prototype.peek = function(length) {
|
442
|
+
return this.source.substr(this.head, (typeof length !== "undefined" && length !== null) ? length : 1);
|
443
|
+
};
|
444
|
+
StringScanner.prototype.getSource = function() {
|
445
|
+
return this.source;
|
446
|
+
};
|
447
|
+
StringScanner.prototype.getRemainder = function() {
|
448
|
+
return this.source.slice(this.head);
|
449
|
+
};
|
450
|
+
StringScanner.prototype.getPosition = function() {
|
451
|
+
return this.head;
|
452
|
+
};
|
453
|
+
StringScanner.prototype.hasTerminated = function() {
|
454
|
+
return this.head === this.source.length;
|
455
|
+
};
|
456
|
+
StringScanner.prototype.getPreMatch = function() {
|
457
|
+
if (this.match) {
|
458
|
+
return this.source.slice(0, this.head - this.match.length);
|
459
|
+
}
|
460
|
+
};
|
461
|
+
StringScanner.prototype.getMatch = function() {
|
462
|
+
return this.match;
|
463
|
+
};
|
464
|
+
StringScanner.prototype.getPostMatch = function() {
|
465
|
+
if (this.match) {
|
466
|
+
return this.source.slice(this.head);
|
467
|
+
}
|
468
|
+
};
|
469
|
+
StringScanner.prototype.getCapture = function(index) {
|
470
|
+
return this.captures[index];
|
471
|
+
};
|
472
|
+
StringScanner.prototype.reset = function() {
|
473
|
+
return this.setState([], {
|
474
|
+
head: 0,
|
475
|
+
last: 0
|
476
|
+
});
|
477
|
+
};
|
478
|
+
StringScanner.prototype.terminate = function() {
|
479
|
+
return this.setState([], {
|
480
|
+
head: this.source.length,
|
481
|
+
last: this.head
|
482
|
+
});
|
483
|
+
};
|
484
|
+
StringScanner.prototype.concat = function(string) {
|
485
|
+
return this.source += string;
|
486
|
+
};
|
487
|
+
StringScanner.prototype.unscan = function() {
|
488
|
+
if (this.match) {
|
489
|
+
return this.setState([], {
|
490
|
+
head: this.last,
|
491
|
+
last: 0
|
492
|
+
});
|
493
|
+
} else {
|
494
|
+
throw "nothing to unscan";
|
495
|
+
}
|
496
|
+
};
|
497
|
+
StringScanner.prototype.setState = function(matches, values) {
|
498
|
+
var _a, _b;
|
499
|
+
this.head = (typeof (_a = ((typeof values === "undefined" || values === null) ? undefined : values.head)) !== "undefined" && _a !== null) ? _a : this.head;
|
500
|
+
this.last = (typeof (_b = ((typeof values === "undefined" || values === null) ? undefined : values.last)) !== "undefined" && _b !== null) ? _b : this.last;
|
501
|
+
this.captures = matches.slice(1);
|
502
|
+
return (this.match = matches[0]);
|
503
|
+
};
|
504
|
+
return StringScanner;
|
505
|
+
})();
|
506
|
+
})();
|
507
|
+
|
508
|
+
},
|
509
|
+
'coffee-script': function(module, require, exports) {
|
510
|
+
if (typeof CoffeeScript !== 'undefined' && CoffeeScript != null) {
|
511
|
+
module.exports = CoffeeScript;
|
512
|
+
} else {
|
513
|
+
throw 'Cannot require \'' + module.id + '\': CoffeeScript not found';
|
514
|
+
}
|
515
|
+
}
|
516
|
+
})('eco');
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Lanes
|
2
|
+
module API
|
3
|
+
module ErrorFormmater
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def call(message, backtrace=nil, options=nil, env=nil)
|
7
|
+
{
|
8
|
+
success: false, message: message,
|
9
|
+
errors: { base: message }
|
10
|
+
}.to_json
|
11
|
+
end
|
12
|
+
|
13
|
+
def handle_exception(message, code, e)
|
14
|
+
Rack::Response.new([self.call(message)],
|
15
|
+
code, {"Content-type" => "application/json"}
|
16
|
+
).finish
|
17
|
+
Lanes.logger.error e
|
18
|
+
end
|
19
|
+
|
20
|
+
def handle_fk_exception(e,model)
|
21
|
+
( target, depends ) = e.message.scan(/on table \"(.*?)\"/).flatten.map do |table|
|
22
|
+
table.gsub(/^hip_/, '').capitalize.singularize
|
23
|
+
end
|
24
|
+
Lanes::API::ErrorFormmater.handle_exception(
|
25
|
+
"Unable to delete #{target}, still in use by #{depends}", 400, e
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def handle_not_found_exception(e,model)
|
30
|
+
Lanes::API::ErrorFormmater.handle_exception(
|
31
|
+
model.to_s.demodulize + " (or one of it's dependencies) was not found", 404, e
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Lanes
|
2
|
+
module API
|
3
|
+
|
4
|
+
module HelperMethods
|
5
|
+
|
6
|
+
def bootstrap_data
|
7
|
+
Oj.dump Extension.bootstrap_data(self)
|
8
|
+
end
|
9
|
+
|
10
|
+
def user_data
|
11
|
+
if (user_id = session[:user_id]) && (user = Lanes::User.where( id: user_id ).first)
|
12
|
+
Oj.dump(user.workspace_data, mode: :compat)
|
13
|
+
else
|
14
|
+
{}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def csrf_token
|
19
|
+
Rack::Csrf.csrf_token(env)
|
20
|
+
end
|
21
|
+
|
22
|
+
def lanes_api_url
|
23
|
+
Lanes.config.mounted_at
|
24
|
+
end
|
25
|
+
|
26
|
+
def data
|
27
|
+
@json_data ||= Oj.load( request.body.read )
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'execjs'
|
2
|
+
require 'coffee-script'
|
3
|
+
require 'open3'
|
4
|
+
|
5
|
+
module Lanes
|
6
|
+
module API
|
7
|
+
|
8
|
+
TranspileError = Class.new(StandardError)
|
9
|
+
|
10
|
+
class JsAssetCompiler < Tilt::Template
|
11
|
+
class_attribute :registered_extension
|
12
|
+
def prepare
|
13
|
+
# NOOP
|
14
|
+
end
|
15
|
+
def self.register(env)
|
16
|
+
self.descendants.each do | klass |
|
17
|
+
klass.default_mime_type = 'application/javascript'
|
18
|
+
env.register_engine( klass.registered_extension, klass )
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def wrap_js(js)
|
23
|
+
"(function(Lanes, _, window, undefined) {\n#{js}\n})(window.Lanes, window._, window);"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
class CoffeeScriptWrapper < JsAssetCompiler
|
29
|
+
self.registered_extension = '.coffee'
|
30
|
+
|
31
|
+
CONSTRUCTOR = /constructor\s*:/
|
32
|
+
EXTENDING_CLASS = /class\s+([\w|\.]+)\s+extends\s+([\w|\.]+)\s*?\n/
|
33
|
+
|
34
|
+
# Coffeescript has two shortcomings with regards to Ampersandjs
|
35
|
+
#
|
36
|
+
# The first is that it's extends format is incompatible with Ampersandjs,
|
37
|
+
# Ampersandjs does quite a bit more via it's own .extend methods.
|
38
|
+
# Accordingly, we substitute our own "extend" call whenever we encounter a coffeescript extends
|
39
|
+
#
|
40
|
+
# The second issue is that if a constructor isn't present, coffeescript with generate it's own
|
41
|
+
# blank implementation that fails to call "super". We add a constructor that does call super if one's missing.
|
42
|
+
|
43
|
+
def cleaned
|
44
|
+
contents = data.dup
|
45
|
+
data.scan(EXTENDING_CLASS) do |match|
|
46
|
+
(name,extends) = match
|
47
|
+
|
48
|
+
contents.gsub!(/class\s+#{name}\s+.*?\n/,"class #{name}\n")
|
49
|
+
definition = contents[/(class #{name}\n.*?)(\n\w|\Z)/m,1]
|
50
|
+
# is it missing a constructor?
|
51
|
+
if definition !~ /constructor:/
|
52
|
+
# figure out how much to indent, sigh.
|
53
|
+
indent = definition[/\n(\s+)(\w+):/,1] || ' '
|
54
|
+
contents.gsub!(/class #{name}\n/,"\\0#{indent}constructor: -> super\n")
|
55
|
+
|
56
|
+
end
|
57
|
+
contents.gsub!( /(class #{name}\n.*?)(\n\w|\Z)/m, "\\1\n#{extends}.extend(#{name})\n\\2" )
|
58
|
+
|
59
|
+
contents
|
60
|
+
#contents << "#{extends}.extend(#{name})\n"
|
61
|
+
end
|
62
|
+
contents
|
63
|
+
end
|
64
|
+
|
65
|
+
def evaluate(scope, locals, &block)
|
66
|
+
wrap_js ::CoffeeScript.compile(cleaned, bare: true)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class Es6Compiler < JsAssetCompiler
|
71
|
+
self.registered_extension = '.es6'
|
72
|
+
def evaluate(scope, locals, &block)
|
73
|
+
cmd = "#{Lanes.config.es6_transpiler_path} #{Lanes.config.es6_transpiler_options}"
|
74
|
+
stdout, stderr, _status = Open3.capture3(cmd, stdin_data: data)
|
75
|
+
if stderr.empty?
|
76
|
+
wrap_js stdout
|
77
|
+
else
|
78
|
+
raise TranspileError, stderr
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
class JSWrapper < JsAssetCompiler
|
84
|
+
self.registered_extension = '.lanes'
|
85
|
+
def evaluate(scope, locals, &block)
|
86
|
+
wrap_js data
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class SkrTemplates < JsAssetCompiler
|
91
|
+
self.registered_extension = '.html'
|
92
|
+
def evaluate(scope, locals, &block)
|
93
|
+
"Lanes.Templates['#{scope.logical_path}']=" + self.compile(data)
|
94
|
+
end
|
95
|
+
|
96
|
+
def contents
|
97
|
+
@contents ||= Pathname.new(__FILE__).dirname.join('eco.js').read
|
98
|
+
end
|
99
|
+
|
100
|
+
def combined_contents
|
101
|
+
[CoffeeScript::Source.contents, contents].join(";\n")
|
102
|
+
end
|
103
|
+
|
104
|
+
def context
|
105
|
+
@context ||= ExecJS.compile(combined_contents)
|
106
|
+
end
|
107
|
+
|
108
|
+
def compile(template)
|
109
|
+
template = template.read if template.respond_to?(:read)
|
110
|
+
context.call("eco.precompile", template, 'Lanes.TemplateWrapper','Lanes.View.Helpers')
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
end
|