trusty-cms 4.1.5 → 4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +122 -115
  3. data/INSTALL.md +2 -0
  4. data/app/views/admin/assets/edit.html.haml +3 -0
  5. data/config/environments/development.rb +2 -0
  6. data/config/locales/en.yml +1 -0
  7. data/lib/generators/extension/USAGE +30 -0
  8. data/lib/generators/extension/extension_generator.rb +97 -0
  9. data/lib/generators/extension/templates/README.md +6 -0
  10. data/lib/generators/extension/templates/RSpecRakefile +109 -0
  11. data/lib/generators/extension/templates/Rakefile +25 -0
  12. data/lib/generators/extension/templates/cucumber.yml +1 -0
  13. data/lib/generators/extension/templates/cucumber_env.rb +11 -0
  14. data/lib/generators/extension/templates/cucumber_paths.rb +22 -0
  15. data/lib/generators/extension/templates/en.yml +3 -0
  16. data/lib/generators/extension/templates/extension.rb +21 -0
  17. data/lib/generators/extension/templates/functional_test.rb +15 -0
  18. data/lib/generators/extension/templates/gemspec.rb +29 -0
  19. data/lib/generators/extension/templates/lib.rb +8 -0
  20. data/lib/generators/extension/templates/migration.rb +9 -0
  21. data/lib/generators/extension/templates/radiant_config.rb +3 -0
  22. data/lib/generators/extension/templates/routes.rb +5 -0
  23. data/lib/generators/extension/templates/spec.opts +6 -0
  24. data/lib/generators/extension/templates/spec_helper.rb +42 -0
  25. data/lib/generators/extension/templates/tasks.rake +47 -0
  26. data/lib/generators/extension/templates/test_helper.rb +26 -0
  27. data/lib/generators/extension_controller/USAGE +36 -0
  28. data/lib/generators/extension_controller/extension_controller_generator.rb +84 -0
  29. data/lib/generators/extension_controller/templates/controller.rb +10 -0
  30. data/lib/generators/extension_controller/templates/controller_spec.rb +23 -0
  31. data/lib/generators/extension_controller/templates/functional_test.rb +11 -0
  32. data/lib/generators/extension_controller/templates/helper.rb +2 -0
  33. data/lib/generators/extension_controller/templates/helper_spec.rb +11 -0
  34. data/lib/generators/extension_controller/templates/helper_test.rb +4 -0
  35. data/lib/generators/extension_controller/templates/view.html.erb +2 -0
  36. data/lib/generators/extension_controller/templates/view_spec.rb +12 -0
  37. data/lib/generators/extension_mailer/USAGE +17 -0
  38. data/lib/generators/extension_mailer/extension_mailer_generator.rb +68 -0
  39. data/lib/generators/extension_mailer/templates/fixture.erb +3 -0
  40. data/lib/generators/extension_mailer/templates/mailer.rb +15 -0
  41. data/lib/generators/extension_mailer/templates/unit_test.rb +21 -0
  42. data/lib/generators/extension_mailer/templates/view.erb +3 -0
  43. data/lib/generators/extension_migration/USAGE +34 -0
  44. data/lib/generators/extension_migration/extension_migration_generator.rb +25 -0
  45. data/lib/generators/extension_migration/templates/migration.rb +11 -0
  46. data/lib/generators/extension_model/USAGE +35 -0
  47. data/lib/generators/extension_model/extension_model_generator.rb +68 -0
  48. data/lib/generators/extension_model/templates/fixtures.yml +19 -0
  49. data/lib/generators/extension_model/templates/migration.rb +16 -0
  50. data/lib/generators/extension_model/templates/model.rb +2 -0
  51. data/lib/generators/extension_model/templates/model_spec.rb +11 -0
  52. data/lib/generators/extension_model/templates/unit_test.rb +8 -0
  53. data/lib/generators/generator_base_extension.rb +18 -0
  54. data/lib/generators/instance/instance_generator.rb +148 -0
  55. data/lib/generators/instance/templates/databases/db2.yml +40 -0
  56. data/lib/generators/instance/templates/databases/mysql.yml +47 -0
  57. data/lib/generators/instance/templates/databases/postgresql.yml +44 -0
  58. data/lib/generators/instance/templates/databases/sqlite3.yml +16 -0
  59. data/lib/generators/instance/templates/databases/sqlserver.yml +21 -0
  60. data/lib/generators/instance/templates/instance_boot.rb +122 -0
  61. data/lib/generators/instance/templates/instance_config.ru +2 -0
  62. data/lib/generators/instance/templates/instance_environment.rb +93 -0
  63. data/lib/generators/instance/templates/instance_gemfile +78 -0
  64. data/lib/generators/instance/templates/instance_generate +6 -0
  65. data/lib/generators/instance/templates/instance_radiant_config.rb +16 -0
  66. data/lib/generators/instance/templates/instance_rakefile +3 -0
  67. data/lib/generators/instance/templates/instance_routes.rb +1 -0
  68. data/lib/generators/language_extension/USAGE +27 -0
  69. data/lib/generators/language_extension/language_extension_generator.rb +71 -0
  70. data/lib/generators/language_extension/templates/README +3 -0
  71. data/lib/generators/language_extension/templates/RSpecRakefile +123 -0
  72. data/lib/generators/language_extension/templates/Rakefile +25 -0
  73. data/lib/generators/language_extension/templates/available_tags.yml +553 -0
  74. data/lib/generators/language_extension/templates/cucumber.yml +1 -0
  75. data/lib/generators/language_extension/templates/cucumber_env.rb +16 -0
  76. data/lib/generators/language_extension/templates/cucumber_paths.rb +14 -0
  77. data/lib/generators/language_extension/templates/extension.rb +12 -0
  78. data/lib/generators/language_extension/templates/functional_test.rb +15 -0
  79. data/lib/generators/language_extension/templates/gemspec.rb +24 -0
  80. data/lib/generators/language_extension/templates/lang.yml +181 -0
  81. data/lib/generators/language_extension/templates/lib.rb +8 -0
  82. data/lib/generators/language_extension/templates/spec.opts +6 -0
  83. data/lib/generators/language_extension/templates/spec_helper.rb +36 -0
  84. data/lib/generators/language_extension/templates/tasks.rake +28 -0
  85. data/lib/generators/language_extension/templates/test_helper.rb +26 -0
  86. data/lib/generators/trusty_cms/USAGE +8 -0
  87. data/lib/generators/trusty_cms/templates/Rakefile.erb +7 -0
  88. data/lib/generators/trusty_cms/templates/application.rb.erb +149 -0
  89. data/lib/generators/trusty_cms/templates/boot.rb.erb +9 -0
  90. data/lib/generators/trusty_cms/templates/config.ru.erb +4 -0
  91. data/lib/generators/trusty_cms/templates/database.yml.erb +28 -0
  92. data/lib/generators/trusty_cms/templates/environment.rb.erb +5 -0
  93. data/lib/generators/trusty_cms/templates/environments/development.rb.erb +24 -0
  94. data/lib/generators/trusty_cms/templates/environments/production.rb.erb +26 -0
  95. data/lib/generators/trusty_cms/templates/environments/test.rb.erb +35 -0
  96. data/lib/generators/trusty_cms/templates/initializers/secret_token.rb.erb +13 -0
  97. data/lib/generators/trusty_cms/templates/initializers/session_store.rb.erb +8 -0
  98. data/lib/generators/trusty_cms/templates/initializers/trusty_cms_config.rb.erb +16 -0
  99. data/lib/generators/trusty_cms/templates/preinitializer.rb.erb +18 -0
  100. data/lib/generators/trusty_cms/templates/routes.rb.erb +0 -0
  101. data/lib/generators/trusty_cms/trusty_cms_generator.rb +32 -0
  102. data/lib/trusty_cms.rb +1 -1
  103. data/lib/trusty_cms/setup.rb +7 -7
  104. data/trusty_cms.gemspec +4 -4
  105. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/base.rb +195 -0
  106. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/check_box.rb +65 -0
  107. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/checkable.rb +18 -0
  108. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_check_boxes.rb +35 -0
  109. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_helpers.rb +118 -0
  110. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_radio_buttons.rb +30 -0
  111. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_select.rb +30 -0
  112. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/color_field.rb +26 -0
  113. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/date_field.rb +14 -0
  114. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/date_select.rb +73 -0
  115. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_field.rb +31 -0
  116. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_local_field.rb +20 -0
  117. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_select.rb +10 -0
  118. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/email_field.rb +10 -0
  119. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/file_field.rb +10 -0
  120. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/grouped_collection_select.rb +31 -0
  121. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/hidden_field.rb +10 -0
  122. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/label.rb +80 -0
  123. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/month_field.rb +14 -0
  124. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/number_field.rb +20 -0
  125. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/password_field.rb +14 -0
  126. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/placeholderable.rb +24 -0
  127. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/radio_button.rb +32 -0
  128. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/range_field.rb +10 -0
  129. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/search_field.rb +27 -0
  130. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/select.rb +42 -0
  131. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/tel_field.rb +10 -0
  132. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/text_area.rb +24 -0
  133. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/text_field.rb +33 -0
  134. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_field.rb +14 -0
  135. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_select.rb +10 -0
  136. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_zone_select.rb +22 -0
  137. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/translator.rb +39 -0
  138. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/url_field.rb +10 -0
  139. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/week_field.rb +14 -0
  140. data/yarn.lock +3 -3
  141. metadata +296 -71
  142. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/core.js +0 -126
  143. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/index.js +0 -4
  144. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/map.js +0 -56
  145. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/seq.js +0 -43
  146. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/string.js +0 -28
  147. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/index.js +0 -36
  148. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/json.js +0 -76
  149. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/options.js +0 -23
  150. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/binary.js +0 -87
  151. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/index.js +0 -157
  152. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/omap.js +0 -142
  153. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/pairs.js +0 -81
  154. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/set.js +0 -114
  155. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/timestamp.js +0 -97
  156. data/spec/spec/dummy/node_modules/yaml/dist/tags/core.js +0 -114
  157. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/index.js +0 -17
  158. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/map.js +0 -37
  159. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/seq.js +0 -34
  160. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/string.js +0 -40
  161. data/spec/spec/dummy/node_modules/yaml/dist/tags/index.js +0 -62
  162. data/spec/spec/dummy/node_modules/yaml/dist/tags/json.js +0 -60
  163. data/spec/spec/dummy/node_modules/yaml/dist/tags/options.js +0 -35
  164. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/binary.js +0 -97
  165. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/index.js +0 -131
  166. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/omap.js +0 -105
  167. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/pairs.js +0 -80
  168. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/set.js +0 -91
  169. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/timestamp.js +0 -93
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.strOptions = exports.nullOptions = exports.boolOptions = exports.binaryOptions = void 0;
7
-
8
- var _constants = require("../constants");
9
-
10
- const binaryOptions = {
11
- defaultType: _constants.Type.BLOCK_LITERAL,
12
- lineWidth: 76
13
- };
14
- exports.binaryOptions = binaryOptions;
15
- const boolOptions = {
16
- trueStr: 'true',
17
- falseStr: 'false'
18
- };
19
- exports.boolOptions = boolOptions;
20
- const nullOptions = {
21
- nullStr: 'null'
22
- };
23
- exports.nullOptions = nullOptions;
24
- const strOptions = {
25
- defaultType: _constants.Type.PLAIN,
26
- doubleQuoted: {
27
- jsonEncoding: false,
28
- minMultiLineLength: 40
29
- },
30
- fold: {
31
- lineWidth: 80,
32
- minContentWidth: 20
33
- }
34
- };
35
- exports.strOptions = strOptions;
@@ -1,97 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _constants = require("../../constants");
9
-
10
- var _errors = require("../../errors");
11
-
12
- var _stringify = require("../../stringify");
13
-
14
- var _string = require("../failsafe/string");
15
-
16
- var _options = require("../options");
17
-
18
- /* global atob, btoa, Buffer */
19
- var _default = {
20
- identify: value => value instanceof Uint8Array,
21
- // Buffer inherits from Uint8Array
22
- default: false,
23
- tag: 'tag:yaml.org,2002:binary',
24
-
25
- /**
26
- * Returns a Buffer in node and an Uint8Array in browsers
27
- *
28
- * To use the resulting buffer as an image, you'll want to do something like:
29
- *
30
- * const blob = new Blob([buffer], { type: 'image/jpeg' })
31
- * document.querySelector('#photo').src = URL.createObjectURL(blob)
32
- */
33
- resolve: (doc, node) => {
34
- const src = (0, _string.resolveString)(doc, node);
35
-
36
- if (typeof Buffer === 'function') {
37
- return Buffer.from(src, 'base64');
38
- } else if (typeof atob === 'function') {
39
- // On IE 11, atob() can't handle newlines
40
- const str = atob(src.replace(/[\n\r]/g, ''));
41
- const buffer = new Uint8Array(str.length);
42
-
43
- for (let i = 0; i < str.length; ++i) buffer[i] = str.charCodeAt(i);
44
-
45
- return buffer;
46
- } else {
47
- const msg = 'This environment does not support reading binary tags; either Buffer or atob is required';
48
- doc.errors.push(new _errors.YAMLReferenceError(node, msg));
49
- return null;
50
- }
51
- },
52
- options: _options.binaryOptions,
53
- stringify: ({
54
- comment,
55
- type,
56
- value
57
- }, ctx, onComment, onChompKeep) => {
58
- let src;
59
-
60
- if (typeof Buffer === 'function') {
61
- src = value instanceof Buffer ? value.toString('base64') : Buffer.from(value.buffer).toString('base64');
62
- } else if (typeof btoa === 'function') {
63
- let s = '';
64
-
65
- for (let i = 0; i < value.length; ++i) s += String.fromCharCode(value[i]);
66
-
67
- src = btoa(s);
68
- } else {
69
- throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
70
- }
71
-
72
- if (!type) type = _options.binaryOptions.defaultType;
73
-
74
- if (type === _constants.Type.QUOTE_DOUBLE) {
75
- value = src;
76
- } else {
77
- const {
78
- lineWidth
79
- } = _options.binaryOptions;
80
- const n = Math.ceil(src.length / lineWidth);
81
- const lines = new Array(n);
82
-
83
- for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
84
- lines[i] = src.substr(o, lineWidth);
85
- }
86
-
87
- value = lines.join(type === _constants.Type.BLOCK_LITERAL ? '\n' : ' ');
88
- }
89
-
90
- return (0, _stringify.stringifyString)({
91
- comment,
92
- type,
93
- value
94
- }, ctx, onComment, onChompKeep);
95
- }
96
- };
97
- exports.default = _default;
@@ -1,131 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _Scalar = _interopRequireDefault(require("../../schema/Scalar"));
9
-
10
- var _stringify = require("../../stringify");
11
-
12
- var _failsafe = _interopRequireDefault(require("../failsafe"));
13
-
14
- var _options = require("../options");
15
-
16
- var _binary = _interopRequireDefault(require("./binary"));
17
-
18
- var _omap = _interopRequireDefault(require("./omap"));
19
-
20
- var _pairs = _interopRequireDefault(require("./pairs"));
21
-
22
- var _set = _interopRequireDefault(require("./set"));
23
-
24
- var _timestamp = require("./timestamp");
25
-
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
- const boolStringify = ({
29
- value
30
- }) => value ? _options.boolOptions.trueStr : _options.boolOptions.falseStr;
31
-
32
- var _default = _failsafe.default.concat([{
33
- identify: value => value == null,
34
- createNode: (schema, value, ctx) => ctx.wrapScalars ? new _Scalar.default(null) : null,
35
- default: true,
36
- tag: 'tag:yaml.org,2002:null',
37
- test: /^(?:~|[Nn]ull|NULL)?$/,
38
- resolve: () => null,
39
- options: _options.nullOptions,
40
- stringify: () => _options.nullOptions.nullStr
41
- }, {
42
- identify: value => typeof value === 'boolean',
43
- default: true,
44
- tag: 'tag:yaml.org,2002:bool',
45
- test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
46
- resolve: () => true,
47
- options: _options.boolOptions,
48
- stringify: boolStringify
49
- }, {
50
- identify: value => typeof value === 'boolean',
51
- default: true,
52
- tag: 'tag:yaml.org,2002:bool',
53
- test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
54
- resolve: () => false,
55
- options: _options.boolOptions,
56
- stringify: boolStringify
57
- }, {
58
- identify: value => typeof value === 'number',
59
- default: true,
60
- tag: 'tag:yaml.org,2002:int',
61
- format: 'BIN',
62
- test: /^0b([0-1_]+)$/,
63
- resolve: (str, bin) => parseInt(bin.replace(/_/g, ''), 2),
64
- stringify: ({
65
- value
66
- }) => '0b' + value.toString(2)
67
- }, {
68
- identify: value => typeof value === 'number',
69
- default: true,
70
- tag: 'tag:yaml.org,2002:int',
71
- format: 'OCT',
72
- test: /^[-+]?0([0-7_]+)$/,
73
- resolve: (str, oct) => parseInt(oct.replace(/_/g, ''), 8),
74
- stringify: ({
75
- value
76
- }) => (value < 0 ? '-0' : '0') + value.toString(8)
77
- }, {
78
- identify: value => typeof value === 'number',
79
- default: true,
80
- tag: 'tag:yaml.org,2002:int',
81
- test: /^[-+]?[0-9][0-9_]*$/,
82
- resolve: str => parseInt(str.replace(/_/g, ''), 10),
83
- stringify: _stringify.stringifyNumber
84
- }, {
85
- identify: value => typeof value === 'number',
86
- default: true,
87
- tag: 'tag:yaml.org,2002:int',
88
- format: 'HEX',
89
- test: /^0x([0-9a-fA-F_]+)$/,
90
- resolve: (str, hex) => parseInt(hex.replace(/_/g, ''), 16),
91
- stringify: ({
92
- value
93
- }) => (value < 0 ? '-0x' : '0x') + value.toString(16)
94
- }, {
95
- identify: value => typeof value === 'number',
96
- default: true,
97
- tag: 'tag:yaml.org,2002:float',
98
- test: /^(?:[-+]?\.inf|(\.nan))$/i,
99
- resolve: (str, nan) => nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
100
- stringify: _stringify.stringifyNumber
101
- }, {
102
- identify: value => typeof value === 'number',
103
- default: true,
104
- tag: 'tag:yaml.org,2002:float',
105
- format: 'EXP',
106
- test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/,
107
- resolve: str => parseFloat(str.replace(/_/g, '')),
108
- stringify: ({
109
- value
110
- }) => Number(value).toExponential()
111
- }, {
112
- identify: value => typeof value === 'number',
113
- default: true,
114
- tag: 'tag:yaml.org,2002:float',
115
- test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/,
116
-
117
- resolve(str, frac) {
118
- const node = new _Scalar.default(parseFloat(str.replace(/_/g, '')));
119
-
120
- if (frac) {
121
- const f = frac.replace(/_/g, '');
122
- if (f[f.length - 1] === '0') node.minFractionDigits = f.length;
123
- }
124
-
125
- return node;
126
- },
127
-
128
- stringify: _stringify.stringifyNumber
129
- }], _binary.default, _omap.default, _pairs.default, _set.default, _timestamp.intTime, _timestamp.floatTime, _timestamp.timestamp);
130
-
131
- exports.default = _default;
@@ -1,105 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.YAMLOMap = void 0;
7
-
8
- var _errors = require("../../errors");
9
-
10
- var _toJSON = _interopRequireDefault(require("../../toJSON"));
11
-
12
- var _Map = _interopRequireDefault(require("../../schema/Map"));
13
-
14
- var _Pair = _interopRequireDefault(require("../../schema/Pair"));
15
-
16
- var _Scalar = _interopRequireDefault(require("../../schema/Scalar"));
17
-
18
- var _Seq = _interopRequireDefault(require("../../schema/Seq"));
19
-
20
- var _pairs = require("./pairs");
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
-
26
- class YAMLOMap extends _Seq.default {
27
- constructor() {
28
- super();
29
-
30
- _defineProperty(this, "add", _Map.default.prototype.add.bind(this));
31
-
32
- _defineProperty(this, "delete", _Map.default.prototype.delete.bind(this));
33
-
34
- _defineProperty(this, "get", _Map.default.prototype.get.bind(this));
35
-
36
- _defineProperty(this, "has", _Map.default.prototype.has.bind(this));
37
-
38
- _defineProperty(this, "set", _Map.default.prototype.set.bind(this));
39
-
40
- this.tag = YAMLOMap.tag;
41
- }
42
-
43
- toJSON(_, ctx) {
44
- const map = new Map();
45
- if (ctx && ctx.onCreate) ctx.onCreate(map);
46
-
47
- for (const pair of this.items) {
48
- let key, value;
49
-
50
- if (pair instanceof _Pair.default) {
51
- key = (0, _toJSON.default)(pair.key, '', ctx);
52
- value = (0, _toJSON.default)(pair.value, key, ctx);
53
- } else {
54
- key = (0, _toJSON.default)(pair, '', ctx);
55
- }
56
-
57
- if (map.has(key)) throw new Error('Ordered maps must not include duplicate keys');
58
- map.set(key, value);
59
- }
60
-
61
- return map;
62
- }
63
-
64
- }
65
-
66
- exports.YAMLOMap = YAMLOMap;
67
-
68
- _defineProperty(YAMLOMap, "tag", 'tag:yaml.org,2002:omap');
69
-
70
- function parseOMap(doc, cst) {
71
- const pairs = (0, _pairs.parsePairs)(doc, cst);
72
- const seenKeys = [];
73
-
74
- for (const {
75
- key
76
- } of pairs.items) {
77
- if (key instanceof _Scalar.default) {
78
- if (seenKeys.includes(key.value)) {
79
- const msg = 'Ordered maps must not include duplicate keys';
80
- throw new _errors.YAMLSemanticError(cst, msg);
81
- } else {
82
- seenKeys.push(key.value);
83
- }
84
- }
85
- }
86
-
87
- return Object.assign(new YAMLOMap(), pairs);
88
- }
89
-
90
- function createOMap(schema, iterable, ctx) {
91
- const pairs = (0, _pairs.createPairs)(schema, iterable, ctx);
92
- const omap = new YAMLOMap();
93
- omap.items = pairs.items;
94
- return omap;
95
- }
96
-
97
- var _default = {
98
- identify: value => value instanceof Map,
99
- nodeClass: YAMLOMap,
100
- default: false,
101
- tag: 'tag:yaml.org,2002:omap',
102
- resolve: parseOMap,
103
- createNode: createOMap
104
- };
105
- exports.default = _default;
@@ -1,80 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.parsePairs = parsePairs;
7
- exports.createPairs = createPairs;
8
- exports.default = void 0;
9
-
10
- var _errors = require("../../errors");
11
-
12
- var _Map = _interopRequireDefault(require("../../schema/Map"));
13
-
14
- var _Pair = _interopRequireDefault(require("../../schema/Pair"));
15
-
16
- var _parseSeq = _interopRequireDefault(require("../../schema/parseSeq"));
17
-
18
- var _Seq = _interopRequireDefault(require("../../schema/Seq"));
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
- function parsePairs(doc, cst) {
23
- const seq = (0, _parseSeq.default)(doc, cst);
24
-
25
- for (let i = 0; i < seq.items.length; ++i) {
26
- let item = seq.items[i];
27
- if (item instanceof _Pair.default) continue;else if (item instanceof _Map.default) {
28
- if (item.items.length > 1) {
29
- const msg = 'Each pair must have its own sequence indicator';
30
- throw new _errors.YAMLSemanticError(cst, msg);
31
- }
32
-
33
- const pair = item.items[0] || new _Pair.default();
34
- if (item.commentBefore) pair.commentBefore = pair.commentBefore ? `${item.commentBefore}\n${pair.commentBefore}` : item.commentBefore;
35
- if (item.comment) pair.comment = pair.comment ? `${item.comment}\n${pair.comment}` : item.comment;
36
- item = pair;
37
- }
38
- seq.items[i] = item instanceof _Pair.default ? item : new _Pair.default(item);
39
- }
40
-
41
- return seq;
42
- }
43
-
44
- function createPairs(schema, iterable, ctx) {
45
- const pairs = new _Seq.default(schema);
46
- pairs.tag = 'tag:yaml.org,2002:pairs';
47
-
48
- for (const it of iterable) {
49
- let key, value;
50
-
51
- if (Array.isArray(it)) {
52
- if (it.length === 2) {
53
- key = it[0];
54
- value = it[1];
55
- } else throw new TypeError(`Expected [key, value] tuple: ${it}`);
56
- } else if (it && it instanceof Object) {
57
- const keys = Object.keys(it);
58
-
59
- if (keys.length === 1) {
60
- key = keys[0];
61
- value = it[key];
62
- } else throw new TypeError(`Expected { key: value } tuple: ${it}`);
63
- } else {
64
- key = it;
65
- }
66
-
67
- const pair = schema.createPair(key, value, ctx);
68
- pairs.items.push(pair);
69
- }
70
-
71
- return pairs;
72
- }
73
-
74
- var _default = {
75
- default: false,
76
- tag: 'tag:yaml.org,2002:pairs',
77
- resolve: parsePairs,
78
- createNode: createPairs
79
- };
80
- exports.default = _default;