loggable_activity 0.2.1 → 0.5.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.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +29 -42
  3. data/.vscode/commands.json +2 -2
  4. data/.vscode/terminals.json +8 -8
  5. data/CHEAT_SHEET.md +31 -0
  6. data/MIT-LICENSE +21 -0
  7. data/README.md +31 -45
  8. data/Rakefile +6 -4
  9. data/app/assets/config/loggable_activity_manifest.js +4 -0
  10. data/app/assets/javascripts/loggable_activity/application.js +2 -0
  11. data/app/assets/stylesheets/loggable_activity/application.scss +20 -0
  12. data/app/controllers/concerns/.keep +0 -0
  13. data/app/controllers/loggable_activity/activities_controller.rb +12 -0
  14. data/app/controllers/loggable_activity/application_controller.rb +6 -0
  15. data/app/helpers/loggable_activity/activities_helper.rb +17 -0
  16. data/app/helpers/loggable_activity/application_helper.rb +6 -0
  17. data/app/jobs/loggable_activity/application_job.rb +6 -0
  18. data/app/mailers/loggable_activity/application_mailer.rb +8 -0
  19. data/app/models/loggable_activity/application_record.rb +7 -0
  20. data/app/views/kaminari/kaminari-turbo-bootstrap/_first_page.html.erb +14 -0
  21. data/app/views/kaminari/kaminari-turbo-bootstrap/_gap.html.erb +8 -0
  22. data/app/views/kaminari/kaminari-turbo-bootstrap/_last_page.html.erb +13 -0
  23. data/app/views/kaminari/kaminari-turbo-bootstrap/_next_page.html.erb +13 -0
  24. data/app/views/kaminari/kaminari-turbo-bootstrap/_page.html.erb +14 -0
  25. data/app/views/kaminari/kaminari-turbo-bootstrap/_paginator.html.erb +27 -0
  26. data/app/views/kaminari/kaminari-turbo-bootstrap/_prev_page.html.erb +14 -0
  27. data/app/views/layouts/loggable_activity/application.html.erb +19 -0
  28. data/app/views/loggable_activity/activities/_activities.html.erb +56 -0
  29. data/app/views/loggable_activity/activities/index.html.erb +7 -0
  30. data/app/views/loggable_activity/activities/show.html.erb +2 -0
  31. data/config/initializers/kaminari_config.rb +14 -0
  32. data/config/routes.rb +7 -0
  33. data/{lib/generators/loggable_activity/templates/create_loggable_activities.rb → db/migrate/20240702092648_create_loggable_activity_tables.rb} +18 -10
  34. data/git-org/HEAD +1 -0
  35. data/git-org/config +7 -0
  36. data/git-org/description +1 -0
  37. data/git-org/hooks/applypatch-msg.sample +15 -0
  38. data/git-org/hooks/commit-msg.sample +24 -0
  39. data/git-org/hooks/fsmonitor-watchman.sample +174 -0
  40. data/git-org/hooks/post-update.sample +8 -0
  41. data/git-org/hooks/pre-applypatch.sample +14 -0
  42. data/git-org/hooks/pre-commit.sample +49 -0
  43. data/git-org/hooks/pre-merge-commit.sample +13 -0
  44. data/git-org/hooks/pre-push.sample +53 -0
  45. data/git-org/hooks/pre-rebase.sample +169 -0
  46. data/git-org/hooks/pre-receive.sample +24 -0
  47. data/git-org/hooks/prepare-commit-msg.sample +42 -0
  48. data/git-org/hooks/push-to-checkout.sample +78 -0
  49. data/git-org/hooks/update.sample +128 -0
  50. data/git-org/info/exclude +6 -0
  51. data/lib/loggable_activity/activity.rb +3 -3
  52. data/lib/{schemas → loggable_activity}/config_schema.json +3 -3
  53. data/lib/loggable_activity/configuration.rb +51 -75
  54. data/lib/loggable_activity/data_owner.rb +0 -1
  55. data/lib/loggable_activity/encryption.rb +16 -7
  56. data/lib/loggable_activity/encryption_key.rb +4 -7
  57. data/lib/loggable_activity/engine.rb +27 -0
  58. data/lib/loggable_activity/error.rb +0 -10
  59. data/lib/loggable_activity/hooks.rb +10 -5
  60. data/lib/loggable_activity/payload.rb +8 -11
  61. data/lib/loggable_activity/sanitizer.rb +6 -2
  62. data/lib/loggable_activity/services/base_payloads_builder.rb +14 -5
  63. data/lib/loggable_activity/services/destroy_payloads_builder.rb +2 -1
  64. data/lib/loggable_activity/services/payloads_builder.rb +9 -2
  65. data/lib/loggable_activity/services/update_payloads_builder.rb +30 -2
  66. data/lib/loggable_activity/version.rb +1 -1
  67. data/lib/loggable_activity.rb +51 -14
  68. data/lib/tasks/loggable_activity_tasks.rake +6 -0
  69. metadata +129 -117
  70. data/.document +0 -1
  71. data/.nojekyll +0 -1
  72. data/.rspec +0 -3
  73. data/CONSIDERTIONS.md +0 -129
  74. data/GETTING-STARTED.md +0 -119
  75. data/LICENSE.txt +0 -21
  76. data/PAYLOAD_EXAMPLE.md +0 -63
  77. data/ROADMAP.md +0 -23
  78. data/docs/LoggableActivity/Activity.html +0 -555
  79. data/docs/LoggableActivity/Configuration.html +0 -330
  80. data/docs/LoggableActivity/ConfigurationError.html +0 -148
  81. data/docs/LoggableActivity/DataOwner.html +0 -138
  82. data/docs/LoggableActivity/Encryption.html +0 -234
  83. data/docs/LoggableActivity/EncryptionError.html +0 -145
  84. data/docs/LoggableActivity/EncryptionKey.html +0 -351
  85. data/docs/LoggableActivity/Error.html +0 -145
  86. data/docs/LoggableActivity/Hooks.html +0 -759
  87. data/docs/LoggableActivity/Payload.html +0 -432
  88. data/docs/LoggableActivity/Services/BasePayloadsBuilder.html +0 -442
  89. data/docs/LoggableActivity/Services/DestroyPayloadsBuilder.html +0 -395
  90. data/docs/LoggableActivity/Services/PayloadsBuilder.html +0 -342
  91. data/docs/LoggableActivity/Services/UpdatePayloadsBuilder.html +0 -490
  92. data/docs/LoggableActivity/Services.html +0 -93
  93. data/docs/LoggableActivity.html +0 -102
  94. data/docs/created.rid +0 -14
  95. data/docs/css/fonts.css +0 -167
  96. data/docs/css/rdoc.css +0 -687
  97. data/docs/fonts/Lato-Light.ttf +0 -0
  98. data/docs/fonts/Lato-LightItalic.ttf +0 -0
  99. data/docs/fonts/Lato-Regular.ttf +0 -0
  100. data/docs/fonts/Lato-RegularItalic.ttf +0 -0
  101. data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
  102. data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
  103. data/docs/images/add.png +0 -0
  104. data/docs/images/arrow_up.png +0 -0
  105. data/docs/images/brick.png +0 -0
  106. data/docs/images/brick_link.png +0 -0
  107. data/docs/images/bug.png +0 -0
  108. data/docs/images/bullet_black.png +0 -0
  109. data/docs/images/bullet_toggle_minus.png +0 -0
  110. data/docs/images/bullet_toggle_plus.png +0 -0
  111. data/docs/images/date.png +0 -0
  112. data/docs/images/delete.png +0 -0
  113. data/docs/images/find.png +0 -0
  114. data/docs/images/loadingAnimation.gif +0 -0
  115. data/docs/images/macFFBgHack.png +0 -0
  116. data/docs/images/package.png +0 -0
  117. data/docs/images/page_green.png +0 -0
  118. data/docs/images/page_white_text.png +0 -0
  119. data/docs/images/page_white_width.png +0 -0
  120. data/docs/images/plugin.png +0 -0
  121. data/docs/images/ruby.png +0 -0
  122. data/docs/images/tag_blue.png +0 -0
  123. data/docs/images/tag_green.png +0 -0
  124. data/docs/images/transparent.png +0 -0
  125. data/docs/images/wrench.png +0 -0
  126. data/docs/images/wrench_orange.png +0 -0
  127. data/docs/images/zoom.png +0 -0
  128. data/docs/index.html +0 -99
  129. data/docs/js/darkfish.js +0 -97
  130. data/docs/js/navigation.js +0 -105
  131. data/docs/js/navigation.js.gz +0 -0
  132. data/docs/js/search.js +0 -110
  133. data/docs/js/search_index.js +0 -1
  134. data/docs/js/search_index.js.gz +0 -0
  135. data/docs/js/searcher.js +0 -229
  136. data/docs/js/searcher.js.gz +0 -0
  137. data/docs/table_of_contents.html +0 -617
  138. data/help/loggable_activity_help.txt +0 -19
  139. data/lib/generators/.DS_Store +0 -0
  140. data/lib/generators/loggable_activity/.DS_Store +0 -0
  141. data/lib/generators/loggable_activity/install_generator.rb +0 -109
  142. data/lib/generators/loggable_activity/templates/.DS_Store +0 -0
  143. data/lib/generators/loggable_activity/templates/binary_ids/create_loggable_activities.rb +0 -30
  144. data/lib/generators/loggable_activity/templates/config/locales/loggable_activity.en.yml +0 -36
  145. data/lib/generators/loggable_activity/templates/config/loggable_activity.yaml +0 -29
  146. data/lib/generators/loggable_activity/templates/loggable_activity.en.yaml +0 -36
  147. data/pkg/loggable_activity-0.1.35.gem +0 -0
  148. data/sig/loggable_activity.rbs +0 -4
  149. /data/{.rspec_status → app/assets/images/loggable_activity/.keep} +0 -0
  150. /data/lib/{generators/loggable_activity/templates → loggable_activity/concerns}/current_user.rb +0 -0
