change_manager 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eaef00e1eb69b31268ab24e359ea02a343db52c6
4
- data.tar.gz: 66624dafb2f25dd2f1000dee0db38302ba065b16
3
+ metadata.gz: ea1e4209fecbde33ceccb43f2b03c220b87f6b4a
4
+ data.tar.gz: a1832f3f3e1dbabc4764ee1899c418265476359d
5
5
  SHA512:
6
- metadata.gz: 4c6e6dc30d5565d0a67b89ea76a31746f169700b7e7a1156526eb60c523e7d3e0c2eeced999e19f5a539ab60868bb93a4a141c381fdd342cd5f9d160cfeb67f4
7
- data.tar.gz: cc12a9ede04b38dedd74d274d3f83b7baad529e5c03703342496483cf2ec8a426e4603d9c9725c242f1f119a23bea8a852b82b4bf73789961dcf143651d30880
6
+ metadata.gz: bc8139bb9f8ba564a4f6f066844b66230d62f81d2e30777201dd78b8491752ecec77b3d86a3ef9b578c6eea40b237a6c3c557d2d495d1314322d7ae18da83b21
7
+ data.tar.gz: 7e09f3c776bd61c8437acb7b9da1173b6484055092d2920557f5d291c36fa85f23ae2f3e6a1f13dde1706a59f7b6b9d491d5e0bbeca3600ad7768042286e82b6
@@ -7,7 +7,7 @@ module ChangeManager
7
7
 
8
8
  def self.perform(change_id)
9
9
  puts 'job started'
10
- config ||= YAML.load_file(File.join(Curate::Engine.root, 'config/change_manager_config.yml'))
10
+ config ||= YAML.load_file(File.join(Rails.root, 'config/change_manager_config.yml'))
11
11
  config['manager_class'].constantize.process_change(change_id)
12
12
  end
13
13
  end
@@ -1,12 +1,14 @@
1
+ require 'yaml'
2
+
1
3
  module ChangeManager
2
4
  class NotificationMailer < ActionMailer::Base
3
-
5
+ CONFIG ||= YAML.load_file(File.join(Rails.root, 'config/change_manager_config.yml'))
4
6
  def construct_email(changes)
5
7
  @body = prepare_body(changes)
6
8
  mail(
7
9
  to: changes.first.target,
8
10
  from: changes.first.owner,
9
- subject: 'Updates from Scholar@UC',
11
+ subject: 'Recent Updates from ' + CONFIG['site_name'],
10
12
  )
11
13
  end
12
14
 
@@ -2,6 +2,7 @@ require 'yaml'
2
2
 
3
3
  module ChangeManager
4
4
  class Change < ActiveRecord::Base
5
+ include ComparisonConcern
5
6
  validates :change_type, :owner, :target, presence: true
6
7
 
7
8
  def self.new_change(owner, change_type, context, target, cancelled = false)
@@ -37,20 +38,8 @@ module ChangeManager
37
38
  self.notified
38
39
  end
39
40
 
40
- def is_group_change?
41
- self.change_type == 'added_to_group' || self.change_type == 'removed_from_group'
42
- end
43
-
44
- def is_delegate_change?
45
- self.change_type == 'added_as_delegate' || self.change_type == 'removed_as_delegate'
46
- end
47
-
48
- def is_editor_change?
49
- self.change_type == 'added_as_editor' || self.change_type == 'removed_as_editor'
50
- end
51
-
52
41
  def inverse_of?(possible_inverse_change)
53
- @change_types ||= YAML.load_file(File.join(ChangeManager::Engine.root, 'config/change_types.yaml'))
42
+ @change_types ||= YAML.load_file(File.join(ChangeManager::Engine.root, 'config/change_types.yml'))
54
43
  if self.context == possible_inverse_change.context
55
44
  self.change_type == @change_types[possible_inverse_change.change_type]['inverse']
56
45
  else
