├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── CERTIFICATE ├── LICENSE ├── README.md ├── alias.json ├── config.json ├── docker ├── Dockerfile ├── README.md └── main ├── github ├── CERTIFICATE.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md ├── main └── stale.yml ├── node-bin ├── bin.js └── main ├── node-script └── main ├── node ├── README.md ├── main └── travis.yml ├── note └── main ├── playground └── main ├── project-base ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── _gitignore └── main ├── project-choo ├── index.js └── main ├── project-electron ├── index.js └── main ├── project-node ├── index.js ├── main └── package.json ├── project └── main ├── rust-bin ├── Cargo.toml ├── build.rs ├── cli.rs ├── lib.rs ├── main └── main.rs ├── rust ├── Cargo.toml ├── README.md ├── ci.yaml ├── error.rs ├── gitignore ├── lib.rs ├── main ├── test └── test.rs ├── script └── main ├── see-also └── main ├── shared.sh ├── shell └── main ├── talk └── main └── template ├── main └── template.sh /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of 9 | experience, 10 | education, socio-economic status, nationality, personal appearance, race, 11 | religion, or sexual identity and orientation. 12 | 13 | ## Our Standards 14 | 15 | Examples of behavior that contributes to creating a positive environment 16 | include: 17 | 18 | - Using welcoming and inclusive language 19 | - Being respectful of differing viewpoints and experiences 20 | - Gracefully accepting constructive criticism 21 | - Focusing on what is best for the community 22 | - Showing empathy towards other community members 23 | 24 | Examples of unacceptable behavior by participants include: 25 | 26 | - The use of sexualized language or imagery and unwelcome sexual attention or 27 | advances 28 | - Trolling, insulting/derogatory comments, and personal or political attacks 29 | - Public or private harassment 30 | - Publishing others' private information, such as a physical or electronic 31 | address, without explicit permission 32 | - Other conduct which could reasonably be considered inappropriate in a 33 | professional setting 34 | 35 | 36 | ## Our Responsibilities 37 | 38 | Project maintainers are responsible for clarifying the standards of acceptable 39 | behavior and are expected to take appropriate and fair corrective action in 40 | response to any instances of unacceptable behavior. 41 | 42 | Project maintainers have the right and responsibility to remove, edit, or 43 | reject comments, commits, code, wiki edits, issues, and other contributions 44 | that are not aligned to this Code of Conduct, or to ban temporarily or 45 | permanently any contributor for other behaviors that they deem inappropriate, 46 | threatening, offensive, or harmful. 47 | 48 | ## Scope 49 | 50 | This Code of Conduct applies both within project spaces and in public spaces 51 | when an individual is representing the project or its community. Examples of 52 | representing a project or community include using an official project e-mail 53 | address, posting via an official social media account, or acting as an appointed 54 | representative at an online or offline event. Representation of a project may be 55 | further defined and clarified by project maintainers. 56 | 57 | ## Enforcement 58 | 59 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 60 | reported by contacting the project team at yoshuawuyts@gmail.com, or through 61 | IRC. All complaints will be reviewed and investigated and will result in a 62 | response that is deemed necessary and appropriate to the circumstances. The 63 | project team is obligated to maintain confidentiality with regard to the 64 | reporter of an incident. 65 | Further details of specific enforcement policies may be posted separately. 66 | 67 | Project maintainers who do not follow or enforce the Code of Conduct in good 68 | faith may face temporary or permanent repercussions as determined by other 69 | members of the project's leadership. 70 | 71 | ## Attribution 72 | 73 | This Code of Conduct is adapted from the Contributor Covenant, version 1.4, 74 | available at 75 | https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 76 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | Contributions include code, documentation, answering user questions, running the 3 | project's infrastructure, and advocating for all types of users. 4 | 5 | The project welcomes all contributions from anyone willing to work in good faith 6 | with other contributors and the community. No contribution is too small and all 7 | contributions are valued. 8 | 9 | This guide explains the process for contributing to the project's GitHub 10 | Repository. 11 | 12 | - [Code of Conduct](#code-of-conduct) 13 | - [Bad Actors](#bad-actors) 14 | - [Developer Certificate of Origin](#developer-certificate-of-origin) 15 | 16 | ## Code of Conduct 17 | The project has a [Code of Conduct][] that *all* contributors are 18 | expected to follow. This code describes the *minimum* behavior expectations 19 | for all contributors. 20 | 21 | As a contributor, how you choose to act and interact towards your 22 | fellow contributors, as well as to the community, will reflect back not only 23 | on yourself but on the project as a whole. The Code of Conduct is designed and 24 | intended, above all else, to help establish a culture within the project that 25 | allows anyone and everyone who wants to contribute to feel safe doing so. 26 | 27 | Should any individual act in any way that is considered in violation of the 28 | [Code of Conduct][], corrective actions will be taken. It is possible, 29 | however, 30 | for any individual to *act* in such a manner that is not in violation of the 31 | strict letter of the Code of Conduct guidelines while still going completely 32 | against the spirit of what that Code is intended to accomplish. 33 | 34 | Open, diverse, and inclusive communities live and die on the basis of trust. 35 | Contributors can disagree with one another so long as they trust that those 36 | disagreements are in good faith and everyone is working towards a common 37 | goal. 38 | 39 | ## Bad Actors 40 | All contributors to tacitly agree to abide by both the letter and 41 | spirit of the [Code of Conduct][./CODE_OF_CONDUCT.md]. Failure, or 42 | unwillingness, to do so will result in contributions being respectfully 43 | declined. 44 | 45 | A *bad actor* is someone who repeatedly violates the *spirit* of the Code of 46 | Conduct through consistent failure to self-regulate the way in which they 47 | interact with other contributors in the project. In doing so, bad actors 48 | alienate other contributors, discourage collaboration, and generally reflect 49 | poorly on the project as a whole. 50 | 51 | Being a bad actor may be intentional or unintentional. Typically, unintentional 52 | bad behavior can be easily corrected by being quick to apologize and correct 53 | course *even if you are not entirely convinced you need to*. Giving other 54 | contributors the benefit of the doubt and having a sincere willingness to admit 55 | that you *might* be wrong is critical for any successful open collaboration. 56 | 57 | Don't be a bad actor. 58 | 59 | ## Developer Certificate of Origin 60 | All contributors must read and agree to the [Developer Certificate of 61 | Origin (DCO)](./CERTIFICATE.md). 62 | 63 | The DCO allows us to accept contributions from people to the project, similarly 64 | to how a license allows us to distribute our code. 65 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 7 | 8 | **Choose one:** is this a 🐛 bug report, a 🙋 feature request, or a 🔦 question? 9 | 10 | 11 | 12 | ## Expected Behavior 13 | 14 | 15 | 16 | 17 | ## Current Behavior 18 | 19 | 20 | 21 | 22 | ## Possible Solution 23 | 24 | 25 | 26 | ## Context 27 | 28 | 29 | 30 | ## Code Sample 31 | 32 | 33 | ## Your Environment 34 | 35 | 36 | | Software | Version(s) | 37 | | ---------------- | ---------- | 38 | | Package | 39 | | Runtime | 40 | | Package Manager | 41 | | Operating System | 42 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | **Choose one:** is this a 🐛 bug fix, a 🙋 feature, or a 🔦 documentation change? 8 | 9 | 10 | 11 | ## Checklist 12 | 13 | - [ ] tests pass 14 | - [ ] tests and/or benchmarks are included 15 | - [ ] documentation is changed or added 16 | 17 | ## Context 18 | 19 | 20 | ## Semver Changes 21 | 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | tmp/ 2 | 3 | /target 4 | **/*.rs.bk 5 | -------------------------------------------------------------------------------- /CERTIFICATE: -------------------------------------------------------------------------------- 1 | Developer Certificate of Origin 2 | Version 1.1 3 | 4 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 5 | 1 Letterman Drive 6 | Suite D4700 7 | San Francisco, CA, 94129 8 | 9 | Everyone is permitted to copy and distribute verbatim copies of this 10 | license document, but changing it is not allowed. 11 | 12 | 13 | Developer's Certificate of Origin 1.1 14 | 15 | By making a contribution to this project, I certify that: 16 | 17 | (a) The contribution was created in whole or in part by me and I 18 | have the right to submit it under the open source license 19 | indicated in the file; or 20 | 21 | (b) The contribution is based upon previous work that, to the best 22 | of my knowledge, is covered under an appropriate open source 23 | license and I have the right under that license to submit that 24 | work with modifications, whether created in whole or in part 25 | by me, under the same open source license (unless I am 26 | permitted to submit under a different license), as indicated 27 | in the file; or 28 | 29 | (c) The contribution was provided directly to me by some other 30 | person who certified (a), (b) or (c) and I have not modified 31 | it. 32 | 33 | (d) I understand and agree that this project and the contribution 34 | are public and that a record of the contribution (including all 35 | personal information I submit with it, including my sign-off) is 36 | maintained indefinitely and may be redistributed consistent with 37 | this project or the open source license(s) involved. 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | Copyright 2018 Yoshua Wuyts 179 | 180 | Licensed under the Apache License, Version 2.0 (the "License"); 181 | you may not use this file except in compliance with the License. 182 | You may obtain a copy of the License at 183 | 184 | http://www.apache.org/licenses/LICENSE-2.0 185 | 186 | Unless required by applicable law or agreed to in writing, software 187 | distributed under the License is distributed on an "AS IS" BASIS, 188 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 189 | See the License for the specific language governing permissions and 190 | limitations under the License. 191 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # templates 2 | Template files used to generate things. Uses the `{{varname}}` syntax for 3 | interpolation. Each project has a `manifest.json` file the metadata for that 4 | template. 5 | 6 | ## Usage 7 | This templates directory is meant to be sourced through a shell script. It's 8 | a neat little way of multiplexing arbitrary initialization commands. Here's a 9 | basic version you can place in your `/usr/bin` directory (or equivalent): 10 | ```sh 11 | #!/bin/sh 12 | 13 | if [ ! -z "$TEMPLATES" ]; then 14 | printf 'bin/ew: TEMPLATES variable not set\n' 15 | exit 1 16 | fi 17 | 18 | if [ $# = "0" ]; then 19 | printf 'usage: ew \n' 20 | exit 1 21 | fi 22 | 23 | template="$TEMPLATES/$1/main" 24 | if [ ! -x "$template" ]; then 25 | printf 'bin/ew: template %s does not exist\n' "$1" 26 | exit 1 27 | fi 28 | 29 | shift 30 | "$template" "$@" 31 | ``` 32 | You can now run commands using `ew`, for example: 33 | ```sh 34 | $ ew shell my_cool_shell_script 35 | ``` 36 | 37 | ## See Also 38 | - [yoshuawuyts/dotfiles](https://github.com/yoshuawuyts/dotfiles) 39 | - [yoshuawuyts/infrastructure](https://github.com/yoshuawuyts/infrastructure) 40 | - [yoshuawuyts/knowledge](https://github.com/yoshuawuyts/knowledge) 41 | - [yoshuawuyts/writing](https://github.com/yoshuawuyts/writing) 42 | 43 | ## License 44 | [Apache-2.0](https://tldrlegal.com/license/mit-license) 45 | -------------------------------------------------------------------------------- /alias.json: -------------------------------------------------------------------------------- 1 | { 2 | "sa": "see-also" 3 | } 4 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "username": "Yoshua Wuyts", 3 | "email": "yoshuawuyts@gmail.com", 4 | "gh_name": "yoshuawuyts" 5 | } 6 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | MAINTAINER Yoshua Wuyts 3 | 4 | WORKDIR / 5 | 6 | ENTRYPOINT ["ls"] 7 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | # {{PROJECTNAME}} 2 | {{DESCRIPTION}} 3 | 4 | ## Usage 5 | ```sh 6 | $ docker run -i yoshuawuyts/{{PROJECTNAME}} 7 | ``` 8 | 9 | ## See Also 10 | 11 | ## License 12 | [Apache-2.0](./LICENSE) 13 | -------------------------------------------------------------------------------- /docker/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | dirname=$(dirname "$(readlink -f "$0")") 4 | 5 | readf () { 6 | file="$(readlink -f "$dirname/$1")" 7 | cat "$file" 8 | } 9 | 10 | replace () { 11 | sed "s/{{$1}}/$2/g" 12 | } 13 | 14 | copy () { 15 | infile="$1" 16 | outfile="$2" 17 | tmpfile="$(readlink -f "$dirname/$infile")" 18 | cat "$tmpfile" > "$outfile" 19 | } 20 | 21 | if [ $# = "0" ]; then 22 | printf 'usage: ew docker \n' 23 | exit 1 24 | fi 25 | 26 | printf 'What does this Dockerfile do?\n❯ ' 27 | read -r desc 28 | if [ "$desc" = "" ]; then 29 | printf 'no description provided, exiting\n' 30 | exit 1 31 | fi 32 | 33 | mkdir -p "$1" 34 | cd "$1" || exit 1 35 | 36 | readf 'README.md' \ 37 | | replace 'PROJECTNAME' "$1" \ 38 | | replace 'DESCRIPTION' "$desc" \ 39 | > README.md 40 | 41 | copy 'Dockerfile' 'Dockerfile' 42 | -------------------------------------------------------------------------------- /github/CERTIFICATE.md: -------------------------------------------------------------------------------- 1 | Developer Certificate of Origin 2 | Version 1.1 3 | 4 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 5 | 1 Letterman Drive 6 | Suite D4700 7 | San Francisco, CA, 94129 8 | 9 | Everyone is permitted to copy and distribute verbatim copies of this 10 | license document, but changing it is not allowed. 11 | 12 | 13 | Developer's Certificate of Origin 1.1 14 | 15 | By making a contribution to this project, I certify that: 16 | 17 | (a) The contribution was created in whole or in part by me and I 18 | have the right to submit it under the open source license 19 | indicated in the file; or 20 | 21 | (b) The contribution is based upon previous work that, to the best 22 | of my knowledge, is covered under an appropriate open source 23 | license and I have the right under that license to submit that 24 | work with modifications, whether created in whole or in part 25 | by me, under the same open source license (unless I am 26 | permitted to submit under a different license), as indicated 27 | in the file; or 28 | 29 | (c) The contribution was provided directly to me by some other 30 | person who certified (a), (b) or (c) and I have not modified 31 | it. 32 | 33 | (d) I understand and agree that this project and the contribution 34 | are public and that a record of the contribution (including all 35 | personal information I submit with it, including my sign-off) is 36 | maintained indefinitely and may be redistributed consistent with 37 | this project or the open source license(s) involved. 38 | -------------------------------------------------------------------------------- /github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of 9 | experience, 10 | education, socio-economic status, nationality, personal appearance, race, 11 | religion, or sexual identity and orientation. 12 | 13 | ## Our Standards 14 | 15 | Examples of behavior that contributes to creating a positive environment 16 | include: 17 | 18 | - Using welcoming and inclusive language 19 | - Being respectful of differing viewpoints and experiences 20 | - Gracefully accepting constructive criticism 21 | - Focusing on what is best for the community 22 | - Showing empathy towards other community members 23 | 24 | Examples of unacceptable behavior by participants include: 25 | 26 | - The use of sexualized language or imagery and unwelcome sexual attention or 27 | advances 28 | - Trolling, insulting/derogatory comments, and personal or political attacks 29 | - Public or private harassment 30 | - Publishing others' private information, such as a physical or electronic 31 | address, without explicit permission 32 | - Other conduct which could reasonably be considered inappropriate in a 33 | professional setting 34 | 35 | 36 | ## Our Responsibilities 37 | 38 | Project maintainers are responsible for clarifying the standards of acceptable 39 | behavior and are expected to take appropriate and fair corrective action in 40 | response to any instances of unacceptable behavior. 41 | 42 | Project maintainers have the right and responsibility to remove, edit, or 43 | reject comments, commits, code, wiki edits, issues, and other contributions 44 | that are not aligned to this Code of Conduct, or to ban temporarily or 45 | permanently any contributor for other behaviors that they deem inappropriate, 46 | threatening, offensive, or harmful. 47 | 48 | ## Scope 49 | 50 | This Code of Conduct applies both within project spaces and in public spaces 51 | when an individual is representing the project or its community. Examples of 52 | representing a project or community include using an official project e-mail 53 | address, posting via an official social media account, or acting as an appointed 54 | representative at an online or offline event. Representation of a project may be 55 | further defined and clarified by project maintainers. 56 | 57 | ## Enforcement 58 | 59 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 60 | reported by contacting the project team at yoshuawuyts@gmail.com, or through 61 | IRC. All complaints will be reviewed and investigated and will result in a 62 | response that is deemed necessary and appropriate to the circumstances. The 63 | project team is obligated to maintain confidentiality with regard to the 64 | reporter of an incident. 65 | Further details of specific enforcement policies may be posted separately. 66 | 67 | Project maintainers who do not follow or enforce the Code of Conduct in good 68 | faith may face temporary or permanent repercussions as determined by other 69 | members of the project's leadership. 70 | 71 | ## Attribution 72 | 73 | This Code of Conduct is adapted from the Contributor Covenant, version 1.4, 74 | available at 75 | https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 76 | -------------------------------------------------------------------------------- /github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | Contributions include code, documentation, answering user questions, running the 3 | project's infrastructure, and advocating for all types of users. 4 | 5 | The project welcomes all contributions from anyone willing to work in good faith 6 | with other contributors and the community. No contribution is too small and all 7 | contributions are valued. 8 | 9 | This guide explains the process for contributing to the project's GitHub 10 | Repository. 11 | 12 | - [Code of Conduct](#code-of-conduct) 13 | - [Bad Actors](#bad-actors) 14 | 15 | ## Code of Conduct 16 | The project has a [Code of Conduct](./CODE_OF_CONDUCT.md) that *all* 17 | contributors are expected to follow. This code describes the *minimum* behavior 18 | expectations for all contributors. 19 | 20 | As a contributor, how you choose to act and interact towards your 21 | fellow contributors, as well as to the community, will reflect back not only 22 | on yourself but on the project as a whole. The Code of Conduct is designed and 23 | intended, above all else, to help establish a culture within the project that 24 | allows anyone and everyone who wants to contribute to feel safe doing so. 25 | 26 | Should any individual act in any way that is considered in violation of the 27 | [Code of Conduct](./CODE_OF_CONDUCT.md), corrective actions will be taken. It is 28 | possible, however, for any individual to *act* in such a manner that is not in 29 | violation of the strict letter of the Code of Conduct guidelines while still 30 | going completely against the spirit of what that Code is intended to accomplish. 31 | 32 | Open, diverse, and inclusive communities live and die on the basis of trust. 33 | Contributors can disagree with one another so long as they trust that those 34 | disagreements are in good faith and everyone is working towards a common 35 | goal. 36 | 37 | ## Bad Actors 38 | All contributors to tacitly agree to abide by both the letter and 39 | spirit of the [Code of Conduct](./CODE_OF_CONDUCT.md). Failure, or 40 | unwillingness, to do so will result in contributions being respectfully 41 | declined. 42 | 43 | A *bad actor* is someone who repeatedly violates the *spirit* of the Code of 44 | Conduct through consistent failure to self-regulate the way in which they 45 | interact with other contributors in the project. In doing so, bad actors 46 | alienate other contributors, discourage collaboration, and generally reflect 47 | poorly on the project as a whole. 48 | 49 | Being a bad actor may be intentional or unintentional. Typically, unintentional 50 | bad behavior can be easily corrected by being quick to apologize and correct 51 | course *even if you are not entirely convinced you need to*. Giving other 52 | contributors the benefit of the doubt and having a sincere willingness to admit 53 | that you *might* be wrong is critical for any successful open collaboration. 54 | 55 | Don't be a bad actor. 56 | -------------------------------------------------------------------------------- /github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 7 | 8 | **Choose one:** is this a 🐛 bug report, a 🙋 feature request, or a 🔦 question? 9 | 10 | 11 | 12 | ## Expected Behavior 13 | 14 | 15 | 16 | 17 | ## Current Behavior 18 | 19 | 20 | 21 | 22 | ## Possible Solution 23 | 24 | 25 | 26 | ## Context 27 | 28 | 29 | 30 | ## Code Sample 31 | 32 | 33 | ## Your Environment 34 | 35 | 36 | | Software | Version(s) | 37 | | ---------------- | ---------- | 38 | | Package | 39 | | Runtime | 40 | | Package Manager | 41 | | Operating System | 42 | -------------------------------------------------------------------------------- /github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoshuawuyts/templates/10ded8ee86a5d741de4eed72e8cb389e0371a940/github/PULL_REQUEST_TEMPLATE.md -------------------------------------------------------------------------------- /github/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | __dirname=$(dirname "$(readlink -f "$0")") 4 | source "$(readlink -f "$__dirname/../shared.sh")" 5 | 6 | mkdir -p ".github/" 7 | copy "$__dirname/CODE_OF_CONDUCT.md" ".github/CODE_OF_CONDUCT.md" 8 | copy "$__dirname/CONTRIBUTING.md" ".github/CONTRIBUTING.md" 9 | # copy "$__dirname/ISSUE_TEMPLATE.md" ".github/ISSUE_TEMPLATE.md" 10 | # copy "$__dirname/PULL_REQUEST_TEMPLATE.md" ".github/PULL_REQUEST_TEMPLATE.md" 11 | # copy "$__dirname/stale.yml" ".github/stale.yml" 12 | -------------------------------------------------------------------------------- /github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | daysUntilStale: 90 4 | daysUntilClose: 7 5 | exemptLabels: 6 | - pinned 7 | - security 8 | exemptProjects: false 9 | exemptMilestones: false 10 | staleLabel: wontfix 11 | markComment: > 12 | This issue has been automatically marked as stale because it has not had 13 | recent activity. It will be closed if no further activity occurs. Thank you 14 | for your contributions. 15 | unmarkComment: false 16 | closeComment: false 17 | limitPerRun: 30 18 | -------------------------------------------------------------------------------- /node-bin/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var minimist = require('minimist') 4 | 5 | var argv = minimist(process.argv.slice(2), { 6 | boolean: [ 7 | 'version', 8 | 'help' 9 | ] 10 | }) 11 | 12 | var usage = ` 13 | Usage: 14 | $ 15 | 16 | Commands: 17 | 18 | 19 | Options: 20 | -h, --help Print usage 21 | -v, --version Print version 22 | 23 | Examples: 24 | ` 25 | 26 | ;(function main (argv) { 27 | if (argv.h) { 28 | return console.info(usage) 29 | } else if (argv.v) { 30 | return console.info('v' + require('./package.json').version) 31 | } 32 | })(argv) 33 | -------------------------------------------------------------------------------- /node-bin/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | __dirname=$(dirname "$(readlink -f "$0")") 4 | . "$(readlink -f "$__dirname/../shared.sh")" 5 | 6 | name="$(jq '.name' < package.json)" 7 | copy "$__dirname/bin.js" "bin.js" 8 | chmod +x "bin.js" 9 | 10 | script="{bin: {" 11 | script="$script$name" 12 | script="$script: \"./bin.js\" } }" 13 | pkg="$(jq ". + $script" < package.json)" 14 | echo "$pkg" > package.json 15 | 16 | npm install -S minimist 17 | -------------------------------------------------------------------------------- /node-script/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ $# = "0" ]; then 4 | printf 'usage: ew shell \n' 5 | exit 1 6 | fi 7 | 8 | touch "$1" 9 | chmod +x "$1" 10 | printf '#!/bin/env node\n' > "$1" 11 | -------------------------------------------------------------------------------- /node/README.md: -------------------------------------------------------------------------------- 1 | # {{PROJECTNAME}} 2 | [![npm version][2]][3] [![build status][4]][5] 3 | [![downloads][8]][9] [![js-standard-style][10]][11] 4 | 5 | {{DESCRIPTION}} 6 | 7 | ## Installation 8 | ```sh 9 | $ npm install {{PROJECTNAME}} 10 | ``` 11 | 12 | ## License 13 | [Apache-2.0](./LICENSE) 14 | 15 | [0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square 16 | [1]: https://nodejs.org/api/documentation.html#documentation_stability_index 17 | [2]: https://img.shields.io/npm/v/{{PROJECTNAME}}.svg?style=flat-square 18 | [3]: https://npmjs.org/package/{{PROJECTNAME}} 19 | [4]: https://img.shields.io/travis/{{USERNAME}}/{{PROJECTNAME}}/master.svg?style=flat-square 20 | [5]: https://travis-ci.org/{{USERNAME}}/{{PROJECTNAME}} 21 | [6]: https://img.shields.io/codecov/c/github/{{USERNAME}}/{{PROJECTNAME}}/master.svg?style=flat-square 22 | [7]: https://codecov.io/github/{{USERNAME}}/{{PROJECTNAME}} 23 | [8]: http://img.shields.io/npm/dm/{{PROJECTNAME}}.svg?style=flat-square 24 | [9]: https://npmjs.org/package/{{PROJECTNAME}} 25 | [10]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square 26 | [11]: https://github.com/feross/standard 27 | -------------------------------------------------------------------------------- /node/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | __dirname=$(dirname "$(readlink -f "$0")") 4 | . "$(readlink -f "$__dirname/../shared.sh")" 5 | 6 | parse_keywords () { 7 | keywords="$1" 8 | keywords="$(echo "$keywords" | sed 's/,/ /g' | sed 's/ / /g' | tr ' ' '\n')" 9 | str="" 10 | for f in $keywords; do 11 | str="$str\"$f\"," 12 | done 13 | 14 | keywords="$str" 15 | keywords="$(echo "$keywords" | sed '$ s/,$//' | sed 's/,/, /' | tr ' ' '\n')" 16 | keywords="$(printf '[\n%s\n]\n' "$keywords")" 17 | keywords="$(printf '{\nkeywords: %s\n}' "$keywords")" 18 | echo "$keywords" 19 | } 20 | 21 | # define PROJECTNAME 22 | if [ -z "$1" ]; then 23 | printf 'What is the name of the project?\n❯ ' 24 | read -r PROJECTNAME 25 | if [ "$PROJECTNAME" = "" ]; then 26 | printf 'no name provided, exiting\n' 27 | exit 1 28 | fi 29 | else 30 | PROJECTNAME="$1" 31 | fi 32 | 33 | # define DESCRIPTION 34 | if [ -z "$2" ]; then 35 | printf 'What does this project do?\n❯ ' 36 | read -r DESCRIPTION 37 | if [ "$DESCRIPTION" = "" ]; then 38 | printf 'no description provided, exiting\n' 39 | exit 1 40 | fi 41 | else 42 | DESCRIPTION="$2" 43 | fi 44 | 45 | # define USERNAME 46 | if [ -z "$3" ]; then 47 | printf 'Under what user on GitHub will this project live?\n❯ ' 48 | read -r USERNAME 49 | if [ "$USERNAME" = "" ]; then 50 | printf 'no username provided, exiting\n' 51 | exit 1 52 | fi 53 | else 54 | USERNAME="$3" 55 | fi 56 | 57 | # create base project 58 | ew project-node "$PROJECTNAME" "$DESCRIPTION" "$USERNAME" 59 | cd "$PROJECTNAME" || exit 1 60 | 61 | # define KEYWORDS 62 | if [ -z "$4" ]; then 63 | printf 'What keywords should we include?\n❯ ' 64 | read -r KEYWORDS 65 | else 66 | KEYWORDS="$4" 67 | fi 68 | keywords="$(parse_keywords "$KEYWORDS")" 69 | 70 | pkg="$(cat package.json)" 71 | pkg="$(echo "$pkg" | jq 'del(.private)')" 72 | pkg="$(echo "$pkg" | jq ". + $keywords")" 73 | pkg="$(echo "$pkg" | jq '. + { license: "Apache-2.0" }')" 74 | echo "$pkg" > package.json 75 | 76 | readf "$__dirname/travis.yml" > .travis.yml 77 | 78 | readf "$__dirname/README.md" \ 79 | | replace PROJECTNAME "$PROJECTNAME" \ 80 | | replace DESCRIPTION "$DESCRIPTION" \ 81 | | replace USERNAME "$USERNAME" \ 82 | > README.md 83 | 84 | ew github 85 | -------------------------------------------------------------------------------- /node/travis.yml: -------------------------------------------------------------------------------- 1 | node_js: 2 | - "4" 3 | - "5" 4 | - "6" 5 | - "7" 6 | sudo: false 7 | language: node_js 8 | script: "npm run test" 9 | # after_success: "npm i -g codecov && npm run coverage && codecov" 10 | -------------------------------------------------------------------------------- /note/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | __dirname=$(dirname "$(readlink -f "$0")") 4 | . "$(readlink -f "$__dirname/../shared.sh")" 5 | 6 | # define note 7 | if [ -z "$1" ]; then 8 | printf 'What is the note about?\n❯ ' 9 | read -r note 10 | if [ "$note" = "" ]; then 11 | printf 'no details provided, exiting\n' 12 | exit 1 13 | fi 14 | else 15 | note="$1" 16 | fi 17 | 18 | note="$(echo "$note" | tr ' ' '-')" 19 | now="$(date -I)" 20 | touch "$now-$note.md" 21 | -------------------------------------------------------------------------------- /playground/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ $# = "0" ]; then 4 | printf 'usage: ew playground \n' 5 | exit 1 6 | fi 7 | 8 | name="playground-$1" 9 | ew project-base "$name" 10 | 11 | readme="$(pwd)/$name/README.md" 12 | sed -i '3 i ## See also\n' "$readme" 13 | -------------------------------------------------------------------------------- /project-base/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | Copyright {{YEAR}} {{NAME}} 179 | 180 | Licensed under the Apache License, Version 2.0 (the "License"); 181 | you may not use this file except in compliance with the License. 182 | You may obtain a copy of the License at 183 | 184 | http://www.apache.org/licenses/LICENSE-2.0 185 | 186 | Unless required by applicable law or agreed to in writing, software 187 | distributed under the License is distributed on an "AS IS" BASIS, 188 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 189 | See the License for the specific language governing permissions and 190 | limitations under the License. 191 | -------------------------------------------------------------------------------- /project-base/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) {{YEAR}} {{NAME}} 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 | -------------------------------------------------------------------------------- /project-base/README.md: -------------------------------------------------------------------------------- 1 | # {{PROJECTNAME}} 2 | {{DESCRIPTION}} 3 | 4 | ## License 5 | [MIT](./LICENSE-MIT) OR [Apache-2.0](./LICENSE-APACHE) 6 | -------------------------------------------------------------------------------- /project-base/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | coverage/ 3 | tmp/ 4 | dist/ 5 | npm-debug.log* 6 | .DS_Store 7 | .nyc_output 8 | -------------------------------------------------------------------------------- /project-base/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | __dirname=$(dirname "$(readlink -f "$0")") 4 | # shellcheck source=/dev/null 5 | . "$(readlink -f "$__dirname/../shared.sh")" 6 | 7 | # define PROJECTNAME 8 | if [ -z "$1" ]; then 9 | printf 'What is the name of the project?\n❯ ' 10 | read -r PROJECTNAME 11 | if [ "$PROJECTNAME" = "" ]; then 12 | printf 'no name provided, exiting\n' 13 | exit 1 14 | fi 15 | else 16 | PROJECTNAME="$1" 17 | fi 18 | 19 | # define DESCRIPTION 20 | if [ -z "$2" ]; then 21 | printf 'What does this project do?\n❯ ' 22 | read -r DESCRIPTION 23 | if [ "$DESCRIPTION" = "" ]; then 24 | printf 'no description provided, exiting\n' 25 | exit 1 26 | fi 27 | else 28 | DESCRIPTION="$2" 29 | fi 30 | 31 | mkdir -p "$PROJECTNAME" 32 | cd "$PROJECTNAME" || exit 1 33 | 34 | readf "$__dirname/README.md" \ 35 | | replace PROJECTNAME "$PROJECTNAME" \ 36 | | replace DESCRIPTION "$DESCRIPTION" \ 37 | > README.md 38 | 39 | copy "$__dirname/_gitignore" ".gitignore" 40 | 41 | echo '[copy] LICENSE-APACHE' 42 | readf "$__dirname/LICENSE-APACHE" \ 43 | | replace YEAR "$(date +%Y)" \ 44 | | replace NAME "Yoshua Wuyts" \ 45 | > LICENSE-APACHE 46 | 47 | echo '[copy] LICENSE-MIT' 48 | readf "$__dirname/LICENSE-MIT" \ 49 | | replace YEAR "$(date +%Y)" \ 50 | | replace NAME "Yoshua Wuyts" \ 51 | > LICENSE-MIT 52 | 53 | git init 54 | -------------------------------------------------------------------------------- /project-choo/index.js: -------------------------------------------------------------------------------- 1 | var expose = require('choo-expose') 2 | var html = require('choo/html') 3 | var log = require('choo-log') 4 | var css = require('sheetify') 5 | var choo = require('choo') 6 | 7 | css('tachyons') 8 | 9 | var app = choo() 10 | app.use(log()) 11 | app.use(expose()) 12 | app.route('/', mainView) 13 | app.mount('body') 14 | 15 | function mainView (state, prev, send) { 16 | return html` 17 | 18 |
19 |
20 |

