Git Product home page Git Product logo

ac-academiccommons's Introduction

Academic Commons 4.0

Build Status Coverage Status

Checking out and working with a local development instance

Current recommended version of Ruby is specified in .ruby-version.

  1. Clone the repository to a location of your choosing

    git clone [email protected]:cul/ac-academiccommons.git
    
  2. Checkout the current development branch

    git checkout {branch}
    
  3. Create local config files from templates

    cp config/database.template.yml config/database.yml
    cp config/solr.template.yml config/solr.yml
    cp config/fedora.template.yml config/fedora.yml
    cp config/secrets.template.yml config/secrets.yml
    cp config/blacklight.template.yml config/blacklight.yml
    
  4. Install any needed gems using Bundler

    bundle install
    
  5. Install required Javascript libraries using Yarn

    brew install yarn
    yarn
    
  6. Setup your local development DB.

    rake db:migrate
    
  7. Start your local fedora instance.

    rake jetty:start
    
  8. Start your local solr instance with a development core. (Leave this command running in the background)

    solr_wrapper
    
  9. Start your local Rails app

    rails server
    

Populating your development instance with items

If you need an object in AC to do further testing and development, add an item with the following instructions.

  1. Clean out Solr and Fedora (only necessary if previously loaded items)

    solr_wrapper clean
    rake jetty:clean
    
  2. Start Fedora

    rake jetty:start
    
  3. Start Solr (Leave this command running in the background)

    solr_wrapper
    
  4. Load the collection and one item into Fedora.

    rake ac:populate_solr
    

Authentication/Authorization in development

If you would like to see pages that require authentication follow the steps below.

  1. Seed your development database with two users. ONLY USE THIS IN DEVELOPMENT.

    rake db:seed
    
  2. Log in as one of the users that was just added. When you click the log in link, you will be prompted for a uni.

    For administrative privileges, log in as ta123.

    For a user without administrative privileges, log in as tu123.

Rubocop

We use the rubocul to centralize our rubocop config and share it among repos. In order to regenerate .rubocop_todo please use the following command. Using the following command creates a rubocop_todo configuration that only excludes files from cops instead of enabling/disabling cops and changing configuration values.

rubocop --auto-gen-config  --auto-gen-only-exclude --exclude-limit 10000

Running tests

  1. In order to run tests that require javascript you will might need chrome installed (needs to be tested).
  2. Run tests locally by running rake ci.
  3. Run tests and rubocop by running rake (this is the task used on each travis build).

Deploying

  1. When deploying a new version of the application to test or prod, make sure to create a new tag by running:
    cap test cul:auto_tag
    
    This will create a tag based on the version number (listed in VERSION).

API v1

Documentation for the Academic Commons API can be found at /api/v1/swagger_doc. To view documentation in a swagger GUI, the following url has to be created:

http://petstore.swagger.io/?url=#{root_url}/api/v1/swagger_doc

example: http://petstore.swagger.io/?url=http://www.example.com/api/v1/swagger_doc

Helpful things to know

Authentication/Authorization

We are using cul_omniauth to provide Columbia CAS login (authentication). In addition, we are using CanCanCan for authorization of specific tasks. Right now, we just have one role, and that's 'admin.' Later, we might want a more complex permissions structure, but for right now this fits our needs. Any page that requires authentication will redirect the user to the Columbia CAS login page. If a json response is requested, the user is not redirected.

Statistics

For every asset and item in Academic Commons we store view and download statistics. Assets should only have download statistics and items should only have view statistics. When we calculate download statistics for an item we use the download statistics of its assets. If there are multiple assets associated with an item, we use the download statistics for the most downloaded asset.

Notifications

  • When an item is first added to Academic Commons, we notify the author of the availability of the item if there is a UNI present for the author.

  • Monthly statistics email are sent to authors manually. Authors can opt-out of receiving emails by using an unsubscribe link. Administrators can also prevent authors from getting emails by adding an Email Preference for the author.

  • Academic Commons staff are sent an email when a new deposit is added or when a new agreement is signed.

  • Depositors that self-identify as students are sent a notification that serves as a reminder that departmental approval is required for student works.

Worker Queue

We are using redis and resque for our worker queue. The worker queue UI can be accessed by administrators are /admin/resque. Redis/resque are configured for our deployed production and test environments. Development does not have a worker queue yet.

Indexing Digital Objects

Synchronously (for deployed and local development environments)

To index all items/assets currently in AC, use the following rake task:

ac:reindex:all

To index specific items and related assets (that are already in AC), use the following rake task:

# available parameters: pids
# pids should be a comma-delineated list of pids

ac:reindex:by_item_pid

To index specific items/assets, use the following rake task:

# available parameters: pids and pidlist
# pids should be a comma-delineated list of pids
# pidlist should be a file with a pid in everyline

ac:reindex_by_pid

Asynchronously (for deployed test and production environments)

To index all items/assets currently in AC, use the following rake task:

rake ac:index:all

To index select item/assets, use the following rake task:

# available parameters: pids and pidlist
# pids should be a comma-delineated list of pids
# pidlist should be a file with a pid in everyline 

rake ac:index:by_pid pids=ac:test1,ac:test2

ac-academiccommons's People

Contributors

edmadrid avatar jackblacklight avatar bicyclista avatar rockholla avatar barmintor avatar ej2432 avatar elohanlon avatar infomnivore avatar skparkk avatar cgalarza avatar alpok45 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.