synthra 0.1.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 (302) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +4 -0
  3. data/.rubocop.yml +40 -0
  4. data/.yardopts +18 -0
  5. data/ACCESS_DOCS.md +116 -0
  6. data/ADVANCED_FEATURES_SUMMARY.md +245 -0
  7. data/CHANGELOG.md +498 -0
  8. data/CODE_OF_CONDUCT.md +122 -0
  9. data/CONTRIBUTING.md +307 -0
  10. data/DOCUMENTATION.md +204 -0
  11. data/DOCUMENTATION_GUIDE.md +194 -0
  12. data/LICENSE +22 -0
  13. data/README.md +1458 -0
  14. data/Rakefile +128 -0
  15. data/benchmark/README.md +591 -0
  16. data/benchmark/batch_generation.rb +63 -0
  17. data/benchmark/engine_comparison.rb +295 -0
  18. data/benchmark/single_record.rb +108 -0
  19. data/benchmark/streaming.rb +74 -0
  20. data/docs/ACTIVERECORD_INFERENCE.md +524 -0
  21. data/docs/API_SERVER.md +278 -0
  22. data/docs/CONFIG_FILE.md +315 -0
  23. data/docs/DATA_CONTRACTS.md +312 -0
  24. data/docs/ENHANCED_REPL.md +304 -0
  25. data/docs/FACTORY_BOT.md +271 -0
  26. data/docs/GITHUB_ACTION.md +420 -0
  27. data/docs/GRAPHQL_EXPORT.md +303 -0
  28. data/docs/GRAPHQL_FEDERATION.md +651 -0
  29. data/docs/HOW_TO_GENERATE_DOCS.md +252 -0
  30. data/docs/LSP.md +189 -0
  31. data/docs/MIGRATION_GENERATOR.md +547 -0
  32. data/docs/MOCK_SERVER.md +280 -0
  33. data/docs/NATIVE_ENGINE.md +298 -0
  34. data/docs/OPENAPI_EXPORT.md +252 -0
  35. data/docs/PERFORMANCE_MODE.md +228 -0
  36. data/docs/PERSONAS.md +547 -0
  37. data/docs/PROPERTY_TESTING.md +284 -0
  38. data/docs/PROTOBUF_EXPORT.md +276 -0
  39. data/docs/QUALITY_METRICS.md +555 -0
  40. data/docs/QUICK_REFERENCE.md +88 -0
  41. data/docs/RAILS_ENGINE.md +404 -0
  42. data/docs/RAILS_INTEGRATION.md +454 -0
  43. data/docs/README.md +175 -0
  44. data/docs/REPL_QUICK_REFERENCE.md +149 -0
  45. data/docs/RUST_INTEGRATION_GUIDE.md +1376 -0
  46. data/docs/SCENARIOS.md +576 -0
  47. data/docs/SECURITY_TESTING.md +318 -0
  48. data/docs/SNAPSHOT_TESTING.md +308 -0
  49. data/docs/STRING_TEXT_TYPES_REFERENCE.md +512 -0
  50. data/docs/TERRAFORM_EXPORT.md +447 -0
  51. data/docs/TIME_TRAVEL.md +507 -0
  52. data/docs/USAGE_GUIDE.md +980 -0
  53. data/docs/WEBHOOK_SIMULATOR.md +579 -0
  54. data/docs/advanced_features.md +183 -0
  55. data/docs/api_reference.md +153 -0
  56. data/docs/behaviors.md +138 -0
  57. data/docs/best_practices.md +191 -0
  58. data/docs/dsl_reference.md +172 -0
  59. data/docs/examples.md +162 -0
  60. data/docs/generation_modes.md +125 -0
  61. data/docs/getting_started.md +92 -0
  62. data/docs/index.html +177 -0
  63. data/docs/strategic/CLOUD_REGISTRY_ARCHITECTURE.md +268 -0
  64. data/docs/strategic/SIMD_OPTIMIZATION_STRATEGY.md +153 -0
  65. data/docs/troubleshooting.md +215 -0
  66. data/docs/type_reference.md +224 -0
  67. data/examples/hostile_mode_demo.rb +64 -0
  68. data/exe/synthra +6 -0
  69. data/ext/synthra_native/Cargo.lock +972 -0
  70. data/ext/synthra_native/Cargo.toml +46 -0
  71. data/ext/synthra_native/extconf.rb +41 -0
  72. data/ext/synthra_native/src/generator.rs +397 -0
  73. data/ext/synthra_native/src/lib.rs +229 -0
  74. data/ext/synthra_native/src/types.rs +1485 -0
  75. data/lib/generators/synthra/install_generator.rb +86 -0
  76. data/lib/generators/synthra/templates/api_response.dsl +15 -0
  77. data/lib/generators/synthra/templates/fake_data.rake +116 -0
  78. data/lib/generators/synthra/templates/synthra.yml +31 -0
  79. data/lib/generators/synthra/templates/synthra_support.rb +19 -0
  80. data/lib/generators/synthra/templates/user.dsl +11 -0
  81. data/lib/synthra/activerecord_inference.rb +394 -0
  82. data/lib/synthra/api.rb +381 -0
  83. data/lib/synthra/api_server.rb +718 -0
  84. data/lib/synthra/behaviors/applicator.rb +165 -0
  85. data/lib/synthra/behaviors/base.rb +155 -0
  86. data/lib/synthra/behaviors/close_connection.rb +60 -0
  87. data/lib/synthra/behaviors/deprecated.rb +100 -0
  88. data/lib/synthra/behaviors/failure.rb +69 -0
  89. data/lib/synthra/behaviors/latency.rb +103 -0
  90. data/lib/synthra/behaviors/partial_data.rb +83 -0
  91. data/lib/synthra/behaviors/randomize_order.rb +74 -0
  92. data/lib/synthra/behaviors/registry.rb +238 -0
  93. data/lib/synthra/behaviors/simulate_error.rb +79 -0
  94. data/lib/synthra/cli/commands/base.rb +105 -0
  95. data/lib/synthra/cli/commands/diff.rb +227 -0
  96. data/lib/synthra/cli/commands/docs.rb +67 -0
  97. data/lib/synthra/cli/commands/export.rb +150 -0
  98. data/lib/synthra/cli/commands/generate.rb +72 -0
  99. data/lib/synthra/cli/commands/import.rb +80 -0
  100. data/lib/synthra/cli/commands/lint.rb +53 -0
  101. data/lib/synthra/cli/commands/live.rb +57 -0
  102. data/lib/synthra/cli/commands/seed.rb +99 -0
  103. data/lib/synthra/cli/commands/validate.rb +28 -0
  104. data/lib/synthra/cli.rb +2471 -0
  105. data/lib/synthra/config_file.rb +129 -0
  106. data/lib/synthra/configuration.rb +281 -0
  107. data/lib/synthra/contracts_registry.rb +408 -0
  108. data/lib/synthra/database_seeder.rb +268 -0
  109. data/lib/synthra/deterministic_ids.rb +218 -0
  110. data/lib/synthra/documentation_generator.rb +414 -0
  111. data/lib/synthra/engine.rb +251 -0
  112. data/lib/synthra/errors.rb +1169 -0
  113. data/lib/synthra/export/base.rb +85 -0
  114. data/lib/synthra/export/csv.rb +101 -0
  115. data/lib/synthra/export/graphql.rb +266 -0
  116. data/lib/synthra/export/graphql_federation.rb +377 -0
  117. data/lib/synthra/export/graphviz.rb +258 -0
  118. data/lib/synthra/export/javascript.rb +327 -0
  119. data/lib/synthra/export/json_data.rb +61 -0
  120. data/lib/synthra/export/json_schema.rb +290 -0
  121. data/lib/synthra/export/openapi.rb +514 -0
  122. data/lib/synthra/export/protobuf.rb +483 -0
  123. data/lib/synthra/export/python.rb +560 -0
  124. data/lib/synthra/export/sql.rb +381 -0
  125. data/lib/synthra/export/sql_insert.rb +152 -0
  126. data/lib/synthra/export/terraform.rb +501 -0
  127. data/lib/synthra/export/type_mapping.rb +389 -0
  128. data/lib/synthra/export/typescript.rb +300 -0
  129. data/lib/synthra/export/xml_data.rb +104 -0
  130. data/lib/synthra/export/yaml_data.rb +56 -0
  131. data/lib/synthra/export.rb +404 -0
  132. data/lib/synthra/factory_bot_integration.rb +157 -0
  133. data/lib/synthra/field.rb +440 -0
  134. data/lib/synthra/functions/registry.rb +104 -0
  135. data/lib/synthra/generator/context.rb +372 -0
  136. data/lib/synthra/generator/engine.rb +336 -0
  137. data/lib/synthra/generator/faker_adapter.rb +425 -0
  138. data/lib/synthra/generator/modes.rb +444 -0
  139. data/lib/synthra/generator/resolver.rb +256 -0
  140. data/lib/synthra/generator/rng.rb +273 -0
  141. data/lib/synthra/generator/streamer.rb +63 -0
  142. data/lib/synthra/generator/uniqueness.rb +118 -0
  143. data/lib/synthra/initializer.rb +97 -0
  144. data/lib/synthra/limits.rb +279 -0
  145. data/lib/synthra/live_preview.rb +518 -0
  146. data/lib/synthra/loader_config.rb +78 -0
  147. data/lib/synthra/lsp/server.rb +689 -0
  148. data/lib/synthra/migration_generator.rb +301 -0
  149. data/lib/synthra/mixin.rb +174 -0
  150. data/lib/synthra/mock_server.rb +458 -0
  151. data/lib/synthra/native_engine.rb +304 -0
  152. data/lib/synthra/openapi_importer.rb +228 -0
  153. data/lib/synthra/output/json_formatter.rb +40 -0
  154. data/lib/synthra/output/ndjson_formatter.rb +55 -0
  155. data/lib/synthra/parser/ast.rb +1287 -0
  156. data/lib/synthra/parser/lexer.rb +1152 -0
  157. data/lib/synthra/parser/parser.rb +1664 -0
  158. data/lib/synthra/parser/tokens.rb +461 -0
  159. data/lib/synthra/performance_mode.rb +364 -0
  160. data/lib/synthra/personas.rb +397 -0
  161. data/lib/synthra/property_testing.rb +172 -0
  162. data/lib/synthra/quality_metrics.rb +405 -0
  163. data/lib/synthra/rails_test_helper.rb +248 -0
  164. data/lib/synthra/registry.rb +533 -0
  165. data/lib/synthra/relationships.rb +193 -0
  166. data/lib/synthra/repl/enhanced_repl.rb +607 -0
  167. data/lib/synthra/repl/formatter.rb +191 -0
  168. data/lib/synthra/scenarios.rb +423 -0
  169. data/lib/synthra/schema.rb +605 -0
  170. data/lib/synthra/schema_inheritance.rb +104 -0
  171. data/lib/synthra/schema_versioning.rb +212 -0
  172. data/lib/synthra/snapshot_testing.rb +199 -0
  173. data/lib/synthra/time_travel.rb +338 -0
  174. data/lib/synthra/type_definitions.rb +274 -0
  175. data/lib/synthra/types/address_location/addresses.rb +125 -0
  176. data/lib/synthra/types/address_location/airports.rb +200 -0
  177. data/lib/synthra/types/address_location/banks_hospitals.rb +207 -0
  178. data/lib/synthra/types/address_location/locations.rb +406 -0
  179. data/lib/synthra/types/base.rb +48 -0
  180. data/lib/synthra/types/commerce_products/commerce.rb +119 -0
  181. data/lib/synthra/types/commerce_products/companies.rb +71 -0
  182. data/lib/synthra/types/commerce_products/construction.rb +126 -0
  183. data/lib/synthra/types/commerce_products/products.rb +205 -0
  184. data/lib/synthra/types/core/collections.rb +513 -0
  185. data/lib/synthra/types/core/defaults.rb +76 -0
  186. data/lib/synthra/types/core/enums.rb +102 -0
  187. data/lib/synthra/types/core/identifiers.rb +445 -0
  188. data/lib/synthra/types/core/primitives.rb +586 -0
  189. data/lib/synthra/types/core/references.rb +466 -0
  190. data/lib/synthra/types/core/sequences.rb +304 -0
  191. data/lib/synthra/types/crypto/crypto.rb +162 -0
  192. data/lib/synthra/types/date_time/dates.rb +387 -0
  193. data/lib/synthra/types/finance_banking/banking.rb +424 -0
  194. data/lib/synthra/types/finance_banking/credit_cards.rb +24 -0
  195. data/lib/synthra/types/finance_banking/identifiers.rb +93 -0
  196. data/lib/synthra/types/formula.rb +184 -0
  197. data/lib/synthra/types/health_medical/medical.rb +150 -0
  198. data/lib/synthra/types/hostile_payloads.rb +122 -0
  199. data/lib/synthra/types/json_array.rb +51 -0
  200. data/lib/synthra/types/media_entertainment/media.rb +62 -0
  201. data/lib/synthra/types/naughty_string.rb +30 -0
  202. data/lib/synthra/types/personal_names/chinese.rb +41 -0
  203. data/lib/synthra/types/personal_names/identifiers.rb +187 -0
  204. data/lib/synthra/types/personal_names/names.rb +246 -0
  205. data/lib/synthra/types/personal_names/national_id.rb +89 -0
  206. data/lib/synthra/types/personal_names/titles_suffixes.rb +41 -0
  207. data/lib/synthra/types/regex.rb +248 -0
  208. data/lib/synthra/types/registry.rb +182 -0
  209. data/lib/synthra/types/repeating_element.rb +50 -0
  210. data/lib/synthra/types/scenario.rb +29 -0
  211. data/lib/synthra/types/technology_internet/apps.rb +67 -0
  212. data/lib/synthra/types/technology_internet/communication.rb +162 -0
  213. data/lib/synthra/types/technology_internet/devices.rb +80 -0
  214. data/lib/synthra/types/technology_internet/formats.rb +139 -0
  215. data/lib/synthra/types/technology_internet/networking.rb +143 -0
  216. data/lib/synthra/types/template.rb +92 -0
  217. data/lib/synthra/types/text_content/business.rb +128 -0
  218. data/lib/synthra/types/text_content/colors.rb +70 -0
  219. data/lib/synthra/types/text_content/misc.rb +237 -0
  220. data/lib/synthra/types/text_content/security.rb +130 -0
  221. data/lib/synthra/types/text_content/text_generation.rb +532 -0
  222. data/lib/synthra/types/travel/travel.rb +150 -0
  223. data/lib/synthra/utils/string_distance.rb +133 -0
  224. data/lib/synthra/validator/dsl_validator.rb +339 -0
  225. data/lib/synthra/validator/path_validator.rb +615 -0
  226. data/lib/synthra/version.rb +35 -0
  227. data/lib/synthra/webhook_simulator.rb +341 -0
  228. data/lib/synthra.rb +259 -0
  229. data/schemas/address.dsl +16 -0
  230. data/schemas/api_response.dsl +8 -0
  231. data/schemas/error_payload.dsl +9 -0
  232. data/schemas/order.dsl +10 -0
  233. data/schemas/order_item.dsl +8 -0
  234. data/schemas/payment.dsl +11 -0
  235. data/schemas/social_post.dsl +13 -0
  236. data/schemas/user.dsl +10 -0
  237. data/scripts/batch_fix_all.rb +96 -0
  238. data/scripts/delete_old_files.rb +32 -0
  239. data/scripts/fix_all_grouped_files.rb +137 -0
  240. data/scripts/fix_all_indentation.rb +48 -0
  241. data/scripts/fix_all_syntax.rb +124 -0
  242. data/scripts/fix_grouped_files.rb +184 -0
  243. data/scripts/fix_syntax_errors.rb +108 -0
  244. data/scripts/group_domain_types.rb +112 -0
  245. data/scripts/group_domain_types_fixed.rb +150 -0
  246. data/scripts/merge_domains_to_one_file.rb +68 -0
  247. data/scripts/move_existing_types.rb +130 -0
  248. data/scripts/split_grouped_types.rb +142 -0
  249. data/tech_docs/README.md +134 -0
  250. data/tech_docs/advanced/streaming.md +405 -0
  251. data/tech_docs/advanced/thread_safety.md +253 -0
  252. data/tech_docs/api/overview.md +485 -0
  253. data/tech_docs/appendices/type_chart.md +193 -0
  254. data/tech_docs/basic_concepts.md +383 -0
  255. data/tech_docs/behaviors/overview.md +346 -0
  256. data/tech_docs/dsl/complex_types.md +790 -0
  257. data/tech_docs/dsl/core_types.md +464 -0
  258. data/tech_docs/dsl/datetime_types.md +325 -0
  259. data/tech_docs/dsl/field_modifiers.md +414 -0
  260. data/tech_docs/dsl/grammar.md +431 -0
  261. data/tech_docs/dsl/schema_definition.md +399 -0
  262. data/tech_docs/export/README.md +276 -0
  263. data/tech_docs/installation.md +273 -0
  264. data/tech_docs/integration/ci_cd.md +707 -0
  265. data/tech_docs/integration/ci_cd_guide.md +579 -0
  266. data/tech_docs/integration/factory_bot.md +485 -0
  267. data/tech_docs/integration/rails.md +630 -0
  268. data/tech_docs/integration/rspec.md +449 -0
  269. data/tech_docs/modes/overview.md +350 -0
  270. data/tech_docs/performance/NATIVE_RUST_EXTENSION.md +1270 -0
  271. data/tech_docs/performance/OPTIMIZATION_GUIDE.md +901 -0
  272. data/tech_docs/quick_start.md +256 -0
  273. data/tech_docs/templates/README.md +805 -0
  274. data/tech_docs/tutorials/advanced.md +371 -0
  275. data/tech_docs/tutorials/getting_started.md +189 -0
  276. data/tech_docs/tutorials/intermediate.md +231 -0
  277. data/tech_docs/tutorials/template_gallery.md +569 -0
  278. data/tech_example/01_basic_usage.rb +238 -0
  279. data/tech_example/02_types_demo.rb +336 -0
  280. data/tech_example/04_cli_usage.md +429 -0
  281. data/tech_example/05_database_seeding.rb +283 -0
  282. data/tech_example/07_rspec_integration.rb +359 -0
  283. data/tech_example/10_custom_types.rb +387 -0
  284. data/tech_example/12_behaviors.rb +372 -0
  285. data/tech_example/13_twitter_dm_example.rb +120 -0
  286. data/tech_example/14_exact_json_structure.rb +253 -0
  287. data/tech_example/16_lsp_server.rb +56 -0
  288. data/tech_example/17_property_testing.rb +92 -0
  289. data/tech_example/18_enhanced_repl.rb +120 -0
  290. data/tech_example/19_security_fuzzing.rb +145 -0
  291. data/tech_example/NEW_FEATURES.md +169 -0
  292. data/tech_example/README.md +118 -0
  293. data/tech_example/schemas/api_response.dsl +123 -0
  294. data/tech_example/schemas/ecommerce.dsl +121 -0
  295. data/tech_example/schemas/twitter_dm.dsl +109 -0
  296. data/tech_example/schemas/user.dsl +36 -0
  297. data/vscode-extension/README.md +246 -0
  298. data/vscode-extension/language-configuration.json +31 -0
  299. data/vscode-extension/package.json +55 -0
  300. data/vscode-extension/snippets/fakedatadsl.json +198 -0
  301. data/vscode-extension/syntaxes/fakedatadsl.tmLanguage.json +128 -0
  302. metadata +478 -0
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,307 @@
1
+ # Contributing to FakeDataDSL
2
+
3
+ Thank you for your interest in contributing to FakeDataDSL! This document provides guidelines and information for contributors.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Code of Conduct](#code-of-conduct)
8
+ - [Getting Started](#getting-started)
9
+ - [Development Setup](#development-setup)
10
+ - [How to Contribute](#how-to-contribute)
11
+ - [Pull Request Process](#pull-request-process)
12
+ - [Code Style](#code-style)
13
+ - [Testing Guidelines](#testing-guidelines)
14
+ - [Documentation](#documentation)
15
+
16
+ ## Code of Conduct
17
+
18
+ This project adheres to a Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the maintainers.
19
+
20
+ ## Getting Started
21
+
22
+ 1. Fork the repository on GitHub
23
+ 2. Clone your fork locally:
24
+ ```bash
25
+ git clone https://github.com/YOUR_USERNAME/fake_data_dsl.git
26
+ cd fake_data_dsl
27
+ ```
28
+ 3. Add the upstream remote:
29
+ ```bash
30
+ git remote add upstream https://github.com/talaatmagdyx/fake_data_dsl.git
31
+ ```
32
+
33
+ ## Development Setup
34
+
35
+ ### Prerequisites
36
+
37
+ - Ruby 3.1.0 or higher
38
+ - Bundler 2.0+
39
+
40
+ ### Installation
41
+
42
+ ```bash
43
+ # Install dependencies
44
+ bundle install
45
+
46
+ # Run tests to verify setup
47
+ bundle exec rspec
48
+
49
+ # Run linter
50
+ bundle exec rubocop
51
+ ```
52
+
53
+ ### Running the CLI locally
54
+
55
+ ```bash
56
+ # From the project root
57
+ bundle exec exe/fake_data_dsl --help
58
+ ```
59
+
60
+ ## How to Contribute
61
+
62
+ ### Reporting Bugs
63
+
64
+ Before creating a bug report:
65
+
66
+ 1. Check the [existing issues](https://github.com/talaatmagdyx/fake_data_dsl/issues)
67
+ 2. Ensure you're using the latest version
68
+ 3. Collect information about the bug:
69
+ - Stack trace
70
+ - Ruby version (`ruby --version`)
71
+ - Gem version (`bundle show fake_data_dsl`)
72
+ - Your operating system
73
+ - Steps to reproduce
74
+
75
+ ### Suggesting Enhancements
76
+
77
+ Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, include:
78
+
79
+ - A clear and descriptive title
80
+ - A detailed description of the proposed functionality
81
+ - Examples of how the feature would be used
82
+ - Why this enhancement would be useful
83
+
84
+ ### Adding New Types
85
+
86
+ To add a new data type:
87
+
88
+ 1. Create a new file in `lib/fake_data_dsl/types/` in the appropriate domain folder
89
+ 2. Inherit from `FakeDataDSL::Types::Base`
90
+ 3. Implement `generate_random`, `generate_edge`, and `generate_invalid` methods
91
+ 4. Register the type in `lib/fake_data_dsl.rb` in `register_builtin_types!`
92
+ 5. Add tests in `spec/types/`
93
+ 6. Document in `tech_docs/dsl/core_types.md`
94
+
95
+ Example:
96
+
97
+ ```ruby
98
+ # lib/fake_data_dsl/types/personal_names/nickname.rb
99
+ module FakeDataDSL
100
+ module Types
101
+ module PersonalNames
102
+ class Nickname < Base
103
+ def generate_random(rng, context, args)
104
+ rng.element(["Ace", "Buddy", "Chief", "Duke", "Flash"])
105
+ end
106
+
107
+ def generate_edge(rng, context, args)
108
+ rng.element(["", "X", "A" * 100])
109
+ end
110
+
111
+ def generate_invalid(rng, context, args)
112
+ rng.element([nil, 123, [], {}])
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
118
+ ```
119
+
120
+ ### Adding New Behaviors
121
+
122
+ To add a new behavior:
123
+
124
+ 1. Create a new file in `lib/fake_data_dsl/behaviors/`
125
+ 2. Inherit from `FakeDataDSL::Behaviors::Base`
126
+ 3. Implement the `apply` method
127
+ 4. Register in `lib/fake_data_dsl/behaviors/registry.rb`
128
+ 5. Add tests and documentation
129
+
130
+ ### Adding New Export Formats
131
+
132
+ To add a new export format:
133
+
134
+ 1. Create a new file in `lib/fake_data_dsl/export/`
135
+ 2. Inherit from `FakeDataDSL::Export::Base`
136
+ 3. Implement `export` and optionally `export_all` methods
137
+ 4. Register in `lib/fake_data_dsl/export.rb`
138
+ 5. Add CLI support in `lib/fake_data_dsl/cli.rb` if needed
139
+ 6. Add tests and documentation
140
+
141
+ ## Pull Request Process
142
+
143
+ 1. Create a new branch from `main`:
144
+ ```bash
145
+ git checkout -b feature/my-new-feature
146
+ ```
147
+
148
+ 2. Make your changes and commit:
149
+ ```bash
150
+ git add .
151
+ git commit -m "feat: add new feature X"
152
+ ```
153
+
154
+ 3. Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
155
+ - `feat:` - New features
156
+ - `fix:` - Bug fixes
157
+ - `docs:` - Documentation changes
158
+ - `style:` - Code style changes (formatting, etc.)
159
+ - `refactor:` - Code refactoring
160
+ - `test:` - Adding or updating tests
161
+ - `chore:` - Maintenance tasks
162
+
163
+ 4. Ensure all tests pass:
164
+ ```bash
165
+ bundle exec rspec
166
+ ```
167
+
168
+ 5. Ensure code style compliance:
169
+ ```bash
170
+ bundle exec rubocop
171
+ ```
172
+
173
+ 6. Update documentation if needed
174
+
175
+ 7. Push your branch and create a Pull Request
176
+
177
+ ### PR Requirements
178
+
179
+ - [ ] Tests pass
180
+ - [ ] RuboCop passes
181
+ - [ ] New code has test coverage
182
+ - [ ] Documentation updated (if applicable)
183
+ - [ ] CHANGELOG.md updated (for user-facing changes)
184
+
185
+ ## Code Style
186
+
187
+ We follow the Ruby Style Guide with some customizations. RuboCop is configured to enforce these rules.
188
+
189
+ ### Key Guidelines
190
+
191
+ - Use 2 spaces for indentation
192
+ - Use `frozen_string_literal` pragma
193
+ - Maximum line length: 120 characters
194
+ - Document public methods with YARD
195
+ - Prefer explicit over implicit
196
+ - Keep methods small and focused
197
+
198
+ ### Example
199
+
200
+ ```ruby
201
+ # frozen_string_literal: true
202
+
203
+ module FakeDataDSL
204
+ module Example
205
+ # Generate a random example value
206
+ #
207
+ # @param count [Integer] number of values to generate
208
+ # @return [Array<String>] generated values
209
+ #
210
+ # @example
211
+ # generate_examples(3)
212
+ # # => ["example1", "example2", "example3"]
213
+ #
214
+ def generate_examples(count)
215
+ count.times.map { |i| "example#{i + 1}" }
216
+ end
217
+ end
218
+ end
219
+ ```
220
+
221
+ ## Testing Guidelines
222
+
223
+ ### Running Tests
224
+
225
+ ```bash
226
+ # Run all tests
227
+ bundle exec rspec
228
+
229
+ # Run specific file
230
+ bundle exec rspec spec/types/core_types_spec.rb
231
+
232
+ # Run with coverage
233
+ bundle exec rspec --coverage
234
+ ```
235
+
236
+ ### Writing Tests
237
+
238
+ - Place tests in `spec/` mirroring the `lib/` structure
239
+ - Use descriptive `describe` and `it` blocks
240
+ - Test edge cases and error conditions
241
+ - Use factories or fixtures for complex data
242
+
243
+ ### Example Test
244
+
245
+ ```ruby
246
+ # frozen_string_literal: true
247
+
248
+ RSpec.describe FakeDataDSL::Types::PersonalNames::Nickname do
249
+ subject(:generator) { described_class.new }
250
+
251
+ describe "#generate_random" do
252
+ it "returns a string" do
253
+ result = generator.generate_random(rng, context, {})
254
+ expect(result).to be_a(String)
255
+ end
256
+
257
+ it "returns consistent results with same seed" do
258
+ rng1 = FakeDataDSL::Generator::RNG.new(42)
259
+ rng2 = FakeDataDSL::Generator::RNG.new(42)
260
+
261
+ result1 = generator.generate_random(rng1, context, {})
262
+ result2 = generator.generate_random(rng2, context, {})
263
+
264
+ expect(result1).to eq(result2)
265
+ end
266
+ end
267
+
268
+ describe "#generate_edge" do
269
+ it "returns edge case values" do
270
+ result = generator.generate_edge(rng, context, {})
271
+ expect(result).to satisfy { |v| v.empty? || v.length == 1 || v.length >= 100 }
272
+ end
273
+ end
274
+ end
275
+ ```
276
+
277
+ ## Documentation
278
+
279
+ ### Code Documentation
280
+
281
+ - Use YARD for API documentation
282
+ - Document all public methods
283
+ - Include usage examples
284
+ - Document parameters and return values
285
+
286
+ ### User Documentation
287
+
288
+ - Update `tech_docs/` for user-facing features
289
+ - Include examples that users can copy/paste
290
+ - Keep tutorials up to date
291
+
292
+ ### Generating Docs
293
+
294
+ ```bash
295
+ # Generate YARD documentation
296
+ bundle exec yard doc
297
+ ```
298
+
299
+ ## Questions?
300
+
301
+ If you have questions about contributing:
302
+
303
+ 1. Check existing documentation
304
+ 2. Search existing issues
305
+ 3. Open a new issue with the "question" label
306
+
307
+ Thank you for contributing to FakeDataDSL! 🎉
data/DOCUMENTATION.md ADDED
@@ -0,0 +1,204 @@
1
+ # Documentation Guide
2
+
3
+ This guide explains how to generate and view the documentation for FakeDataDSL.
4
+
5
+ ## Prerequisites
6
+
7
+ First, install the documentation dependencies:
8
+
9
+ ```bash
10
+ bundle install
11
+ ```
12
+
13
+ This will install:
14
+ - `yard` - YARD documentation generator
15
+ - `redcarpet` - Markdown processor for YARD
16
+ - `webrick` - Web server for viewing docs
17
+
18
+ ## Generating Documentation
19
+
20
+ ### Method 1: Using Rake (Recommended)
21
+
22
+ ```bash
23
+ # Generate documentation
24
+ bundle exec rake docs
25
+
26
+ # This will:
27
+ # - Generate HTML documentation in the doc/ directory
28
+ # - Include README, CHANGELOG, and all code documentation
29
+ # - Show a message with the location
30
+ ```
31
+
32
+ After generation, open `doc/index.html` in your browser.
33
+
34
+ ### Method 2: Using YARD Directly
35
+
36
+ ```bash
37
+ # Generate documentation
38
+ bundle exec yard doc
39
+
40
+ # Generate with specific options
41
+ bundle exec yard doc --no-cache --private
42
+ ```
43
+
44
+ ### Method 3: View Documentation Online
45
+
46
+ If the gem is published to RubyGems, documentation is automatically available at:
47
+ - [RubyDoc.info](https://www.rubydoc.info/gems/fake_data_dsl)
48
+ - [RubyGems.org](https://rubygems.org/gems/fake_data_dsl)
49
+
50
+ ## Viewing Documentation Locally
51
+
52
+ ### Option 1: Open HTML Files
53
+
54
+ After generating docs:
55
+
56
+ ```bash
57
+ # macOS
58
+ open doc/index.html
59
+
60
+ # Linux
61
+ xdg-open doc/index.html
62
+
63
+ # Windows
64
+ start doc/index.html
65
+ ```
66
+
67
+ ### Option 2: YARD Server (Live Reload)
68
+
69
+ Start a local documentation server with auto-reload:
70
+
71
+ ```bash
72
+ # Using Rake
73
+ bundle exec rake docs_server
74
+
75
+ # Or directly
76
+ bundle exec yard server --reload
77
+ ```
78
+
79
+ Then open http://localhost:8808 in your browser.
80
+
81
+ The server will automatically reload when you make changes to the code.
82
+
83
+ ## Documentation Structure
84
+
85
+ The generated documentation includes:
86
+
87
+ - **README.md** - Full project documentation and usage guide
88
+ - **API Reference** - All classes, modules, and methods
89
+ - **Examples** - Code examples from YARD comments
90
+ - **Type System** - All built-in types with descriptions
91
+ - **Behaviors** - All simulation behaviors
92
+ - **Configuration** - Configuration options
93
+ - **Error Classes** - All error types
94
+
95
+ ## Writing Documentation
96
+
97
+ ### YARD Comments
98
+
99
+ All public methods should have YARD documentation:
100
+
101
+ ```ruby
102
+ # Generates a UUID value.
103
+ #
104
+ # Supports UUID versions 4, 6, and 7 for different use cases.
105
+ # Version 4 is random, version 6/7 are time-sortable.
106
+ #
107
+ # @param rng [Generator::RNG] random number generator
108
+ # @param args [Hash] generation arguments
109
+ # @option args [Integer] :version UUID version (4, 6, or 7)
110
+ # @return [String] UUID string in standard format
111
+ #
112
+ # @example Generate UUID v4
113
+ # uuid = type.generate_random(rng, {})
114
+ # # => "550e8400-e29b-41d4-a716-446655440000"
115
+ #
116
+ # @see https://www.rfc-editor.org/rfc/rfc9562 RFC 9562 - UUID
117
+ #
118
+ def generate_random(rng, args)
119
+ # Implementation
120
+ end
121
+ ```
122
+
123
+ ### Documentation Tags
124
+
125
+ Common YARD tags:
126
+
127
+ - `@param` - Method parameters
128
+ - `@return` - Return value
129
+ - `@option` - Hash options
130
+ - `@example` - Usage examples
131
+ - `@raise` - Exceptions raised
132
+ - `@see` - Related references
133
+ - `@since` - Version introduced
134
+ - `@deprecated` - Deprecated methods
135
+ - `@api` - API visibility (public/private)
136
+
137
+ ## Updating Documentation
138
+
139
+ After making code changes:
140
+
141
+ 1. Update YARD comments in code
142
+ 2. Regenerate documentation: `bundle exec rake docs`
143
+ 3. Review changes in `doc/index.html`
144
+ 4. Commit documentation updates with code changes
145
+
146
+ ## Documentation Files
147
+
148
+ - **README.md** - Main project documentation
149
+ - **CHANGELOG.md** - Version history
150
+ - **CONTRIBUTING.md** - Contribution guidelines
151
+ - **CODE_OF_CONDUCT.md** - Community standards
152
+ - **DOCUMENTATION.md** - This file
153
+ - **.yardopts** - YARD configuration
154
+
155
+ ## Troubleshooting
156
+
157
+ ### Documentation Not Generating
158
+
159
+ ```bash
160
+ # Check if YARD is installed
161
+ bundle exec yard --version
162
+
163
+ # Clear YARD cache
164
+ rm -rf .yardoc doc/
165
+
166
+ # Regenerate
167
+ bundle exec rake docs
168
+ ```
169
+
170
+ ### Missing Examples
171
+
172
+ Ensure examples in YARD comments use the `@example` tag:
173
+
174
+ ```ruby
175
+ # @example Basic usage
176
+ # schema = FakeDataDSL.load('user.dsl')
177
+ # user = schema.generate
178
+ ```
179
+
180
+ ### Private Methods Not Showing
181
+
182
+ By default, private methods are hidden. To include them:
183
+
184
+ ```bash
185
+ bundle exec yard doc --private
186
+ ```
187
+
188
+ Or update `.yardopts` to include `--private`.
189
+
190
+ ## Publishing Documentation
191
+
192
+ When releasing a new version:
193
+
194
+ 1. Generate documentation: `bundle exec rake docs`
195
+ 2. Commit the `doc/` directory (if hosting yourself)
196
+ 3. Push to RubyGems (auto-publishes to RubyDoc.info)
197
+ 4. Update any external documentation sites
198
+
199
+ ## Additional Resources
200
+
201
+ - [YARD Documentation](https://yardoc.org/)
202
+ - [YARD Tags Reference](https://www.rubydoc.info/gems/yard/file/docs/Tags.md)
203
+ - [RubyDoc.info](https://www.rubydoc.info/)
204
+
@@ -0,0 +1,194 @@
1
+ # FakeDataDSL Documentation Guide
2
+
3
+ ## 📚 Documentation Structure
4
+
5
+ The FakeDataDSL documentation consists of:
6
+
7
+ 1. **YARD Documentation** - Auto-generated from code comments
8
+ 2. **Markdown Guides** - Comprehensive guides in `docs/` folder
9
+ 3. **API Reference** - Programmatic API documentation
10
+
11
+ ## 🚀 Quick Start
12
+
13
+ ### Generate Documentation
14
+
15
+ ```bash
16
+ # Navigate to project directory
17
+ cd /path/to/fake_data_dsl
18
+
19
+ # Generate YARD documentation
20
+ bundle exec yard doc
21
+ ```
22
+
23
+ ### View Documentation
24
+
25
+ ```bash
26
+ # Open in browser (macOS)
27
+ open doc/index.html
28
+
29
+ # Open in browser (Linux)
30
+ xdg-open doc/index.html
31
+
32
+ # Or use a local server
33
+ cd doc
34
+ python3 -m http.server 8000
35
+ # Visit http://localhost:8000
36
+ ```
37
+
38
+ ## 📖 Documentation Files
39
+
40
+ All documentation is in the `docs/` folder:
41
+
42
+ - **README.md** - Documentation index
43
+ - **getting_started.md** - Quick start guide
44
+ - **dsl_reference.md** - Complete DSL syntax
45
+ - **type_reference.md** - All available types
46
+ - **behaviors.md** - Behaviors guide
47
+ - **generation_modes.md** - Generation modes
48
+ - **advanced_features.md** - Advanced features
49
+ - **examples.md** - Real-world examples
50
+ - **api_reference.md** - Programmatic API
51
+ - **best_practices.md** - Best practices
52
+ - **troubleshooting.md** - Common issues
53
+ - **HOW_TO_GENERATE_DOCS.md** - This guide
54
+ - **QUICK_REFERENCE.md** - Quick reference card
55
+
56
+ ## 🔧 Configuration
57
+
58
+ The `.yardopts` file configures YARD:
59
+
60
+ - Includes markdown files from `docs/`
61
+ - Sets output directory to `doc/`
62
+ - Configures markup provider (Redcarpet)
63
+
64
+ ## 📝 Adding Documentation
65
+
66
+ ### Add New Guide
67
+
68
+ 1. Create markdown file in `docs/`:
69
+ ```bash
70
+ touch docs/my_guide.md
71
+ ```
72
+
73
+ 2. Add to `docs/README.md` table of contents
74
+
75
+ 3. Regenerate docs:
76
+ ```bash
77
+ bundle exec yard doc
78
+ ```
79
+
80
+ ### Update Code Documentation
81
+
82
+ 1. Add YARD comments to code:
83
+ ```ruby
84
+ # My method
85
+ #
86
+ # @param arg [String] description
87
+ # @return [Integer] description
88
+ #
89
+ def my_method(arg)
90
+ # ...
91
+ end
92
+ ```
93
+
94
+ 2. Regenerate docs:
95
+ ```bash
96
+ bundle exec yard doc
97
+ ```
98
+
99
+ ## 🌐 Publishing
100
+
101
+ ### GitHub Pages
102
+
103
+ 1. Generate docs:
104
+ ```bash
105
+ bundle exec yard doc
106
+ ```
107
+
108
+ 2. Push to `gh-pages` branch:
109
+ ```bash
110
+ git checkout --orphan gh-pages
111
+ git rm -rf .
112
+ cp -r doc/* .
113
+ git add .
114
+ git commit -m "Update documentation"
115
+ git push origin gh-pages
116
+ ```
117
+
118
+ 3. Enable GitHub Pages in repository settings
119
+
120
+ ## 📊 Documentation Stats
121
+
122
+ Current documentation coverage:
123
+ - **94.37% documented**
124
+ - 154 classes (0 undocumented)
125
+ - 588 methods (9 undocumented)
126
+ - 99 constants (36 undocumented)
127
+
128
+ ## 🔍 Accessing Documentation
129
+
130
+ ### Local Access
131
+
132
+ ```bash
133
+ # Generate
134
+ bundle exec yard doc
135
+
136
+ # View
137
+ open doc/index.html
138
+ ```
139
+
140
+ ### Online Access
141
+
142
+ If published to GitHub Pages:
143
+ - Visit: `https://yourusername.github.io/fake_data_dsl/`
144
+
145
+ ## 📚 Documentation Sections
146
+
147
+ ### For Users
148
+
149
+ - [Getting Started](docs/getting_started.md)
150
+ - [DSL Reference](docs/dsl_reference.md)
151
+ - [Type Reference](docs/type_reference.md)
152
+ - [Examples](docs/examples.md)
153
+
154
+ ### For Developers
155
+
156
+ - [API Reference](docs/api_reference.md)
157
+ - [Advanced Features](docs/advanced_features.md)
158
+ - [Best Practices](docs/best_practices.md)
159
+
160
+ ### For Troubleshooting
161
+
162
+ - [Troubleshooting](docs/troubleshooting.md)
163
+ - [Best Practices](docs/best_practices.md)
164
+
165
+ ## 🛠️ Troubleshooting
166
+
167
+ ### YARD Not Found
168
+
169
+ ```bash
170
+ gem install yard
171
+ # or
172
+ bundle install
173
+ ```
174
+
175
+ ### Documentation Not Updating
176
+
177
+ ```bash
178
+ rm -rf .yardoc doc/
179
+ bundle exec yard doc
180
+ ```
181
+
182
+ ### Missing Markdown Files
183
+
184
+ Ensure `.yardopts` includes:
185
+ ```
186
+ docs/**/*.md
187
+ ```
188
+
189
+ ## 📞 Need Help?
190
+
191
+ - Check [Troubleshooting](docs/troubleshooting.md)
192
+ - Review [Examples](docs/examples.md)
193
+ - Open an issue on GitHub
194
+
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Synthra Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+