21 | choo choo 22 |

23 |
24 |
25 | 26 | ` 27 | } 28 | -------------------------------------------------------------------------------- /project-choo/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | dirname=$(dirname "$(readlink -f "$0")") 4 | 5 | readf () { 6 | file="$(readlink -f "$dirname/$1")" 7 | cat "$file" 8 | } 9 | 10 | replace () { 11 | sed "s/{{$1}}/$2/g" 12 | } 13 | 14 | copy () { 15 | infile="$1" 16 | outfile="$2" 17 | tmpfile="$(readlink -f "$dirname/$infile")" 18 | cp --preserve=mode "$tmpfile" "$outfile" 19 | } 20 | 21 | # define PROJECTNAME 22 | if [ -z "$1" ]; then 23 | printf 'What is the name of the project?\n❯ ' 24 | read -r PROJECTNAME 25 | if [ "$PROJECTNAME" = "" ]; then 26 | printf 'no name provided, exiting\n' 27 | exit 1 28 | fi 29 | else 30 | PROJECTNAME="$1" 31 | fi 32 | 33 | # define DESCRIPTION 34 | if [ -z "$2" ]; then 35 | printf 'What does this project do?\n❯ ' 36 | read -r DESCRIPTION 37 | if [ "$DESCRIPTION" = "" ]; then 38 | printf 'no description provided, exiting\n' 39 | exit 1 40 | fi 41 | else 42 | DESCRIPTION="$2" 43 | fi 44 | 45 | # define USERNAME 46 | if [ -z "$3" ]; then 47 | printf 'Under what user on GitHub will this project live?\n❯ ' 48 | read -r USERNAME 49 | if [ "$USERNAME" = "" ]; then 50 | printf 'no username provided, exiting\n' 51 | exit 1 52 | fi 53 | else 54 | USERNAME="$3" 55 | fi 56 | 57 | 58 | ew project-node "$PROJECTNAME" "$DESCRIPTION" "$USERNAME" 59 | cd "$PROJECTNAME" || exit 1 60 | 61 | # dirs 62 | mkdir -p assets/ 63 | mkdir -p elements/ 64 | mkdir -p lib/ 65 | mkdir -p stores/ 66 | mkdir -p views/ 67 | 68 | # install 69 | npm install -S \ 70 | choo@next \ 71 | choo-log \ 72 | choo-expose \ 73 | sheetify \ 74 | tachyons 75 | 76 | npm install -D \ 77 | bankai \ 78 | dependency-check \ 79 | standard 80 | 81 | copy "index.js" "index.js" 82 | 83 | pkg="$(cat package.json)" 84 | pkg="$(echo "$pkg" | jq 'del(.scripts.coverage)')" 85 | pkg="$(echo "$pkg" | jq '.scripts + { build: "bankai build" }')" 86 | pkg="$(echo "$pkg" | jq '.scripts + { inspect: "bankai inspect" }')" 87 | pkg="$(echo "$pkg" | jq '.scripts + { start: "bankai start" }')" 88 | pkg="$(echo "$pkg" | jq '.scripts + { start: "bankai start" }')" 89 | echo "$pkg" > package.json 90 | 91 | git init 92 | git add -A 93 | git commit -m . 94 | -------------------------------------------------------------------------------- /project-electron/index.js: -------------------------------------------------------------------------------- 1 | var defaultMenu = require('electron-default-menu') 2 | var electron = require('electron') 3 | var bankai = require('bankai') 4 | var merry = require('merry') 5 | var path = require('path') 6 | 7 | var BrowserWindow = electron.BrowserWindow 8 | var shell = electron.shell 9 | var Menu = electron.Menu 10 | var app = electron.app 11 | 12 | var windowStyles = { 13 | titleBarStyle: 'hidden-inset', 14 | minWidth: 640, 15 | height: 600, 16 | width: 800 17 | } 18 | 19 | var env = merry.env({ 20 | NODE_ENV: 'production', 21 | PORT: 8080 22 | }) 23 | 24 | app.on('ready', function () { 25 | if (env.NODE_ENV === 'development') renderDevelopment() 26 | else renderProduction() 27 | }) 28 | 29 | function renderDevelopment () { 30 | var clientPath = path.join(__dirname, 'app.js') 31 | var indexPath = 'http://localhost:' + env.PORT 32 | var assets = bankai(clientPath) 33 | var server = merry() 34 | 35 | server.router([ 36 | [ '/', _merryAssets(assets.html.bind(assets)) ], 37 | [ '/bundle.js', _merryAssets(assets.js.bind(assets)) ], 38 | [ '/bundle.css', _merryAssets(assets.css.bind(assets)) ] 39 | ]) 40 | 41 | server.listen(env.PORT, function () { 42 | var win = new BrowserWindow(windowStyles) 43 | win.loadURL(indexPath) 44 | win.webContents.on('did-finish-load', function () { 45 | win.show() 46 | var menu = Menu.buildFromTemplate(defaultMenu(app, shell)) 47 | Menu.setApplicationMenu(menu) 48 | win.webContents.openDevTools() 49 | }) 50 | }) 51 | } 52 | 53 | function renderProduction () { 54 | var indexPath = path.join(__dirname, 'dist/index.html') 55 | var win = new BrowserWindow(windowStyles) 56 | win.loadURL(indexPath) 57 | win.webContents.on('did-finish-load', function () { 58 | win.show() 59 | var menu = Menu.buildFromTemplate(defaultMenu(app, shell)) 60 | Menu.setApplicationMenu(menu) 61 | win.webContents.openDevTools() 62 | }) 63 | } 64 | 65 | function _merryAssets (assets) { 66 | return function (req, res, ctx, done) { 67 | done(null, assets(req, res)) 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /project-electron/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | __dirname=$(dirname "$(readlink -f "$0")") 4 | . "$(readlink -f "$__dirname/../shared.sh")" 5 | 6 | # create base project 7 | ew project-node "$@" 8 | cd "$PROJECTNAME" || exit 1 9 | 10 | readf "$__dirname/index.js" \ 11 | > index.js 12 | 13 | touch app.js 14 | 15 | # install 16 | npm install -S \ 17 | bankai \ 18 | choo \ 19 | choo-log \ 20 | electron \ 21 | electron-default-window \ 22 | merry \ 23 | sheetify \ 24 | tachyons 25 | 26 | npm install -D electron-builder 27 | -------------------------------------------------------------------------------- /project-node/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoshuawuyts/templates/10ded8ee86a5d741de4eed72e8cb389e0371a940/project-node/index.js -------------------------------------------------------------------------------- /project-node/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | __dirname=$(dirname "$(readlink -f "$0")") 4 | . "$(readlink -f "$__dirname/../shared.sh")" 5 | 6 | # define PROJECTNAME 7 | if [ -z "$1" ]; then 8 | printf 'What is the name of the project?\n❯ ' 9 | read -r PROJECTNAME 10 | if [ "$PROJECTNAME" = "" ]; then 11 | printf 'no name provided, exiting\n' 12 | exit 1 13 | fi 14 | else 15 | PROJECTNAME="$1" 16 | fi 17 | 18 | # define DESCRIPTION 19 | if [ -z "$2" ]; then 20 | printf 'What does this project do?\n❯ ' 21 | read -r DESCRIPTION 22 | if [ "$DESCRIPTION" = "" ]; then 23 | printf 'no description provided, exiting\n' 24 | exit 1 25 | fi 26 | else 27 | DESCRIPTION="$2" 28 | fi 29 | 30 | # define USERNAME 31 | if [ -z "$3" ]; then 32 | printf 'Under what user on GitHub will this project live?\n❯ ' 33 | read -r USERNAME 34 | if [ "$USERNAME" = "" ]; then 35 | printf 'no username provided, exiting\n' 36 | exit 1 37 | fi 38 | else 39 | USERNAME="$3" 40 | fi 41 | 42 | CAMELNAME="$(echo "$PROJECTNAME" | to_camel_case)" 43 | 44 | # create base project 45 | ew project-base "$PROJECTNAME" "$DESCRIPTION" 46 | cd "$PROJECTNAME" || exit 1 47 | 48 | readf "$__dirname/index.js" \ 49 | | replace 'CAMELNAME' "$CAMELNAME" \ 50 | > index.js 51 | 52 | readf "$__dirname/package.json" \ 53 | | replace 'PROJECTNAME' "$PROJECTNAME" \ 54 | | replace 'DESCRIPTION' "$DESCRIPTION" \ 55 | | replace 'USERNAME' "$USERNAME" \ 56 | > package.json 57 | 58 | # install 59 | npm install -D \ 60 | tape \ 61 | standard \ 62 | dependency-check 63 | -------------------------------------------------------------------------------- /project-node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{PROJECTNAME}}", 3 | "description": "{{DESCRIPTION}}", 4 | "repository": "{{USERNAME}}/{{PROJECTNAME}}", 5 | "version": "1.0.0", 6 | "private": true, 7 | "scripts": { 8 | "deps": "dependency-check . && dependency-check . --extra --no-dev", 9 | "start": "node .", 10 | "test": "standard && npm run deps" 11 | }, 12 | "dependencies": {}, 13 | "devDependencies": {} 14 | } 15 | -------------------------------------------------------------------------------- /project/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | choose () { 4 | printf 'What kind of project do you want to create? ' > /dev/tty 5 | printf '(base|node|rust)\n' > /dev/tty 6 | printf '❯ ' > /dev/tty 7 | read -r project 8 | echo "$project" 9 | } 10 | 11 | if [ -z "$1" ]; then 12 | CHOICE="$(choose)" 13 | else 14 | CHOICE="$1" 15 | fi 16 | 17 | # define PROJECTNAME 18 | if [ -z "$2" ]; then 19 | printf 'What is the name of the project?\n❯ ' 20 | read -r PROJECTNAME 21 | if [ "$PROJECTNAME" = "" ]; then 22 | printf 'no name provided, exiting\n' 23 | exit 1 24 | fi 25 | else 26 | PROJECTNAME="$2" 27 | fi 28 | 29 | shift 2 30 | case "$CHOICE" in 31 | b|base) ew project-base "$PROJECTNAME" "$@" ;; 32 | c|choo) ew project-choo "$PROJECTNAME" "$@" ;; 33 | n|node) ew project-node "$PROJECTNAME" "$@" ;; 34 | r|rust) ew project-rust "$PROJECTNAME" "$@" ;; 35 | *) { printf 'No valid project selected. Exiting'; exit 1; } 36 | esac 37 | -------------------------------------------------------------------------------- /rust-bin/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{package_name}}" 3 | version = "1.0.0" 4 | authors = ["Yoshua Wuyts "] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | -------------------------------------------------------------------------------- /rust-bin/build.rs: -------------------------------------------------------------------------------- 1 | extern crate clap_flags; 2 | extern crate failure; 3 | extern crate structopt; 4 | 5 | use std::path::PathBuf; 6 | use std::str::FromStr; 7 | use structopt::{clap::Shell, StructOpt}; 8 | 9 | #[path = "src/cli.rs"] 10 | mod cli; 11 | 12 | fn main() -> std::result::Result<(), Box> { 13 | let outdir = ::std::env::var_os("OUT_DIR").expect("OUT_DIR not found."); 14 | let mut app = cli::Cli::clap(); 15 | 16 | let target: PathBuf = outdir.into(); 17 | let target = target.join("../../../scripts"); 18 | mkdirp::mkdirp(&target)?; 19 | 20 | for shell in &Shell::variants() { 21 | let shell = Shell::from_str(*shell)?; 22 | app.gen_completions(env!("CARGO_PKG_NAME"), shell, &target); 23 | } 24 | 25 | Ok(()) 26 | } 27 | -------------------------------------------------------------------------------- /rust-bin/cli.rs: -------------------------------------------------------------------------------- 1 | use clap_flags; 2 | use failure::{Error, ResultExt}; 3 | use structopt::{self, StructOpt}; 4 | 5 | /// Command line parser. 6 | #[derive(Debug, StructOpt)] 7 | #[structopt( 8 | about = "{{DESCRIPTION}}", 9 | raw(setting = "structopt::clap::AppSettings::ColoredHelp") 10 | )] 11 | pub struct Cli { 12 | #[structopt(flatten)] 13 | logger: clap_flags::Log, 14 | #[structopt(flatten)] 15 | verbosity: clap_flags::Verbosity, 16 | } 17 | 18 | impl Cli { 19 | /// Initialize a logger. 20 | #[inline] 21 | pub fn log(&self, name: &str) -> Result<(), Error> { 22 | self 23 | .logger 24 | .log(self.verbosity.log_level(), name) 25 | .context("Could not create logger")?; 26 | Ok(()) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /rust-bin/lib.rs: -------------------------------------------------------------------------------- 1 | //! ## Example 2 | //! ```rust 3 | //! ``` 4 | 5 | mod cli; 6 | 7 | pub use crate::cli::Cli; 8 | -------------------------------------------------------------------------------- /rust-bin/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | __dirname=$(dirname "$(readlink -f "$0")") 4 | source "$(readlink -f "$__dirname/../shared.sh")" 5 | 6 | # define PROJECTNAME 7 | if [ -z "$1" ]; then 8 | printf 'What is the name of the project?\n❯ ' 9 | read -r PROJECTNAME 10 | if [ "$PROJECTNAME" = "" ]; then 11 | printf 'no name provided, exiting\n' 12 | exit 1 13 | fi 14 | else 15 | PROJECTNAME="$1" 16 | shift 17 | fi 18 | 19 | # define DESCRIPTION 20 | if [ -z "$2" ]; then 21 | printf 'What does this project do?\n❯ ' 22 | read -r DESCRIPTION 23 | if [ "$DESCRIPTION" = "" ]; then 24 | printf 'no description provided, exiting\n' 25 | exit 1 26 | fi 27 | else 28 | DESCRIPTION="$(echo "$2" | sed 's|\.$||')." 29 | shift 30 | fi 31 | 32 | ew rust "$PROJECTNAME" "$DESCRIPTION" "$@" 33 | 34 | pushd "$PROJECTNAME" 35 | rm src/lib.rs 36 | 37 | readf "$__dirname/main.rs" \ 38 | | replace PROJECTNAME "$(echo "$PROJECTNAME" | tr '-' '_')" \ 39 | > src/main.rs 40 | 41 | readf "$__dirname/cli.rs" \ 42 | | replace DESCRIPTION "$DESCRIPTION" \ 43 | > src/cli.rs 44 | 45 | copy "$__dirname/lib.rs" src/lib.rs 46 | copy "$__dirname/build.rs" build.rs 47 | 48 | cargo add exitfailure 49 | cargo add human-panic 50 | cargo add structopt 51 | cargo add log 52 | cargo add clap_flags 53 | 54 | cargo add -B mkdirp 55 | cargo add -B structopt 56 | cargo add -B clap_flags 57 | popd 58 | -------------------------------------------------------------------------------- /rust-bin/main.rs: -------------------------------------------------------------------------------- 1 | #![forbid(unsafe_code, future_incompatible, rust_2018_idioms)] 2 | #![deny(missing_debug_implementations, nonstandard_style)] 3 | #![warn(missing_docs, missing_doc_code_examples, unreachable_pub)] 4 | #![cfg_attr(test, deny(warnings))] 5 | 6 | use {{PROJECTNAME}}::Cli; 7 | use structopt::StructOpt; 8 | use exitfailure::ExitFailure; 9 | use human_panic::setup_panic; 10 | use log::info; 11 | 12 | fn main() -> Result<(), ExitFailure> { 13 | setup_panic!(); 14 | let args = Cli::from_args(); 15 | args.log(env!("CARGO_PKG_NAME"))?; 16 | info!("program started"); 17 | Ok(()) 18 | } 19 | -------------------------------------------------------------------------------- /rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{PROJECTNAME}}" 3 | version = "1.0.0" 4 | license = "MIT OR Apache-2.0" 5 | repository = "https://github.com/{{USERNAME}}/{{PROJECTNAME}}" 6 | documentation = "https://docs.rs/{{PROJECTNAME}}" 7 | description = "{{DESCRIPTION}}" 8 | keywords = [{{KEYWORDS}}] 9 | categories = [{{CATEGORIES}}] 10 | authors = ["{{AUTHOR}} <{{EMAIL}}>"] 11 | readme = "README.md" 12 | edition = "2018" 13 | 14 | [dependencies] 15 | 16 | [dev-dependencies] 17 | -------------------------------------------------------------------------------- /rust/README.md: -------------------------------------------------------------------------------- 1 |

