trusty-cms 4.1.6 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +114 -107
  3. data/INSTALL.md +2 -0
  4. data/app/controllers/admin/pages_controller.rb +1 -1
  5. data/app/controllers/admin/preferences_controller.rb +1 -1
  6. data/app/controllers/admin/resource_controller.rb +1 -1
  7. data/app/controllers/admin/users_controller.rb +1 -1
  8. data/config/environments/development.rb +2 -0
  9. data/lib/generators/extension/USAGE +30 -0
  10. data/lib/generators/extension/extension_generator.rb +97 -0
  11. data/lib/generators/extension/templates/README.md +6 -0
  12. data/lib/generators/extension/templates/RSpecRakefile +109 -0
  13. data/lib/generators/extension/templates/Rakefile +25 -0
  14. data/lib/generators/extension/templates/cucumber.yml +1 -0
  15. data/lib/generators/extension/templates/cucumber_env.rb +11 -0
  16. data/lib/generators/extension/templates/cucumber_paths.rb +22 -0
  17. data/lib/generators/extension/templates/en.yml +3 -0
  18. data/lib/generators/extension/templates/extension.rb +21 -0
  19. data/lib/generators/extension/templates/functional_test.rb +15 -0
  20. data/lib/generators/extension/templates/gemspec.rb +29 -0
  21. data/lib/generators/extension/templates/lib.rb +8 -0
  22. data/lib/generators/extension/templates/migration.rb +9 -0
  23. data/lib/generators/extension/templates/radiant_config.rb +3 -0
  24. data/lib/generators/extension/templates/routes.rb +5 -0
  25. data/lib/generators/extension/templates/spec.opts +6 -0
  26. data/lib/generators/extension/templates/spec_helper.rb +42 -0
  27. data/lib/generators/extension/templates/tasks.rake +47 -0
  28. data/lib/generators/extension/templates/test_helper.rb +26 -0
  29. data/lib/generators/extension_controller/USAGE +36 -0
  30. data/lib/generators/extension_controller/extension_controller_generator.rb +84 -0
  31. data/lib/generators/extension_controller/templates/controller.rb +10 -0
  32. data/lib/generators/extension_controller/templates/controller_spec.rb +23 -0
  33. data/lib/generators/extension_controller/templates/functional_test.rb +11 -0
  34. data/lib/generators/extension_controller/templates/helper.rb +2 -0
  35. data/lib/generators/extension_controller/templates/helper_spec.rb +11 -0
  36. data/lib/generators/extension_controller/templates/helper_test.rb +4 -0
  37. data/lib/generators/extension_controller/templates/view.html.erb +2 -0
  38. data/lib/generators/extension_controller/templates/view_spec.rb +12 -0
  39. data/lib/generators/extension_mailer/USAGE +17 -0
  40. data/lib/generators/extension_mailer/extension_mailer_generator.rb +68 -0
  41. data/lib/generators/extension_mailer/templates/fixture.erb +3 -0
  42. data/lib/generators/extension_mailer/templates/mailer.rb +15 -0
  43. data/lib/generators/extension_mailer/templates/unit_test.rb +21 -0
  44. data/lib/generators/extension_mailer/templates/view.erb +3 -0
  45. data/lib/generators/extension_migration/USAGE +34 -0
  46. data/lib/generators/extension_migration/extension_migration_generator.rb +25 -0
  47. data/lib/generators/extension_migration/templates/migration.rb +11 -0
  48. data/lib/generators/extension_model/USAGE +35 -0
  49. data/lib/generators/extension_model/extension_model_generator.rb +68 -0
  50. data/lib/generators/extension_model/templates/fixtures.yml +19 -0
  51. data/lib/generators/extension_model/templates/migration.rb +16 -0
  52. data/lib/generators/extension_model/templates/model.rb +2 -0
  53. data/lib/generators/extension_model/templates/model_spec.rb +11 -0
  54. data/lib/generators/extension_model/templates/unit_test.rb +8 -0
  55. data/lib/generators/generator_base_extension.rb +18 -0
  56. data/lib/generators/instance/instance_generator.rb +148 -0
  57. data/lib/generators/instance/templates/databases/db2.yml +40 -0
  58. data/lib/generators/instance/templates/databases/mysql.yml +47 -0
  59. data/lib/generators/instance/templates/databases/postgresql.yml +44 -0
  60. data/lib/generators/instance/templates/databases/sqlite3.yml +16 -0
  61. data/lib/generators/instance/templates/databases/sqlserver.yml +21 -0
  62. data/lib/generators/instance/templates/instance_boot.rb +122 -0
  63. data/lib/generators/instance/templates/instance_config.ru +2 -0
  64. data/lib/generators/instance/templates/instance_environment.rb +93 -0
  65. data/lib/generators/instance/templates/instance_gemfile +78 -0
  66. data/lib/generators/instance/templates/instance_generate +6 -0
  67. data/lib/generators/instance/templates/instance_radiant_config.rb +16 -0
  68. data/lib/generators/instance/templates/instance_rakefile +3 -0
  69. data/lib/generators/instance/templates/instance_routes.rb +1 -0
  70. data/lib/generators/language_extension/USAGE +27 -0
  71. data/lib/generators/language_extension/language_extension_generator.rb +71 -0
  72. data/lib/generators/language_extension/templates/README +3 -0
  73. data/lib/generators/language_extension/templates/RSpecRakefile +123 -0
  74. data/lib/generators/language_extension/templates/Rakefile +25 -0
  75. data/lib/generators/language_extension/templates/available_tags.yml +553 -0
  76. data/lib/generators/language_extension/templates/cucumber.yml +1 -0
  77. data/lib/generators/language_extension/templates/cucumber_env.rb +16 -0
  78. data/lib/generators/language_extension/templates/cucumber_paths.rb +14 -0
  79. data/lib/generators/language_extension/templates/extension.rb +12 -0
  80. data/lib/generators/language_extension/templates/functional_test.rb +15 -0
  81. data/lib/generators/language_extension/templates/gemspec.rb +24 -0
  82. data/lib/generators/language_extension/templates/lang.yml +181 -0
  83. data/lib/generators/language_extension/templates/lib.rb +8 -0
  84. data/lib/generators/language_extension/templates/spec.opts +6 -0
  85. data/lib/generators/language_extension/templates/spec_helper.rb +36 -0
  86. data/lib/generators/language_extension/templates/tasks.rake +28 -0
  87. data/lib/generators/language_extension/templates/test_helper.rb +26 -0
  88. data/lib/generators/trusty_cms/USAGE +8 -0
  89. data/lib/generators/trusty_cms/templates/Rakefile.erb +7 -0
  90. data/lib/generators/trusty_cms/templates/application.rb.erb +149 -0
  91. data/lib/generators/trusty_cms/templates/boot.rb.erb +9 -0
  92. data/lib/generators/trusty_cms/templates/config.ru.erb +4 -0
  93. data/lib/generators/trusty_cms/templates/database.yml.erb +28 -0
  94. data/lib/generators/trusty_cms/templates/environment.rb.erb +5 -0
  95. data/lib/generators/trusty_cms/templates/environments/development.rb.erb +24 -0
  96. data/lib/generators/trusty_cms/templates/environments/production.rb.erb +26 -0
  97. data/lib/generators/trusty_cms/templates/environments/test.rb.erb +35 -0
  98. data/lib/generators/trusty_cms/templates/initializers/secret_token.rb.erb +13 -0
  99. data/lib/generators/trusty_cms/templates/initializers/session_store.rb.erb +8 -0
  100. data/lib/generators/trusty_cms/templates/initializers/trusty_cms_config.rb.erb +16 -0
  101. data/lib/generators/trusty_cms/templates/preinitializer.rb.erb +18 -0
  102. data/lib/generators/trusty_cms/templates/routes.rb.erb +0 -0
  103. data/lib/generators/trusty_cms/trusty_cms_generator.rb +32 -0
  104. data/lib/trusty_cms.rb +1 -1
  105. data/lib/trusty_cms/setup.rb +8 -8
  106. data/trusty_cms.gemspec +4 -4
  107. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/base.rb +195 -0
  108. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/check_box.rb +65 -0
  109. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/checkable.rb +18 -0
  110. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_check_boxes.rb +35 -0
  111. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_helpers.rb +118 -0
  112. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_radio_buttons.rb +30 -0
  113. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_select.rb +30 -0
  114. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/color_field.rb +26 -0
  115. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/date_field.rb +14 -0
  116. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/date_select.rb +73 -0
  117. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_field.rb +31 -0
  118. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_local_field.rb +20 -0
  119. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_select.rb +10 -0
  120. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/email_field.rb +10 -0
  121. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/file_field.rb +10 -0
  122. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/grouped_collection_select.rb +31 -0
  123. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/hidden_field.rb +10 -0
  124. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/label.rb +80 -0
  125. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/month_field.rb +14 -0
  126. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/number_field.rb +20 -0
  127. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/password_field.rb +14 -0
  128. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/placeholderable.rb +24 -0
  129. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/radio_button.rb +32 -0
  130. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/range_field.rb +10 -0
  131. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/search_field.rb +27 -0
  132. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/select.rb +42 -0
  133. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/tel_field.rb +10 -0
  134. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/text_area.rb +24 -0
  135. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/text_field.rb +33 -0
  136. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_field.rb +14 -0
  137. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_select.rb +10 -0
  138. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_zone_select.rb +22 -0
  139. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/translator.rb +39 -0
  140. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/url_field.rb +10 -0
  141. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/week_field.rb +14 -0
  142. data/yarn.lock +3 -3
  143. metadata +296 -71
  144. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/core.js +0 -126
  145. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/index.js +0 -4
  146. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/map.js +0 -56
  147. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/seq.js +0 -43
  148. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/string.js +0 -28
  149. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/index.js +0 -36
  150. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/json.js +0 -76
  151. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/options.js +0 -23
  152. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/binary.js +0 -87
  153. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/index.js +0 -157
  154. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/omap.js +0 -142
  155. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/pairs.js +0 -81
  156. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/set.js +0 -114
  157. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/timestamp.js +0 -97
  158. data/spec/spec/dummy/node_modules/yaml/dist/tags/core.js +0 -114
  159. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/index.js +0 -17
  160. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/map.js +0 -37
  161. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/seq.js +0 -34
  162. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/string.js +0 -40
  163. data/spec/spec/dummy/node_modules/yaml/dist/tags/index.js +0 -62
  164. data/spec/spec/dummy/node_modules/yaml/dist/tags/json.js +0 -60
  165. data/spec/spec/dummy/node_modules/yaml/dist/tags/options.js +0 -35
  166. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/binary.js +0 -97
  167. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/index.js +0 -131
  168. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/omap.js +0 -105
  169. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/pairs.js +0 -80
  170. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/set.js +0 -91
  171. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/timestamp.js +0 -93
