factory_bot_instrumentation 2.9.0 → 3.0.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 +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +13 -0
- data/Makefile +7 -1
- data/Rakefile +19 -0
- data/app/assets/javascripts/factory_bot_instrumentation/application.js +454 -12
- data/app/assets/stylesheets/factory_bot_instrumentation/application.css +31 -33
- data/factory_bot_instrumentation.gemspec +8 -1
- data/lib/factory_bot/instrumentation/asset_bundler.rb +194 -0
- data/lib/factory_bot/instrumentation/engine.rb +24 -0
- data/lib/factory_bot/instrumentation/version.rb +1 -1
- data/lib/factory_bot/instrumentation.rb +3 -0
- metadata +2 -6
- data/app/assets/config/factory_bot_instrumentation_manifest.js +0 -2
- data/app/assets/javascripts/factory_bot_instrumentation/create.js +0 -134
- data/app/assets/javascripts/factory_bot_instrumentation/hooks.js +0 -123
- data/app/assets/javascripts/factory_bot_instrumentation/lib/form.js +0 -66
- data/app/assets/javascripts/factory_bot_instrumentation/lib/utils.js +0 -116
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
window.utils = Utils = {};
|
|
2
|
-
|
|
3
|
-
Utils.pushWaterfallPayload = function(data)
|
|
4
|
-
{
|
|
5
|
-
return (cb) => cb(null, data);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
Utils.waterfallWithHooks = function(opts, cb)
|
|
9
|
-
{
|
|
10
|
-
cb = cb || function(){};
|
|
11
|
-
opts = Object.assign({
|
|
12
|
-
pre: [],
|
|
13
|
-
post: [],
|
|
14
|
-
data: {},
|
|
15
|
-
action: (payload, cb) => cb(null, payload)
|
|
16
|
-
}, opts);
|
|
17
|
-
|
|
18
|
-
async.waterfall([
|
|
19
|
-
// Yield the data to pre hooks
|
|
20
|
-
Utils.pushWaterfallPayload(opts.data),
|
|
21
|
-
// Perform pre hooks
|
|
22
|
-
...opts.pre,
|
|
23
|
-
// Perform the create request
|
|
24
|
-
opts.action,
|
|
25
|
-
// Perform post hooks
|
|
26
|
-
...opts.post
|
|
27
|
-
], cb);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
Utils.request = function(opts, cb)
|
|
31
|
-
{
|
|
32
|
-
opts = Object.assign({
|
|
33
|
-
url: '/',
|
|
34
|
-
type: 'POST',
|
|
35
|
-
data: '{}',
|
|
36
|
-
dataType: 'json',
|
|
37
|
-
contentType: 'application/json; charset=utf-8',
|
|
38
|
-
ignoreErrors: false
|
|
39
|
-
}, opts || {}, {
|
|
40
|
-
success: (result) => cb(null, result)
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
errCb = (err) => cb(err);
|
|
44
|
-
if (opts.ignoreErrors) {
|
|
45
|
-
errCb = (err) => cb(null, err);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
$.ajax(opts).fail(errCb);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
Utils.escape = function(str)
|
|
52
|
-
{
|
|
53
|
-
return str.replace(/&/g, "&")
|
|
54
|
-
.replace(/</g, "<")
|
|
55
|
-
.replace(/>/g, ">");
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
Utils.prepareOutput = function(output)
|
|
59
|
-
{
|
|
60
|
-
try {
|
|
61
|
-
if (typeof output !== 'object') { output = JSON.parse(output); }
|
|
62
|
-
output = JSON.stringify(output, null, 2);
|
|
63
|
-
} catch { }
|
|
64
|
-
|
|
65
|
-
return window.utils.escape(output);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
Utils.clipboardButton = function(id)
|
|
69
|
-
{
|
|
70
|
-
id = id || 'data';
|
|
71
|
-
return `
|
|
72
|
-
<span class="btn btn-primary cb-copy"
|
|
73
|
-
data-clipboard-target="#${id}">
|
|
74
|
-
<i class="fas fa-paste"></i> Copy result to clipboard
|
|
75
|
-
</span>
|
|
76
|
-
`;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
Utils.clipboardBadge = function(id)
|
|
80
|
-
{
|
|
81
|
-
id = id || 'data';
|
|
82
|
-
return `
|
|
83
|
-
<span class="badge badge-dark cb-copy" title="Copy result to clipboard"
|
|
84
|
-
data-clipboard-target="#${id}"><i class="fas fa-paste"></i>
|
|
85
|
-
</span>
|
|
86
|
-
`;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
Utils.card = function(opts)
|
|
90
|
-
{
|
|
91
|
-
opts = Object.assign({
|
|
92
|
-
id: 'details',
|
|
93
|
-
icon: 'fa-asterisk',
|
|
94
|
-
title: 'Details',
|
|
95
|
-
body: ''
|
|
96
|
-
}, opts || {});
|
|
97
|
-
|
|
98
|
-
return `
|
|
99
|
-
<div class="card">
|
|
100
|
-
<div class="card-header">
|
|
101
|
-
<h5 class="mb-0">
|
|
102
|
-
<button class="btn btn-link collapsed" type="button"
|
|
103
|
-
data-toggle="collapse" data-target="#${opts.id}"
|
|
104
|
-
aria-expanded="false">
|
|
105
|
-
<i class="fas ${opts.icon}"></i> ${opts.title}</h5>
|
|
106
|
-
</button>
|
|
107
|
-
</h5>
|
|
108
|
-
</div>
|
|
109
|
-
<div id="${opts.id}" class="collapse" data-parent="#response">
|
|
110
|
-
<div class="card-body">
|
|
111
|
-
${opts.body}
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
`;
|
|
116
|
-
};
|