clowne 0.1.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +11 -45
  3. data/.travis.yml +14 -21
  4. data/CHANGELOG.md +30 -0
  5. data/Gemfile +11 -7
  6. data/README.md +38 -18
  7. data/Rakefile +3 -3
  8. data/clowne.gemspec +17 -10
  9. data/docs/.nojekyll +0 -0
  10. data/docs/.rubocop.yml +8 -2
  11. data/docs/CNAME +1 -0
  12. data/docs/README.md +131 -0
  13. data/docs/_sidebar.md +25 -0
  14. data/docs/active_record.md +4 -7
  15. data/docs/after_clone.md +53 -0
  16. data/docs/after_persist.md +77 -0
  17. data/docs/architecture.md +2 -5
  18. data/docs/assets/docsify.min.js +1 -0
  19. data/docs/assets/prism-ruby.min.js +1 -0
  20. data/docs/assets/styles.css +348 -0
  21. data/docs/assets/vue.css +1 -0
  22. data/docs/clone_mapper.md +59 -0
  23. data/docs/customization.md +6 -7
  24. data/docs/exclude_association.md +6 -8
  25. data/docs/finalize.md +11 -15
  26. data/docs/from_v02_to_v1.md +83 -0
  27. data/docs/getting_started.md +171 -0
  28. data/docs/implicit_cloner.md +2 -5
  29. data/docs/include_association.md +24 -10
  30. data/docs/index.html +29 -0
  31. data/docs/init_as.md +13 -9
  32. data/docs/inline_configuration.md +5 -6
  33. data/docs/nullify.md +3 -7
  34. data/docs/operation.md +55 -0
  35. data/docs/parameters.md +112 -0
  36. data/docs/sequel.md +16 -22
  37. data/docs/supported_adapters.md +3 -6
  38. data/docs/testing.md +194 -0
  39. data/docs/traits.md +1 -4
  40. data/gemfiles/activerecord42.gemfile +7 -5
  41. data/gemfiles/jruby.gemfile +8 -6
  42. data/gemfiles/railsmaster.gemfile +8 -6
  43. data/lib/clowne.rb +12 -9
  44. data/lib/clowne/adapters/active_record.rb +4 -5
  45. data/lib/clowne/adapters/active_record/associations.rb +8 -6
  46. data/lib/clowne/adapters/active_record/associations/base.rb +1 -5
  47. data/lib/clowne/adapters/active_record/associations/belongs_to.rb +29 -0
  48. data/lib/clowne/adapters/active_record/associations/has_one.rb +3 -2
  49. data/lib/clowne/adapters/active_record/dsl.rb +2 -2
  50. data/lib/clowne/adapters/active_record/resolvers/association.rb +38 -0
  51. data/lib/clowne/adapters/base.rb +49 -44
  52. data/lib/clowne/adapters/base/association.rb +24 -15
  53. data/lib/clowne/adapters/registry.rb +49 -0
  54. data/lib/clowne/adapters/sequel.rb +14 -10
  55. data/lib/clowne/adapters/sequel/associations.rb +6 -6
  56. data/lib/clowne/adapters/sequel/associations/base.rb +9 -5
  57. data/lib/clowne/adapters/sequel/associations/many_to_many.rb +6 -2
  58. data/lib/clowne/adapters/sequel/associations/one_to_many.rb +7 -2
  59. data/lib/clowne/adapters/sequel/associations/one_to_one.rb +7 -2
  60. data/lib/clowne/adapters/sequel/operation.rb +35 -0
  61. data/lib/clowne/adapters/sequel/record_wrapper.rb +0 -16
  62. data/lib/clowne/adapters/sequel/resolvers/after_persist.rb +22 -0
  63. data/lib/clowne/adapters/sequel/resolvers/association.rb +51 -0
  64. data/lib/clowne/adapters/sequel/specifications/after_persist_does_not_support.rb +15 -0
  65. data/lib/clowne/cloner.rb +49 -21
  66. data/lib/clowne/declarations.rb +15 -12
  67. data/lib/clowne/declarations/after_clone.rb +21 -0
  68. data/lib/clowne/declarations/after_persist.rb +21 -0
  69. data/lib/clowne/declarations/base.rb +13 -0
  70. data/lib/clowne/declarations/exclude_association.rb +2 -2
  71. data/lib/clowne/declarations/finalize.rb +5 -4
  72. data/lib/clowne/declarations/include_association.rb +16 -2
  73. data/lib/clowne/declarations/init_as.rb +5 -4
  74. data/lib/clowne/declarations/nullify.rb +4 -3
  75. data/lib/clowne/declarations/trait.rb +1 -0
  76. data/lib/clowne/dsl.rb +9 -0
  77. data/lib/clowne/ext/lambda_as_proc.rb +17 -0
  78. data/lib/clowne/ext/orm_ext.rb +1 -1
  79. data/lib/clowne/ext/record_key.rb +12 -0
  80. data/lib/clowne/ext/string_constantize.rb +9 -3
  81. data/lib/clowne/ext/yield_self_then.rb +25 -0
  82. data/lib/clowne/planner.rb +16 -3
  83. data/lib/clowne/resolvers/after_clone.rb +17 -0
  84. data/lib/clowne/resolvers/after_persist.rb +18 -0
  85. data/lib/clowne/resolvers/finalize.rb +12 -0
  86. data/lib/clowne/resolvers/init_as.rb +13 -0
  87. data/lib/clowne/resolvers/nullify.rb +15 -0
  88. data/lib/clowne/rspec.rb +5 -0
  89. data/lib/clowne/rspec/clone_association.rb +99 -0
  90. data/lib/clowne/rspec/clone_associations.rb +26 -0
  91. data/lib/clowne/rspec/helpers.rb +35 -0
  92. data/lib/clowne/utils/clone_mapper.rb +26 -0
  93. data/lib/clowne/utils/operation.rb +95 -0
  94. data/lib/clowne/utils/options.rb +39 -0
  95. data/lib/clowne/utils/params.rb +64 -0
  96. data/lib/clowne/utils/plan.rb +90 -0
  97. data/lib/clowne/version.rb +1 -1
  98. metadata +99 -45
  99. data/docs/alternatives.md +0 -26
  100. data/docs/basic_example.md +0 -66
  101. data/docs/configuration.md +0 -29
  102. data/docs/execution_order.md +0 -14
  103. data/docs/installation.md +0 -16
  104. data/docs/web/.gitignore +0 -11
  105. data/docs/web/core/Footer.js +0 -92
  106. data/docs/web/i18n/en.json +0 -134
  107. data/docs/web/package.json +0 -14
  108. data/docs/web/pages/en/help.js +0 -50
  109. data/docs/web/pages/en/index.js +0 -231
  110. data/docs/web/pages/en/users.js +0 -47
  111. data/docs/web/sidebars.json +0 -30
  112. data/docs/web/siteConfig.js +0 -44
  113. data/docs/web/static/css/custom.css +0 -229
  114. data/docs/web/static/fonts/FiraCode-Medium.woff +0 -0
  115. data/docs/web/static/fonts/FiraCode-Regular.woff +0 -0
  116. data/docs/web/static/fonts/StemText.woff +0 -0
  117. data/docs/web/static/fonts/StemTextBold.woff +0 -0
  118. data/docs/web/static/img/favicon/favicon.ico +0 -0
  119. data/docs/web/yarn.lock +0 -1741
  120. data/lib/clowne/adapters/active_record/association.rb +0 -34
  121. data/lib/clowne/adapters/base/finalize.rb +0 -19
  122. data/lib/clowne/adapters/base/init_as.rb +0 -21
  123. data/lib/clowne/adapters/base/nullify.rb +0 -19
  124. data/lib/clowne/adapters/sequel/association.rb +0 -47
  125. data/lib/clowne/plan.rb +0 -81
