setup sciNote for Rails 5.1
3
Gemfile
|
@ -43,7 +43,7 @@ gem 'logging', '~> 2.0.0'
|
|||
gem 'aspector' # Aspect-oriented programming for Rails
|
||||
gem 'rgl' # Graph framework for project diagram calculations
|
||||
gem 'nested_form_fields'
|
||||
gem 'ajax-datatables-rails', '~> 0.4.0'
|
||||
gem 'ajax-datatables-rails', '~> 0.3.1'
|
||||
gem 'commit_param_routing' # Enables different submit actions in the same form to route to different actions in controller
|
||||
gem 'kaminari'
|
||||
gem "i18n-js", ">= 3.0.0.rc11" # Localization in javascript files
|
||||
|
@ -73,6 +73,7 @@ gem 'base62' # Used for smart annotations
|
|||
gem 'newrelic_rpm'
|
||||
|
||||
group :development, :test do
|
||||
gem 'listen', '~> 3.0'
|
||||
gem 'byebug'
|
||||
gem 'better_errors'
|
||||
gem 'binding_of_caller'
|
||||
|
|
16
Gemfile.lock
|
@ -52,8 +52,8 @@ GEM
|
|||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
ajax-datatables-rails (0.4.0)
|
||||
railties (>= 4.0)
|
||||
ajax-datatables-rails (0.3.1)
|
||||
railties (>= 3.1)
|
||||
ansi (1.5.0)
|
||||
arel (8.0.0)
|
||||
aspector (0.14.0)
|
||||
|
@ -139,6 +139,7 @@ GEM
|
|||
execjs (2.7.0)
|
||||
faker (1.7.3)
|
||||
i18n (~> 0.5)
|
||||
ffi (1.9.18)
|
||||
figaro (1.1.1)
|
||||
thor (~> 0.14)
|
||||
font-awesome-rails (4.7.0.2)
|
||||
|
@ -178,6 +179,10 @@ GEM
|
|||
kaminari-core (= 1.0.1)
|
||||
kaminari-core (1.0.1)
|
||||
lazy_priority_queue (0.1.1)
|
||||
listen (3.1.5)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
ruby_dep (~> 1.2)
|
||||
little-plugger (1.1.4)
|
||||
logging (2.0.0)
|
||||
little-plugger (~> 1.1)
|
||||
|
@ -260,6 +265,9 @@ GEM
|
|||
rainbow (2.2.2)
|
||||
rake
|
||||
rake (12.0.0)
|
||||
rb-fsevent (0.9.8)
|
||||
rb-inotify (0.9.10)
|
||||
ffi (>= 0.5.0, < 2)
|
||||
rdoc (4.3.0)
|
||||
recaptcha (4.3.1)
|
||||
json
|
||||
|
@ -283,6 +291,7 @@ GEM
|
|||
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||
ruby-graphviz (1.2.3)
|
||||
ruby-progressbar (1.8.1)
|
||||
ruby_dep (1.5.0)
|
||||
rubyzip (1.2.1)
|
||||
sanitize (4.5.0)
|
||||
crass (~> 1.0.2)
|
||||
|
@ -358,7 +367,7 @@ PLATFORMS
|
|||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
ajax-datatables-rails (~> 0.4.0)
|
||||
ajax-datatables-rails (~> 0.3.1)
|
||||
aspector
|
||||
auto_strip_attributes (~> 2.1)
|
||||
autosize-rails
|
||||
|
@ -393,6 +402,7 @@ DEPENDENCIES
|
|||
jquery-ui-rails
|
||||
js_cookie_rails
|
||||
kaminari
|
||||
listen (~> 3.0)
|
||||
logging (~> 2.0.0)
|
||||
minitest-reporters (~> 1.1)
|
||||
momentjs-rails (~> 2.17.1)
|
||||
|
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -5,7 +5,7 @@ class ApplicationController < ActionController::Base
|
|||
acts_as_token_authentication_handler_for User
|
||||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
protect_from_forgery with: :exception
|
||||
protect_from_forgery with: :exception, prepend: true
|
||||
before_action :authenticate_user!
|
||||
helper_method :current_team
|
||||
before_action :generate_intro_tutorial, if: :is_current_page_root?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Activity < ActiveRecord::Base
|
||||
class Activity < ApplicationRecord
|
||||
include InputSanitizeHelper
|
||||
|
||||
after_create :generate_notification
|
||||
|
|
3
app/models/application_record.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
class Asset < ActiveRecord::Base
|
||||
class Asset < ApplicationRecord
|
||||
include SearchableModel
|
||||
include DatabaseHelper
|
||||
include Encryptor
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AssetTextDatum < ActiveRecord::Base
|
||||
class AssetTextDatum < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
validates :data, presence: true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Checklist < ActiveRecord::Base
|
||||
class Checklist < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
auto_strip_attributes :name, nullify: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ChecklistItem < ActiveRecord::Base
|
||||
class ChecklistItem < ApplicationRecord
|
||||
auto_strip_attributes :text, nullify: false
|
||||
validates :text,
|
||||
presence: true,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Comment < ActiveRecord::Base
|
||||
class Comment < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
auto_strip_attributes :message, nullify: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Connection < ActiveRecord::Base
|
||||
class Connection < ApplicationRecord
|
||||
belongs_to :to, :class_name => 'MyModule', :foreign_key => 'input_id', inverse_of: :inputs
|
||||
belongs_to :from, :class_name => 'MyModule', :foreign_key => 'output_id', inverse_of: :outputs
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CustomField < ActiveRecord::Base
|
||||
class CustomField < ApplicationRecord
|
||||
auto_strip_attributes :name, nullify: false
|
||||
validates :name,
|
||||
presence: true,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Experiment < ActiveRecord::Base
|
||||
class Experiment < ApplicationRecord
|
||||
include ArchivableModel
|
||||
include SearchableModel
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class MyModule < ActiveRecord::Base
|
||||
class MyModule < ApplicationRecord
|
||||
include ArchivableModel, SearchableModel
|
||||
|
||||
enum state: Extends::TASKS_STATES
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class MyModuleGroup < ActiveRecord::Base
|
||||
class MyModuleGroup < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
auto_strip_attributes :name, nullify: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class MyModuleRepositoryRow < ActiveRecord::Base
|
||||
class MyModuleRepositoryRow < ApplicationRecord
|
||||
belongs_to :assigned_by, foreign_key: 'assigned_by_id', class_name: 'User'
|
||||
belongs_to :repository_row
|
||||
belongs_to :my_module
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class MyModuleTag < ActiveRecord::Base
|
||||
class MyModuleTag < ApplicationRecord
|
||||
validates :my_module, :tag, presence: true
|
||||
validates :tag_id, uniqueness: { scope: :my_module_id }
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Notification < ActiveRecord::Base
|
||||
class Notification < ApplicationRecord
|
||||
has_many :user_notifications, inverse_of: :notification, dependent: :destroy
|
||||
has_many :users, through: :user_notifications
|
||||
belongs_to :generator_user, class_name: 'User'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Project < ActiveRecord::Base
|
||||
class Project < ApplicationRecord
|
||||
include ArchivableModel, SearchableModel
|
||||
|
||||
enum visibility: { hidden: 0, visible: 1 }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Protocol < ActiveRecord::Base
|
||||
class Protocol < ApplicationRecord
|
||||
include SearchableModel
|
||||
include RenamingUtil
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ProtocolKeyword < ActiveRecord::Base
|
||||
class ProtocolKeyword < ApplicationRecord
|
||||
auto_strip_attributes :name, nullify: false
|
||||
validates :name,
|
||||
length: { minimum: Constants::NAME_MIN_LENGTH,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ProtocolProtocolKeyword < ActiveRecord::Base
|
||||
class ProtocolProtocolKeyword < ApplicationRecord
|
||||
after_create :increment_protocols_count
|
||||
after_destroy :decrement_protocols_count
|
||||
|
||||
|
@ -20,4 +20,4 @@ class ProtocolProtocolKeyword < ActiveRecord::Base
|
|||
self.protocol_keyword.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Report < ActiveRecord::Base
|
||||
class Report < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
auto_strip_attributes :name, :description, nullify: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ReportElement < ActiveRecord::Base
|
||||
class ReportElement < ApplicationRecord
|
||||
enum type_of: Extends::REPORT_ELEMENT_TYPES
|
||||
|
||||
# This is only used by certain elements
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Repository < ActiveRecord::Base
|
||||
class Repository < ApplicationRecord
|
||||
belongs_to :team
|
||||
belongs_to :created_by, foreign_key: :created_by_id, class_name: 'User'
|
||||
has_many :repository_columns
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class RepositoryCell < ActiveRecord::Base
|
||||
class RepositoryCell < ApplicationRecord
|
||||
belongs_to :repository_row
|
||||
belongs_to :repository_column
|
||||
belongs_to :value, polymorphic: true, dependent: :destroy
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class RepositoryColumn < ActiveRecord::Base
|
||||
class RepositoryColumn < ApplicationRecord
|
||||
belongs_to :repository
|
||||
belongs_to :created_by, foreign_key: :created_by_id, class_name: 'User'
|
||||
has_many :repository_cells, dependent: :destroy
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class RepositoryDateValue < ActiveRecord::Base
|
||||
class RepositoryDateValue < ApplicationRecord
|
||||
belongs_to :created_by, foreign_key: :created_by_id, class_name: 'User'
|
||||
belongs_to :last_modified_by, foreign_key: :last_modified_by_id,
|
||||
class_name: 'User'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class RepositoryRow < ActiveRecord::Base
|
||||
class RepositoryRow < ApplicationRecord
|
||||
belongs_to :repository
|
||||
belongs_to :created_by, foreign_key: :created_by_id, class_name: 'User'
|
||||
belongs_to :last_modified_by, foreign_key: :last_modified_by_id,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class RepositoryTableState < ActiveRecord::Base
|
||||
class RepositoryTableState < ApplicationRecord
|
||||
belongs_to :user, inverse_of: :repository_table_states
|
||||
belongs_to :repository, inverse_of: :repository_table_states
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class RepositoryTextValue < ActiveRecord::Base
|
||||
class RepositoryTextValue < ApplicationRecord
|
||||
belongs_to :created_by, foreign_key: :created_by_id, class_name: 'User'
|
||||
belongs_to :last_modified_by, foreign_key: :last_modified_by_id,
|
||||
class_name: 'User'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Result < ActiveRecord::Base
|
||||
class Result < ApplicationRecord
|
||||
include ArchivableModel, SearchableModel
|
||||
|
||||
auto_strip_attributes :name, nullify: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ResultAsset < ActiveRecord::Base
|
||||
class ResultAsset < ApplicationRecord
|
||||
validates :result, :asset, presence: true
|
||||
|
||||
belongs_to :result, inverse_of: :result_asset
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ResultTable < ActiveRecord::Base
|
||||
class ResultTable < ApplicationRecord
|
||||
validates :result, :table, presence: true
|
||||
|
||||
belongs_to :result, inverse_of: :result_table
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ResultText < ActiveRecord::Base
|
||||
class ResultText < ApplicationRecord
|
||||
auto_strip_attributes :text, nullify: false
|
||||
validates :text,
|
||||
presence: true,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Sample < ActiveRecord::Base
|
||||
class Sample < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
auto_strip_attributes :name, nullify: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class SampleCustomField < ActiveRecord::Base
|
||||
class SampleCustomField < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
auto_strip_attributes :value, nullify: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class SampleGroup < ActiveRecord::Base
|
||||
class SampleGroup < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
auto_strip_attributes :name, :color, nullify: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class SampleMyModule < ActiveRecord::Base
|
||||
class SampleMyModule < ApplicationRecord
|
||||
after_create :increment_nr_of_module_samples
|
||||
after_destroy :decrement_nr_of_module_samples
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class SampleType < ActiveRecord::Base
|
||||
class SampleType < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
auto_strip_attributes :name, nullify: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class SamplesTable < ActiveRecord::Base
|
||||
class SamplesTable < ApplicationRecord
|
||||
validates :user, :team, presence: true
|
||||
|
||||
belongs_to :user, inverse_of: :samples_tables
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Settings < ActiveRecord::Base
|
||||
class Settings < ApplicationRecord
|
||||
def self.instance
|
||||
@instance ||= first
|
||||
@instance ||= new
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Step < ActiveRecord::Base
|
||||
class Step < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
auto_strip_attributes :name, :description, nullify: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class StepAsset < ActiveRecord::Base
|
||||
class StepAsset < ApplicationRecord
|
||||
validates :step, :asset, presence: true
|
||||
|
||||
belongs_to :step, inverse_of: :step_assets
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class StepTable < ActiveRecord::Base
|
||||
class StepTable < ApplicationRecord
|
||||
validates :step, :table, presence: true
|
||||
|
||||
belongs_to :step, inverse_of: :step_tables
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Table < ActiveRecord::Base
|
||||
class Table < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
auto_strip_attributes :name, nullify: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Tag < ActiveRecord::Base
|
||||
class Tag <ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
auto_strip_attributes :name, :color, nullify: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Team < ActiveRecord::Base
|
||||
class Team < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
# Not really MVC-compliant, but we just use it for logger
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class TempFile < ActiveRecord::Base
|
||||
class TempFile < ApplicationRecord
|
||||
validates :session_id, presence: true
|
||||
|
||||
has_attached_file :file
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class TinyMceAsset < ActiveRecord::Base
|
||||
class TinyMceAsset < ApplicationRecord
|
||||
attr_accessor :reference
|
||||
before_create :set_reference
|
||||
after_create :update_estimated_size
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
class Token < ActiveRecord::Base
|
||||
class Token < ApplicationRecord
|
||||
|
||||
validates :token, presence: true
|
||||
validates :ttl, presence: true
|
||||
|
||||
belongs_to :user, foreign_key: 'user_id', class_name: 'User', inverse_of: :tokens
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class User < ActiveRecord::Base
|
||||
class User < ApplicationRecord
|
||||
include SearchableModel
|
||||
|
||||
acts_as_token_authenticatable
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class UserMyModule < ActiveRecord::Base
|
||||
class UserMyModule < ApplicationRecord
|
||||
validates :user, :my_module, presence: true
|
||||
|
||||
belongs_to :user, inverse_of: :user_my_modules
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class UserNotification < ActiveRecord::Base
|
||||
class UserNotification < ApplicationRecord
|
||||
include NotificationsHelper
|
||||
|
||||
belongs_to :user
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class UserProject < ActiveRecord::Base
|
||||
class UserProject < ApplicationRecord
|
||||
enum role: { owner: 0, normal_user: 1, technician: 2, viewer: 3 }
|
||||
|
||||
validates :role, presence: true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class UserTeam < ActiveRecord::Base
|
||||
class UserTeam < ApplicationRecord
|
||||
enum role: { guest: 0, normal_user: 1, admin: 2 }
|
||||
|
||||
validates :role, presence: true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class WopiAction < ActiveRecord::Base
|
||||
class WopiAction < ApplicationRecord
|
||||
belongs_to :wopi_app, foreign_key: 'wopi_app_id', class_name: 'WopiApp'
|
||||
validates :action, :extension, :urlsrc, :wopi_app, presence: true
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class WopiApp < ActiveRecord::Base
|
||||
class WopiApp < ApplicationRecord
|
||||
belongs_to :wopi_discovery,
|
||||
foreign_key: 'wopi_discovery_id',
|
||||
class_name: 'WopiDiscovery'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class WopiDiscovery < ActiveRecord::Base
|
||||
class WopiDiscovery < ApplicationRecord
|
||||
require 'base64'
|
||||
|
||||
has_many :wopi_apps,
|
||||
|
|
|
@ -15,7 +15,7 @@ require 'fileutils'
|
|||
# end
|
||||
# end
|
||||
|
||||
class ZipExport < ActiveRecord::Base
|
||||
class ZipExport < ApplicationRecord
|
||||
belongs_to :user
|
||||
has_attached_file :zip_file
|
||||
validates_attachment :zip_file,
|
||||
|
|
2
bin/bundle
Normal file → Executable file
|
@ -1,3 +1,3 @@
|
|||
#!/usr/bin/env ruby.exe
|
||||
#!/usr/bin/env ruby
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
load Gem.bin_path('bundler', 'bundle')
|
||||
|
|
0
bin/delayed_job
Normal file → Executable file
4
bin/rails
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env ruby.exe
|
||||
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||
#!/usr/bin/env ruby
|
||||
APP_PATH = File.expand_path('../config/application', __dir__)
|
||||
require_relative '../config/boot'
|
||||
require 'rails/commands'
|
||||
|
|
2
bin/rake
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env ruby.exe
|
||||
#!/usr/bin/env ruby
|
||||
require_relative '../config/boot'
|
||||
require 'rake'
|
||||
Rake.application.run
|
||||
|
|
35
bin/setup
Normal file → Executable file
|
@ -1,29 +1,38 @@
|
|||
#!/usr/bin/env ruby.exe
|
||||
#!/usr/bin/env ruby
|
||||
require 'pathname'
|
||||
require 'fileutils'
|
||||
include FileUtils
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||
|
||||
Dir.chdir APP_ROOT do
|
||||
def system!(*args)
|
||||
system(*args) || abort("\n== Command #{args} failed ==")
|
||||
end
|
||||
|
||||
chdir APP_ROOT do
|
||||
# This script is a starting point to setup your application.
|
||||
# Add necessary setup steps to this file:
|
||||
# Add necessary setup steps to this file.
|
||||
|
||||
puts '== Installing dependencies =='
|
||||
system! 'gem install bundler --conservative'
|
||||
system('bundle check') || system!('bundle install')
|
||||
|
||||
# Install JavaScript dependencies if using Yarn
|
||||
# system('bin/yarn')
|
||||
|
||||
puts "== Installing dependencies =="
|
||||
system "gem install bundler --conservative"
|
||||
system "bundle check || bundle install"
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
# unless File.exist?("config/database.yml")
|
||||
# system "cp config/database.yml.sample config/database.yml"
|
||||
# unless File.exist?('config/database.yml')
|
||||
# cp 'config/database.yml.sample', 'config/database.yml'
|
||||
# end
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
system "bin/rake db:setup"
|
||||
system! 'bin/rails db:setup'
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system "rm -f log/*"
|
||||
system "rm -rf tmp/cache"
|
||||
system! 'bin/rails log:clear tmp:clear'
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system "touch tmp/restart.txt"
|
||||
system! 'bin/rails restart'
|
||||
end
|
||||
|
|
29
bin/update
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'pathname'
|
||||
require 'fileutils'
|
||||
include FileUtils
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||
|
||||
def system!(*args)
|
||||
system(*args) || abort("\n== Command #{args} failed ==")
|
||||
end
|
||||
|
||||
chdir APP_ROOT do
|
||||
# This script is a way to update your development environment automatically.
|
||||
# Add necessary update steps to this file.
|
||||
|
||||
puts '== Installing dependencies =='
|
||||
system! 'gem install bundler --conservative'
|
||||
system('bundle check') || system!('bundle install')
|
||||
|
||||
puts "\n== Updating database =="
|
||||
system! 'bin/rails db:migrate'
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! 'bin/rails log:clear tmp:clear'
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system! 'bin/rails restart'
|
||||
end
|
11
bin/yarn
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env ruby
|
||||
VENDOR_PATH = File.expand_path('..', __dir__)
|
||||
Dir.chdir(VENDOR_PATH) do
|
||||
begin
|
||||
exec "yarnpkg #{ARGV.join(" ")}"
|
||||
rescue Errno::ENOENT
|
||||
$stderr.puts "Yarn executable was not detected in the system."
|
||||
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
||||
exit 1
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
require File.expand_path('../boot', __FILE__)
|
||||
require_relative 'boot'
|
||||
|
||||
require 'rails/all'
|
||||
|
||||
|
@ -8,24 +8,19 @@ Bundler.require(*Rails.groups)
|
|||
|
||||
module Scinote
|
||||
class Application < Rails::Application
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 5.1
|
||||
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Application configuration should go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded.
|
||||
|
||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||
# config.time_zone = 'Central Time (US & Canada)'
|
||||
|
||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
# config.i18n.default_locale = :de
|
||||
|
||||
config.encoding = 'utf-8'
|
||||
|
||||
config.active_job.queue_adapter = :delayed_job
|
||||
|
||||
# Do not swallow errors in after_commit/after_rollback callbacks.
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
# config.active_record.raise_in_transactional_callbacks = true
|
||||
|
||||
# Logging
|
||||
config.log_formatter = proc do |severity, datetime, progname, msg|
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||
|
||||
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
||||
|
|
10
config/cable.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
development:
|
||||
adapter: async
|
||||
|
||||
test:
|
||||
adapter: async
|
||||
|
||||
production:
|
||||
adapter: redis
|
||||
url: redis://localhost:6379/1
|
||||
channel_prefix: scinote_production
|
|
@ -1,5 +1,5 @@
|
|||
# Load the Rails application.
|
||||
require File.expand_path('../application', __FILE__)
|
||||
require_relative 'application'
|
||||
|
||||
# Set the encoding
|
||||
Encoding.default_external = Encoding::UTF_8
|
||||
|
|
|
@ -26,6 +26,8 @@ Rails.application.configure do
|
|||
reply_to: Rails.application.secrets.mailer_reply_to
|
||||
}
|
||||
config.action_mailer.raise_delivery_errors = true
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
|
||||
config.action_mailer.smtp_settings = {
|
||||
|
@ -86,4 +88,25 @@ Rails.application.configure do
|
|||
# Enable user registrations
|
||||
config.x.enable_user_registration =
|
||||
ENV['ENABLE_USER_REGISTRATION'] == 'false' ? false : true
|
||||
|
||||
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||
# routes, locales, etc. This feature depends on the listen gem.
|
||||
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||
|
||||
# Suppress logger output for asset requests.
|
||||
config.assets.quiet = true
|
||||
|
||||
# Enable/disable caching. By default caching is disabled.
|
||||
if Rails.root.join('tmp/caching-dev.txt').exist?
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
config.cache_store = :memory_store
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
|
||||
}
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
config.cache_store = :null_store
|
||||
end
|
||||
end
|
||||
|
|
|
@ -48,7 +48,7 @@ Rails.application.configure do
|
|||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||
# config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
|
@ -119,4 +119,46 @@ Rails.application.configure do
|
|||
# Enable user registrations
|
||||
config.x.enable_user_registration =
|
||||
ENV['ENABLE_USER_REGISTRATION'] == 'false' ? false : true
|
||||
|
||||
# Use a different logger for distributed setups.
|
||||
# require 'syslog/logger'
|
||||
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
||||
|
||||
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
||||
logger = ActiveSupport::Logger.new(STDOUT)
|
||||
logger.formatter = config.log_formatter
|
||||
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
||||
end
|
||||
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment)
|
||||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_name_prefix = "scinote_#{Rails.env}"
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||
|
||||
# Mount Action Cable outside main process or domain
|
||||
# config.action_cable.mount_path = nil
|
||||
# config.action_cable.url = 'wss://example.com/cable'
|
||||
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
||||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||
|
||||
|
||||
# Attempt to read encrypted secrets from `config/secrets.yml.enc`.
|
||||
# Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
|
||||
# `config/secrets.yml.key`.
|
||||
config.read_encrypted_secrets = true
|
||||
end
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# Configure public file server for tests with Cache-Control for performance.
|
||||
config.public_file_server.enabled = true
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
|
||||
}
|
||||
|
||||
# Enable this to be able to output stuff to STDOUT during tests
|
||||
# via Rails::logger.info "..."
|
||||
config.logger = Logger.new(STDOUT)
|
||||
|
|
6
config/initializers/application_controller_renderer.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# ApplicationController.renderer.defaults.merge!(
|
||||
# http_host: 'example.org',
|
||||
# https: false
|
||||
# )
|
|
@ -3,12 +3,16 @@
|
|||
# Version of your assets, change this if you want to expire all your assets.
|
||||
Rails.application.config.assets.version = '1.0'
|
||||
|
||||
# Add additional assets to the asset load path
|
||||
# Add additional assets to the asset load path.
|
||||
# Rails.application.config.assets.paths << Emoji.images_path
|
||||
# Add Yarn node_modules folder to the asset load path.
|
||||
Rails.application.config.assets.paths << Rails.root.join('node_modules')
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js application.css, and all non-JS/CSS
|
||||
# in app/assets folder are already added.
|
||||
# application.js, application.css, and all non-JS/CSS in the app/assets
|
||||
# folder are already added.
|
||||
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|
||||
|
||||
Rails.application.config.assets.precompile += %w(underscore.js)
|
||||
Rails.application.config.assets.precompile += %w(jsPlumb-2.0.4-min.js)
|
||||
Rails.application.config.assets.precompile += %w(jsnetworkx.js)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Specify a serializer for the signed and encrypted cookie jars.
|
||||
# Valid options are :json, :marshal, and :hybrid.
|
||||
Rails.application.config.action_dispatch.cookies_serializer = :json
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Devise::Async.enabled = true
|
||||
Devise::Async.backend = :delayed_job
|
||||
Devise::Async.queue = :devise_email
|
||||
Devise::Async.priority = 10
|
||||
# Devise::Async.priority = 10
|
||||
|
|
14
config/initializers/new_framework_defaults_5_1.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file contains migration options to ease your Rails 5.1 upgrade.
|
||||
#
|
||||
# Once upgraded flip defaults one by one to migrate to the new default.
|
||||
#
|
||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||
|
||||
# Make `form_with` generate non-remote forms.
|
||||
Rails.application.config.action_view.form_with_generates_remote_forms = false
|
||||
|
||||
# Unknown asset fallback will return the path passed in when the given
|
||||
# asset is not present in the asset pipeline.
|
||||
# Rails.application.config.assets.unknown_asset_fallback = false
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
||||
wrap_parameters format: [:json]
|
||||
end
|
||||
|
||||
# To enable root element in JSON for ActiveRecord objects.
|
||||
# ActiveSupport.on_load(:active_record) do
|
||||
# self.include_root_in_json = true
|
||||
# self.include_root_in_json = true
|
||||
# end
|
||||
|
|
|
@ -910,8 +910,8 @@ en:
|
|||
column_create: "Create"
|
||||
columns_delete: "Delete"
|
||||
columns_visibility: "Visible columns"
|
||||
view_all_records: "View all records"
|
||||
view_assigned_records: "View assigned records"
|
||||
view_all_records: "View all items"
|
||||
view_assigned_records: "View assigned items"
|
||||
modal_delete_record:
|
||||
title: "Delete record"
|
||||
notice: "Are you sure you want to delete the selected records?"
|
||||
|
|
|
@ -13,3 +13,60 @@ on_worker_boot do
|
|||
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
|
||||
ActiveRecord::Base.establish_connection
|
||||
end
|
||||
|
||||
# Puma can serve each request in a thread from an internal thread pool.
|
||||
# The `threads` method setting takes two numbers: a minimum and maximum.
|
||||
# Any libraries that use thread pools should be configured to match
|
||||
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
||||
# and maximum; this matches the default thread size of Active Record.
|
||||
#
|
||||
# threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
||||
# threads threads_count, threads_count
|
||||
#
|
||||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
||||
#
|
||||
# port ENV.fetch("PORT") { 3000 }
|
||||
#
|
||||
# Specifies the `environment` that Puma will run in.
|
||||
#
|
||||
# environment ENV.fetch("RAILS_ENV") { "development" }
|
||||
|
||||
# Specifies the number of `workers` to boot in clustered mode.
|
||||
# Workers are forked webserver processes. If using threads and workers together
|
||||
# the concurrency of the application would be max `threads` * `workers`.
|
||||
# Workers do not work on JRuby or Windows (both of which do not support
|
||||
# processes).
|
||||
#
|
||||
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
||||
|
||||
# Use the `preload_app!` method when specifying a `workers` number.
|
||||
# This directive tells Puma to first boot the application and load code
|
||||
# before forking the application. This takes advantage of Copy On Write
|
||||
# process behavior so workers use less memory. If you use this option
|
||||
# you need to make sure to reconnect any threads in the `on_worker_boot`
|
||||
# block.
|
||||
#
|
||||
# preload_app!
|
||||
|
||||
# If you are preloading your application and using Active Record, it's
|
||||
# recommended that you close any connections to the database before workers
|
||||
# are forked to prevent connection leakage.
|
||||
#
|
||||
# before_fork do
|
||||
# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
|
||||
# end
|
||||
|
||||
# The code in the `on_worker_boot` will be called if you are using
|
||||
# clustered mode by specifying a number of `workers`. After each worker
|
||||
# process is booted, this block will be run. If you are using the `preload_app!`
|
||||
# option, you will want to use this block to reconnect to any threads
|
||||
# or connections that may have been created at application boot, as Ruby
|
||||
# cannot share connections between processes.
|
||||
#
|
||||
# on_worker_boot do
|
||||
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||
# end
|
||||
#
|
||||
|
||||
# Allow puma to be restarted by `rails restart` command.
|
||||
# plugin :tmp_restart
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Your secret key is used for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
# You can use `rails secret` to generate a secure secret key.
|
||||
|
||||
# Make sure the secrets in this file are kept private
|
||||
# if you're sharing your code publicly.
|
||||
|
||||
# Shared secrets are available across all environments.
|
||||
|
||||
# shared:
|
||||
# api_key: a1B2c3D4e5F6
|
||||
|
||||
# Environmental secrets are only available for that specific environment.
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
common: &common
|
||||
|
||||
# ======================================================================
|
||||
|
@ -39,10 +57,13 @@ common: &common
|
|||
# ======================================================================
|
||||
|
||||
development:
|
||||
secret_key_base: 22f2adf8f5cb73351da28f2292daa840cc2a414ae00ae605b175a8d5c73932f7e5b8ff8ef8f1554a7f1064f9869b15347f7709f0daa6ccb24c50f3cace304f64
|
||||
<<: *common
|
||||
|
||||
test:
|
||||
secret_key_base: f3719934e04fa8871cf5d33d5c60f05e1b8995e0315265aef9f8b878da49bd2d386eb25ce35545b469a94ccf22f91e0052b93a15194b4f57b0c8d6ce8b150e1e
|
||||
<<: *common
|
||||
|
||||
production:
|
||||
<<: *common
|
||||
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
||||
<<: *common
|
||||
|
|
6
config/spring.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
%w(
|
||||
.ruby-version
|
||||
.rbenv-vars
|
||||
tmp/restart.txt
|
||||
tmp/caching-dev.txt
|
||||
).each { |path| Spring.watch(path) }
|