Skip to content

Instantly share code, notes, and snippets.

@mankind
mankind / chunk_file_doc.md
Created August 9, 2019 14:25 — forked from ashikajith/chunk_file_doc.md
Chunk File Upload Doc

File Chunk Upload

To support large file upload we need to segregate the file to different chunks and we will be sending each chunk in a single request to the server. Once they recieve the complete chunk, we will combine the chunk to get the actual file.

Following are the steps we followed to implement the feature.

@mankind
mankind / mailer_report_doc.md
Created August 9, 2019 14:25 — forked from ashikajith/mailer_report_doc.md
Mailer Report Doc

Mailer Report

For the mailer report we have WorkReportMailer which acts as the controller of the Application Mailer. The mailer is called in the ExportController file.

  def send_mail_report
    emails = process_email
    emails.each do |email|
      WorkReportMailer.send_report(email.strip, current_account.cname, params[:email_type]).deliver_later
    end
 redirect_to hyrax.admin_stats_path(anchor: 'email_reports')
@mankind
mankind / mask_s3_url.md
Created August 9, 2019 14:24 — forked from ashikajith/mask_s3_url.md
Masking S3 URL

S3 Masking URL

For masking the url we created a seperate routes, controller to fetch the record and generate the url for the download file.

  app/controllers/ubiquity/fail_uploads_controller.rb
  
  def download_file
    params[:fileset_id]
    uuid = params[:uuid]
 s3_file_set_url = Ubiquity::ImporterClient.get_s3_url uuid

RIF Doc

For Rif template all the fileds have unique codes and we represent eah codes to the corresponding value. Following are the steps we follow to generate the report

  • Fetch the corresponding work from the controller CitationExportsController (app/controllers/ubiquity/citation_exports_controller.rb) and process the fetched record to render in RIF fromat.
  • A Controller Concern is added to handle the processing of data in Rif format (app/controllers/concerns/ubiquity/citations_export_concern.rb)

Basically we have a hash which consist of code and the fields that needs to map. Please find the hash below

@mankind
mankind / oai_export_doc.md
Created August 9, 2019 14:24 — forked from ashikajith/oai_export_doc.md
OAI Export Feature

OAI Export

For OAI we are using the BlackLightOaiProvider gem (https://github.com/projectblacklight/blacklight_oai_provider) which harvest the data automatically once it is configured in the catalog controller. We have divided into two phases.

We do have an ENV variable which acts as a switch to enable this feature .

ENABLE_OAI_METADATA: 'true'
@mankind
mankind / oai_extension.rb
Created August 6, 2019 07:52
oai_exporting repository_url
#file location
#app/controllers/ubiquity/oai_extension.rb
module Ubiquity
module OaiExtension
extend ActiveSupport::Concern
def oai_config
blacklight_config.oai.merge(provider: {repository_url: request.original_url}) || {provider: {repository_url: request.original_url}}
end
end
end
class AccountSettingsController < ApplicationController
before_action :set_company
def index
end
def update
@company.update(set_record_params)
redirect_to account_settings_path
end
@mankind
mankind / add_file.rb
Last active January 30, 2019 09:21
general-notes
#app/services/ubiquity/add_file.rb
#this works as it is called whilr creating hte file, however all efforts to set the file_size field failed
module Ubiquity
module AddFile
#private
=begin
def attach_attributes(file)
puts "lagos"
::Ubiquity::DetermineFileSize.call(file)
@mankind
mankind / database.yml
Last active January 2, 2019 12:35
example docker-compose with netwroks
# PostgreSQL. Versions 9.1 and up are supported.
#
# Install the pg driver:
# gem install pg
# On OS X with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On OS X with MacPorts:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
@mankind
mankind / note
Last active January 2, 2019 10:19
hyku-kubernetes
sudo vim /etc/sudoers
https://docs.google.com/document/d/1cXS-hQ09_AXATTjcvpKqzrqVEwATsZHY9t2VfTkxRYg/edit#heading=h.wxbnbz4dhgpy
https://www.digitalocean.com/community/tutorials/how-to-install-software-on-kubernetes-clusters-with-the-helm-package-manager
https://docs.helm.sh/using_helm/#quickstart-guide
helm installed into /usr/local/bin/helm
tiller installed into /usr/local/bin/tiller
Run 'helm init' to configure helm.