cortex 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.babelrc +18 -0
- data/.codeclimate.yml +43 -0
- data/.csslintrc +2 -0
- data/.editorconfig +9 -0
- data/.eslintignore +1 -0
- data/.eslintrc.yml +277 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +47 -0
- data/.gitignore +82 -0
- data/.npmignore +34 -0
- data/.postcssrc.yml +3 -0
- data/.rspec +3 -0
- data/.rubocop.yml +1156 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +58 -0
- data/Gemfile +101 -0
- data/Gemfile.lock +604 -0
- data/Guardfile +23 -0
- data/LICENSE.md +201 -0
- data/README.md +239 -0
- data/Rakefile +22 -0
- data/app/assets/config/cortex_manifest.js +4 -0
- data/app/assets/fonts/cortex/Montserrat-Light.otf +0 -0
- data/app/assets/fonts/cortex/Montserrat-Medium.otf +0 -0
- data/app/assets/fonts/cortex/Montserrat-Regular.otf +0 -0
- data/app/assets/fonts/cortex/Montserrat-SemiBold.otf +0 -0
- data/app/assets/images/cortex/favicon.ico +0 -0
- data/app/assets/images/cortex/icons/add.svg +59 -0
- data/app/assets/images/cortex/icons/blog.png +0 -0
- data/app/assets/images/cortex/icons/media.png +0 -0
- data/app/assets/images/cortex/logo.svg +43 -0
- data/app/assets/javascripts/cortex/application.js +17 -0
- data/app/assets/javascripts/cortex/authentication.js +6 -0
- data/app/assets/javascripts/cortex/base.js +6 -0
- data/app/assets/javascripts/cortex/datepicker_init.js +29 -0
- data/app/assets/javascripts/cortex/flash.js +7 -0
- data/app/assets/javascripts/cortex/form.js +6 -0
- data/app/assets/javascripts/cortex/media_dialogs.js +40 -0
- data/app/assets/javascripts/cortex/quick_links.js +13 -0
- data/app/assets/stylesheets/cortex/application.scss +34 -0
- data/app/assets/stylesheets/cortex/authentication.scss +34 -0
- data/app/assets/stylesheets/cortex/base.scss +4 -0
- data/app/assets/stylesheets/cortex/bootstrap-namespaced.scss +57 -0
- data/app/assets/stylesheets/cortex/components/card.scss +9 -0
- data/app/assets/stylesheets/cortex/components/dialog.scss +67 -0
- data/app/assets/stylesheets/cortex/components/flash.scss +60 -0
- data/app/assets/stylesheets/cortex/components/form.scss +45 -0
- data/app/assets/stylesheets/cortex/components/header.scss +53 -0
- data/app/assets/stylesheets/cortex/components/index.scss +28 -0
- data/app/assets/stylesheets/cortex/components/jumbo-button.scss +41 -0
- data/app/assets/stylesheets/cortex/components/loaders.scss +76 -0
- data/app/assets/stylesheets/cortex/components/notes.scss +26 -0
- data/app/assets/stylesheets/cortex/components/sidebar.scss +120 -0
- data/app/assets/stylesheets/cortex/components/table.scss +7 -0
- data/app/assets/stylesheets/cortex/components/tenant-switcher.scss +209 -0
- data/app/assets/stylesheets/cortex/components/ui.scss +119 -0
- data/app/assets/stylesheets/cortex/demo.scss +140 -0
- data/app/assets/stylesheets/cortex/directives/aspect-ratio.scss +9 -0
- data/app/assets/stylesheets/cortex/helpers.scss +1701 -0
- data/app/assets/stylesheets/cortex/layout.scss +21 -0
- data/app/assets/stylesheets/cortex/material-icons.scss +13 -0
- data/app/assets/stylesheets/cortex/variables/_colors.scss +46 -0
- data/app/assets/stylesheets/cortex/variables/_material-overrides.scss +1 -0
- data/app/assets/stylesheets/cortex/variables/_typography.scss +114 -0
- data/app/cells/cortex/application_cell.rb +8 -0
- data/app/cells/cortex/content_type/nav.haml +5 -0
- data/app/cells/cortex/content_type_cell.rb +10 -0
- data/app/cells/cortex/field_cell.rb +35 -0
- data/app/cells/cortex/index/content_item/column.haml +4 -0
- data/app/cells/cortex/index/content_item_cell.rb +37 -0
- data/app/cells/cortex/index/index.haml +5 -0
- data/app/cells/cortex/index/table_body.haml +11 -0
- data/app/cells/cortex/index/table_headers.haml +5 -0
- data/app/cells/cortex/index_cell.rb +53 -0
- data/app/cells/cortex/wizard/column/show.haml +10 -0
- data/app/cells/cortex/wizard/column_cell.rb +21 -0
- data/app/cells/cortex/wizard/field/show.haml +30 -0
- data/app/cells/cortex/wizard/field_cell.rb +29 -0
- data/app/cells/cortex/wizard/plugin/show.haml +1 -0
- data/app/cells/cortex/wizard/plugin_cell.rb +28 -0
- data/app/cells/cortex/wizard/show.haml +1 -0
- data/app/cells/cortex/wizard/step/show.haml +2 -0
- data/app/cells/cortex/wizard/step_cell.rb +17 -0
- data/app/cells/cortex/wizard_cell.rb +15 -0
- data/app/containers/cortex/transaction_container.rb +23 -0
- data/app/controllers/concerns/cortex/decoratable.rb +16 -0
- data/app/controllers/cortex/admin_controller.rb +7 -0
- data/app/controllers/cortex/application_controller.rb +19 -0
- data/app/controllers/cortex/authentication/passwords_controller.rb +3 -0
- data/app/controllers/cortex/authentication/sessions_controller.rb +3 -0
- data/app/controllers/cortex/content_items_controller.rb +75 -0
- data/app/controllers/cortex/content_types_controller.rb +19 -0
- data/app/controllers/cortex/dashboards_controller.rb +7 -0
- data/app/controllers/cortex/graphql_controller.rb +40 -0
- data/app/controllers/cortex/tenants_controller.rb +12 -0
- data/app/devise/cortex/authentication_failure.rb +12 -0
- data/app/graphql/cortex/cortex_schema.rb +8 -0
- data/app/graphql/cortex/interfaces/.keep +0 -0
- data/app/graphql/cortex/mutations/.keep +0 -0
- data/app/graphql/cortex/types/content_item_type.rb +31 -0
- data/app/graphql/cortex/types/content_type_type.rb +23 -0
- data/app/graphql/cortex/types/contract_type.rb +10 -0
- data/app/graphql/cortex/types/date_time_type.rb +8 -0
- data/app/graphql/cortex/types/field_item_type.rb +15 -0
- data/app/graphql/cortex/types/field_type.rb +18 -0
- data/app/graphql/cortex/types/mutation_type.rb +5 -0
- data/app/graphql/cortex/types/query_type.rb +45 -0
- data/app/graphql/cortex/types/tenant_type.rb +19 -0
- data/app/graphql/cortex/types/user_type.rb +20 -0
- data/app/helpers/cortex/application_helper.rb +75 -0
- data/app/helpers/cortex/cells/association_helper.rb +25 -0
- data/app/helpers/cortex/content_item_helper.rb +106 -0
- data/app/helpers/cortex/dashboard_helper.rb +19 -0
- data/app/helpers/cortex/popup_helper.rb +27 -0
- data/app/jobs/cortex/application_job.rb +4 -0
- data/app/mailers/cortex/application_mailer.rb +6 -0
- data/app/mailers/cortex/password_reset_mailer.rb +13 -0
- data/app/models/concerns/cortex/belongs_to_tenant.rb +13 -0
- data/app/models/concerns/cortex/has_firstname_lastname.rb +11 -0
- data/app/models/concerns/cortex/has_gravatar.rb +18 -0
- data/app/models/concerns/cortex/searchable.rb +11 -0
- data/app/models/concerns/cortex/searchable_content_item.rb +31 -0
- data/app/models/concerns/cortex/searchable_content_item_for_content_type.rb +52 -0
- data/app/models/concerns/cortex/searchable_content_type.rb +11 -0
- data/app/models/cortex/application_record.rb +17 -0
- data/app/models/cortex/content_item.rb +71 -0
- data/app/models/cortex/content_type.rb +27 -0
- data/app/models/cortex/contentable_decorator.rb +8 -0
- data/app/models/cortex/contract.rb +12 -0
- data/app/models/cortex/decorator.rb +13 -0
- data/app/models/cortex/field.rb +36 -0
- data/app/models/cortex/field_item.rb +54 -0
- data/app/models/cortex/field_type.rb +44 -0
- data/app/models/cortex/permission.rb +11 -0
- data/app/models/cortex/role.rb +12 -0
- data/app/models/cortex/tenant.rb +41 -0
- data/app/models/cortex/user.rb +77 -0
- data/app/operations/cortex/database_transact_operation.rb +17 -0
- data/app/operations/cortex/execute_content_item_state_change_operation.rb +16 -0
- data/app/operations/cortex/parse_content_item_field_items_operation.rb +18 -0
- data/app/operations/cortex/persist_content_item_operation.rb +12 -0
- data/app/policies/cortex/application_policy.rb +55 -0
- data/app/policies/cortex/content_item_policy.rb +49 -0
- data/app/policies/cortex/content_type_policy.rb +38 -0
- data/app/transactions/concerns/cortex/content_itemable.rb +15 -0
- data/app/transactions/concerns/cortex/field_item_transactor.rb +28 -0
- data/app/transactions/concerns/cortex/widget_parsable.rb +19 -0
- data/app/transactions/cortex/application_transaction.rb +5 -0
- data/app/transactions/cortex/create_content_item_transaction.rb +35 -0
- data/app/transactions/cortex/get_content_item_transaction.rb +4 -0
- data/app/transactions/cortex/get_content_items_for_content_type_transaction.rb +34 -0
- data/app/transactions/cortex/get_publish_state_transaction.rb +28 -0
- data/app/transactions/cortex/new_field_item_transaction.rb +16 -0
- data/app/transactions/cortex/update_content_item_transaction.rb +45 -0
- data/app/transactions/cortex/update_field_item_transaction.rb +23 -0
- data/app/types/cortex/application_types.rb +21 -0
- data/app/types/cortex/content_item_transaction_type.rb +10 -0
- data/app/types/cortex/core_types.rb +5 -0
- data/app/types/cortex/transaction_type.rb +5 -0
- data/app/views/cortex/authentication/passwords/new.html.haml +13 -0
- data/app/views/cortex/authentication/sessions/new.html.haml +20 -0
- data/app/views/cortex/authentication/shared/_links.html.haml +19 -0
- data/app/views/cortex/content_items/_form.html.haml +13 -0
- data/app/views/cortex/content_items/_grid.html.haml +1 -0
- data/app/views/cortex/content_items/edit.html.haml +2 -0
- data/app/views/cortex/content_items/index.html.haml +4 -0
- data/app/views/cortex/content_items/new.html.haml +2 -0
- data/app/views/cortex/content_types/index.html.haml +2 -0
- data/app/views/cortex/content_types/new.html.haml +0 -0
- data/app/views/cortex/dashboards/index.html.haml +6 -0
- data/app/views/cortex/graphql/ide.haml +1 -0
- data/app/views/cortex/partials/_breadcrumb.html.haml +2 -0
- data/app/views/cortex/partials/_cortex_redux_state.html.haml +1 -0
- data/app/views/cortex/partials/_flash.html.haml +25 -0
- data/app/views/cortex/partials/_media_dialogs.html.haml +13 -0
- data/app/views/cortex/partials/_navigation.html.haml +15 -0
- data/app/views/cortex/partials/_notes.html.haml +17 -0
- data/app/views/cortex/partials/_quick_links.html.haml +22 -0
- data/app/views/cortex/partials/_sidebar.html.haml +7 -0
- data/app/views/cortex/partials/_topbar.html.haml +5 -0
- data/app/views/cortex/partials/_user_control.html.haml +7 -0
- data/app/views/cortex/partials/authentication/_header.html.haml +4 -0
- data/app/views/cortex/partials/trackers/_google_analytics.html.haml +10 -0
- data/app/views/cortex/partials/trackers/_qualtrics.html.haml +10 -0
- data/app/views/cortex/password_reset_mailer/send_password_reset.html.erb +5 -0
- data/app/views/cortex/password_reset_mailer/send_password_reset.text.erb +5 -0
- data/app/views/layouts/cortex/application.html.haml +30 -0
- data/app/views/layouts/cortex/devise.html.haml +19 -0
- data/app/views/layouts/cortex/mailer.html.erb +13 -0
- data/app/views/layouts/cortex/mailer.text.erb +1 -0
- data/bin/rails +25 -0
- data/config/config.yml +22 -0
- data/config/initializers/devise.rb +35 -0
- data/config/initializers/elasticsearch.rb +3 -0
- data/config/initializers/filter_parameter_logging.rb +4 -0
- data/config/initializers/flipper.rb +16 -0
- data/config/initializers/graphiql.rb +51 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/load_config.rb +16 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/plugins.rb +17 -0
- data/config/initializers/react_on_rails.rb +15 -0
- data/config/initializers/rolify.rb +9 -0
- data/config/initializers/tag_parsers.rb +5 -0
- data/config/locales/devise.en.yml +64 -0
- data/config/routes.rb +41 -0
- data/cortex.gemspec +84 -0
- data/db/migrate/0_enable_pgcrypto_extension.rb +5 -0
- data/db/migrate/10_create_fields.rb +15 -0
- data/db/migrate/11_create_content_items.rb +14 -0
- data/db/migrate/12_create_field_items.rb +12 -0
- data/db/migrate/13_create_field_types.rb +5 -0
- data/db/migrate/1_create_users.rb +14 -0
- data/db/migrate/2_create_tenants.rb +26 -0
- data/db/migrate/3_add_devise_to_users.rb +49 -0
- data/db/migrate/4_create_roles.rb +15 -0
- data/db/migrate/5_create_permissions.rb +16 -0
- data/db/migrate/6_create_flipper_tables.rb +20 -0
- data/db/migrate/7_create_contracts.rb +11 -0
- data/db/migrate/8_create_decorators.rb +21 -0
- data/db/migrate/9_create_content_types.rb +17 -0
- data/db/seeds.rb +40 -0
- data/db/seeds.yml +33 -0
- data/lib/assets/.keep +0 -0
- data/lib/breadcrumbs/title_builder.rb +12 -0
- data/lib/cortex.rb +4 -0
- data/lib/cortex/engine.rb +41 -0
- data/lib/cortex/version.rb +3 -0
- data/lib/helpers/utility_helper.rb +7 -0
- data/lib/tasks/cortex_tasks.rake +13 -0
- data/lib/tasks/elasticsearch_tasks.rake +1 -0
- data/node_package/.babelrc +26 -0
- data/node_package/src/components/side_bar/environment_flag.jsx +21 -0
- data/node_package/src/components/side_bar/tenant_list.jsx +65 -0
- data/node_package/src/components/wizard/column.jsx +29 -0
- data/node_package/src/components/wizard/field.jsx +22 -0
- data/node_package/src/components/wizard/step.jsx +20 -0
- data/node_package/src/constants/tenant_switcher.jsx +17 -0
- data/node_package/src/constants/type_constants.jsx +12 -0
- data/node_package/src/constants/wizard.jsx +9 -0
- data/node_package/src/containers/layout.jsx +33 -0
- data/node_package/src/containers/tenant_switcher_container.jsx +115 -0
- data/node_package/src/containers/wizard_container.jsx +28 -0
- data/node_package/src/elements/loaders.jsx +7 -0
- data/node_package/src/helpers/formatting.jsx +5 -0
- data/node_package/src/helpers/tenant_ancestry.jsx +14 -0
- data/node_package/src/helpers/tenant_lookup.jsx +23 -0
- data/node_package/src/index.jsx +21 -0
- data/node_package/src/reducers/index.jsx +13 -0
- data/node_package/src/reducers/rails_context_reducer.jsx +5 -0
- data/node_package/src/reducers/tenant_switcher_reducer.jsx +74 -0
- data/node_package/src/reducers/wizard_reducer.jsx +32 -0
- data/node_package/src/services/rails_api_service.jsx +13 -0
- data/node_package/src/store/store.jsx +15 -0
- data/package.json +66 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/config/manifest.js +4 -0
- data/spec/dummy/app/assets/javascripts/application.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.scss +2 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/javascript/packs/application.js +8 -0
- data/spec/dummy/app/javascript/packs/cortex.jsx +1 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.haml +11 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +105 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/rspec +17 -0
- data/spec/dummy/bin/setup +38 -0
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/bin/webpack +29 -0
- data/spec/dummy/bin/webpack-dev-server +29 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config.ru +7 -0
- data/spec/dummy/config/apollo_engine_proxy.yml +23 -0
- data/spec/dummy/config/application.rb +21 -0
- data/spec/dummy/config/boot.rb +11 -0
- data/spec/dummy/config/cable.yml +9 -0
- data/spec/dummy/config/config.yml +22 -0
- data/spec/dummy/config/database.yml +22 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +74 -0
- data/spec/dummy/config/environments/production.rb +103 -0
- data/spec/dummy/config/environments/staging.rb +103 -0
- data/spec/dummy/config/environments/test.rb +65 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/load_config.rb +9 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/react_on_rails.rb +41 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/sentry.rb +6 -0
- data/spec/dummy/config/initializers/session_store.rb +7 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +8 -0
- data/spec/dummy/config/newrelic.yml +224 -0
- data/spec/dummy/config/puma.rb +47 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/config/secrets.yml +32 -0
- data/spec/dummy/config/sidekiq.yml +9 -0
- data/spec/dummy/config/webpack/development.js +3 -0
- data/spec/dummy/config/webpack/environment.js +3 -0
- data/spec/dummy/config/webpack/production.js +3 -0
- data/spec/dummy/config/webpack/test.js +3 -0
- data/spec/dummy/config/webpacker.yml +66 -0
- data/spec/dummy/db/migrate/20180118233001_enable_pgcrypto_extension.cortex.rb +6 -0
- data/spec/dummy/db/migrate/20180118233002_create_users.cortex.rb +15 -0
- data/spec/dummy/db/migrate/20180118233003_create_tenants.cortex.rb +27 -0
- data/spec/dummy/db/migrate/20180118233004_add_devise_to_users.cortex.rb +50 -0
- data/spec/dummy/db/migrate/20180118233005_create_roles.cortex.rb +16 -0
- data/spec/dummy/db/migrate/20180118233006_create_permissions.cortex.rb +17 -0
- data/spec/dummy/db/migrate/20180118233007_create_flipper_tables.cortex.rb +21 -0
- data/spec/dummy/db/migrate/20180118233008_create_contracts.cortex.rb +12 -0
- data/spec/dummy/db/migrate/20180118233009_create_decorators.cortex.rb +22 -0
- data/spec/dummy/db/migrate/20180118233010_create_content_types.cortex.rb +18 -0
- data/spec/dummy/db/migrate/20180118233011_create_fields.cortex.rb +16 -0
- data/spec/dummy/db/migrate/20180118233012_create_content_items.cortex.rb +15 -0
- data/spec/dummy/db/migrate/20180118233013_create_field_items.cortex.rb +13 -0
- data/spec/dummy/db/migrate/20180118233014_create_field_types.cortex.rb +6 -0
- data/spec/dummy/db/schema.rb +258 -0
- data/spec/dummy/db/seeds.rb +1 -0
- data/spec/dummy/lib/tasks/content_types_tasks.rake +31 -0
- data/spec/dummy/lib/tasks/employer/blog_tasks.rake +345 -0
- data/spec/dummy/package.json +28 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/dummy/spec/javascripts/support/jasmine.yml +50 -0
- data/spec/dummy/yarn.lock +6615 -0
- data/spec/rails_helper.rb +57 -0
- data/spec/spec_helper.rb +96 -0
- data/yarn.lock +6032 -0
- metadata +1061 -0
data/config/routes.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'sidekiq/web'
|
2
|
+
require 'flipper/ui'
|
3
|
+
|
4
|
+
Cortex::Engine.routes.draw do
|
5
|
+
# API - TODO: Authorize GraphQL + GraphiQL
|
6
|
+
mount GraphiQL::Rails::Engine, at: '/graphiql', graphql_path: ENV['GRAPHQL_URL'], as: 'graphiql'
|
7
|
+
scope '/graphql' do
|
8
|
+
post '/', to: 'graphql#execute'
|
9
|
+
get '/ide', to: 'graphql#ide', as: 'graphql_ide'
|
10
|
+
end
|
11
|
+
|
12
|
+
root 'dashboards#index'
|
13
|
+
|
14
|
+
scope '/admin_update' do
|
15
|
+
match '/tenant_change', to: 'tenants#switch_tenants', via: [:post]
|
16
|
+
end
|
17
|
+
|
18
|
+
scope '/admin' do
|
19
|
+
resources :dashboards
|
20
|
+
resources :medias
|
21
|
+
end
|
22
|
+
|
23
|
+
resources :content_types do
|
24
|
+
resources :content_items
|
25
|
+
end
|
26
|
+
|
27
|
+
# Authentication
|
28
|
+
devise_for :users, controllers: {sessions: 'cortex/authentication/sessions', passwords: 'cortex/authentication/passwords'}, class_name: 'Cortex::User', module: :devise
|
29
|
+
|
30
|
+
# Sidekiq Admin TODO: this needs to be updated with new role system
|
31
|
+
#authenticate :user, lambda { |u| u.is_admin? } do
|
32
|
+
mount Sidekiq::Web => '/sidekiq'
|
33
|
+
#end
|
34
|
+
|
35
|
+
# Flipper TODO: this needs to be updated with new role system
|
36
|
+
#authenticated :user, lambda {|u| u.is_admin? } do
|
37
|
+
mount Flipper::UI.app(Flipper) => '/flipper'
|
38
|
+
#end
|
39
|
+
|
40
|
+
mount JasmineRails::Engine => '/specs' if defined?(JasmineRails)
|
41
|
+
end
|
data/cortex.gemspec
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
$:.push File.expand_path("lib", __dir__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require 'cortex/version'
|
5
|
+
|
6
|
+
# Describe your s.add_dependency and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'cortex'
|
9
|
+
s.version = Cortex::VERSION
|
10
|
+
s.authors = ['CareerBuilder Employer Site & Content Products']
|
11
|
+
s.email = 'toastercup@gmail.com'
|
12
|
+
s.homepage = 'https://github.com/cortex-cms/cortex'
|
13
|
+
s.summary = 'An API-driven multitenant identity, dynamic content distribution/management and reporting platform powered by Rails, GraphQL and ElasticSearch'
|
14
|
+
s.license = 'Apache-2.0'
|
15
|
+
|
16
|
+
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
s.test_files = Dir["spec/**/*"]
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
# Rails
|
23
|
+
s.add_dependency 'rails', '~> 5.1.6'
|
24
|
+
|
25
|
+
# API
|
26
|
+
s.add_dependency 'graphql', '~> 1.7.14'
|
27
|
+
s.add_dependency 'graphiql-rails', '~> 1.4.11'
|
28
|
+
|
29
|
+
# Cortex-specific
|
30
|
+
s.add_dependency 'cortex-exceptions', '= 0.0.4'
|
31
|
+
#s.add_dependency 'cortex-plugins-core' # TODO: this is an awkward dependency, but necessary until we clean up hardcoded references to Plugins::Core
|
32
|
+
|
33
|
+
# Service Layer
|
34
|
+
s.add_dependency 'dry-types', '~> 0.13.2'
|
35
|
+
s.add_dependency 'dry-struct', '~> 0.5.0'
|
36
|
+
s.add_dependency 'dry-transaction', '~> 0.13.0'
|
37
|
+
|
38
|
+
# Authentication
|
39
|
+
s.add_dependency 'devise', '~> 4.4.3'
|
40
|
+
|
41
|
+
# Authorization
|
42
|
+
s.add_dependency 'rolify', '~> 5.2.0'
|
43
|
+
s.add_dependency 'pundit', '~> 1.1.0'
|
44
|
+
|
45
|
+
# Data
|
46
|
+
s.add_dependency 'awesome_nested_set', '~> 3.1.4'
|
47
|
+
s.add_dependency 'elasticsearch-model', '~> 5.1'
|
48
|
+
s.add_dependency 'elasticsearch-rails', '~> 5.1'
|
49
|
+
s.add_dependency 'elasticsearch-dsl', '~> 0.1'
|
50
|
+
s.add_dependency 'paranoia', '~> 2.4'
|
51
|
+
s.add_dependency 'pomona', '~> 0.7'
|
52
|
+
s.add_dependency 'transitions', '~> 1.2'
|
53
|
+
|
54
|
+
# Middleware
|
55
|
+
s.add_dependency 'rack-cors', '~> 1.0.2'
|
56
|
+
|
57
|
+
# Utility
|
58
|
+
s.add_dependency 'hashie', '~> 3.5.7'
|
59
|
+
s.add_dependency 'mimemagic', '~> 0.3.2'
|
60
|
+
s.add_dependency 'addressable', '~> 2.5.2'
|
61
|
+
s.add_dependency 'json'
|
62
|
+
s.add_dependency 'nokogiri'
|
63
|
+
|
64
|
+
# View
|
65
|
+
s.add_dependency 'haml', '~> 5.0'
|
66
|
+
s.add_dependency 'cells', '~> 4.1.7'
|
67
|
+
s.add_dependency 'cells-rails', '~> 0.0.8'
|
68
|
+
s.add_dependency 'cells-haml', '~> 0.0.10'
|
69
|
+
s.add_dependency 'breadcrumbs_on_rails', '~> 3.0.1'
|
70
|
+
|
71
|
+
# Style
|
72
|
+
s.add_dependency 'sass-rails', '~> 5.0'
|
73
|
+
|
74
|
+
# JavaScript
|
75
|
+
s.add_dependency 'gon', '~> 6.2.1'
|
76
|
+
s.add_dependency 'react_on_rails', '9.0.3'
|
77
|
+
s.add_dependency 'mini_racer'
|
78
|
+
s.add_dependency 'webpacker'
|
79
|
+
|
80
|
+
# Feature Flagging
|
81
|
+
s.add_dependency 'flipper', '~> 0.16'
|
82
|
+
s.add_dependency 'flipper-ui', '~> 0.16'
|
83
|
+
s.add_dependency 'flipper-active_record', '~> 0.16' # TODO: broken - need to override table prefix
|
84
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateFields < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :cortex_fields, id: :uuid do |t|
|
4
|
+
t.string :name, null: false, index: true
|
5
|
+
t.string :name_id, null: false, index: true
|
6
|
+
t.string :field_type, null: false, index: true
|
7
|
+
t.jsonb :metadata, null: false, default: {}
|
8
|
+
t.jsonb :validations, null: false, default: {}
|
9
|
+
t.references :content_type, type: :uuid, null: false, foreign_key: { to_table: :cortex_content_types }
|
10
|
+
|
11
|
+
t.datetime :deleted_at, index: true
|
12
|
+
t.timestamps null: false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateContentItems < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :cortex_content_items, id: :uuid do |t|
|
4
|
+
t.string :state, index: true
|
5
|
+
t.references :content_type, type: :uuid, null: false, foreign_key: { to_table: :cortex_content_types }
|
6
|
+
t.references :tenant, type: :uuid, null: false, foreign_key: { to_table: :cortex_tenants }
|
7
|
+
t.references :creator, type: :uuid, null: false, foreign_key: { to_table: :cortex_users }
|
8
|
+
t.references :updated_by, type: :uuid, foreign_key: { to_table: :cortex_users }
|
9
|
+
|
10
|
+
t.datetime :deleted_at, index: true
|
11
|
+
t.timestamps null: false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateFieldItems < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :cortex_field_items, id: :uuid do |t|
|
4
|
+
t.jsonb :data, null: false, default: {}, index: { using: :gin }
|
5
|
+
t.references :field, type: :uuid, null: false, foreign_key: { to_table: :cortex_fields }
|
6
|
+
t.references :content_item, type: :uuid, null: false, foreign_key: { to_table: :cortex_content_items }
|
7
|
+
|
8
|
+
t.datetime :deleted_at, index: true
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateUsers < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :cortex_users, id: :uuid do |t|
|
4
|
+
t.string :email, null: false
|
5
|
+
t.string :firstname, null: false
|
6
|
+
t.string :lastname, null: false
|
7
|
+
t.string :locale, limit: 30, null: false, default: 'en_US'
|
8
|
+
t.string :timezone, limit: 30, null: false, default: 'EST'
|
9
|
+
|
10
|
+
t.datetime :deleted_at, index: true
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class CreateTenants < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :cortex_tenants, id: :uuid do |t|
|
4
|
+
t.string :name, limit: 50, null: false, index: { unique: true }
|
5
|
+
t.string :name_id, null: false, index: { unique: true }
|
6
|
+
t.text :description
|
7
|
+
t.uuid :parent_id, index: true
|
8
|
+
t.integer :lft
|
9
|
+
t.integer :rgt
|
10
|
+
t.integer :depth
|
11
|
+
t.datetime :deleted_at
|
12
|
+
t.datetime :active_at
|
13
|
+
t.datetime :deactive_at
|
14
|
+
t.references :owner, type: :uuid, foreign_key: { to_table: :cortex_users }
|
15
|
+
|
16
|
+
t.datetime :deleted_at, index: true
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
|
20
|
+
create_join_table :tenants, :users, table_name: :cortex_tenants_users, column_options: { type: :uuid, index: true }
|
21
|
+
add_foreign_key :cortex_tenants_users, :cortex_tenants, column: :tenant_id, type: :uuid
|
22
|
+
add_foreign_key :cortex_tenants_users, :cortex_users, column: :user_id, type: :uuid
|
23
|
+
|
24
|
+
add_reference :cortex_users, :active_tenant, type: :uuid, foreign_key: { to_table: :cortex_tenants }
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class AddDeviseToUsers < ActiveRecord::Migration[5.1]
|
2
|
+
def self.up
|
3
|
+
change_table(:cortex_users) do |t|
|
4
|
+
## Database authenticatable
|
5
|
+
t.change :email, :string, :default => ""
|
6
|
+
t.string :encrypted_password, :null => false, :default => ""
|
7
|
+
|
8
|
+
## Recoverable
|
9
|
+
t.string :reset_password_token
|
10
|
+
t.datetime :reset_password_sent_at
|
11
|
+
|
12
|
+
## Rememberable
|
13
|
+
t.datetime :remember_created_at
|
14
|
+
|
15
|
+
## Trackable
|
16
|
+
t.integer :sign_in_count, :default => 0, :null => false
|
17
|
+
t.datetime :current_sign_in_at
|
18
|
+
t.datetime :last_sign_in_at
|
19
|
+
t.string :current_sign_in_ip
|
20
|
+
t.string :last_sign_in_ip
|
21
|
+
|
22
|
+
## Confirmable
|
23
|
+
# t.string :confirmation_token
|
24
|
+
# t.datetime :confirmed_at
|
25
|
+
# t.datetime :confirmation_sent_at
|
26
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
27
|
+
|
28
|
+
## Lockable
|
29
|
+
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
|
30
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
31
|
+
# t.datetime :locked_at
|
32
|
+
|
33
|
+
|
34
|
+
# Uncomment below if timestamps were not included in your original model.
|
35
|
+
# t.timestamps
|
36
|
+
end
|
37
|
+
|
38
|
+
add_index :cortex_users, :email, :unique => true
|
39
|
+
add_index :cortex_users, :reset_password_token, :unique => true
|
40
|
+
# add_index :users, :confirmation_token, :unique => true
|
41
|
+
# add_index :users, :unlock_token, :unique => true
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.down
|
45
|
+
# By default, we don't want to make any assumption about how to roll back a migration when your
|
46
|
+
# model already existed. Please edit below which fields you would like to remove in this migration.
|
47
|
+
raise ActiveRecord::IrreversibleMigration
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateRoles < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :cortex_roles, id: :uuid do |t|
|
4
|
+
t.string :name, index: true
|
5
|
+
t.references :resource, type: :uuid, polymorphic: true, index: true
|
6
|
+
|
7
|
+
t.datetime :deleted_at, index: true
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
|
11
|
+
create_join_table :roles, :users, table_name: :cortex_roles_users, column_options: { type: :uuid, index: true }
|
12
|
+
add_foreign_key :cortex_roles_users, :cortex_roles, column: :role_id, type: :uuid
|
13
|
+
add_foreign_key :cortex_roles_users, :cortex_users, column: :user_id, type: :uuid
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreatePermissions < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :cortex_permissions, id: :uuid do |t|
|
4
|
+
t.string :name, index: true
|
5
|
+
t.string :resource_type, index: true
|
6
|
+
t.uuid :resource_id, index: true
|
7
|
+
|
8
|
+
t.datetime :deleted_at, index: true
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
|
12
|
+
create_join_table :permissions, :roles, table_name: :cortex_permissions_roles, column_options: { type: :uuid, index: true }
|
13
|
+
add_foreign_key :cortex_permissions_roles, :cortex_permissions, column: :permission_id, type: :uuid
|
14
|
+
add_foreign_key :cortex_permissions_roles, :cortex_roles, column: :role_id, type: :uuid
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreateFlipperTables < ActiveRecord::Migration[5.1]
|
2
|
+
def self.up
|
3
|
+
create_table :cortex_flipper_features, id: :uuid do |t|
|
4
|
+
t.string :key, null: false, index: { unique: true }
|
5
|
+
t.timestamps null: false
|
6
|
+
end
|
7
|
+
|
8
|
+
create_table :cortex_flipper_gates, id: :uuid do |t|
|
9
|
+
t.string :feature_key, null: false, index: { unique: true }
|
10
|
+
t.string :key, null: false, index: { unique: true }
|
11
|
+
t.string :value, index: { unique: true }
|
12
|
+
t.timestamps null: false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
drop_table :cortex_flipper_gates
|
18
|
+
drop_table :cortex_flipper_features
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateContracts < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :cortex_contracts, id: :uuid do |t|
|
4
|
+
t.string :name, null: false, index: true
|
5
|
+
t.references :tenant, type: :uuid, null: false, foreign_key: { to_table: :cortex_tenants }
|
6
|
+
|
7
|
+
t.datetime :deleted_at, index: true
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateDecorators < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :cortex_decorators, id: :uuid do |t|
|
4
|
+
t.string :name, null: false, index: true
|
5
|
+
t.jsonb :data, null: false, default: {}
|
6
|
+
t.references :tenant, type: :uuid, null: false, foreign_key: { to_table: :cortex_tenants }
|
7
|
+
|
8
|
+
t.datetime :deleted_at, index: true
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
|
12
|
+
create_table :cortex_contentable_decorators, id: :uuid do |t|
|
13
|
+
t.references :decorator, type: :uuid, foreign_key: { to_table: :cortex_decorators }
|
14
|
+
t.references :contentable, type: :uuid, polymorphic: true, index: { name: 'index_cortex_contentable_decorators_on_contentable' }
|
15
|
+
t.references :tenant, type: :uuid, null: false, foreign_key: { to_table: :cortex_tenants }
|
16
|
+
|
17
|
+
t.datetime :deleted_at, index: true
|
18
|
+
t.timestamps null: false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateContentTypes < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :cortex_content_types, id: :uuid do |t|
|
4
|
+
t.string :name, null: false, index: true
|
5
|
+
t.string :name_id, null: false, index: true
|
6
|
+
t.text :description
|
7
|
+
t.references :creator, type: :uuid, null: false, foreign_key: { to_table: :cortex_users }
|
8
|
+
t.references :tenant, type: :uuid, null: false, foreign_key: { to_table: :cortex_tenants }
|
9
|
+
t.references :contract, type: :uuid, null: false, foreign_key: { to_table: :cortex_contracts }
|
10
|
+
t.boolean :publishable, null: false, default: false
|
11
|
+
t.string :icon, default: :help
|
12
|
+
|
13
|
+
t.datetime :deleted_at, index: true
|
14
|
+
t.timestamps null: false
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Create root tenant and user
|
2
|
+
cortex_tenant_seed = Cortex.seed_data[:cortex_tenant]
|
3
|
+
example_tenant_seed = Cortex.seed_data[:example_tenant]
|
4
|
+
example_subtenant_seed = Cortex.seed_data[:example_subtenant]
|
5
|
+
example_contract_seed = Cortex.seed_data[:example_contract]
|
6
|
+
user_seed = cortex_tenant_seed[:creator]
|
7
|
+
|
8
|
+
existing_tenant = Cortex::Tenant.find_by_name(cortex_tenant_seed[:name])
|
9
|
+
|
10
|
+
unless existing_tenant
|
11
|
+
user = Cortex::User.new(email: user_seed[:email],
|
12
|
+
firstname: user_seed[:firstname],
|
13
|
+
lastname: user_seed[:lastname],
|
14
|
+
password: user_seed[:password],
|
15
|
+
password_confirmation: user_seed[:password])
|
16
|
+
cortex_tenant = Cortex::Tenant.new(name: cortex_tenant_seed[:name],
|
17
|
+
name_id: cortex_tenant_seed[:name_id],
|
18
|
+
description: cortex_tenant_seed[:description],
|
19
|
+
owner: user)
|
20
|
+
example_tenant = Cortex::Tenant.new(name: example_tenant_seed[:name],
|
21
|
+
name_id: example_tenant_seed[:name_id],
|
22
|
+
description: example_tenant_seed[:description],
|
23
|
+
owner: user)
|
24
|
+
example_subtenant = Cortex::Tenant.new(name: example_subtenant_seed[:name],
|
25
|
+
name_id: example_subtenant_seed[:name_id],
|
26
|
+
description: example_subtenant_seed[:description],
|
27
|
+
owner: user,
|
28
|
+
parent: example_tenant)
|
29
|
+
example_contract = Cortex::Contract.new(name: example_contract_seed[:name],
|
30
|
+
tenant: cortex_tenant)
|
31
|
+
|
32
|
+
cortex_tenant.save!
|
33
|
+
example_tenant.save!
|
34
|
+
example_subtenant.save!
|
35
|
+
|
36
|
+
example_contract.save!
|
37
|
+
|
38
|
+
user.tenants = [cortex_tenant, example_tenant]
|
39
|
+
user.save!
|
40
|
+
end
|
data/db/seeds.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
defaults: &defaults
|
2
|
+
initial_post:
|
3
|
+
title: 'Welcome to Cortex!'
|
4
|
+
slug: 'initial-news-post'
|
5
|
+
description: 'This is an initial test news ArticlePost for Cortex that you can delete'
|
6
|
+
body: 'Your initial superadministrator user credentials are:<br /><br /><strong>Email:</strong> admin@cortexcms.org<br /><strong>Password:</strong> welcome1<br /><br />Please change them in deployed environments.'
|
7
|
+
cortex_tenant:
|
8
|
+
name: 'System'
|
9
|
+
name_id: 'system'
|
10
|
+
description: 'Core tenant for news/etc'
|
11
|
+
creator: {email: 'admin@cortexcms.org', firstname: 'Cortex', lastname: 'Admin', password: 'welcome1'}
|
12
|
+
example_tenant:
|
13
|
+
name: 'Example'
|
14
|
+
name_id: 'example'
|
15
|
+
description: 'ContentTypes to get started with'
|
16
|
+
example_subtenant:
|
17
|
+
name: 'Bogus'
|
18
|
+
name_id: 'bogus'
|
19
|
+
description: 'Example subtenant'
|
20
|
+
example_contract:
|
21
|
+
name: 'Bogus'
|
22
|
+
|
23
|
+
test:
|
24
|
+
<<: *defaults
|
25
|
+
|
26
|
+
development:
|
27
|
+
<<: *defaults
|
28
|
+
|
29
|
+
staging:
|
30
|
+
<<: *defaults
|
31
|
+
|
32
|
+
production:
|
33
|
+
<<: *defaults
|