Skip to content

Commit

Permalink
v0.3.3. Improvement.
Browse files Browse the repository at this point in the history
- v0.3.3 January 01, 2014
	- Added [david-dm](https://david-dm.org/) badge support
		- Thanks to [Rob Loach](https://github.com/RobLoach) for [pull
request #21](#21)
	- Automatic badge detection for `travis`, `npm`, and `david` badges
	- Travis file is now regarded as a readme file
  • Loading branch information
balupton committed Jan 1, 2014
1 parent a8b6853 commit 297af94
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 23 deletions.
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# History

- v0.3.3 January 01, 2014
- Added [david-dm](https://david-dm.org/) badge support
- Thanks to [Rob Loach](https://github.com/RobLoach) for [pull request #21](https://github.com/bevry/projectz/pull/21)
- Automatic badge detection for `travis`, `npm`, and `david` badges
- Travis file is now regarded as a readme file

- v0.3.2 December 16, 2013
- Formatting changes to backers listing

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ The special fields are as so:
badges:
travis: true
npm: true
daviddm: true
david: true
gittip: true
flattr: "344188/balupton-on-Flattr"
paypal: "QB8GQPZAH84N6"
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Projectz",
"name": "projectz",
"version": "0.3.2",
"version": "0.3.3",
"description": "Stop wasting time syncing and updating your project's README and Package Files!",
"homepage": "https://github.com/bevry/projectz",
"keywords": [
Expand All @@ -12,6 +12,14 @@
"component.json",
"bower.json"
],
"badges": {
"travis": true,
"npm": true,
"david": true,
"gittip": "bevry",
"flattr": "344188/balupton-on-Flattr",
"paypal": "QB8GQPZAH84N6"
},
"author": "2013+ Bevry Pty Ltd <us@bevry.me> (http://bevry.me)",
"maintainers": [
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)",
Expand Down Expand Up @@ -43,7 +51,7 @@
"caterpillar": "~2.0.4",
"caterpillar-filter": "~2.0.1",
"caterpillar-human": "~2.1.0",
"safefs": "~3.0.3",
"safefs": "~3.1.0",
"commander": "~2.1.0",
"typechecker": "~2.0.8"
},
Expand All @@ -62,13 +70,5 @@
},
"bin": {
"projectz": "./bin/projectz"
},
"badges": {
"travis": true,
"npm": true,
"daviddm": true,
"gittip": "bevry",
"flattr": "344188/balupton-on-Flattr",
"paypal": "QB8GQPZAH84N6"
}
}
}
17 changes: 9 additions & 8 deletions src/lib/badge-util.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ module.exports = badgeUtil =
[![NPM version](http://badge.fury.io/js/#{opts.name}.png)](https://npmjs.org/package/#{opts.name} "View this project on NPM")
"""

# Get David DM
daviddm: (opts={}) ->
# Get David DM Badge
david: (opts={}) ->
# Check
return '' if !opts.badges.daviddm
return '' if !opts.badges.david or (opts.badges.david is true and !opts.repo)

# Use the repo value, if it's available, and daviddm is simply "true".
if opts.badges.daviddm is true and (opts.repo or false)
url = "https://david-dm.org/#{opts.repo}"
# Custom Value
if opts.badges.david isnt true
url = "https://david-dm.org/#{opts.badges.david}"

# Repo Value
else
# Otherwise, assume it's the github repository name.
url = "https://david-dm.org/#{opts.badges.daviddm}"
url = "https://david-dm.org/#{opts.repo}"

# Return
return """
Expand Down
7 changes: 7 additions & 0 deletions src/lib/projectz.litcoffee
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Apply our determined paths for readmes
contributing: pathUtil.join(@cwd, 'CONTRIBUTING.md')
backers: pathUtil.join(@cwd, 'BACKERS.md')
license: pathUtil.join(@cwd, 'LICENSE.md')
travis: pathUtil.join(@cwd, '.travis.yml')
### Log

Expand Down Expand Up @@ -331,6 +332,12 @@ By first merging in all the package data together into the enhanced data
@dataForPackagesMerged.packages[name] = @dataForPackages.packages?[name] ? value?
return true
Fallback badges, by checking if the relevant files exists

@dataForPackagesMerged.badges.travis ?= @dataForReadmes.travis?
@dataForPackagesMerged.badges.npm ?= @dataForPackages.package?
@dataForPackagesMerged.badges.david ?= @dataForPackages.package?
Fallback browsers field, by checking if `component` or `bower` package information exists

@dataForPackagesMerged.browsers ?= true if @dataForPackagesMerged.packages.component or @dataForPackagesMerged.packages.bower
Expand Down
1 change: 1 addition & 0 deletions test/out-expected/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- BADGES/ -->

[![Build Status](http://img.shields.io/travis-ci/bevry/ambi.png?branch=master)](http://travis-ci.org/bevry/ambi "Check this project's build status on TravisCI")
[![NPM version](http://badge.fury.io/js/ambi.png)](https://npmjs.org/package/ambi "View this project on NPM")
[![Dependency Status](https://david-dm.org/bevry/ambi.png)](https://david-dm.org/bevry/ambi)
[![Gittip donate button](http://img.shields.io/gittip/bevry.png)](https://www.gittip.com/bevry/ "Donate weekly to this project using Gittip")
[![Flattr donate button](http://img.shields.io/flattr/donate.png?color=yellow)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr")
Expand Down
1 change: 1 addition & 0 deletions test/src/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# bleh blah
1 change: 1 addition & 0 deletions test/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- BADGES/ -->

[![Build Status](http://img.shields.io/travis-ci/bevry/ambi.png?branch=master)](http://travis-ci.org/bevry/ambi "Check this project's build status on TravisCI")
[![NPM version](http://badge.fury.io/js/ambi.png)](https://npmjs.org/package/ambi "View this project on NPM")
[![Dependency Status](https://david-dm.org/bevry/ambi.png)](https://david-dm.org/bevry/ambi)
[![Gittip donate button](http://img.shields.io/gittip/bevry.png)](https://www.gittip.com/bevry/ "Donate weekly to this project using Gittip")
[![Flattr donate button](http://img.shields.io/flattr/donate.png?color=yellow)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr")
Expand Down
3 changes: 0 additions & 3 deletions test/src/projectz.cson
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@
Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)
"""
badges:
travis: true
fury: true
gittip: 'bevry'
flattr: '344188/balupton-on-Flattr'
paypal: 'QB8GQPZAH84N6'
daviddm: true
dependencies:
"typechecker": "~2.0.6"
devDependencies:
Expand Down

0 comments on commit 297af94

Please sign in to comment.