Skip to content

Commit

Permalink
Adding contribution information
Browse files Browse the repository at this point in the history
  • Loading branch information
ollelauribostrom committed Sep 6, 2018
1 parent acbeb5e commit 3017ad1
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 10 deletions.
41 changes: 41 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Contributing to cl-dotenv

## Prerequisites
- Git
- [SBCL](http://www.sbcl.org/)
- [Roswell](https://github.com/roswell/roswell)
- [Cmake](https://cmake.org/install/)

## Contribution process overview
1. Create your own fork of this project.
2. Create a feature branch.
3. Make your changes.
4. Run the tests `make test`.
5. Push changes to your fork/branch.
6. Create pull request.
7. Code review and automated testing.
8. Merge into master.

### 1. Fork
1. Click the fork button up top.
2. Clone your fork locally (Notice that git's `origin` reference will point to your forked repository).
3. It is useful to have the upstream repository registered as well using: `git remote add upstream https://github.com/ollelauribostrom/cl-dotenv.git` and periodically fetch it using `git fetch upstream`.

### 2. Create feature branch
Create and switch to new feature branch: `git checkout -b {branch_name} upstream/master`
(replace `{branch_name}` with a meaningful name that describes your feature or change).

### 3. Make changes
1. Now that you have a new branch you can edit/create/delete files.
2. Use touch-up commits with main one (squash) -- the `git commit --amend` can be used for that. (You may use git force push after that).

### 4. Run testing
`make test`.
`make coverage`

### 5. Push changes to your fork/branch
1. After lint and all tests pass, push the changes to your fork/branch on GitHub: `git push origin {branch_name}`.
2. For force push, which will destroy previous commits on the server, use `--force` (or `-f`) option.

### 6. Create pull request
Create a pull request on GitHub for your feature branch.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Expected Behavior
...

## Actual Behavior
...

## Steps to Reproduce the Problem
1.
2.
3.

## Specifications
- Version:
- OS:
- Lisp Installation:
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Associated Issue: #<issue number>

Please get familiar with the contributing guide before submitting a PR:
https://github.com/ollelauribostrom/cl-dotenv/blob/master/.github/CONTRIBUTING.md

### Summary of Changes
* change 1
* change 2
30 changes: 21 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
# cl-dotenv - Load .env files from Common Lisp
[![Build Status](https://travis-ci.org/ollelauribostrom/cl-dotenv.svg?branch=master)](https://travis-ci.org/ollelauribostrom/cl-dotenv) [![Coverage Status](https://coveralls.io/repos/github/ollelauribostrom/cl-dotenv/badge.svg?branch=master)](https://coveralls.io/github/ollelauribostrom/cl-dotenv?branch=master)

Tiny utility library for loading .env files & getting/setting environment variables.

> Currently tested with: SBCL, Allegro, ECL, CLISP
## Usage
Corrupt .env files will generate an error when being loaded. Make sure your .env file is in the format:
> NOTE: Corrupt .env files will generate an error when being loaded. Make sure your .env file is in the format:
```bash
key1=value
key2=value
```

Load & set environment from .env file
### Load & set the environment from an .env file
Calling `load-env` loads the environment from the specified .env file.
```lisp
(dotenv:load-env (merge-pathnames "./path/.env"))
=> t
```

Get environment variable
### Get an environment variable
The value of a variable can be read by calling `get-env` with the name of the variable.
```lisp
(dotenv:get-env "SOME_VAR")
=> "value" or nil
```

Get environment variable and return default value if not set
If you wish, you can provide a default value that is returned if the variable you are trying to read is not set.
```lisp
(dotenv:get-env "SOME_NONEXISTING_VAR" "default-value")
=> "default-value"
```

Set environment variable
> Setting a environment variable overwrites any existing value
### Set an environment variable
Setting a variable overwrites any existing value
```lisp
(dotenv:set-env "SOME_VAR" "some_value")
=> t
Expand All @@ -45,16 +50,23 @@ The package is not yet available through Quicklisp.
(ql:quickload :cl-dotenv)
```

## Contributing
All contributions are very much welcome. Please get familiar with the [contributing guide](https://github.com/ollelauribostrom/cl-dotenv/blob/master/.github/CONTRIBUTING.md).


## Commands
- `make test`: Run all tests using SBCL
- `make load`: Start SBCL and load library
- `make install`: Install the packages **cl-dotenv** and **cl-dotenv-test** locally using [Roswell](https://github.com/roswell/roswell)
- `make tests`: Run the tests using [Prove](https://github.com/fukamachi/prove)
- `make coverage`: Run the tests and generate a coverage report
- `make sbcl`: Start SBCL and load **cl-dotenv**

## Author
* Olle Lauri Boström (ollebostr@gmail.com)

## Inspiration
- [The Common Lisp Cookbook, Interfacing with your OS](http://cl-cookbook.sourceforge.net/os.html)
- [LispForum, Setting Path Variable](http://www.lispforum.com/viewtopic.php?f=2&t=446)
- [dotenv](https://www.npmjs.com/package/dotenv)

## License
Licensed under the MIT License.
2 changes: 1 addition & 1 deletion src/cl-dotenv.lisp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;;; Utility library for loading .env files
;;; Author: Olle Lauri Boström <ollebostr@gmail.com>
;;; Documentation: https://github.com/ollelauribostrom/cl-dotenv
;;; Inspiration from http://cl-cookbook.sourceforge.net/os.html & http://www.lispforum.com/viewtopic.php?f=2&t=446
;;; Inspiration from http://cl-cookbook.sourceforge.net/os.html & http://www.lispforum.com/viewtopic.php?f=2&t=446 & https://www.npmjs.com/package/dotenv

(defpackage cl-dotenv
(:use :cl :cl-ppcre)
Expand Down

0 comments on commit 3017ad1

Please sign in to comment.