-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10e35b4
commit cb09252
Showing
6 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
|
||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
*.log | ||
*.dump | ||
*.swp | ||
.DS_Store | ||
.nyc_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
sudo: false | ||
language: node_js | ||
cache: | ||
directories: | ||
- node_modules | ||
notifications: | ||
email: false | ||
node_js: | ||
- 6 | ||
- 4 | ||
- '0.12' | ||
before_script: | ||
- npm prune | ||
after_success: | ||
- 'curl -Lo travis_after_all.py https://git.io/travis_after_all' | ||
- python travis_after_all.py | ||
- 'export $(cat .to_export_back) &> /dev/null' | ||
- npm run semantic-release | ||
branches: | ||
except: | ||
- "/^v\\d+\\.\\d+\\.\\d+$/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# @greenkeeper/rc | ||
|
||
[](https://travis-ci.org/greenkeeperio/rc) | ||
[](https://david-dm.org/greenkeeperio/rc/master) | ||
[](https://david-dm.org/greenkeeperio/rc/master#info=devDependencies) | ||
[](https://github.com/feross/standard) | ||
[](https://github.com/semantic-release/semantic-release) | ||
|
||
`get`, `set`, `unset`, `replace` or `merge` Greenkeeper config and persist it to a `.greenkeeperrc` file in the homedir. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
var fs = require('fs') | ||
var path = require('path') | ||
|
||
var _ = require('lodash') | ||
var home = require('os-homedir') | ||
|
||
var configPath = path.join(home(), '.greenkeeperrc') | ||
|
||
var config | ||
|
||
try { | ||
config = JSON.parse(fs.readFileSync(configPath)) | ||
} catch (e) { | ||
config = {} | ||
} | ||
|
||
exports.get = function (name) { | ||
return name | ||
? config[name] | ||
: config | ||
} | ||
|
||
exports.set = function (name, value) { | ||
config[name] = value | ||
exports._save() | ||
} | ||
|
||
exports.unset = function (name) { | ||
delete config[name] | ||
exports._save() | ||
} | ||
|
||
exports.replace = function (newConfig) { | ||
config = newConfig | ||
exports._save() | ||
} | ||
|
||
exports.merge = function (newConfig) { | ||
_.merge(config, newConfig) | ||
exports._save() | ||
} | ||
|
||
exports._save = function () { | ||
fs.writeFileSync(configPath, JSON.stringify(config, null, 2)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "@greenkeeper/rc", | ||
"description": "CRUD for .greenkeeperrc file", | ||
"author": "Stephan Bönnemann <[email protected]> (http://boennemann.me)", | ||
"bugs": { | ||
"url": "https://github.com/greenkeeperio/rc/issues" | ||
}, | ||
"dependencies": { | ||
"lodash": "^4.11.1", | ||
"os-homedir": "^1.0.1" | ||
}, | ||
"devDependencies": { | ||
"standard": "^6.0.8", | ||
"semantic-release": "^4.3.5" | ||
}, | ||
"homepage": "https://greenkeeper.io", | ||
"license": "Apache-2.0", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/greenkeeperio/rc.git" | ||
}, | ||
"scripts": { | ||
"test": "standard", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |