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

Commit

Permalink
Add automatic bootstrapping script makenew.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Jan 19, 2016
1 parent ab932e1 commit 3560d26
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 44 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) yyyy copyright_owner
Copyright (c) 2016 Evan Sosenko

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
60 changes: 25 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# libSass Package Skeleton

<!--
[![npm](https://img.shields.io/npm/v/makenew-libsass-package.svg)](https://www.npmjs.com/package/makenew-libsass-package)
-->
<!--
[![Bower](https://img.shields.io/bower/v/makenew-libsass-package.svg)](http://bower.io/search/?q=makenew-libsass-package)
-->
[![GitHub license](https://img.shields.io/github/license/makenew/libsass-package.svg)](./LICENSE.txt)
[![Dependency Status](https://img.shields.io/gemnasium/makenew/libsass-package.svg)](https://gemnasium.com/makenew/libsass-package)
[![Build Status](https://img.shields.io/travis/makenew/libsass-package.svg)](https://travis-ci.org/makenew/libsass-package)
Expand All @@ -23,52 +19,36 @@ For [Ruby Sass][Sass], use [makenew/sass-package].

### Features

* [Bower] package structure.
* [Bower] and [npm] package structure.
* [Grunt] tasks for development.
* Node package management with [npm].
* [Travis CI] ready.
* [EditorConfig].
* Badges from [Shields.io]!
* Badges from [Shields.io].

[Bundler]: http://bundler.io/
[Bower]: http://bower.io/
[EditorConfig]: http://editorconfig.org/
[Grunt]: http://gruntjs.com/
[npm]: https://www.npmjs.com/
[Shields.io]: http://shields.io/
[Travis CI]: https://travis-ci.org/

### Usage

This software can be used freely, see [The Unlicense].
The MIT License text appearing in this software is for
demonstration purposes only and does not apply to this software.
### Bootstrapping a New Project

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

2. Customize this README.
- Set the title and summary text.
- Replace the Description section.
- Update the Source section.
- Update the Contributing section.
- Remove or update the badges.

3. Set the copyright year and owner in `LICENSE.txt`.
2. Run `./makenew.sh` and follow the prompts.
This will replace the boilerplate, delete itself,
and stage changes for commit.
This script assumes the project repository will be hosted on GitHub.
For an alternative location, you must update the URLs manually.

4. Customize `bower.json`.
3. Fill in the README Description section.

5. Replace any remaining instances of the placeholder package name.
You can replace the placeholder package name and GitHub username
with your own using

```
$ git ls-files -z | xargs -0 sed -i 's/libsass-package/your-package/g'
$ git ls-files -z | xargs -0 sed -i 's/makenew/your_username/g'
```

Note that `CHANGELOG.md` is just a template for this skeleton.
The actual changes for this project are documented in the commit history
and summarized under [Releases].
4. If [choosing a license][Choose a license] other than the one provided:
update `LICENSE.txt`, the README License section,
`package.json`, and `bower.json` with your chosen license.

[Choose a license]: http://choosealicense.com/
[Releases]: https://github.com/makenew/libsass-package/releases
[The Unlicense]: http://unlicense.org/UNLICENSE

Expand Down Expand Up @@ -96,9 +76,15 @@ You can then fetch and merge changes with

```
$ git fetch upstream
$ git merge upstream/libsass
$ git merge upstream/master
```

#### Changelog

Note that `CHANGELOG.md` is just a template for this skeleton.
The actual changes for this project are documented in the commit history
and summarized under [Releases].

## Installation

The recommended method is to add this as a dependency
Expand Down Expand Up @@ -189,6 +175,10 @@ To submit a patch:

## License

This software can be used freely, see [The Unlicense].
The copyright text appearing below and elsewhere in this repository
is for demonstration purposes only and does not apply to this software.

This Sass package is licensed under the MIT license.

## Warranty
Expand Down
9 changes: 5 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "libsass-package",
"version": "0.0.0",
"description": "Package description.",
"name": "makenew-libsass-package",
"version": "2.0.0",
"description": "libSass package skeleton.",
"main": "stylesheets/main.sass",
"authors": [
"Your Name <you@example.com>"
"Evan Sosenko <razorx@evansosenko.com>"
],
"keywords": [
"sass",
Expand All @@ -24,6 +24,7 @@
"test",
"tests",
"build",
"makenew.sh",
"package.json",
"Gruntfile.coffee"
]
Expand Down
65 changes: 65 additions & 0 deletions makenew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env sh

set -e
set -u

find_replace () {
git ls-files -z | xargs -0 sed -i "$1"
}

check_env () {
test -d .git || (echo 'This is not a Git repository. Exiting.' && exit 1)
for cmd in ${1}; do
command -v ${cmd} >/dev/null 2>&1 || \
(echo "Could not find '$cmd' which is required to continue." && exit 2)
done
echo
echo 'Ready to bootstrap your new project!'
echo
}

stage_env () {
echo
git rm -f makenew.sh
echo
echo 'Staging changes.'
git add --all
echo
echo 'Done!'
echo
}

makenew () {
read -p '> Package title: ' mk_title
read -p '> Package name (slug): ' mk_slug
read -p '> Short package description: ' mk_description
read -p '> Version number: ' mk_version
read -p '> Author name: ' mk_author
read -p '> Author email: ' mk_email
read -p '> Copyright owner: ' mk_owner
read -p '> Copyright year: ' mk_year
read -p '> GitHub user or organization name: ' mk_user
read -p '> GitHub repository name: ' mk_project

sed -i -e '11,86d;177,180d' README.md
sed -i -e "11i ${mk_description}" README.md
sed -i -e '27d' bower.json

find_replace "s/version\": \".*\"/version \": \"${mk_version}\"/g"
find_replace "s/0\.0\.0\.\.\./${mk_version}.../g"
find_replace "s/libSass Package Skeleton/${mk_title}/g"
find_replace "s/libSass package skeleton\./${mk_description}/g"
find_replace "s/2016 Evan Sosenko/${mk_year} ${mk_owner}/g"
find_replace "s/Evan Sosenko/${mk_author}/g"
find_replace "s/razorx@evansosenko\.com/${mk_email}/g"
find_replace "s/makenew\/libsass-package/${mk_user}\/${mk_project}/g"
find_replace "s/makenew-libsass-package/${mk_slug}/g"

echo
echo 'Replacing boilerplate.'
}

check_env 'git read sed xargs'
makenew
stage_env
exit
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "libsass-package",
"version": "0.0.0",
"description": "Package description.",
"name": "makenew-libsass-package",
"version": "2.0.0",
"description": "libSass package skeleton.",
"main": "stylesheets/main.sass",
"keywords": [
"sass",
Expand All @@ -13,7 +13,7 @@
"repository": "makenew/libsass-package",
"license": "MIT",
"authors": [
"Your Name <you@example.com>"
"Evan Sosenko <razorx@evansosenko.com>"
],
"scripts": {
"prestart": "bower install",
Expand Down

0 comments on commit 3560d26

Please sign in to comment.