data/docs/web/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- node_modules
2
- .DS_Store
3
- lib/core/metadata.js
4
- lib/core/MetadataBlog.js
5
- website/translated_docs
6
- website/build/
7
- website/yarn.lock
8
- website/node_modules
9
-
10
- website/i18n/*
11
- !website/i18n/en.json
@@ -1,92 +0,0 @@
1
- /**
2
- * Copyright (c) 2017-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- const React = require('react');
9
-
10
- class Footer extends React.Component {
11
- docUrl(doc, language) {
12
- const baseUrl = this.props.config.baseUrl;
13
- return baseUrl + 'docs/' + (language ? language + '/' : '') + doc;
14
- }
15
-
16
- pageUrl(doc, language) {
17
- const baseUrl = this.props.config.baseUrl;
18
- return baseUrl + (language ? language + '/' : '') + doc;
19
- }
20
-
21
- render() {
22
- const currentYear = new Date().getFullYear();
23
-
24
- const yearLabel = currentYear > 2018 ? `2018–${currentYear}` : currentYear;
25
-
26
- return (
27
- <footer className="nav-footer" id="footer">
28
- <section className="sitemap">
29
- <div className="footer--block">
30
- <h5>Project</h5>
31
- <div className="footer--list--item">
32
- <a href={this.props.config.repoUrl} target="_blank">
33
- GitHub
34
- </a>
35
- </div>
36
- <div className="footer--list--item">
37
- <a href={this.props.config.gemUrl} target="_blank">
38
- RubyGems
39
- </a>
40
- </div>
41
- </div>
42
- {/* <div className="footer--block">
43
- <h5>Community</h5>
44
- <div className="footer--list--item">
45
- <a href="https://discordapp.com/" target="_blank">Project Chat</a>
46
- </div>
47
- <div className="footer--list--item">
48
- <a href="https://twitter.com/" target="_blank">
49
- Twitter
50
- </a>
51
- </div>
52
- </div>
53
- <div className="footer--block">
54
- <h5>Resources</h5>
55
- <div className="footer--list--item">
56
- <a href="#" target="_blank">Super puper chronicles post</a>
57
- </div>
58
- <div className="footer--list--item">
59
- <a href="#" target="_blank">
60
- Talk Slides
61
- </a>
62
- </div>
63
- </div> */}
64
- <div className="footer--block legals">
65
- <p className="footer--copy">
66
- <span className="copy">{yearLabel}</span>&nbsp;
67
- <a href="https://evilmartians.com" target="_blank">Evil Martians</a>
68
- </p>
69
- <div className="footer--list--item">
70
- <p>Released under the <a href="https://github.com/palkan/clowne/blob/master/LICENSE.txt" target="_blank">MIT license</a></p>
71
- </div>
72
- <div className="footer--list--item">
73
- <p>Built with <a href="https://docusaurus.io" target="_blank">Docusaurus</a></p>
74
- </div>
75
- </div>
76
- </section>
77
- <div className="footer--humanoids">
78
- <div className="humanoids">
79
- <div className="humanoids__martian">
80
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 108 92"><path fill="#111" d="M26 88L8 78l18-10"/><path fill="#111" d="M94 92v-6H44c-5.5 0-10-4.5-10-10s4.5-10 10-10h50V32c0-14-7.9-22-22-22H48c-14.1 0-22 8-22 22v60h68z"/><circle fill="#FFF" cx="48" cy="50" r="8"/><circle fill="#FFF" cx="72" cy="50" r="8"/><circle fill="#363636" cx="48" cy="50" r="4"/><circle fill="#363636" cx="72" cy="50" r="4"/><g fill="#fff"><path d="M48 60c-5.5 0-10-4.5-10-10s4.5-10 10-10 10 4.5 10 10-4.5 10-10 10zm0-16c-3.3 0-6 2.7-6 6s2.7 6 6 6 6-2.7 6-6-2.7-6-6-6zM82 50c0 5.5-4.5 10-10 10s-10-4.5-10-10 4.5-10 10-10 10 4.5 10 10zm-16 0c0 3.3 2.7 6 6 6s6-2.7 6-6-2.7-6-6-6-6 2.7-6 6z"/><path d="M102 8c-3.8 0-6-2.2-6-6 0-1.1-.9-2-2-2s-2 .9-2 2c0 2.2.5 4.1 1.5 5.7L88.2 13c-4-3.3-9.5-5-16.2-5H48c-6.7 0-12.2 1.7-16.2 4.9l-5.3-5.3C27.5 6.1 28 4.2 28 2c0-1.1-.9-2-2-2s-2 .9-2 2c0 3.8-2.2 6-6 6-1.1 0-2 .9-2 2s.9 2 2 2c2.2 0 4.1-.5 5.7-1.5l5.3 5.3c-3.2 4-4.9 9.5-4.9 16.2v34.8L3.9 78 24 89v3h4V32c0-12.9 7.1-20 20-20h24c12.9 0 20 7.1 20 20v32H44c-6.6 0-12 5.4-12 12s5.4 12 12 12h48v4h4v-8h-2l-4-8-4 8h-4l-4-8-4 8h-4l-4-8-4 8h-4l-4-8-4 8h-4l-4-8-3.1 6.2C37.1 80.7 36 78.5 36 76c0-4.4 3.6-8 8-8l4 8 4-8h4l4 8 4-8h4l4 8 4-8h4l4 8 4-8h8V32c0-6.7-1.7-12.2-4.9-16.2l5.3-5.3c1.6 1 3.5 1.5 5.7 1.5 1.1 0 2-.9 2-2s-1-2-2.1-2zM24 84.4L12.1 78 24 71.4v13z"/></g></svg>
81
- </div>
82
- <div className="humanoids__human">
83
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 108 92"><path fill="#FFF" d="M14 62v30h68v-6H32c-5.5 0-10-4.5-10-10s4.5-10 10-10h50v-4c4 0 8-3.6 8-8s-4-8-8-8V32c0-14-7.9-22-22-22H36c-14.1 0-22 8-22 22v14c-4 0-8 3.6-8 8s4 8 8 8z"/><circle fill="#FFF" cx="36" cy="50" r="8"/><circle fill="#FFF" cx="60" cy="50" r="8"/><circle fill="#363636" cx="36" cy="50" r="4"/><circle fill="#363636" cx="60" cy="50" r="4"/><path fill="#363636" d="M60 10H36c-14.1 0-22 8-22 22v2l4-4 6 6 6-6 6 6 6-6 6 6 6-6 6 6 6-6 6 6 6-6 4 4v-2c0-14-7.9-22-22-22z"/><g fill="#111"><path d="M36 60c-5.5 0-10-4.5-10-10s4.5-10 10-10 10 4.5 10 10-4.5 10-10 10zm0-16c-3.3 0-6 2.7-6 6s2.7 6 6 6 6-2.7 6-6-2.7-6-6-6zM60 60c-5.5 0-10-4.5-10-10s4.5-10 10-10 10 4.5 10 10-4.5 10-10 10zm0-16c-3.3 0-6 2.7-6 6s2.7 6 6 6 6-2.7 6-6-2.7-6-6-6z"/><path d="M12 63.8V92h4V32c0-12.9 7.1-20 20-20h24c12.9 0 20 7.1 20 20v32H32c-6.6 0-12 5.4-12 12s5.4 12 12 12h48v4h4v-8H74v-1c0-1.7-1.3-3-3-3s-3 1.3-3 3v1h-6v-1c0-1.7-1.3-3-3-3s-3 1.3-3 3v1h-6v-1c0-1.7-1.3-3-3-3s-3 1.3-3 3v1h-6v-1c0-1.7-1.3-3-3-3s-3 1.3-3 3v1c-4 0-8-3.6-8-8s3.6-8 8-8h6v1c0 1.7 1.3 3 3 3s3-1.3 3-3v-1h6v1c0 1.7 1.3 3 3 3s3-1.3 3-3v-1h6v1c0 1.7 1.3 3 3 3s3-1.3 3-3v-1h6v1c0 1.7 1.3 3 3 3s3-1.3 3-3v-1h4v-4.2c5-.9 8-5 8-9.8s-3-8.9-8-9.8V32c0-15.3-8.7-24-24-24H36c-15.3 0-24 8.7-24 24v12.2c-5 .9-8 5-8 9.8s3 8.9 8 9.8zm72-15.5c2 .8 4 3 4 5.7s-2 4.8-4 5.7V48.3zm-72 0v11.3c-2-.8-4-3-4-5.7s2-4.7 4-5.6z"/></g></svg>
84
- </div>
85
- </div>
86
- </div>
87
- </footer>
88
- );
89
- }
90
- }
91
-
92
- module.exports = Footer;
@@ -1,134 +0,0 @@
1
- {
2
- "_comment": "This file is auto-generated by write-translations.js",
3
- "localized-strings": {
4
- "next": "Next",
5
- "previous": "Previous",
6
- "tagline": "A flexible gem for cloning your models",
7
- "active_record": "Active Record",
8
- "alternatives": "Motivation & Alternatives",
9
- "architecture": "Architecture",
10
- "basic_example": "Basic Example",
11
- "configuration": "Configuration",
12
- "customization": "Customization",
13
- "exclude_association": "Exclude Association",
14
- "execution_order": "Execution Order",
15
- "finalize": "Finalization",
16
- "Finalize": "Finalize",
17
- "implicit_cloner": "Implicit Cloner",
18
- "include_association": "Include Association",
19
- "init_as": "Initialize Cloning Target",
20
- "Init As": "Init As",
21
- "inline_configuration": "Inline Configuration",
22
- "installation": "Installation",
23
- "nullify": "Nullify Attributes",
24
- "Nullify": "Nullify",
25
- "sequel": "Sequel",
26
- "supported_adapters": "Supported Adapters",
27
- "traits": "Traits",
28
- "HISTORY": "HISTORY",
29
- "README": "README",
30
- "readme": "readme",
31
- "CHANGES": "CHANGES",
32
- "LICENSE": "LICENSE",
33
- "CHANGELOG": "CHANGELOG",
34
- "CONTRIBUTING": "CONTRIBUTING",
35
- "History": "History",
36
- "Readme": "Readme",
37
- "extending-remarkable": "extending-remarkable",
38
- "local-third-party-project-testing": "local-third-party-project-testing",
39
- "publish": "publish",
40
- "testing-changes-on-Docusaurus-itself": "testing-changes-on-Docusaurus-itself",
41
- "CODE_OF_CONDUCT": "CODE_OF_CONDUCT",
42
- "2016-03-11-blog-post": "Blog Title",
43
- "2017-04-10-blog-post-two": "New Blog Post",
44
- "2017-09-25-testing-rss": "Adding RSS Support - RSS Truncation Test",
45
- "2017-09-26-adding-rss": "Adding RSS Support",
46
- "2017-10-24-new-version-1.0.0": "New Version 1.0.0",
47
- "doc1": "Latin-ish",
48
- "Example Page": "Example Page",
49
- "doc2": "document number 2",
50
- "doc3": "This is document number 3",
51
- "doc4": "Other Document",
52
- "doc5": "Fifth Document",
53
- "copy-sync": "copy-sync",
54
- "copy": "copy",
55
- "emptyDir-sync": "emptyDir-sync",
56
- "emptyDir": "emptyDir",
57
- "ensureDir-sync": "ensureDir-sync",
58
- "ensureDir": "ensureDir",
59
- "ensureFile-sync": "ensureFile-sync",
60
- "ensureFile": "ensureFile",
61
- "ensureLink-sync": "ensureLink-sync",
62
- "ensureLink": "ensureLink",
63
- "ensureSymlink-sync": "ensureSymlink-sync",
64
- "ensureSymlink": "ensureSymlink",
65
- "fs-read-write": "fs-read-write",
66
- "move-sync": "move-sync",
67
- "move": "move",
68
- "outputFile-sync": "outputFile-sync",
69
- "outputFile": "outputFile",
70
- "outputJson-sync": "outputJson-sync",
71
- "outputJson": "outputJson",
72
- "pathExists-sync": "pathExists-sync",
73
- "pathExists": "pathExists",
74
- "readJson-sync": "readJson-sync",
75
- "readJson": "readJson",
76
- "remove-sync": "remove-sync",
77
- "remove": "remove",
78
- "writeJson-sync": "writeJson-sync",
79
- "writeJson": "writeJson",
80
- "changelog": "changelog",
81
- "http_signing": "http_signing",
82
- "Changelog": "Changelog",
83
- "license": "license",
84
- "ERROR-HANDLING": "ERROR-HANDLING",
85
- "LIMITS": "LIMITS",
86
- "block-bq-flat": "block-bq-flat",
87
- "block-bq-nested": "block-bq-nested",
88
- "block-code": "block-code",
89
- "block-fences": "block-fences",
90
- "block-heading": "block-heading",
91
- "block-hr": "block-hr",
92
- "block-html": "block-html",
93
- "block-lheading": "block-lheading",
94
- "block-list-flat": "block-list-flat",
95
- "block-list-nested": "block-list-nested",
96
- "block-ref-flat": "block-ref-flat",
97
- "block-ref-nested": "block-ref-nested",
98
- "block-tables-large": "block-tables-large",
99
- "block-tables": "block-tables",
100
- "inline-autolink": "inline-autolink",
101
- "inline-backticks": "inline-backticks",
102
- "inline-em-flat": "inline-em-flat",
103
- "inline-em-nested": "inline-em-nested",
104
- "inline-em-worst": "inline-em-worst",
105
- "inline-entity": "inline-entity",
106
- "inline-escape": "inline-escape",
107
- "inline-html": "inline-html",
108
- "inline-links-flat": "inline-links-flat",
109
- "inline-links-nested": "inline-links-nested",
110
- "inline-newlines-large": "inline-newlines-large",
111
- "inline-newlines": "inline-newlines",
112
- "rawtabs": "rawtabs",
113
- "example": "example",
114
- "parser": "parser",
115
- "parsing_block": "parsing_block",
116
- "parsing_core": "parsing_core",
117
- "parsing_inline": "parsing_inline",
118
- "plugins": "plugins",
119
- "renderer": "renderer",
120
- "AUTHORS": "AUTHORS",
121
- "PULL_REQUEST_TEMPLATE": "PULL_REQUEST_TEMPLATE",
122
- "Docs": "Docs",
123
- "GitHub": "GitHub",
124
- "Getting Started": "Getting Started",
125
- "API": "API",
126
- "Adapters": "Adapters",
127
- "Features": "Features"
128
- },
129
- "pages-strings": {
130
- "Help Translate|recruit community translators for your project": "Help Translate",
131
- "Edit this Doc|recruitment message asking to edit the doc source": "Edit",
132
- "Translate this Doc|recruitment message asking to translate the docs": "Translate"
133
- }
134
- }
@@ -1,14 +0,0 @@
1
- {
2
- "scripts": {
3
- "examples": "docusaurus-examples",
4
- "start": "docusaurus-start",
5
- "build": "docusaurus-build",
6
- "publish-gh-pages": "docusaurus-publish",
7
- "write-translations": "docusaurus-write-translations",
8
- "version": "docusaurus-version",
9
- "rename-version": "docusaurus-rename-version"
10
- },
11
- "devDependencies": {
12
- "docusaurus": "^1.0.5"
13
- }
14
- }
@@ -1,50 +0,0 @@
1
- /**
2
- * Copyright (c) 2017-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- const React = require('react');
9
-
10
- const CompLibrary = require('../../core/CompLibrary.js');
11
- const Container = CompLibrary.Container;
12
- const GridBlock = CompLibrary.GridBlock;
13
-
14
- const siteConfig = require(process.cwd() + '/siteConfig.js');
15
-
16
- class Help extends React.Component {
17
- render() {
18
- const supportLinks = [
19
- {
20
- content:
21
- 'Learn more using the [documentation on this site.](/test-site/docs/en/doc1.html)',
22
- title: 'Browse Docs',
23
- },
24
- {
25
- content: 'Ask questions about the documentation and project',
26
- title: 'Join the community',
27
- },
28
- {
29
- content: "Find out what's new with this project",
30
- title: 'Stay up to date',
31
- },
32
- ];
33
-
34
- return (
35
- <div className="docMainWrapper wrapper">
36
- <Container className="mainContainer documentContainer postContainer">
37
- <div className="post">
38
- <header className="postHeader">
39
- <h2>Need help?</h2>
40
- </header>
41
- <p>This project is maintained by a dedicated group of people.</p>
42
- <GridBlock contents={supportLinks} layout="threeColumn" />
43
- </div>
44
- </Container>
45
- </div>
46
- );
47
- }
48
- }
49
-
50
- module.exports = Help;
@@ -1,231 +0,0 @@
1
- /**
2
- * Copyright (c) 2017-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- const React = require('react');
9
-
10
- const CompLibrary = require('../../core/CompLibrary.js');
11
- const MarkdownBlock = CompLibrary.MarkdownBlock; /* Used to read markdown */
12
- const Container = CompLibrary.Container;
13
- const GridBlock = CompLibrary.GridBlock;
14
-
15
- const siteConfig = require(process.cwd() + '/siteConfig.js');
16
-
17
- function imgUrl(img) {
18
- return siteConfig.baseUrl + 'img/' + img;
19
- }
20
-
21
- function docUrl(doc, language) {
22
- return siteConfig.baseUrl + 'docs/' + (language ? language + '/' : '') + doc;
23
- }
24
-
25
- function pageUrl(page, language) {
26
- return siteConfig.baseUrl + (language ? language + '/' : '') + page;
27
- }
28
-
29
- class Button extends React.Component {
30
- render() {
31
- return (
32
- <div className="pluginWrapper buttonWrapper">
33
- <a className={`button ${this.props.className}`} href={this.props.href} target={this.props.target}>
34
- {this.props.children}
35
- </a>
36
- </div>
37
- );
38
- }
39
- }
40
-
41
- Button.defaultProps = {
42
- target: '_self',
43
- className: '',
44
- };
45
-
46
- const SplashContainer = props => (
47
- <div className="homeContainer">
48
- <div className="homeSplashFade">
49
- <div className="wrapper homeWrapper">{props.children}</div>
50
- </div>
51
- </div>
52
- );
53
-
54
- const Logo = props => (
55
- <div className="projectLogo">
56
- </div>
57
- );
58
-
59
- const ProjectTitle = props => (
60
- <h2 className="projectTitle">
61
- <span className="projectTitleName">{siteConfig.title}</span>
62
- <small>{siteConfig.tagline}</small>
63
- <p>
64
- <a href="https://badge.fury.io/rb/clowne"><image title="Gem Version" src="https://badge.fury.io/rb/clowne.svg" /></a>
65
- </p>
66
- </h2>
67
- );
68
-
69
- const PromoSection = props => (
70
- <div className="section promoSection">
71
- <div className="promoRow">
72
- <div className="pluginRowBlock">{props.children}</div>
73
- </div>
74
- </div>
75
- );
76
-
77
- class HomeSplash extends React.Component {
78
- render() {
79
- let language = this.props.language || '';
80
- return (
81
- <SplashContainer>
82
- <div className="inner">
83
- <ProjectTitle />
84
- <PromoSection>
85
- <Button href="/clowne/docs/installation.html">Getting Started</Button>
86
- </PromoSection>
87
- </div>
88
- </SplashContainer>
89
- );
90
- }
91
- }
92
-
93
- const Block = props => (
94
- <Container
95
- padding={props.padding}
96
- id={props.id}
97
- background={props.background}>
98
- <GridBlock align="center" contents={props.children} layout={props.layout} />
99
- </Container>
100
- );
101
-
102
- Block.defaultProps = {
103
- padding: ['bottom', 'top'],
104
- };
105
-
106
- const Features = props => (
107
- <Block layout="twoColumn" padding={['bottom']}>
108
- {[
109
- {
110
- content: 'Rich DSL out-of-the-box',
111
- imageAlign: 'top',
112
- title: 'Powerful',
113
- },
114
- {
115
- content: 'Supports ActiveRecord and Sequel<br/><small><em>ROM is coming soon!</em></small>',
116
- imageAlign: 'top',
117
- title: 'ORM adapters',
118
- },
119
- {
120
- content: 'Easy to extend for your needs',
121
- imageAlign: 'top',
122
- title: 'Customizable',
123
- },
124
- {
125
- content: "It's just Ruby without any dependency",
126
- imageAlign: 'top',
127
- title: 'Rails-free',
128
- },
129
- ]}
130
- </Block>
131
- );
132
-
133
- const FeatureCallout = props => (
134
- <div
135
- className="productShowcaseSection paddingBottom"
136
- style={{textAlign: 'center'}}>
137
- <h2>Feature Callout</h2>
138
- <MarkdownBlock>These are features of this project</MarkdownBlock>
139
- </div>
140
- );
141
-
142
- const LearnHow = props => (
143
- <Block background="light">
144
- {[
145
- {
146
- content: 'Talk about learning how to use this',
147
- image: imgUrl('docusaurus.svg'),
148
- imageAlign: 'right',
149
- title: 'Learn How',
150
- },
151
- ]}
152
- </Block>
153
- );
154
-
155
- const TryOut = props => (
156
- <Block id="try">
157
- {[
158
- {
159
- content: 'Talk about trying this out',
160
- image: imgUrl('docusaurus.svg'),
161
- imageAlign: 'left',
162
- title: 'Try it Out',
163
- },
164
- ]}
165
- </Block>
166
- );
167
-
168
- const Description = props => (
169
- <Block background="dark">
170
- {[
171
- {
172
- content: 'This is another description of how this project is useful',
173
- image: imgUrl('docusaurus.svg'),
174
- imageAlign: 'right',
175
- title: 'Description',
176
- },
177
- ]}
178
- </Block>
179
- );
180
-
181
- const Showcase = props => {
182
- if ((siteConfig.users || []).length === 0) {
183
- return null;
184
- }
185
- const showcase = siteConfig.users
186
- .filter(user => {
187
- return user.pinned;
188
- })
189
- .map((user, i) => {
190
- return (
191
- <a href={user.infoLink} key={i}>
192
- <img src={user.image} title={user.caption} />
193
- </a>
194
- );
195
- });
196
-
197
- return (
198
- <div className="productShowcaseSection paddingBottom">
199
- <h2>{"Who's Using This?"}</h2>
200
- <p>This project is used by all these people</p>
201
- <div className="logos">{showcase}</div>
202
- <div className="more-users">
203
- <a className="button" href={pageUrl('users.html', props.language)}>
204
- More {siteConfig.title} Users
205
- </a>
206
- </div>
207
- </div>
208
- );
209
- };
210
-
211
- class Index extends React.Component {
212
- render() {
213
- let language = this.props.language || '';
214
-
215
- return (
216
- <div>
217
- <HomeSplash language={language} />
218
- <div className="mainContainer">
219
- <Features />
220
- {/* <FeatureCallout /> */}
221
- {/* <LearnHow /> */}
222
- {/* <TryOut /> */}
223
- {/* <Description /> */}
224
- {/* <Showcase language={language} /> */}
225
- </div>
226
- </div>
227
- );
228
- }
229
- }
230
-
231
- module.exports = Index;