Skip to content

Commit

Permalink
restructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
icambron committed Aug 2, 2015
1 parent 1bde8c0 commit cc5c0c4
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 72 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html linguist-vendored
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/*
test/*.js
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash

build:
@rm -f bin/*
@find src -name '*.coffee' | xargs coffee -c -o bin
@find test -name '*.coffee' | xargs coffee -c -o test/bin
@node_modules/uglify-js/bin/uglifyjs bin/moment-countdown.js > bin/moment-countdown.min.js
@find src -name '*.coffee' | xargs coffee -c -o dist
@find test -name '*.coffee' | xargs coffee -c -o test
@uglifyjs -o dist/moment-countdown.min.js dist/moment-countdown.js

test: build
@node_modules/mocha/bin/mocha --reporter spec test/bin/moment-countdown.spec.js
@mocha --reporter spec

configure:
@npm install
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#moment-countdown

moment-countdown is a tiny [moment.js](http://momentjs.com) plugin that integrates with [Countdown.js](http://countdownjs.org). The file is [here](https://raw.github.com/icambron/moment-countdown/master/bin/moment-countdown.min.js). The NPM is `moment-countdown`.
moment-countdown is a tiny [moment.js](http://momentjs.com) plugin that integrates with [Countdown.js](http://countdownjs.org). The file is [here](https://raw.github.com/icambron/moment-countdown/master/dist/moment-countdown.min.js). The NPM is `moment-countdown`.

##How it works

Expand All @@ -23,7 +23,7 @@ See [Countdown's documentation](http://countdownjs.org/readme.html) for descript
##Getting set up

###Browser
Grab [moment.js](https://raw.github.com/moment/moment/2.0.0/min/moment.min.js), [countdown.js](https://bitbucket.org/mckamey/countdown.js/raw/tip/countdown.min.js), and [moment-countdown.js](https://raw.github.com/icambron/moment-countdown/master/bin/moment-countdown.min.js). Then inside your header:
Grab [moment.js](https://raw.github.com/moment/moment/2.0.0/min/moment.min.js), [countdown.js](https://bitbucket.org/mckamey/countdown.js/raw/tip/countdown.min.js), and [moment-countdown.js](https://raw.github.com/icambron/moment-countdown/master/dist/moment-countdown.min.js). Then inside your header:

```html
<script src="moment.min.js"></script>
Expand Down
17 changes: 0 additions & 17 deletions bin/moment-countdown.js

This file was deleted.

1 change: 0 additions & 1 deletion bin/moment-countdown.min.js

This file was deleted.

16 changes: 16 additions & 0 deletions dist/moment-countdown.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/moment-countdown.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moment-countdown",
"version": "0.0.2",
"version": "0.0.3",
"description": "A Moment.js plugin for integrating with Countdown.js",
"homepage": "http://icambron.github.com/moment-countdown",
"author": "Isaac Cambron",
Expand All @@ -10,10 +10,11 @@
"countdown": ">= 2.3.0"
},
"devDependencies": {
"mocha" : "1.8.2",
"uglify-js" : ">= 1.2.5"
"mocha" : "latest",
"uglify-js" : "latest",
"coffee-script" : "latest"
},
"main": "bin/moment-countdown",
"main": "dist/moment-countdown",
"scripts": {
"test": "make test"
},
Expand All @@ -27,9 +28,5 @@
"bugs": {
"url": "https://github.com/icambron/moment-countdown/issues"
},
"licenses": [
{
"type": "MIT"
}
]
"license": "MIT"
}
33 changes: 0 additions & 33 deletions test/bin/moment-countdown.spec.js

This file was deleted.

10 changes: 5 additions & 5 deletions test/moment-countdown.spec.coffee
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
moment = require?("moment") ? @moment
countdown = require?("countdown") ? @countdown
require?('../../bin/moment-countdown')
require?('../dist/moment-countdown')

assertEqual = (a, b) -> throw new Error("Found #{b}, expected #{a}") unless a == b

describe "moment.countdown()", ->
start = moment "1982-5-25"
start = moment "1982-05-25"
end = "1990-10-14T00:00:15-04:00"

it "returns a default countdown with no options", ->
assertEqual "8 years, 4 months, 20 days, and 15 seconds", start.countdown(end).toString()
assertEqual "8 years, 4 months, 20 days and 15 seconds", start.countdown(end).toString()

it "returns a specific format when options are provided", ->
assertEqual "100 months, 28800 minutes, and 15 seconds", start.countdown(end, countdown.MONTHS | countdown.MINUTES | countdown.SECONDS, NaN, 1).toString()
assertEqual "100 months, and 28800.25 minutes", start.countdown(end, countdown.MONTHS | countdown.MINUTES | countdown.SECONDS, 2, 2).toString()
assertEqual "100 months, 28800 minutes and 15 seconds", start.countdown(end, countdown.MONTHS | countdown.MINUTES | countdown.SECONDS, NaN, 1).toString()
assertEqual "100 months and 28800.25 minutes", start.countdown(end, countdown.MONTHS | countdown.MINUTES | countdown.SECONDS, 2, 2).toString()

0 comments on commit cc5c0c4

Please sign in to comment.