-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update engine name to samvera-persona
- Loading branch information
1 parent
f8fa4d5
commit b7241fe
Showing
26 changed files
with
128 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
app/controllers/concerns/samvera/persona/becomes_behavior.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Samvera | ||
module Persona | ||
module BecomesBehavior | ||
extend ActiveSupport::Concern | ||
included do | ||
impersonates :user | ||
end | ||
end | ||
end | ||
end |
10 changes: 10 additions & 0 deletions
10
app/controllers/concerns/samvera/persona/soft_delete_behavior.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Samvera | ||
module Persona | ||
module SoftDeleteBehavior | ||
extend ActiveSupport::Concern | ||
included do | ||
acts_as_paranoid | ||
end | ||
end | ||
end | ||
end |
26 changes: 26 additions & 0 deletions
26
app/controllers/concerns/samvera/persona/username_behavior.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module Samvera | ||
module Persona | ||
module SoftDeleteBehavior | ||
extend ActiveSupport::Concern | ||
included do | ||
before_create :check_for_manditory | ||
end | ||
|
||
def check_for_manditory | ||
if self.respond_to?(:username) | ||
if self.email.present? && self.username.blank? | ||
self.username = self.email | ||
end | ||
end | ||
|
||
if self.respond_to?(:uid) | ||
if self.email.present? && self.uid.blank? | ||
self.uid = self.email | ||
end | ||
end | ||
|
||
true | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
app/controllers/concerns/user_management/soft_delete_behavior.rb
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
app/controllers/concerns/user_management/username_behavior.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# requires all dependencies | ||
Gem.loaded_specs['samvera-persona'].dependencies.each do |d| | ||
require d.name unless d.type == :development | ||
end | ||
|
||
require "samvera-persona/engine" | ||
|
||
module Samvera | ||
module Persona | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
require 'rubygems' | ||
require 'paranoia' | ||
require 'pretender' | ||
|
||
module Samvera | ||
module Persona | ||
class Engine < ::Rails::Engine | ||
isolate_namespace Samvera::Persona | ||
|
||
initializer :append_migrations do |app| | ||
unless app.root.to_s.match root.to_s | ||
config.paths["db/migrate"].expanded.each do |expanded_path| | ||
app.config.paths["db/migrate"] << expanded_path | ||
end | ||
end | ||
end | ||
|
||
config.generators do |g| | ||
g.test_framework :rspec, :fixture => false | ||
g.fixture_replacement :factory_bot, :dir => 'spec/factories' | ||
g.assets false | ||
g.helper false | ||
end | ||
|
||
config.before_initialize do | ||
config.i18n.load_path += Dir["#{config.root}/config/locales/**/*.yml"] | ||
end | ||
|
||
config.after_initialize do | ||
my_engine_root = Samvera::Persona::Engine.root.to_s | ||
paths = ActionController::Base.view_paths.collect{|p| p.to_s} | ||
hyrax_path = paths.detect { |path| path.match('/hyrax-') } | ||
if hyrax_path | ||
paths = paths.insert(paths.index(hyrax_path), my_engine_root + '/app/views') | ||
else | ||
paths = paths.insert(0, my_engine_root + '/app/views') | ||
end | ||
ActionController::Base.view_paths = paths | ||
::ApplicationController.send :include, Samvera::Persona::BecomesBehavior | ||
::Devise::InvitationsController.define_method :after_invite_path_for do |_resource| | ||
admin_users_path | ||
end | ||
end | ||
|
||
config.to_prepare do | ||
User.send :include, Samvera::Persona::SoftDeleteBehavior | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Samvera | ||
module Persona | ||
VERSION = '0.1.0' | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
lib/tasks/user_management_tasks.rake → lib/tasks/samvera-persona.rake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# desc "Explaining what the task does" | ||
# task :samvera_persona do | ||
# task :samvera-persona do | ||
# # Task goes here | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
$:.push File.expand_path("../lib", __FILE__) | ||
|
||
# Maintain your gem's version: | ||
require "samvera_persona/version" | ||
require "samvera-persona/version" | ||
|
||
# Describe your gem and declare its dependencies: | ||
Gem::Specification.new do |s| | ||
s.name = "samvera_persona" | ||
s.version = SamveraPersona::VERSION | ||
s.name = "samvera-persona" | ||
s.version = Samvera::Persona::VERSION | ||
s.authors = ["Rob Kaufman", "Lea Ann Bradford"] | ||
s.email = ["[email protected]"] | ||
s.homepage = "https://gitlab.com/notch8/samvera-persona" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters