diff --git a/Gemfile b/Gemfile index 185a7e8..3d0b0e4 100644 --- a/Gemfile +++ b/Gemfile @@ -3,81 +3,152 @@ ruby '>= 2.4.4' # ------------------------------------------------ -# RAILS +# RAILS +# Full-stack web application framework. (http://www.rubyonrails.org) gem 'rails', '~> 4.2.10' + +# Tools for creating, working with, and running Rails applications. (http://www.rubyonrails.org) gem 'railties' +# GEMS ADDED TO HELP HANDLE RAILS MIGRATION FROM 3.x to 4.2 +# THESE GEMS HELP SUPPORT DEPRACATED FUNCTIONALITY AND WILL LOSE SUPPORT IN +# FUTURE VERSIONS WE SHOULD CONSIDER BRINGING THE CODE UP TO DATE INSTEAD -gem 'responders', '~> 2.0' # Allows use of respond_with and respond_to in controllers +# A set of Rails responders to dry up your application (http://github.com/plataformatec/responders) +gem 'responders', '~> 2.0' # ------------------------------------------------ # DATABASE/SERVER +# A simple, fast Mysql library for Ruby, binding to libmysql (http://github.com/brianmario/mysql2) gem 'mysql2', '~> 0.4.10' + +# Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/] (https://bitbucket.org/ged/ruby-pg) gem 'pg', '~> 0.19.0' + +# Bit fields for ActiveRecord (https://github.com/pboling/flag_shih_tzu) gem 'flag_shih_tzu' # Allows for bitfields in activereccord # ------------------------------------------------ # JSON DSL - USED BY API +# Create JSON structures via a Builder-style DSL (https://github.com/rails/jbuilder) gem 'jbuilder', '~> 2.6.0' -# ------------------------------------------------ +# ------------------------------------------------ # USERS # devise for user authentication +# Flexible authentication solution for Rails with Warden (https://github.com/plataformatec/devise) gem 'devise' + +# An invitation strategy for Devise (https://github.com/scambra/devise_invitable) gem 'devise_invitable' + +# A generalized Rack framework for multiple-provider authentication. (https://github.com/omniauth/omniauth) gem 'omniauth' + +# OmniAuth Shibboleth strategies for OmniAuth 1.x gem 'omniauth-shibboleth' + +# ORCID OAuth 2.0 Strategy for OmniAuth 1.0 (https://github.com/datacite/omniauth-orcid) gem 'omniauth-orcid' + +# Pure Ruby implementation of Array#dig and Hash#dig for Ruby < 2.3. (https://github.com/Invoca/ruby_dig) gem 'ruby_dig' # for omniauth-orcid # Gems for repository integration +# OO authorization for Rails (https://github.com/elabs/pundit) gem 'pundit' # ------------------------------------------------ -# SETTINGS FOR TEMPLATES AND PLANS (FONTS, COLUMN LAYOUTS, ETC) +# SETTINGS FOR TEMPLATES AND PLANS (FONTS, COLUMN LAYOUTS, ETC) + +# Ruby gem to handle settings for ActiveRecord instances by storing them as serialized Hash in a separate database table. Namespaces and defaults included. (https://github.com/ledermann/rails-settings) gem 'ledermann-rails-settings' # ------------------------------------------------ -# VIEWS +# VIEWS + +# Gem providing simple Contact Us functionality with a Rails 3+ Engine. (https://github.com/jdutil/contact_us) gem 'contact_us' # COULD BE EASILY REPLACED WITH OUR OWN CODE + +# Helpers for the reCAPTCHA API (http://github.com/ambethia/recaptcha) gem 'recaptcha' -gem 'dragonfly' # LOGO UPLOAD + +# Ideal gem for handling attachments in Rails, Sinatra and Rack applications. (http://github.com/markevans/dragonfly) +gem 'dragonfly' # ------------------------------------------------ -# EXPORTING +# EXPORTING +# Provides binaries for WKHTMLTOPDF project in an easily accessible package. gem 'wkhtmltopdf-binary' + +# A thin and fast web server (http://code.macournoyer.com/thin/) gem 'thin' + +# PDF generator (from HTML) gem for Ruby on Rails (https://github.com/mileszs/wicked_pdf) gem 'wicked_pdf' + +# This simple gem allows you to create MS Word docx documents from simple html documents. This makes it easy to create dynamic reports and forms that can be downloaded by your users as simple MS Word docx files. (http://github.com/karnov/htmltoword) gem 'htmltoword' + +# A feed fetching and parsing library (http://feedjira.com) gem 'feedjira' # ------------------------------------------------ -# INTERNATIONALIZATION +# INTERNATIONALIZATION +# Simple FastGettext Rails integration. (http://github.com/grosser/gettext_i18n_rails) gem 'gettext_i18n_rails' + +# Extends gettext_i18n_rails making your .po files available to client side javascript as JSON (https://github.com/webhippie/gettext_i18n_rails_js) gem 'gettext_i18n_rails_js' -gem 'gettext', :require => false, :group => :development + +# Gettext is a pure Ruby libary and tools to localize messages. (http://ruby-gettext.github.com/) +gem 'gettext', require: false, group: :development # ------------------------------------------------ -# PAGINATION +# PAGINATION +# A pagination engine plugin for Rails 4+ and other modern frameworks (https://github.com/kaminari/kaminari) gem 'kaminari' -# ------------------------------------------------ -# ENVIRONMENT SPECIFIC DEPENDENCIES +# ------------------------------------------------ +# ENVIRONMENT SPECIFIC DEPENDENCIES group :development, :test do + # Ruby fast debugger - base + CLI (http://github.com/deivid-rodriguez/byebug) gem "byebug" end group :test do + # Create customizable Minitest output formats (https://github.com/CapnKernul/minitest-reporters) gem 'minitest-reporters' + + # Simple testing API built on Rack (http://github.com/brynary/rack-test) gem 'rack-test' + + # Library for stubbing HTTP requests in Ruby. (http://github.com/bblimke/webmock) gem 'webmock' + + # This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org) (https://github.com/sparklemotion/sqlite3-ruby) gem 'sqlite3' + + # Code coverage for Ruby 1.9+ with a powerful configuration library and automatic merging of coverage across test suites (http://github.com/colszowka/simplecov) gem 'simplecov', require: false end group :development do + # Better error page for Rails and other Rack apps (https://github.com/charliesome/better_errors) gem "better_errors" + + # Retrieve the binding of a method's caller. Can also retrieve bindings even further up the stack. (http://github.com/banister/binding_of_caller) gem "binding_of_caller" + + # A debugging tool for your Ruby on Rails applications. (https://github.com/rails/web-console) gem 'web-console' + + # Profiles loading speed for rack applications. (http://miniprofiler.com) gem 'rack-mini-profiler' + + # Annotates Rails Models, routes, fixtures, and others based on the database schema. (http://github.com/ctran/annotate_models) + gem "annotate" + + # Add comments to your Gemfile with each dependency's description. (https://github.com/ivantsepp/annotate_gem) + gem "annotate_gem" end diff --git a/Gemfile.lock b/Gemfile.lock index ef41814..5044e53 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,6 +36,11 @@ thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.4.0) + annotate (2.7.4) + activerecord (>= 3.2, < 6.0) + rake (>= 10.4, < 13.0) + annotate_gem (0.0.12) + bundler (~> 1.1) ansi (1.5.0) arel (6.0.4) bcrypt (3.1.11) @@ -244,6 +249,8 @@ ruby DEPENDENCIES + annotate + annotate_gem better_errors binding_of_caller byebug diff --git a/app/models/annotation.rb b/app/models/annotation.rb index ccc1121..98fad83 100644 --- a/app/models/annotation.rb +++ b/app/models/annotation.rb @@ -1,3 +1,25 @@ +# == Schema Information +# +# Table name: annotations +# +# id :integer not null, primary key +# text :text +# type :integer default(0), not null +# created_at :datetime +# updated_at :datetime +# org_id :integer +# question_id :integer +# +# Indexes +# +# index_annotations_on_question_id (question_id) +# +# Foreign Keys +# +# fk_rails_... (org_id => orgs.id) +# fk_rails_... (question_id => questions.id) +# + class Annotation < ActiveRecord::Base enum type: [ :example_answer, :guidance] ## diff --git a/app/models/answer.rb b/app/models/answer.rb index 750cac8..d39d68a 100644 --- a/app/models/answer.rb +++ b/app/models/answer.rb @@ -1,3 +1,28 @@ +# == Schema Information +# +# Table name: answers +# +# id :integer not null, primary key +# lock_version :integer default(0) +# text :text +# created_at :datetime +# updated_at :datetime +# plan_id :integer +# question_id :integer +# user_id :integer +# +# Indexes +# +# index_answers_on_plan_id (plan_id) +# index_answers_on_question_id (question_id) +# +# Foreign Keys +# +# fk_rails_... (plan_id => plans.id) +# fk_rails_... (question_id => questions.id) +# fk_rails_... (user_id => users.id) +# + class Answer < ActiveRecord::Base after_save do |answer| diff --git a/app/models/exported_plan.rb b/app/models/exported_plan.rb index c2e81f9..24bfaac 100644 --- a/app/models/exported_plan.rb +++ b/app/models/exported_plan.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: exported_plans +# +# id :integer not null, primary key +# format :string +# created_at :datetime not null +# updated_at :datetime not null +# phase_id :integer +# plan_id :integer +# user_id :integer +# + class ExportedPlan < ActiveRecord::Base include GlobalHelpers include SettingsTemplateHelper diff --git a/app/models/guidance.rb b/app/models/guidance.rb index 08a5cb7..c98c5cc 100644 --- a/app/models/guidance.rb +++ b/app/models/guidance.rb @@ -1,3 +1,24 @@ +# == Schema Information +# +# Table name: guidances +# +# id :integer not null, primary key +# published :boolean +# text :text +# created_at :datetime not null +# updated_at :datetime not null +# guidance_group_id :integer +# question_id :integer +# +# Indexes +# +# index_guidances_on_guidance_group_id (guidance_group_id) +# +# Foreign Keys +# +# fk_rails_... (guidance_group_id => guidance_groups.id) +# + # [+Project:+] DMPRoadmap # [+Description:+] # This class keeps the information organisations enter to support users when answering questions. diff --git a/app/models/guidance_group.rb b/app/models/guidance_group.rb index 885236f..490c48f 100644 --- a/app/models/guidance_group.rb +++ b/app/models/guidance_group.rb @@ -1,3 +1,24 @@ +# == Schema Information +# +# Table name: guidance_groups +# +# id :integer not null, primary key +# name :string +# optional_subset :boolean +# published :boolean +# created_at :datetime not null +# updated_at :datetime not null +# org_id :integer +# +# Indexes +# +# index_guidance_groups_on_org_id (org_id) +# +# Foreign Keys +# +# fk_rails_... (org_id => orgs.id) +# + class GuidanceGroup < ActiveRecord::Base include GlobalHelpers ## diff --git a/app/models/identifier_scheme.rb b/app/models/identifier_scheme.rb index d07aafc..f96cd79 100644 --- a/app/models/identifier_scheme.rb +++ b/app/models/identifier_scheme.rb @@ -1,6 +1,20 @@ +# == Schema Information +# +# Table name: identifier_schemes +# +# id :integer not null, primary key +# active :boolean +# description :string +# logo_url :text +# name :string +# user_landing_url :text +# created_at :datetime +# updated_at :datetime +# + class IdentifierScheme < ActiveRecord::Base has_many :user_identifiers has_many :users, through: :user_identifiers validates :name, uniqueness: {message: _("must be unique")}, presence: {message: _("can't be blank")} -end \ No newline at end of file +end diff --git a/app/models/language.rb b/app/models/language.rb index 1d86727..7c52f72 100644 --- a/app/models/language.rb +++ b/app/models/language.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: languages +# +# id :integer not null, primary key +# abbreviation :string +# default_language :boolean +# description :string +# name :string +# + class Language < ActiveRecord::Base ## # Associations @@ -13,4 +24,4 @@ scope :default, -> { where(default_language: true).first } # Retrieves the id for a given abbreviation of a language scope :id_for, -> (abbreviation) { where(abbreviation: abbreviation).pluck(:id).first } -end \ No newline at end of file +end diff --git a/app/models/note.rb b/app/models/note.rb index d5f3e28..17f86f0 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -1,3 +1,26 @@ +# == Schema Information +# +# Table name: notes +# +# id :integer not null, primary key +# archived :boolean +# archived_by :integer +# text :text +# created_at :datetime +# updated_at :datetime +# answer_id :integer +# user_id :integer +# +# Indexes +# +# index_notes_on_answer_id (answer_id) +# +# Foreign Keys +# +# fk_rails_... (answer_id => answers.id) +# fk_rails_... (user_id => users.id) +# + class Note < ActiveRecord::Base ## # Associations diff --git a/app/models/notification.rb b/app/models/notification.rb index c320f01..e6386e3 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -1,3 +1,19 @@ +# == Schema Information +# +# Table name: notifications +# +# id :integer not null, primary key +# body :text +# dismissable :boolean +# expires_at :date +# level :integer +# notification_type :integer +# starts_at :date +# title :string +# created_at :datetime not null +# updated_at :datetime not null +# + class Notification < ActiveRecord::Base enum level: %i[info warning danger] enum notification_type: %i[global] diff --git a/app/models/org.rb b/app/models/org.rb index 1c2436a..6f1360e 100644 --- a/app/models/org.rb +++ b/app/models/org.rb @@ -1,3 +1,37 @@ +# == Schema Information +# +# Table name: orgs +# +# id :integer not null, primary key +# abbreviation :string +# banner_text :text +# contact_email :string +# contact_name :string +# feedback_email_msg :text +# feedback_email_subject :string +# feedback_enabled :boolean default(FALSE) +# is_other :boolean +# links :text default({"org"=>[]}) +# logo_file_name :string +# logo_name :string +# logo_uid :string +# name :string +# org_type :integer default(0), not null +# sort_name :string +# target_url :string +# wayfless_entity :string +# created_at :datetime not null +# updated_at :datetime not null +# language_id :integer +# parent_id :integer +# region_id :integer +# +# Foreign Keys +# +# fk_rails_... (language_id => languages.id) +# fk_rails_... (region_id => regions.id) +# + class Org < ActiveRecord::Base include GlobalHelpers include FlagShihTzu diff --git a/app/models/org_identifier.rb b/app/models/org_identifier.rb index db61fd6..4ad113a 100644 --- a/app/models/org_identifier.rb +++ b/app/models/org_identifier.rb @@ -1,3 +1,21 @@ +# == Schema Information +# +# Table name: org_identifiers +# +# id :integer not null, primary key +# attrs :string +# identifier :string +# created_at :datetime +# updated_at :datetime +# identifier_scheme_id :integer +# org_id :integer +# +# Foreign Keys +# +# fk_rails_... (identifier_scheme_id => identifier_schemes.id) +# fk_rails_... (org_id => orgs.id) +# + class OrgIdentifier < ActiveRecord::Base belongs_to :org belongs_to :identifier_scheme @@ -10,4 +28,4 @@ def attrs=(hash) write_attribute(:attrs, (hash.is_a?(Hash) ? hash.to_json.to_s : '{}')) end -end \ No newline at end of file +end diff --git a/app/models/perm.rb b/app/models/perm.rb index 56f3a7c..1cc7c14 100644 --- a/app/models/perm.rb +++ b/app/models/perm.rb @@ -1,3 +1,13 @@ +# == Schema Information +# +# Table name: perms +# +# id :integer not null, primary key +# name :string +# created_at :datetime not null +# updated_at :datetime not null +# + class Perm < ActiveRecord::Base ## # Associations diff --git a/app/models/phase.rb b/app/models/phase.rb index 64dfa9b..1ffab28 100644 --- a/app/models/phase.rb +++ b/app/models/phase.rb @@ -1,3 +1,26 @@ +# == Schema Information +# +# Table name: phases +# +# id :integer not null, primary key +# description :text +# modifiable :boolean +# number :integer +# slug :string +# title :string +# created_at :datetime +# updated_at :datetime +# template_id :integer +# +# Indexes +# +# index_phases_on_template_id (template_id) +# +# Foreign Keys +# +# fk_rails_... (template_id => templates.id) +# + # [+Project:+] DMPRoadmap # [+Description:+] This model describes informmation about the phase of a plan, it's title, order of display and which template it belongs to. # diff --git a/app/models/plan.rb b/app/models/plan.rb index b80b0c5..57f874c 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -1,3 +1,37 @@ +# == Schema Information +# +# Table name: plans +# +# id :integer not null, primary key +# complete :boolean default(FALSE) +# data_contact :string +# data_contact_email :string +# data_contact_phone :string +# description :text +# feedback_requested :boolean default(FALSE) +# funder_name :string +# grant_number :string +# identifier :string +# principal_investigator :string +# principal_investigator_email :string +# principal_investigator_identifier :string +# principal_investigator_phone :string +# slug :string +# title :string +# visibility :integer default(3), not null +# created_at :datetime +# updated_at :datetime +# template_id :integer +# +# Indexes +# +# index_plans_on_template_id (template_id) +# +# Foreign Keys +# +# fk_rails_... (template_id => templates.id) +# + class Plan < ActiveRecord::Base include ConditionalUserMailer include ExportablePlan diff --git a/app/models/pref.rb b/app/models/pref.rb index 02e1a59..ec0b9cb 100644 --- a/app/models/pref.rb +++ b/app/models/pref.rb @@ -1,3 +1,12 @@ +# == Schema Information +# +# Table name: prefs +# +# id :integer not null, primary key +# settings :text +# user_id :integer +# + class Pref < ActiveRecord::Base ## # Serialize prefs to JSON @@ -16,4 +25,4 @@ return Rails.configuration.branding[:preferences] end -end \ No newline at end of file +end diff --git a/app/models/question.rb b/app/models/question.rb index 459c7d1..878c09a 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -1,3 +1,28 @@ +# == Schema Information +# +# Table name: questions +# +# id :integer not null, primary key +# default_value :text +# modifiable :boolean +# number :integer +# option_comment_display :boolean default(TRUE) +# text :text +# created_at :datetime +# updated_at :datetime +# question_format_id :integer +# section_id :integer +# +# Indexes +# +# index_questions_on_section_id (section_id) +# +# Foreign Keys +# +# fk_rails_... (question_format_id => question_formats.id) +# fk_rails_... (section_id => sections.id) +# + class Question < ActiveRecord::Base ## diff --git a/app/models/question_format.rb b/app/models/question_format.rb index 4ca045b..d450406 100644 --- a/app/models/question_format.rb +++ b/app/models/question_format.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: question_formats +# +# id :integer not null, primary key +# description :text +# formattype :integer default(0) +# option_based :boolean default(FALSE) +# title :string +# created_at :datetime not null +# updated_at :datetime not null +# + class QuestionFormat < ActiveRecord::Base ## diff --git a/app/models/question_option.rb b/app/models/question_option.rb index c2be0a4..cac8958 100644 --- a/app/models/question_option.rb +++ b/app/models/question_option.rb @@ -1,3 +1,24 @@ +# == Schema Information +# +# Table name: question_options +# +# id :integer not null, primary key +# is_default :boolean +# number :integer +# text :string +# created_at :datetime +# updated_at :datetime +# question_id :integer +# +# Indexes +# +# index_question_options_on_question_id (question_id) +# +# Foreign Keys +# +# fk_rails_... (question_id => questions.id) +# + class QuestionOption < ActiveRecord::Base ## # Associations diff --git a/app/models/region.rb b/app/models/region.rb index a7e366a..d198285 100644 --- a/app/models/region.rb +++ b/app/models/region.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: regions +# +# id :integer not null, primary key +# abbreviation :string +# description :string +# name :string +# super_region_id :integer +# + class Region < ActiveRecord::Base has_many :sub_regions, class_name: 'Region', foreign_key: 'super_region_id' @@ -5,4 +16,4 @@ validates :name, presence: {message: _("can't be blank")}, uniqueness: {message: _("must be unique")} validates :abbreviation, uniqueness: {message: _("must be unique")}, allow_nil: true -end \ No newline at end of file +end diff --git a/app/models/role.rb b/app/models/role.rb index e48bc58..bbcfb53 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -1,3 +1,26 @@ +# == Schema Information +# +# Table name: roles +# +# id :integer not null, primary key +# access :integer default(0), not null +# active :boolean default(TRUE) +# created_at :datetime +# updated_at :datetime +# plan_id :integer +# user_id :integer +# +# Indexes +# +# index_roles_on_plan_id (plan_id) +# index_roles_on_user_id (user_id) +# +# Foreign Keys +# +# fk_rails_... (plan_id => plans.id) +# fk_rails_... (user_id => users.id) +# + class Role < ActiveRecord::Base after_initialize :set_defaults include FlagShihTzu @@ -143,4 +166,4 @@ # 28 - editor + commenter + reviewer # 29 - creator + editor + commenter + reviewer # 30 - administrator + editor + commenter + reviewer -# 31 - creator + administrator + editor + commenter + reviewer \ No newline at end of file +# 31 - creator + administrator + editor + commenter + reviewer diff --git a/app/models/section.rb b/app/models/section.rb index c807015..bc644c1 100644 --- a/app/models/section.rb +++ b/app/models/section.rb @@ -1,3 +1,26 @@ +# == Schema Information +# +# Table name: sections +# +# id :integer not null, primary key +# description :text +# modifiable :boolean +# number :integer +# published :boolean +# title :string +# created_at :datetime +# updated_at :datetime +# phase_id :integer +# +# Indexes +# +# index_sections_on_phase_id (phase_id) +# +# Foreign Keys +# +# fk_rails_... (phase_id => phases.id) +# + class Section < ActiveRecord::Base ## # Associations diff --git a/app/models/settings/template.rb b/app/models/settings/template.rb index 9d4969c..54a272f 100644 --- a/app/models/settings/template.rb +++ b/app/models/settings/template.rb @@ -1,3 +1,20 @@ +# == Schema Information +# +# Table name: settings +# +# id :integer not null, primary key +# target_type :string not null +# value :text +# var :string not null +# created_at :datetime not null +# updated_at :datetime not null +# target_id :integer not null +# +# Indexes +# +# index_settings_on_target_type_and_target_id_and_var (target_type,target_id,var) UNIQUE +# + module Settings class Template < RailsSettings::SettingObject diff --git a/app/models/splash_log.rb b/app/models/splash_log.rb index 307933f..7b9cc0e 100644 --- a/app/models/splash_log.rb +++ b/app/models/splash_log.rb @@ -1,2 +1,12 @@ +# == Schema Information +# +# Table name: splash_logs +# +# id :integer not null, primary key +# destination :string +# created_at :datetime not null +# updated_at :datetime not null +# + class SplashLog < ActiveRecord::Base end diff --git a/app/models/template.rb b/app/models/template.rb index 58728d1..a22b855 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -1,3 +1,36 @@ +# == Schema Information +# +# Table name: templates +# +# id :integer not null, primary key +# archived :boolean +# customization_of :integer +# description :text +# is_default :boolean +# links :text default({"funder"=>[], "sample_plan"=>[]}) +# locale :string +# published :boolean +# title :string +# version :integer +# visibility :integer +# created_at :datetime +# updated_at :datetime +# family_id :integer +# org_id :integer +# +# Indexes +# +# index_templates_on_customization_of_and_version_and_org_id (customization_of,version,org_id) UNIQUE +# index_templates_on_family_id (family_id) +# index_templates_on_family_id_and_version (family_id,version) UNIQUE +# index_templates_on_org_id (org_id) +# template_organisation_dmptemplate_index (org_id,family_id) +# +# Foreign Keys +# +# fk_rails_... (org_id => orgs.id) +# + class Template < ActiveRecord::Base include GlobalHelpers include ActiveModel::Validations diff --git a/app/models/theme.rb b/app/models/theme.rb index 42e3266..4a35f38 100644 --- a/app/models/theme.rb +++ b/app/models/theme.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: themes +# +# id :integer not null, primary key +# description :text +# locale :string +# title :string +# created_at :datetime not null +# updated_at :datetime not null +# + class Theme < ActiveRecord::Base ## diff --git a/app/models/token_permission_type.rb b/app/models/token_permission_type.rb index 7ffa06a..71370f6 100644 --- a/app/models/token_permission_type.rb +++ b/app/models/token_permission_type.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: token_permission_types +# +# id :integer not null, primary key +# text_description :text +# token_type :string +# created_at :datetime +# updated_at :datetime +# + class TokenPermissionType < ActiveRecord::Base ## # Associations diff --git a/app/models/user.rb b/app/models/user.rb index 780e610..7e4157d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,52 @@ +# == Schema Information +# +# Table name: users +# +# id :integer not null, primary key +# accept_terms :boolean +# active :boolean default(TRUE) +# api_token :string +# confirmation_sent_at :datetime +# confirmation_token :string +# confirmed_at :datetime +# current_sign_in_at :datetime +# current_sign_in_ip :string +# email :string default(""), not null +# encrypted_password :string default("") +# firstname :string +# invitation_accepted_at :datetime +# invitation_created_at :datetime +# invitation_sent_at :datetime +# invitation_token :string +# invited_by_type :string +# last_sign_in_at :datetime +# last_sign_in_ip :string +# other_organisation :string +# recovery_email :string +# remember_created_at :datetime +# reset_password_sent_at :datetime +# reset_password_token :string +# sign_in_count :integer default(0) +# surname :string +# created_at :datetime not null +# updated_at :datetime not null +# invited_by_id :integer +# language_id :integer +# orcid_id :string +# org_id :integer +# shibboleth_id :string +# +# Indexes +# +# index_users_on_email (email) UNIQUE +# index_users_on_org_id (org_id) +# +# Foreign Keys +# +# fk_rails_... (language_id => languages.id) +# fk_rails_... (org_id => orgs.id) +# + class User < ActiveRecord::Base include ConditionalUserMailer ## diff --git a/app/models/user_identifier.rb b/app/models/user_identifier.rb index 840e394..60d83ee 100644 --- a/app/models/user_identifier.rb +++ b/app/models/user_identifier.rb @@ -1,3 +1,24 @@ +# == Schema Information +# +# Table name: user_identifiers +# +# id :integer not null, primary key +# identifier :string +# created_at :datetime +# updated_at :datetime +# identifier_scheme_id :integer +# user_id :integer +# +# Indexes +# +# index_user_identifiers_on_user_id (user_id) +# +# Foreign Keys +# +# fk_rails_... (identifier_scheme_id => identifier_schemes.id) +# fk_rails_... (user_id => users.id) +# + class UserIdentifier < ActiveRecord::Base belongs_to :user belongs_to :identifier_scheme @@ -6,4 +27,4 @@ validates_uniqueness_of :identifier_scheme, scope: :user validates :identifier, :user, :identifier_scheme, presence: {message: _("can't be blank")} -end \ No newline at end of file +end diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake new file mode 100644 index 0000000..77299bd --- /dev/null +++ b/lib/tasks/auto_annotate_models.rake @@ -0,0 +1,54 @@ +# NOTE: only doing this in development as some production environments (Heroku) +# NOTE: are sensitive to local FS writes, and besides -- it's just not proper +# NOTE: to have a dev-mode tool do its thing in production. +if Rails.env.development? + require 'annotate' + task :set_annotation_options do + # You can override any of these by setting an environment variable of the + # same name. + Annotate.set_defaults( + 'routes' => 'false', + 'position_in_routes' => 'before', + 'position_in_class' => 'before', + 'position_in_test' => 'before', + 'position_in_fixture' => 'before', + 'position_in_factory' => 'before', + 'position_in_serializer' => 'before', + 'show_foreign_keys' => 'true', + 'show_complete_foreign_keys' => 'false', + 'show_indexes' => 'true', + 'simple_indexes' => 'false', + 'model_dir' => 'app/models', + 'root_dir' => '', + 'include_version' => 'false', + 'require' => '', + 'exclude_tests' => 'true', + 'exclude_fixtures' => 'true', + 'exclude_factories' => 'false', + 'exclude_serializers' => 'true', + 'exclude_scaffolds' => 'true', + 'exclude_controllers' => 'true', + 'exclude_helpers' => 'true', + 'exclude_sti_subclasses' => 'false', + 'ignore_model_sub_dir' => 'false', + 'ignore_columns' => nil, + 'ignore_routes' => 'true', + 'ignore_unknown_models' => 'false', + 'hide_limit_column_types' => 'integer,boolean', + 'hide_default_column_types' => 'json,jsonb,hstore', + 'skip_on_db_migrate' => 'false', + 'format_bare' => 'true', + 'format_rdoc' => 'false', + 'format_markdown' => 'false', + 'sort' => 'false', + 'force' => 'false', + 'classified_sort' => 'true', + 'trace' => 'false', + 'wrapper_open' => nil, + 'wrapper_close' => nil, + 'with_comment' => true + ) + end + + Annotate.load_tasks +end