diff --git a/.circleci/config.yml b/.circleci/config.yml index 09220714..03d5b973 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,6 +21,10 @@ workflows: debian_version: "stretch" - python_version: "3.5" debian_version: "buster" + - quality-js: + filters: + tags: + only: /v?[0-9]+(\.[0-9]+)*/ - pypi: requires: - test @@ -66,7 +70,6 @@ jobs: test -d venv || virtualenv venv . venv/bin/activate pip install -r requirements/tox.txt - npm install # run tests! # this example uses Django's built-in test-runner @@ -95,6 +98,17 @@ jobs: - PY_ENV: py<< parameters.python_version >> - DJANGO_ENV: << parameters.django_version >> + quality-js: + docker: + - image: circleci/python:3.5-node + steps: + - checkout + - run: + name: Install node dependencies and run JS quality + command: | + npm install + make javascript-quality-test + pypi: docker: - image: circleci/python:3.5 diff --git a/Makefile b/Makefile index df4e2f1e..a424f6f8 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ python-quality-test: javascript-quality-test: ./node_modules/.bin/eslint ./eox_core/**/*.js* -run-tests: python-test python-quality-test javascript-quality-test +run-tests: python-test python-quality-test upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in diff --git a/README.rst b/README.rst index 6fe7c262..3802ecad 100644 --- a/README.rst +++ b/README.rst @@ -12,62 +12,71 @@ and pre-enrollment operations. Usage ===== -**Open edX releases before juniper** +Open edX releases before juniper +-------------------------------- -1) Create the oauth client at http://localhost:18000/admin/oauth2/client/add/, copy the client-id and client-secret. +#. Create the oauth client at http://localhost:18000/admin/oauth2/client/add/, copy the client-id and client-secret. -2) Generate an auth-token using that client-id and client-secret: +#. Generate an auth-token using that client-id and client-secret: -.. code-block:: bash + .. code-block:: bash - $ curl -X POST -d "client_id=&client_secret= - &grant_type=client_credentials" http://localhost:18000/oauth2/access_token/ + $ curl -X POST -d "client_id=&client_secret= &grant_type=client_credentials" http://localhost:18000/oauth2/access_token/ -3) Use the token to call the API as you need: +#. Use the token to call the API as you need: -.. code-block:: bash + * User creation API example + + .. code-block:: bash + + curl -X POST http://localhost:18000/eox-core/api/v1/user/ \ + -H "Authorization: Bearer " \ + -H "Accept: application/json" \ + -H "Content\-Type: application/json" \ + --data '{"username": "jsmith", "email": "jhon@example.com", "password": "qwerty123", "fullname": "Jhon Smith"}' + + * Enroll api example - # User creation API example - curl -X POST --header "Authorization: Bearer " -H "Accept: application/json" \ - http://localhost:18000/eox-core/api/v1/user/ --header "Content\-Type: application/json" \ - --data '{"username": "jsmith", "email": "jhon@example.com", "password": "qwerty123", - "fullname": "Jhon Smith"}' + .. code-block:: bash - # Enroll api example - curl -X POST --header "Authorization: Bearer " -H "Accept: application/json" \ - http://localhost:18000/eox-core/api/v1/enrollment/ --header "Content-Type: application/json" \ - --data '{"course_id": "course-v1:edX+DemoX+Demo_Course", "email": "edx@example.com", - "mode": "audit", "force": 1}' + curl -X POST http://localhost:18000/eox-core/api/v1/enrollment/ \ + -H "Authorization: Bearer " \ + -H "Accept: application/json" \ + -H "Content\-Type: application/json" \ + --data '{"course_id": "course-v1:edX+DemoX+Demo_Course", "email": "edx@example.com", "mode": "audit", "force": 1}' -**Open edX releases after juniper** +Open edX releases after juniper +------------------------------- -Instead of step #1, follow: +Instead of step 1, follow: + +#. Create a Django Oauth Toolkit Application at http://localhost:18000/admin/oauth2_provider/application/add/, + copy the client-id and client-secret. Then follow 2 and 3. -1) Create a Django Oauth Toolkit Application at http://localhost:18000/admin/oauth2_provider/application/add/, -copy the client-id and client-secret. Then follow 2 and 3. Installation on Open edX Devstack ================================= -- Install either the Ironwood or Juniper version of the `Open edX devstack`_ -- Clone the git repo: +* Install either the Ironwood or Juniper version of the `Open edX devstack`_ -.. code-block:: bash +* Clone the git repo: - cd ~/Documents/eoxstack/src/ # Assuming that devstack is in ~/Documents/eoxstack/devstack/ - sudo mkdir edxapp - cd edxapp - git clone git@github.com:eduNEXT/eox-core.git + .. code-block:: bash + + cd ~/Documents/eoxstack/src/ # Assuming that devstack is in ~/Documents/eoxstack/devstack/ + sudo mkdir edxapp + cd edxapp + git clone git@github.com:eduNEXT/eox-core.git - Install plugin from your server (in this case the devstack docker lms shell): -.. code-block:: bash - - cd ~/Documents/eoxstack/devstack # Change for your devstack path (if you are using devstack) - make lms-shell # Enter the devstack machine (or server where lms process lives) - cd /edx/src/edxapp/eox-core - pip install -e . + .. code-block:: bash + + cd ~/Documents/eoxstack/devstack # Change for your devstack path (if you are using devstack) + make lms-shell # Enter the devstack machine (or server where lms process lives) + cd /edx/src/edxapp/eox-core + pip install -e . Compatibility Notes -------------------- @@ -135,31 +144,30 @@ Integrations with third party services The plugin offers some integrations listed below: #. **Sentry**: This service allows to track the errors generated on edx-platform. Check more details in https://sentry.io/welcome/. -To enable the integration, follow the steps below: - - - Install the plugin with Sentry support (extras_require [sentry]). + To enable the integration, follow the steps below: - - Sign up/in to your sentry account and create a new Django application integration. + * Install the plugin with Sentry support (extras_require [sentry]). - - Get the DSN for your integration. This is an unique identifier for your application. + * Sign up/in to your sentry account and create a new Django application integration. - - Setup the following configuration values for edx-platform: + * Get the DSN for your integration. This is an unique identifier for your application. - .. code-block:: yaml + * Setup the following configuration values for edx-platform: - EOX_CORE_SENTRY_INTEGRATION_DSN: - EOX_CORE_SENTRY_IGNORED_ERRORS: [] # optional + .. code-block:: yaml + EOX_CORE_SENTRY_INTEGRATION_DSN: + EOX_CORE_SENTRY_IGNORED_ERRORS: [] # optional - By default, **EOX_CORE_SENTRY_INTEGRATION_DSN** setting is None, which disables the sentry integration. - **EOX_CORE_SENTRY_IGNORED_ERRORS** is optional. It is a list of the exceptions you want to ignore. For instance, it can be defined as: + By default, **EOX_CORE_SENTRY_INTEGRATION_DSN** setting is None, which disables the sentry integration. + **EOX_CORE_SENTRY_IGNORED_ERRORS** is optional. It is a list of the exceptions you want to ignore. For instance, it can be defined as: - .. code-block:: yaml + .. code-block:: yaml - EOX_CORE_SENTRY_IGNORED_ERRORS: [ - 'xmodule.exceptions.NotFoundError', - 'openedx.core.djangoapps.user_authn.exceptions.AuthFailedError', - ] + EOX_CORE_SENTRY_IGNORED_ERRORS: [ + 'xmodule.exceptions.NotFoundError', + 'openedx.core.djangoapps.user_authn.exceptions.AuthFailedError', + ] Course Management automation ============================ @@ -171,16 +179,20 @@ This component allows Studio users to make changes in multiple courses, such as: * Re-run a course across multiple organizations. Compilation -########### +----------- We use webpack to bundle the React js application and its dependencies. To compile in a development environment, run this command on the root folder: -npm run build-dev +.. code-block:: bash + + npm run build-dev Otherwise, if you want to compile for use in production environment, run this command instead: -npm run build-prod +.. code-block:: bash + + npm run build-prod These commands are defined in the package.json file and each one exports two bundle files (build.js and course-management.bundle.css) inside of eox_core/static folder. @@ -223,7 +235,7 @@ For more information, check the eox-audit-model documentation. .. _eox-audit-model: https://github.com/eduNEXT/eox-audit-model/ How to Contribute -################# +----------------- Contributions are welcome! See our `CONTRIBUTING`_ file for more information – it also contains guidelines for how to maintain high code