data/docs/js/searcher.js DELETED
@@ -1,229 +0,0 @@
1
- Searcher = function(data) {
2
- this.data = data;
3
- this.handlers = [];
4
- }
5
-
6
- Searcher.prototype = new function() {
7
- // search is performed in chunks of 1000 for non-blocking user input
8
- var CHUNK_SIZE = 1000;
9
- // do not try to find more than 100 results
10
- var MAX_RESULTS = 100;
11
- var huid = 1;
12
- var suid = 1;
13
- var runs = 0;
14
-
15
- this.find = function(query) {
16
- var queries = splitQuery(query);
17
- var regexps = buildRegexps(queries);
18
- var highlighters = buildHilighters(queries);
19
- var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++};
20
- var _this = this;
21
-
22
- this.currentSuid = state.n;
23
-
24
- if (!query) return;
25
-
26
- var run = function() {
27
- // stop current search thread if new search started
28
- if (state.n != _this.currentSuid) return;
29
-
30
- var results =
31
- performSearch(_this.data, regexps, queries, highlighters, state);
32
- var hasMore = (state.limit > 0 && state.pass < 4);
33
-
34
- triggerResults.call(_this, results, !hasMore);
35
- if (hasMore) {
36
- setTimeout(run, 2);
37
- }
38
- runs++;
39
- };
40
- runs = 0;
41
-
42
- // start search thread
43
- run();
44
- }
45
-
46
- /* ----- Events ------ */
47
- this.ready = function(fn) {
48
- fn.huid = huid;
49
- this.handlers.push(fn);
50
- }
51
-
52
- /* ----- Utilities ------ */
53
- function splitQuery(query) {
54
- return query.split(/(\s+|::?|\(\)?)/).filter(function(string) {
55
- return string.match(/\S/);
56
- });
57
- }
58
-
59
- function buildRegexps(queries) {
60
- return queries.map(function(query) {
61
- return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i');
62
- });
63
- }
64
-
65
- function buildHilighters(queries) {
66
- return queries.map(function(query) {
67
- return query.split('').map(function(l, i) {
68
- return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
69
- }).join('');
70
- });
71
- }
72
-
73
- // function longMatchRegexp(index, longIndex, regexps) {
74
- // for (var i = regexps.length - 1; i >= 0; i--){
75
- // if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
76
- // };
77
- // return true;
78
- // }
79
-
80
-
81
- /* ----- Mathchers ------ */
82
-
83
- /*
84
- * This record matches if the index starts with queries[0] and the record
85
- * matches all of the regexps
86
- */
87
- function matchPassBeginning(index, longIndex, queries, regexps) {
88
- if (index.indexOf(queries[0]) != 0) return false;
89
- for (var i=1, l = regexps.length; i < l; i++) {
90
- if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
91
- return false;
92
- };
93
- return true;
94
- }
95
-
96
- /*
97
- * This record matches if the longIndex starts with queries[0] and the
98
- * longIndex matches all of the regexps
99
- */
100
- function matchPassLongIndex(index, longIndex, queries, regexps) {
101
- if (longIndex.indexOf(queries[0]) != 0) return false;
102
- for (var i=1, l = regexps.length; i < l; i++) {
103
- if (!longIndex.match(regexps[i]))
104
- return false;
105
- };
106
- return true;
107
- }
108
-
109
- /*
110
- * This record matches if the index contains queries[0] and the record
111
- * matches all of the regexps
112
- */
113
- function matchPassContains(index, longIndex, queries, regexps) {
114
- if (index.indexOf(queries[0]) == -1) return false;
115
- for (var i=1, l = regexps.length; i < l; i++) {
116
- if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
117
- return false;
118
- };
119
- return true;
120
- }
121
-
122
- /*
123
- * This record matches if regexps[0] matches the index and the record
124
- * matches all of the regexps
125
- */
126
- function matchPassRegexp(index, longIndex, queries, regexps) {
127
- if (!index.match(regexps[0])) return false;
128
- for (var i=1, l = regexps.length; i < l; i++) {
129
- if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
130
- return false;
131
- };
132
- return true;
133
- }
134
-
135
-
136
- /* ----- Highlighters ------ */
137
- function highlightRegexp(info, queries, regexps, highlighters) {
138
- var result = createResult(info);
139
- for (var i=0, l = regexps.length; i < l; i++) {
140
- result.title = result.title.replace(regexps[i], highlighters[i]);
141
- result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
142
- };
143
- return result;
144
- }
145
-
146
- function hltSubstring(string, pos, length) {
147
- return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
148
- }
149
-
150
- function highlightQuery(info, queries, regexps, highlighters) {
151
- var result = createResult(info);
152
- var pos = 0;
153
- var lcTitle = result.title.toLowerCase();
154
-
155
- pos = lcTitle.indexOf(queries[0]);
156
- if (pos != -1) {
157
- result.title = hltSubstring(result.title, pos, queries[0].length);
158
- }
159
-
160
- result.namespace = result.namespace.replace(regexps[0], highlighters[0]);
161
- for (var i=1, l = regexps.length; i < l; i++) {
162
- result.title = result.title.replace(regexps[i], highlighters[i]);
163
- result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
164
- };
165
- return result;
166
- }
167
-
168
- function createResult(info) {
169
- var result = {};
170
- result.title = info[0];
171
- result.namespace = info[1];
172
- result.path = info[2];
173
- result.params = info[3];
174
- result.snippet = info[4];
175
- result.badge = info[6];
176
- return result;
177
- }
178
-
179
- /* ----- Searching ------ */
180
- function performSearch(data, regexps, queries, highlighters, state) {
181
- var searchIndex = data.searchIndex;
182
- var longSearchIndex = data.longSearchIndex;
183
- var info = data.info;
184
- var result = [];
185
- var i = state.from;
186
- var l = searchIndex.length;
187
- var togo = CHUNK_SIZE;
188
- var matchFunc, hltFunc;
189
-
190
- while (state.pass < 4 && state.limit > 0 && togo > 0) {
191
- if (state.pass == 0) {
192
- matchFunc = matchPassBeginning;
193
- hltFunc = highlightQuery;
194
- } else if (state.pass == 1) {
195
- matchFunc = matchPassLongIndex;
196
- hltFunc = highlightQuery;
197
- } else if (state.pass == 2) {
198
- matchFunc = matchPassContains;
199
- hltFunc = highlightQuery;
200
- } else if (state.pass == 3) {
201
- matchFunc = matchPassRegexp;
202
- hltFunc = highlightRegexp;
203
- }
204
-
205
- for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
206
- if (info[i].n == state.n) continue;
207
- if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
208
- info[i].n = state.n;
209
- result.push(hltFunc(info[i], queries, regexps, highlighters));
210
- state.limit--;
211
- }
212
- };
213
- if (searchIndex.length <= i) {
214
- state.pass++;
215
- i = state.from = 0;
216
- } else {
217
- state.from = i;
218
- }
219
- }
220
- return result;
221
- }
222
-
223
- function triggerResults(results, isLast) {
224
- this.handlers.forEach(function(fn) {
225
- fn.call(this, results, isLast)
226
- });
227
- }
228
- }
229
-
Binary file