@@ -1,126 +0,0 @@
1
- import Scalar from '../schema/Scalar';
2
- import { stringifyNumber } from '../stringify';
3
- import failsafe from './failsafe';
4
- import { boolOptions, nullOptions } from './options';
5
- export var nullObj = {
6
- identify: function identify(value) {
7
- return value == null;
8
- },
9
- createNode: function createNode(schema, value, ctx) {
10
- return ctx.wrapScalars ? new Scalar(null) : null;
11
- },
12
- default: true,
13
- tag: 'tag:yaml.org,2002:null',
14
- test: /^(?:~|[Nn]ull|NULL)?$/,
15
- resolve: function resolve() {
16
- return null;
17
- },
18
- options: nullOptions,
19
- stringify: function stringify() {
20
- return nullOptions.nullStr;
21
- }
22
- };
23
- export var boolObj = {
24
- identify: function identify(value) {
25
- return typeof value === 'boolean';
26
- },
27
- default: true,
28
- tag: 'tag:yaml.org,2002:bool',
29
- test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
30
- resolve: function resolve(str) {
31
- return str[0] === 't' || str[0] === 'T';
32
- },
33
- options: boolOptions,
34
- stringify: function stringify(_ref) {
35
- var value = _ref.value;
36
- return value ? boolOptions.trueStr : boolOptions.falseStr;
37
- }
38
- };
39
- export var octObj = {
40
- identify: function identify(value) {
41
- return typeof value === 'number';
42
- },
43
- default: true,
44
- tag: 'tag:yaml.org,2002:int',
45
- format: 'OCT',
46
- test: /^0o([0-7]+)$/,
47
- resolve: function resolve(str, oct) {
48
- return parseInt(oct, 8);
49
- },
50
- stringify: function stringify(_ref2) {
51
- var value = _ref2.value;
52
- return '0o' + value.toString(8);
53
- }
54
- };
55
- export var intObj = {
56
- identify: function identify(value) {
57
- return typeof value === 'number';
58
- },
59
- default: true,
60
- tag: 'tag:yaml.org,2002:int',
61
- test: /^[-+]?[0-9]+$/,
62
- resolve: function resolve(str) {
63
- return parseInt(str, 10);
64
- },
65
- stringify: stringifyNumber
66
- };
67
- export var hexObj = {
68
- identify: function identify(value) {
69
- return typeof value === 'number';
70
- },
71
- default: true,
72
- tag: 'tag:yaml.org,2002:int',
73
- format: 'HEX',
74
- test: /^0x([0-9a-fA-F]+)$/,
75
- resolve: function resolve(str, hex) {
76
- return parseInt(hex, 16);
77
- },
78
- stringify: function stringify(_ref3) {
79
- var value = _ref3.value;
80
- return '0x' + value.toString(16);
81
- }
82
- };
83
- export var nanObj = {
84
- identify: function identify(value) {
85
- return typeof value === 'number';
86
- },
87
- default: true,
88
- tag: 'tag:yaml.org,2002:float',
89
- test: /^(?:[-+]?\.inf|(\.nan))$/i,
90
- resolve: function resolve(str, nan) {
91
- return nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
92
- },
93
- stringify: stringifyNumber
94
- };
95
- export var expObj = {
96
- identify: function identify(value) {
97
- return typeof value === 'number';
98
- },
99
- default: true,
100
- tag: 'tag:yaml.org,2002:float',
101
- format: 'EXP',
102
- test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
103
- resolve: function resolve(str) {
104
- return parseFloat(str);
105
- },
106
- stringify: function stringify(_ref4) {
107
- var value = _ref4.value;
108
- return Number(value).toExponential();
109
- }
110
- };
111
- export var floatObj = {
112
- identify: function identify(value) {
113
- return typeof value === 'number';
114
- },
115
- default: true,
116
- tag: 'tag:yaml.org,2002:float',
117
- test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/,
118
- resolve: function resolve(str, frac1, frac2) {
119
- var frac = frac1 || frac2;
120
- var node = new Scalar(parseFloat(str));
121
- if (frac && frac[frac.length - 1] === '0') node.minFractionDigits = frac.length;
122
- return node;
123
- },
124
- stringify: stringifyNumber
125
- };
126
- export default failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
@@ -1,4 +0,0 @@
1
- import map from './map';
2
- import seq from './seq';
3
- import str from './string';
4
- export default [map, seq, str];
@@ -1,56 +0,0 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import YAMLMap from '../../schema/Map';
4
- import parseMap from '../../schema/parseMap';
5
-
6
- function createMap(schema, obj, ctx) {
7
- var map = new YAMLMap(schema);
8
-
9
- if (obj instanceof Map) {
10
- var _iteratorNormalCompletion = true;
11
- var _didIteratorError = false;
12
- var _iteratorError = undefined;
13
-
14
- try {
15
- for (var _iterator = obj[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
16
- var _step$value = _slicedToArray(_step.value, 2),
17
- key = _step$value[0],
18
- value = _step$value[1];
19
-
20
- map.items.push(schema.createPair(key, value, ctx));
21
- }
22
- } catch (err) {
23
- _didIteratorError = true;
24
- _iteratorError = err;
25
- } finally {
26
- try {
27
- if (!_iteratorNormalCompletion && _iterator.return != null) {
28
- _iterator.return();
29
- }
30
- } finally {
31
- if (_didIteratorError) {
32
- throw _iteratorError;
33
- }
34
- }
35
- }
36
- } else if (obj && _typeof(obj) === 'object') {
37
- for (var _i = 0, _Object$keys = Object.keys(obj); _i < _Object$keys.length; _i++) {
38
- var _key = _Object$keys[_i];
39
- map.items.push(schema.createPair(_key, obj[_key], ctx));
40
- }
41
- }
42
-
43
- if (typeof schema.sortMapEntries === 'function') {
44
- map.items.sort(schema.sortMapEntries);
45
- }
46
-
47
- return map;
48
- }
49
-
50
- export default {
51
- createNode: createMap,
52
- default: true,
53
- nodeClass: YAMLMap,
54
- tag: 'tag:yaml.org,2002:map',
55
- resolve: parseMap
56
- };
@@ -1,43 +0,0 @@
1
- import parseSeq from '../../schema/parseSeq';
2
- import YAMLSeq from '../../schema/Seq';
3
-
4
- function createSeq(schema, obj, ctx) {
5
- var seq = new YAMLSeq(schema);
6
-
7
- if (obj && obj[Symbol.iterator]) {
8
- var _iteratorNormalCompletion = true;
9
- var _didIteratorError = false;
10
- var _iteratorError = undefined;
11
-
12
- try {
13
- for (var _iterator = obj[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
14
- var it = _step.value;
15
- var v = schema.createNode(it, ctx.wrapScalars, null, ctx);
16
- seq.items.push(v);
17
- }
18
- } catch (err) {
19
- _didIteratorError = true;
20
- _iteratorError = err;
21
- } finally {
22
- try {
23
- if (!_iteratorNormalCompletion && _iterator.return != null) {
24
- _iterator.return();
25
- }
26
- } finally {
27
- if (_didIteratorError) {
28
- throw _iteratorError;
29
- }
30
- }
31
- }
32
- }
33
-
34
- return seq;
35
- }
36
-
37
- export default {
38
- createNode: createSeq,
39
- default: true,
40
- nodeClass: YAMLSeq,
41
- tag: 'tag:yaml.org,2002:seq',
42
- resolve: parseSeq
43
- };
@@ -1,28 +0,0 @@
1
- import { stringifyString } from '../../stringify';
2
- import { strOptions } from '../options';
3
- export var resolveString = function resolveString(doc, node) {
4
- // on error, will return { str: string, errors: Error[] }
5
- var res = node.strValue;
6
- if (!res) return '';
7
- if (typeof res === 'string') return res;
8
- res.errors.forEach(function (error) {
9
- if (!error.source) error.source = node;
10
- doc.errors.push(error);
11
- });
12
- return res.str;
13
- };
14
- export default {
15
- identify: function identify(value) {
16
- return typeof value === 'string';
17
- },
18
- default: true,
19
- tag: 'tag:yaml.org,2002:str',
20
- resolve: resolveString,
21
- stringify: function stringify(item, ctx, onComment, onChompKeep) {
22
- ctx = Object.assign({
23
- actualString: true
24
- }, ctx);
25
- return stringifyString(item, ctx, onComment, onChompKeep);
26
- },
27
- options: strOptions
28
- };
@@ -1,36 +0,0 @@
1
- import core, { nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj } from './core';
2
- import failsafe from './failsafe';
3
- import json from './json';
4
- import yaml11 from './yaml-1.1';
5
- import map from './failsafe/map';
6
- import seq from './failsafe/seq';
7
- import binary from './yaml-1.1/binary';
8
- import omap from './yaml-1.1/omap';
9
- import pairs from './yaml-1.1/pairs';
10
- import set from './yaml-1.1/set';
11
- import { floatTime, intTime, timestamp } from './yaml-1.1/timestamp';
12
- export var schemas = {
13
- core: core,
14
- failsafe: failsafe,
15
- json: json,
16
- yaml11: yaml11
17
- };
18
- export var tags = {
19
- binary: binary,
20
- bool: boolObj,
21
- float: floatObj,
22
- floatExp: expObj,
23
- floatNaN: nanObj,
24
- floatTime: floatTime,
25
- int: intObj,
26
- intHex: hexObj,
27
- intOct: octObj,
28
- intTime: intTime,
29
- map: map,
30
- null: nullObj,
31
- omap: omap,
32
- pairs: pairs,
33
- seq: seq,
34
- set: set,
35
- timestamp: timestamp
36
- };
@@ -1,76 +0,0 @@
1
- import map from './failsafe/map';
2
- import seq from './failsafe/seq';
3
- import Scalar from '../schema/Scalar';
4
- import { resolveString } from './failsafe/string';
5
- var schema = [map, seq, {
6
- identify: function identify(value) {
7
- return typeof value === 'string';
8
- },
9
- default: true,
10
- tag: 'tag:yaml.org,2002:str',
11
- resolve: resolveString,
12
- stringify: function stringify(value) {
13
- return JSON.stringify(value);
14
- }
15
- }, {
16
- identify: function identify(value) {
17
- return value == null;
18
- },
19
- createNode: function createNode(schema, value, ctx) {
20
- return ctx.wrapScalars ? new Scalar(null) : null;
21
- },
22
- default: true,
23
- tag: 'tag:yaml.org,2002:null',
24
- test: /^null$/,
25
- resolve: function resolve() {
26
- return null;
27
- },
28
- stringify: function stringify(value) {
29
- return JSON.stringify(value);
30
- }
31
- }, {
32
- identify: function identify(value) {
33
- return typeof value === 'boolean';
34
- },
35
- default: true,
36
- tag: 'tag:yaml.org,2002:bool',
37
- test: /^true|false$/,
38
- resolve: function resolve(str) {
39
- return str === 'true';
40
- },
41
- stringify: function stringify(value) {
42
- return JSON.stringify(value);
43
- }
44
- }, {
45
- identify: function identify(value) {
46
- return typeof value === 'number';
47
- },
48
- default: true,
49
- tag: 'tag:yaml.org,2002:int',
50
- test: /^-?(?:0|[1-9][0-9]*)$/,
51
- resolve: function resolve(str) {
52
- return parseInt(str, 10);
53
- },
54
- stringify: function stringify(value) {
55
- return JSON.stringify(value);
56
- }
57
- }, {
58
- identify: function identify(value) {
59
- return typeof value === 'number';
60
- },
61
- default: true,
62
- tag: 'tag:yaml.org,2002:float',
63
- test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
64
- resolve: function resolve(str) {
65
- return parseFloat(str);
66
- },
67
- stringify: function stringify(value) {
68
- return JSON.stringify(value);
69
- }
70
- }];
71
-
72
- schema.scalarFallback = function (str) {
73
- throw new SyntaxError("Unresolved plain scalar ".concat(JSON.stringify(str)));
74
- };
75
-
76
- export default schema;
@@ -1,23 +0,0 @@
1
- import { Type } from '../constants';
2
- export var binaryOptions = {
3
- defaultType: Type.BLOCK_LITERAL,
4
- lineWidth: 76
5
- };
6
- export var boolOptions = {
7
- trueStr: 'true',
8
- falseStr: 'false'
9
- };
10
- export var nullOptions = {
11
- nullStr: 'null'
12
- };
13
- export var strOptions = {
14
- defaultType: Type.PLAIN,
15
- doubleQuoted: {
16
- jsonEncoding: false,
17
- minMultiLineLength: 40
18
- },
19
- fold: {
20
- lineWidth: 80,
21
- minContentWidth: 20
22
- }
23
- };
@@ -1,87 +0,0 @@
1
- /* global atob, btoa, Buffer */
2
- import { Type } from '../../constants';
3
- import { YAMLReferenceError } from '../../errors';
4
- import { stringifyString } from '../../stringify';
5
- import { resolveString } from '../failsafe/string';
6
- import { binaryOptions as options } from '../options';
7
- export default {
8
- identify: function identify(value) {
9
- return value instanceof Uint8Array;
10
- },
11
- // Buffer inherits from Uint8Array
12
- default: false,
13
- tag: 'tag:yaml.org,2002:binary',
14
-
15
- /**
16
- * Returns a Buffer in node and an Uint8Array in browsers
17
- *
18
- * To use the resulting buffer as an image, you'll want to do something like:
19
- *
20
- * const blob = new Blob([buffer], { type: 'image/jpeg' })
21
- * document.querySelector('#photo').src = URL.createObjectURL(blob)
22
- */
23
- resolve: function resolve(doc, node) {
24
- var src = resolveString(doc, node);
25
-
26
- if (typeof Buffer === 'function') {
27
- return Buffer.from(src, 'base64');
28
- } else if (typeof atob === 'function') {
29
- // On IE 11, atob() can't handle newlines
30
- var str = atob(src.replace(/[\n\r]/g, ''));
31
- var buffer = new Uint8Array(str.length);
32
-
33
- for (var i = 0; i < str.length; ++i) {
34
- buffer[i] = str.charCodeAt(i);
35
- }
36
-
37
- return buffer;
38
- } else {
39
- var msg = 'This environment does not support reading binary tags; either Buffer or atob is required';
40
- doc.errors.push(new YAMLReferenceError(node, msg));
41
- return null;
42
- }
43
- },
44
- options: options,
45
- stringify: function stringify(_ref, ctx, onComment, onChompKeep) {
46
- var comment = _ref.comment,
47
- type = _ref.type,
48
- value = _ref.value;
49
- var src;
50
-
51
- if (typeof Buffer === 'function') {
52
- src = value instanceof Buffer ? value.toString('base64') : Buffer.from(value.buffer).toString('base64');
53
- } else if (typeof btoa === 'function') {
54
- var s = '';
55
-
56
- for (var i = 0; i < value.length; ++i) {
57
- s += String.fromCharCode(value[i]);
58
- }
59
-
60
- src = btoa(s);
61
- } else {
62
- throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
63
- }
64
-
65
- if (!type) type = options.defaultType;
66
-
67
- if (type === Type.QUOTE_DOUBLE) {
68
- value = src;
69
- } else {
70
- var lineWidth = options.lineWidth;
71
- var n = Math.ceil(src.length / lineWidth);
72
- var lines = new Array(n);
73
-
74
- for (var _i = 0, o = 0; _i < n; ++_i, o += lineWidth) {
75
- lines[_i] = src.substr(o, lineWidth);
76
- }
77
-
78
- value = lines.join(type === Type.BLOCK_LITERAL ? '\n' : ' ');
79
- }
80
-
81
- return stringifyString({
82
- comment: comment,
83
- type: type,
84
- value: value
85
- }, ctx, onComment, onChompKeep);
86
- }
87
- };