Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Commit 93eb136

Browse files
committed
Add automatic bootstrapping script makenew.sh
1 parent eee0d82 commit 93eb136

File tree

5 files changed

+94
-40
lines changed

5 files changed

+94
-40
lines changed

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) yyyy copyright_owner
3+
Copyright (c) 2015 Evan Sosenko
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# CoffeeScript Package Skeleton
22

3-
<!--
4-
[![Bower](https://img.shields.io/bower/v/coffeescript-package.svg)](http://bower.io/search/?q=coffeescript-package)
3+
[![Bower](https://img.shields.io/bower/v/makenew-coffeescript-package.svg)](http://bower.io/search/?q=makenew-coffeescript-package)
54
[![npm](https://img.shields.io/npm/v/makenew-coffeescript-package.svg)](https://www.npmjs.com/package/makenew-coffeescript-package)
6-
-->
75
[![GitHub license](https://img.shields.io/github/license/makenew/coffeescript-package.svg)](./LICENSE.txt)
86
[![Dependency Status](https://img.shields.io/gemnasium/makenew/coffeescript-package.svg)](https://gemnasium.com/makenew/coffeescript-package)
97
[![Build Status](https://img.shields.io/travis/makenew/coffeescript-package.svg)](https://travis-ci.org/makenew/coffeescript-package)
@@ -27,38 +25,23 @@ Bootstrap a new [CoffeeScript] package in less than five minutes.
2725
[Shields.io]: http://shields.io/
2826
[Travis CI]: https://travis-ci.org/
2927

30-
### Usage
31-
32-
This software can be used freely, see [The Unlicense].
33-
The MIT License text appearing in this software is for
34-
demonstration purposes only and does not apply to this software.
28+
### Bootstrapping a New Project
3529

3630
1. Clone this repository or download a [release][Releases].
3731

38-
2. Customize this README.
39-
- Set the title and summary text.
40-
- Replace the Description section.
41-
- Update the Source section.
42-
- Update the Contributing section.
43-
- Remove or update the badges.
44-
45-
3. Set the copyright year and owner in `LICENSE.txt`.
46-
47-
4. Customize `package.json and `bower.json`.
32+
2. Run `./makenew.sh` and follow the prompts.
33+
This will replace the boilerplate, delete itself,
34+
and stage changes for commit.
35+
This script assumes the project repository will be hosted on GitHub.
36+
For an alternative location, you must update the URLs manually.
4837

49-
5. Replace any remaining instances of the placeholder package name.
50-
You can replace the placeholder package name and GitHub username
51-
with your own using
38+
3. Fill in the README Description section.
5239

53-
```
54-
$ git ls-files -z | xargs -0 sed -i 's/coffeescript-package/your-package/g'
55-
$ git ls-files -z | xargs -0 sed -i 's/makenew/your_username/g'
56-
```
57-
58-
Note that `CHANGELOG.md` is just a template for this skeleton.
59-
The actual changes for this project are documented in the commit history
60-
and summarized under [Releases].
40+
4. If [choosing a license][Choose a license] other than the one provided:
41+
update `LICENSE.txt`, the README License section,
42+
`package.json`, and `bower.json` with your chosen license.
6143

44+
[Choose a license]: http://choosealicense.com/
6245
[Releases]: https://github.com/makenew/coffeescript-package/releases
6346
[The Unlicense]: http://unlicense.org/UNLICENSE
6447

@@ -89,19 +72,25 @@ $ git fetch upstream
8972
$ git merge upstream/master
9073
```
9174

75+
#### Changelog
76+
77+
Note that `CHANGELOG.md` is just a template for this skeleton.
78+
The actual changes for this project are documented in the commit history
79+
and summarized under [Releases].
80+
9281
## Installation
9382

9483
The recommended method is to add this as a dependency
9584
to your project using [npm] with
9685

9786
```
98-
$ npm Install --save coffeescript-package
87+
$ npm Install --save makenew-coffeescript-package
9988
```
10089

10190
or [Bower] with
10291

10392
```
104-
$ bower install --save coffeescript-package
93+
$ bower install --save makenew-coffeescript-package
10594
```
10695

10796
Alternatively, you can download a [release][Releases]
@@ -115,14 +104,14 @@ or clone the repository directly.
115104

116105
### Source Code
117106

118-
The [coffeescript-package source] is hosted on GitHub.
107+
The [makenew-coffeescript-package source] is hosted on GitHub.
119108
To clone the project run
120109

121110
```
122111
$ git clone https://github.com/makenew/coffeescript-package.git
123112
```
124113

125-
[coffeescript-package source]: https://github.com/makenew/coffeescript-package
114+
[makenew-coffeescript-package source]: https://github.com/makenew/coffeescript-package
126115

127116
### Requirements
128117

@@ -172,6 +161,10 @@ To submit a patch:
172161

173162
## License
174163

164+
This software can be used freely, see [The Unlicense].
165+
The copyright text appearing below and elsewhere in this repository
166+
is for demonstration purposes only and does not apply to this software.
167+
175168
This CoffeeScript package is licensed under the MIT license.
176169

177170
## Warranty

bower.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "coffeescript-package",
2+
"name": "makenew-coffeescript-package",
33
"version": "0.0.0",
4-
"description": "Package description.",
4+
"description": "CoffeeScript package skeleton.",
55
"main": "javascripts/main.coffee",
66
"authors": [
7-
"Your Name <you@example.com>"
7+
"Evan Sosenko <razorx@evansosenko.com>"
88
],
99
"keywords": [
1010
"coffeescript",

makenew.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env sh
2+
3+
set -e
4+
set -u
5+
6+
find_replace () {
7+
git ls-files -z | xargs -0 sed -i "$1"
8+
}
9+
10+
check_env () {
11+
test -d .git || (echo 'This is not a Git repository. Exiting.' && exit 1)
12+
for cmd in ${1}; do
13+
command -v ${cmd} >/dev/null 2>&1 || \
14+
(echo "Could not find '$cmd' which is required to continue." && exit 2)
15+
done
16+
echo
17+
echo 'Ready to bootstrap your new project!'
18+
echo
19+
}
20+
21+
stage_env () {
22+
echo
23+
git rm -f makenew.sh
24+
echo
25+
echo 'Staging changes.'
26+
git add --all
27+
echo
28+
echo 'Done!'
29+
echo
30+
}
31+
32+
makenew () {
33+
read -p '> Package title: ' mk_title
34+
read -p '> Package name (slug): ' mk_slug
35+
read -p '> Short package description: ' mk_description
36+
read -p '> Author name: ' mk_author
37+
read -p '> Author email: ' mk_email
38+
read -p '> Copyright owner: ' mk_owner
39+
read -p '> Copyright year: ' mk_year
40+
read -p '> GitHub user or organization name: ' mk_user
41+
read -p '> GitHub repository name: ' mk_project
42+
43+
sed -i -e '11,79d;164,167d' README.md
44+
sed -i -e "11i ${mk_description}" README.md
45+
46+
find_replace "s/CoffeeScript Package Skeleton/${mk_title}/g"
47+
find_replace "s/CoffeeScript package skeleton\./${mk_description}/g"
48+
find_replace "s/2015 Evan Sosenko/${mk_year} ${mk_owner}/g"
49+
find_replace "s/Evan Sosenko/${mk_author}/g"
50+
find_replace "s/razorx@evansosenko\.com/${mk_email}/g"
51+
find_replace "s/makenew\/coffeescript-package/${mk_user}\/${mk_project}/g"
52+
find_replace "s/makenew-coffeescript-package/${mk_slug}/g"
53+
54+
echo
55+
echo 'Replacing boilerplate.'
56+
}
57+
58+
check_env 'git read sed xargs'
59+
makenew
60+
stage_env
61+
exit

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "coffeescript-package",
2+
"name": "makenew-coffeescript-package",
33
"version": "0.0.0",
4-
"description": "Package description.",
4+
"description": "CoffeeScript package skeleton.",
55
"main": "javascripts/main.coffee",
66
"keywords": [
77
"coffeescript",
@@ -12,7 +12,7 @@
1212
"repository": "makenew/coffeescript-package",
1313
"license": "MIT",
1414
"authors": [
15-
"Your Name <you@example.com>"
15+
"Evan Sosenko <razorx@evansosenko.com>"
1616
],
1717
"scripts": {
1818
"install": "bower install",

0 commit comments

Comments
 (0)