Skip to content
This repository has been archived by the owner on Jan 10, 2019. It is now read-only.

Commit

Permalink
seed
Browse files Browse the repository at this point in the history
  • Loading branch information
Zolmeister committed Dec 21, 2015
0 parents commit 5c93f20
Show file tree
Hide file tree
Showing 11 changed files with 213 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules
/build
/coverage
npm-debug.log
83 changes: 83 additions & 0 deletions Gulpfile.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
_ = require 'lodash'
gulp = require 'gulp'
mocha = require 'gulp-mocha'
KarmaServer = require('karma').Server
rename = require 'gulp-rename'
webpack = require 'webpack-stream'
istanbul = require 'gulp-coffee-istanbul'
coffeelint = require 'gulp-coffeelint'

TEST_TIMEOUT = 300

paths =
coffee: ['./src/**/*.coffee', './*.coffee', './test/**/*.coffee']
cover: ['./src/**/*.coffee', './*.coffee']
rootScripts: './src/index.coffee'
rootTests: './test/**/*.coffee'
build: './build'
output:
tests: 'tests.js'

karmaConf =
frameworks: ['mocha']
client:
useIframe: true
captureConsole: true
mocha:
timeout: TEST_TIMEOUT
files: [
"#{paths.build}/#{paths.output.tests}"
]
browsers: ['Chrome', 'Firefox']

gulp.task 'test', ['lint', 'test:browser', 'test:coverage']

gulp.task 'watch', ->
gulp.watch paths.coffee, ['test:node']
gulp.task 'watch:phantom', ->
gulp.watch paths.coffee, ['test:browser:phantom']

gulp.task 'lint', ->
gulp.src paths.coffee
.pipe coffeelint()
.pipe coffeelint.reporter()

gulp.task 'test:browser', ['build:test'], (cb) ->
new KarmaServer(_.defaults(singleRun: true, karmaConf), cb).start()

gulp.task 'test:browser:phantom', ['build:test'], (cb) ->
new KarmaServer(_.defaults({
singleRun: true,
browsers: ['PhantomJS']
}, karmaConf), cb).start()

gulp.task 'test:node', ->
gulp.src paths.rootTests
.pipe mocha({timeout: TEST_TIMEOUT})

gulp.task 'test:coverage', ->
gulp.src paths.cover
.pipe istanbul includeUntested: false
.pipe istanbul.hookRequire()
.on 'finish', ->
gulp.src paths.rootTests
.pipe mocha({timeout: TEST_TIMEOUT})
.pipe istanbul.writeReports({
reporters: ['html', 'text', 'text-summary']
})

gulp.task 'build:test', ->
gulp.src paths.rootTests
.pipe webpack
devtool: 'inline-source-map'
module:
exprContextRegExp: /$^/
exprContextCritical: false
loaders: [
{test: /\.coffee$/, loader: 'coffee'}
{test: /\.json$/, loader: 'json'}
]
resolve:
extensions: ['.coffee', '.js', '.json', '']
.pipe rename paths.output.tests
.pipe gulp.dest paths.build
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Zolmeister

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 the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# isomorphic-seed
3 changes: 3 additions & 0 deletions coffeelint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "clay-coffeescript-style-guide"
}
56 changes: 56 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "isomorphic-seed",
"version": "0.0.0",
"description": "Scaffolding for isomorphic coffeescript libraries",
"keywords": [
"isomorphic",
"scaffolding",
"library",
"bootstrap",
"coffee",
"coffeescript"
],
"main": "src/index.coffee",
"scripts": {
"test": "node_modules/gulp/bin/gulp.js test",
"watch": "node_modules/gulp/bin/gulp.js watch",
"watch-phantom": "node_modules/gulp/bin/gulp.js watch:phantom",
"preversion": "npm test"
},
"license": "MIT",
"author": "Zolmeister (https://zolmeister.com/)",
"dependencies": {
"coffee-script": "^1.9.3",
"lodash": "^3.10.0"
},
"devDependencies": {
"b-assert": "^0.1.2",
"clay-coffeescript-style-guide": "^1.1.0",
"coffee-loader": "^0.7.2",
"gulp": "^3.9.0",
"gulp-coffee-istanbul": "^0.7.1",
"gulp-coffeelint": "^0.5.0",
"gulp-mocha": "^2.1.3",
"gulp-rename": "^1.2.2",
"json-loader": "^0.5.2",
"karma": "^0.13.3",
"karma-chrome-launcher": "^0.2.0",
"karma-firefox-launcher": "^0.1.6",
"karma-mocha": "^0.2.0",
"karma-phantomjs-launcher": "^0.2.0",
"mocha": "^2.2.5",
"phantomjs": "^1.9.17",
"webpack-stream": "^2.0.0"
},
"directories": {
"test": "test"
},
"repository": {
"type": "git",
"url": "https://github.com/Zorium/isomorphic-seed.git"
},
"bugs": {
"url": "https://github.com/Zorium/isomorphic-seed/issues"
},
"homepage": "https://github.com/Zorium/isomorphic-seed"
}
3 changes: 3 additions & 0 deletions src/index.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports =
compare: (a, b) ->
a is b
11 changes: 11 additions & 0 deletions test/browser.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
b = require 'b-assert'

example = require '../src'

browserIt = if window? then it else (-> null)

browserIt 'browser compares equals', ->
unless window?
throw new Error 'Only works in browsers'
res = example.compare 'a', 'a'
b res, true
11 changes: 11 additions & 0 deletions test/isomorphic.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
b = require 'b-assert'

example = require '../src'

it 'compares equals', ->
res = example.compare 'a', 'a'
b res, true

it 'compares non-equals', ->
res = example.compare 'b', 'a'
b res, false
11 changes: 11 additions & 0 deletions test/server.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
b = require 'b-assert'

example = require '../src'

serverIt = if window? then (-> null) else it

serverIt 'server compares equals', ->
if window?
throw new Error 'This test only runs on the server'
res = example.compare 'a', 'a'
b res, true

0 comments on commit 5c93f20

Please sign in to comment.