Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a test to check for the current year in the license and source… #384

Merged
merged 2 commits into from
Oct 27, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Adding a test to check for the current year in the license and source…
… header
jonrohan committed Oct 27, 2017

Verified

This commit was signed with the committer’s verified signature.
leninmehedy Lenin Mehedy
commit 4df2cf43f82fad062e75de3a1becb30e4fcae4a4
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 GitHub Inc.
Copyright (c) 2017 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
2 changes: 1 addition & 1 deletion modules/primer-core/index.scss
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* Primer-core
* http://primercss.io
*
* Released under MIT license. Copyright 2015 GitHub, Inc.
* Released under MIT license. Copyright (c) 2017 GitHub Inc.
*/

// Primer master file
2 changes: 1 addition & 1 deletion modules/primer-css/index.scss
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* Primer
* http://primercss.io
*
* Released under MIT license. Copyright 2015 GitHub, Inc.
* Released under MIT license. Copyright (c) 2017 GitHub Inc.
*/

// Primer master file
2 changes: 1 addition & 1 deletion modules/primer-marketing/index.scss
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* Primer-marketing
* http://primercss.io
*
* Released under MIT license. Copyright 2015 GitHub, Inc.
* Released under MIT license. Copyright (c) 2017 GitHub Inc.
*/

// Primer master file
2 changes: 1 addition & 1 deletion modules/primer-product/index.scss
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* Primer-product
* http://primercss.io
*
* Released under MIT license. Copyright 2015 GitHub, Inc.
* Released under MIT license. Copyright (c) 2017 GitHub Inc.
*/

// Primer master file
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -16,7 +16,8 @@
"release": "script/release",
"bump": "lerna publish --exact --skip-npm --since \"v$(npm info primer-css version)\"",
"new-module": "script/new-module",
"test": "lerna run test"
"test": "npm run test-all-modules && lerna run test",
"test-all-modules": "ava --verbose tests/test-*.js"
},
"devDependencies": {
"@storybook/addon-options": "^3.2.6",
2 changes: 1 addition & 1 deletion script/test-docs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
set -e
$(dirname $0)/npm-run ava --verbose $(dirname $0)/../tests/modules/test-*.js
$(dirname $0)/npm-run ava --verbose $(dirname $0)/../tests/modules/test-document-styles.js
31 changes: 31 additions & 0 deletions tests/test-for-current-year.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const test = require("ava")
const fs = require("fs-extra")
const globby = require("globby")

const year = (new Date()).getFullYear()

test(`LICENSE files have the current year ${year}`, t => {
return globby(["**/LICENSE", "!**/node_modules/**/LICENSE"])
.then(paths => {
t.plan(paths.length)
return paths.map(path => {
const license = fs.readFileSync(path, "utf8")
return t.regex(license, new RegExp(`Copyright \\(c\\) ${year} GitHub Inc\\.`), `The license "${path}" does not include the current year ${year}`)
})
})
})

test(`Source header copyrights have the current year ${year}`, t => {
return globby(["**/*.css", "**/*.scss", "!**/node_modules/**", "!**/build/**"])
.then(paths => {
t.plan(paths.length)
return paths.map(path => {
const source = fs.readFileSync(path, "utf8")
if (source.match(/Copyright \(c\)/)) {
return t.regex(source, new RegExp(`Copyright \\(c\\) ${year} GitHub Inc\\.`), `The source's header "${path}" does not include the current year ${year}`)
} else {
return t.true(true)
}
})
})
})
2 changes: 1 addition & 1 deletion tools/generator-primer-module/app/templates/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 GitHub Inc.
Copyright (c) 2017 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
2 changes: 1 addition & 1 deletion tools/stylelint-config-primer/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 GitHub Inc.
Copyright (c) 2017 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
2 changes: 1 addition & 1 deletion tools/stylelint-selector-no-utility/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 GitHub Inc.
Copyright (c) 2017 GitHub Inc.

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