{{PROJECTNAME}}

2 |
3 | 4 | {{DESCRIPTION}} 5 | 6 |
7 | 8 |
9 | 10 |
11 | 12 | 13 | Crates.io version 15 | 16 | 17 | 18 | Download 20 | 21 | 22 | 23 | docs.rs docs 25 | 26 |
27 | 28 | 43 | 44 | ## Installation 45 | ```sh 46 | $ cargo add {{PROJECTNAME}} 47 | ``` 48 | 49 | ## Safety 50 | This crate uses ``#![deny(unsafe_code)]`` to ensure everything is implemented in 51 | 100% Safe Rust. 52 | 53 | ## Contributing 54 | Want to join us? Check out our ["Contributing" guide][contributing] and take a 55 | look at some of these issues: 56 | 57 | - [Issues labeled "good first issue"][good-first-issue] 58 | - [Issues labeled "help wanted"][help-wanted] 59 | 60 | [contributing]: https://github.com/{{USERNAME}}/{{PROJECTNAME}}/blob/master.github/CONTRIBUTING.md 61 | [good-first-issue]: https://github.com/{{USERNAME}}/{{PROJECTNAME}}/labels/good%20first%20issue 62 | [help-wanted]: https://github.com/{{USERNAME}}/{{PROJECTNAME}}/labels/help%20wanted 63 | 64 | ## License 65 | 66 | 67 | Licensed under either of Apache License, Version 68 | 2.0 or MIT license at your option. 69 | 70 | 71 |
72 | 73 | 74 | Unless you explicitly state otherwise, any contribution intentionally submitted 75 | for inclusion in this crate by you, as defined in the Apache-2.0 license, shall 76 | be dual licensed as above, without any additional terms or conditions. 77 | 78 | -------------------------------------------------------------------------------- /rust/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: 7 | - staging 8 | - trying 9 | 10 | env: 11 | RUSTFLAGS: -Dwarnings 12 | 13 | jobs: 14 | build_and_test: 15 | name: Build and test 16 | runs-on: ${{ matrix.os }} 17 | strategy: 18 | matrix: 19 | os: [ubuntu-latest, windows-latest, macOS-latest] 20 | rust: [stable] 21 | 22 | steps: 23 | - uses: actions/checkout@master 24 | 25 | - name: Install ${{ matrix.rust }} 26 | uses: actions-rs/toolchain@v1 27 | with: 28 | toolchain: ${{ matrix.rust }} 29 | override: true 30 | 31 | - name: check 32 | uses: actions-rs/cargo@v1 33 | with: 34 | command: check 35 | args: --all --bins --examples 36 | 37 | - name: tests 38 | uses: actions-rs/cargo@v1 39 | with: 40 | command: test 41 | args: --all 42 | 43 | check_fmt_and_docs: 44 | name: Checking fmt and docs 45 | runs-on: ubuntu-latest 46 | steps: 47 | - uses: actions/checkout@master 48 | 49 | - uses: actions-rs/toolchain@v1 50 | with: 51 | toolchain: stable 52 | profile: minimal 53 | components: rustfmt 54 | 55 | - name: fmt 56 | run: cargo fmt --all -- --check 57 | 58 | - name: Docs 59 | run: cargo doc 60 | -------------------------------------------------------------------------------- /rust/error.rs: -------------------------------------------------------------------------------- 1 | use failure::{self, Backtrace, Context, Fail}; 2 | use std::fmt::{self, Display}; 3 | use std::result; 4 | 5 | /// A specialized [`Result`] type for this crate's operations. 6 | /// 7 | /// This is generally used to avoid writing out [Error] directly and 8 | /// is otherwise a direct mapping to [`Result`]. 9 | /// 10 | /// [`Result`]: https://doc.rust-lang.org/nightly/std/result/enum.Result.html 11 | /// [`Error`]: std.struct.Error.html 12 | pub type Result = result::Result; 13 | 14 | /// A list enumerating the categories of errors in this crate. 15 | /// 16 | /// This list is intended to grow over time and it is not recommended to 17 | /// exhaustively match against it. 18 | /// 19 | /// It is used with the [`Error`] struct. 20 | /// 21 | /// [`Error`]: std.struct.Error.html 22 | #[derive(Debug, Fail)] 23 | pub enum ErrorKind { 24 | /// Any error not part of this list. 25 | #[fail(display = "Generic error.")] 26 | Other, 27 | } 28 | 29 | /// A specialized [`Error`] type for this crate's operations. 30 | /// 31 | /// [`Error`]: https://doc.rust-lang.org/nightly/std/error/trait.Error.html 32 | #[derive(Debug)] 33 | pub struct Error { 34 | inner: Context, 35 | } 36 | 37 | impl Error { 38 | /// Access the [`ErrorKind`] member. 39 | /// 40 | /// [`ErrorKind`]: enum.ErrorKind.html 41 | pub fn kind(&self) -> &ErrorKind { 42 | &*self.inner.get_context() 43 | } 44 | } 45 | 46 | impl Fail for Error { 47 | fn cause(&self) -> Option<&dyn Fail> { 48 | self.inner.cause() 49 | } 50 | 51 | fn backtrace(&self) -> Option<&Backtrace> { 52 | self.inner.backtrace() 53 | } 54 | } 55 | 56 | impl Display for Error { 57 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 58 | Display::fmt(&self.inner, f) 59 | } 60 | } 61 | 62 | impl From for Error { 63 | fn from(kind: ErrorKind) -> Error { 64 | let inner = Context::new(kind); 65 | Error { inner } 66 | } 67 | } 68 | 69 | impl From> for Error { 70 | fn from(inner: Context) -> Error { 71 | Error { inner } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /rust/gitignore: -------------------------------------------------------------------------------- 1 | coverage/ 2 | target/ 3 | tmp/ 4 | dist/ 5 | npm-debug.log* 6 | Cargo.lock 7 | .DS_Store 8 | -------------------------------------------------------------------------------- /rust/lib.rs: -------------------------------------------------------------------------------- 1 | //! {{DESCRIPTION}} 2 | //! 3 | //! # Examples 4 | //! 5 | //! Basic usage: 6 | //! 7 | //! ``` 8 | //! // tbi 9 | //! ``` 10 | 11 | #![forbid(unsafe_code, future_incompatible, rust_2018_idioms)] 12 | #![deny(missing_debug_implementations, nonstandard_style)] 13 | #![warn(missing_docs, missing_doc_code_examples, unreachable_pub)] 14 | -------------------------------------------------------------------------------- /rust/main: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | __dirname=$(dirname "$(readlink -f "$0")") 6 | source "$(readlink -f "$__dirname/../shared.sh")" 7 | 8 | parse_list () { 9 | keywords="$1" 10 | keywords="$(echo "$keywords" | sed 's/,/ /g' | sed 's/ / /g')" 11 | str="" 12 | for f in $keywords; do 13 | str="$str\"$f\", " 14 | done 15 | 16 | str="$(echo "$str" | sed '$s/, $//' | tr -d '\n')" 17 | printf "$str" 18 | } 19 | 20 | EMAIL="yoshuawuyts@gmail.com" 21 | 22 | if [ $# = "0" ]; then 23 | printf 'usage: ew rust \n' 24 | exit 1 25 | fi 26 | 27 | # define PROJECTNAME 28 | if [ -z "$1" ]; then 29 | printf 'What is the name of the project?\n❯ ' 30 | read -r PROJECTNAME 31 | if [ "$PROJECTNAME" = "" ]; then 32 | printf 'no name provided, exiting\n' 33 | exit 1 34 | fi 35 | else 36 | PROJECTNAME="$1" 37 | fi 38 | 39 | # define DESCRIPTION 40 | if [ -z "$2" ]; then 41 | printf 'What does this project do?\n❯ ' 42 | read -r DESCRIPTION 43 | if [ "$DESCRIPTION" = "" ]; then 44 | printf 'no description provided, exiting\n' 45 | exit 1 46 | fi 47 | else 48 | DESCRIPTION="$2" 49 | fi 50 | DESCRIPTION="$(echo "$DESCRIPTION" | sed 's|\.$||')." 51 | 52 | # define USERNAME 53 | if [ -z "$3" ]; then 54 | printf 'Under what user on GitHub will this project live?\n❯ ' 55 | read -r USERNAME 56 | if [ "$USERNAME" = "" ]; then 57 | printf 'no username provided, exiting\n' 58 | exit 1 59 | fi 60 | else 61 | USERNAME="$3" 62 | fi 63 | 64 | # Create base project 65 | cargo init --lib "$PROJECTNAME" 66 | ew project-base "$PROJECTNAME" "$DESCRIPTION" "$USERNAME" 67 | 68 | # define KEYWORDS 69 | if [ -z "$4" ]; then 70 | printf 'Which keywords should we include? (max 5)\n❯ ' 71 | read -r KEYWORDS 72 | else 73 | KEYWORDS="$4" 74 | fi 75 | KEYWORDS="$(parse_list "$KEYWORDS")" 76 | 77 | # define CATEGORIES 78 | if [ -z "$5" ]; then 79 | echo 'cats' 80 | CATEGORIES="$(cargo-categories)" 81 | else 82 | CATEGORIES="$4" 83 | fi 84 | CATEGORIES="$(parse_list "$CATEGORIES")" 85 | 86 | echo "CATEGORIES $CATEGORIES" 87 | 88 | # Copy files 89 | pushd "$1" 90 | copy "$__dirname/gitignore" .gitignore 91 | ew github 92 | 93 | readf "$__dirname/lib.rs" \ 94 | | replace DESCRIPTION "$DESCRIPTION" \ 95 | > src/lib.rs 96 | 97 | readf "$__dirname/README.md" \ 98 | | replace PROJECTNAME "$PROJECTNAME" \ 99 | | replace DESCRIPTION "$DESCRIPTION" \ 100 | | replace USERNAME "$USERNAME" \ 101 | > README.md 102 | 103 | readf "$__dirname/Cargo.toml" \ 104 | | replace PROJECTNAME "$PROJECTNAME" \ 105 | | replace KEYWORDS "$KEYWORDS" \ 106 | | replace CATEGORIES "$CATEGORIES" \ 107 | | replace DESCRIPTION "$DESCRIPTION" \ 108 | | replace USERNAME "$USERNAME" \ 109 | | replace AUTHOR "Yoshua Wuyts" \ 110 | | replace EMAIL "$EMAIL" \ 111 | > Cargo.toml 112 | 113 | # Base directories 114 | mkdir tests 115 | mkdir tests/fixtures 116 | mkdir examples 117 | mkdir benches 118 | 119 | # Empty test file 120 | project_name="$(echo "$PROJECTNAME" | sed 's/\-/_/g')" 121 | readf "$__dirname/test.rs" \ 122 | | replace PROJECTNAME "$project_name" \ 123 | > 'tests/test.rs' 124 | 125 | # Better GitHub integration 126 | mkdir -p .github/workflows 127 | copy "$__dirname/ci.yaml" .github/workflows/ci.yaml 128 | 129 | popd 130 | -------------------------------------------------------------------------------- /rust/test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | tmpdir="asdf" 4 | 5 | # run 6 | ew rust "$tmpdir" 7 | cd "$tmpdir" || exit 1 8 | 9 | # inspect 10 | tree 11 | print () { 12 | for f in *; do 13 | if [ -f "$f" ]; then 14 | cat "$f"; 15 | elif [ -d "$f" ]; then 16 | cd "$f" || exit 1 17 | print 18 | cd ../ || exit 1 19 | fi 20 | done 21 | } 22 | print 23 | 24 | # cleanup 25 | cd ../ || exit 1 26 | rm -rf "$tmpdir" 27 | -------------------------------------------------------------------------------- /rust/test.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | 3 | #[test] 4 | fn should_work() -> Result<(), Box> { 5 | Ok(()) 6 | } 7 | -------------------------------------------------------------------------------- /script/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | shift 2 4 | ew shell "$@" 5 | -------------------------------------------------------------------------------- /see-also/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ 1 = "0" ]; then 4 | printf 'usage: ew name 5 | fi 6 | -------------------------------------------------------------------------------- /shared.sh: -------------------------------------------------------------------------------- 1 | readf () { 2 | file="$(readlink -f "$1")" 3 | cat "$file" 4 | } 5 | 6 | replace () { 7 | sed "s/{{$1}}/$2/g" 8 | } 9 | 10 | copy () { 11 | echo "[copy] $1 -> $2" >&2 12 | cp "$1" "$2" 13 | } 14 | 15 | to_camel_case () { 16 | sed 's/[_|-]\([a-z]\)/\U\1/g;s/^\([a-z]\)/\1/g' 17 | } 18 | -------------------------------------------------------------------------------- /shell/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ $# = "0" ]; then 4 | printf 'usage: ew shell \n' 5 | exit 1 6 | fi 7 | 8 | touch "$1" 9 | chmod +x "$1" 10 | printf '#!/bin/sh\n' > "$1" 11 | -------------------------------------------------------------------------------- /talk/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ $# = "0" ]; then 4 | printf 'usage: ew talk\n' 5 | exit 1 6 | fi 7 | 8 | mkdir -p "$1" 9 | touch "$1/README.md" 10 | touch "$1/proposal.md" 11 | -------------------------------------------------------------------------------- /template/main: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | dirname=$(dirname "$(readlink -f "$0")") 4 | 5 | if [ $# = "0" ]; then 6 | printf 'usage: ew template \n' 7 | fi 8 | 9 | name="$1" 10 | mkdir "$name" 11 | cd "$name" || exit 1 12 | ew shell main 13 | cd ../ || exit 1 14 | 15 | tmpl="$(sed "s/PROJECTNAME/$name/g" < "$dirname/template.sh")" 16 | file="$(pwd)/$name/main" 17 | printf "\n%s\n" "$tmpl" >> "$file" 18 | sed "3 i $tmpl" -i "$file" 19 | -------------------------------------------------------------------------------- /template/template.sh: -------------------------------------------------------------------------------- 1 | __dirname=$(dirname "$(readlink -f "$0")") 2 | . "$(readlink -f "$__dirname/../shared.sh")" 3 | 4 | # define PROJECTNAME 5 | if [ -z "$1" ]; then 6 | printf 'What is the name of the project?\n❯ ' 7 | read -r PROJECTNAME 8 | if [ "$PROJECTNAME" = "" ]; then 9 | printf 'no name provided, exiting\n' 10 | exit 1 11 | fi 12 | else 13 | PROJECTNAME="$1" 14 | fi 15 | --------------------------------------------------------------------------------