File without changes
@@ -1,3 +1,3 @@
1
1
  module ChangeManager
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1,5 @@
1
+ module ChangeManager
2
+ module ComparisonConcern
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ manager_class: LocalManager
2
+ site_name: Test App
@@ -0,0 +1,24 @@
1
+ added_as_delegate:
2
+ print: added_as_delegate
3
+ inverse: removed_as_delegate
4
+ human_readable: Added as a delegate
5
+ removed_as_delegate:
6
+ print: removed_as_delegate
7
+ inverse: added_as_delegate
8
+ human_readable: Removed as a delegate
9
+ added_as_editor:
10
+ print: added_as_editor
11
+ inverse: removed_as_editor
12
+ human_readable: Added as an editor
13
+ removed_as_editor:
14
+ print: removed_as_editor
15
+ inverse: added_as_editor
16
+ human_readable: Removed as an editor
17
+ added_to_group:
18
+ print: added_to_group
19
+ inverse: removed_from_group
20
+ human_readable: Added to a group
21
+ removed_from_group:
22
+ print: removed_from_group
23
+ inverse: added_to_group
24
+ human_readable: Removed from a group
Binary file
@@ -7,3 +7,80 @@ Migrating to CreateChangeManagerChanges (20160420192850)
7
7
   (1.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
8
8
   (0.1ms) SELECT version FROM "schema_migrations"
9
9
   (1.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20160420192850')
10
+  (1.5ms) CREATE TABLE "change_manager_changes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "change_type" varchar(255), "cancelled" boolean, "notified" datetime, "owner" varchar(255), "target" varchar(255), "context" varchar(255), "created_at" datetime, "updated_at" datetime) 
11
+  (1.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
12
+  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
13
+  (0.1ms) SELECT version FROM "schema_migrations"
14
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20160420192850')
15
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
16
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
17
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
18
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
19
+  (1.6ms) CREATE TABLE "change_manager_changes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "change_type" varchar(255), "cancelled" boolean, "notified" datetime, "owner" varchar(255), "target" varchar(255), "context" varchar(255), "created_at" datetime, "updated_at" datetime) 
20
+  (1.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
21
+  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
22
+  (0.1ms) SELECT version FROM "schema_migrations"
23
+  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20160420192850')
24
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
25
+  (1.9ms) DROP TABLE "change_manager_changes"
26
+  (1.0ms) CREATE TABLE "change_manager_changes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "change_type" varchar(255), "cancelled" boolean, "notified" datetime, "owner" varchar(255), "target" varchar(255), "context" varchar(255), "created_at" datetime, "updated_at" datetime)
27
+  (0.1ms) SELECT version FROM "schema_migrations"
28
+  (1.9ms) DROP TABLE "change_manager_changes"
29
+  (1.0ms) CREATE TABLE "change_manager_changes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "change_type" varchar(255), "cancelled" boolean, "notified" datetime, "owner" varchar(255), "target" varchar(255), "context" varchar(255), "created_at" datetime, "updated_at" datetime)
30
+  (0.1ms) SELECT version FROM "schema_migrations"
31
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
32
+  (1.8ms) DROP TABLE "change_manager_changes"
33
+  (1.1ms) CREATE TABLE "change_manager_changes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "change_type" varchar(255), "cancelled" boolean, "notified" datetime, "owner" varchar(255), "target" varchar(255), "context" varchar(255), "created_at" datetime, "updated_at" datetime)
34
+  (0.1ms) SELECT version FROM "schema_migrations"
35
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
36
+  (2.0ms) CREATE TABLE "change_manager_changes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "change_type" varchar(255), "cancelled" boolean, "notified" datetime, "owner" varchar(255), "target" varchar(255), "context" varchar(255), "created_at" datetime, "updated_at" datetime) 
37
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
38
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
39
+  (0.1ms) SELECT version FROM "schema_migrations"
40
+  (1.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20160420192850')
41
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
42
+  (2.0ms) DROP TABLE "change_manager_changes"
43
+  (1.0ms) CREATE TABLE "change_manager_changes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "change_type" varchar(255), "cancelled" boolean, "notified" datetime, "owner" varchar(255), "target" varchar(255), "context" varchar(255), "created_at" datetime, "updated_at" datetime)
44
+  (0.1ms) SELECT version FROM "schema_migrations"
45
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
46
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
47
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
48
+  (44.3ms) CREATE TABLE "change_manager_changes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "change_type" varchar(255), "cancelled" boolean, "notified" datetime, "owner" varchar(255), "target" varchar(255), "context" varchar(255), "created_at" datetime, "updated_at" datetime) 
49
+  (1.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
50
+  (1.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
51
+  (0.1ms) SELECT version FROM "schema_migrations"
52
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20160420192850')
53
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
54
+  (2.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
55
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
56
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
57
+ Migrating to CreateChangeManagerChanges (20160420192850)
58
+  (0.1ms) begin transaction
59
+  (0.4ms) CREATE TABLE "change_manager_changes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "change_type" varchar(255), "cancelled" boolean, "notified" datetime, "owner" varchar(255), "target" varchar(255), "context" varchar(255), "created_at" datetime, "updated_at" datetime) 
60
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160420192850"]]
61
+  (1.3ms) commit transaction
62
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
63
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
64
+  (1.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
65
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
66
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
67
+ Migrating to CreateChangeManagerChanges (20160420192850)
68
+  (0.0ms) begin transaction
69
+  (0.3ms) CREATE TABLE "change_manager_changes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "change_type" varchar(255), "cancelled" boolean, "notified" datetime, "owner" varchar(255), "target" varchar(255), "context" varchar(255), "created_at" datetime, "updated_at" datetime) 
70
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160420192850"]]
71
+  (2.4ms) commit transaction
72
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
73
+  (2.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
74
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
75
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
76
+ Migrating to CreateChangeManagerChanges (20160420192850)
77
+  (0.1ms) begin transaction
78
+  (0.4ms) CREATE TABLE "change_manager_changes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "change_type" varchar(255), "cancelled" boolean, "notified" datetime, "owner" varchar(255), "target" varchar(255), "context" varchar(255), "created_at" datetime, "updated_at" datetime) 
79
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160420192850"]]
80
+  (1.2ms) commit transaction
81
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
82
+  (2.4ms) CREATE TABLE "change_manager_changes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "change_type" varchar(255), "cancelled" boolean, "notified" datetime, "owner" varchar(255), "target" varchar(255), "context" varchar(255), "created_at" datetime, "updated_at" datetime) 
83
+  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
84
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
85
+  (0.1ms) SELECT version FROM "schema_migrations"
86
+  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20160420192850')