aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-01-19 13:21:59 -0600
committerEugene Triguba <eugenetriguba@gmail.com>2020-01-19 13:21:59 -0600
commitdf7a92116ed5b939593f29ef5097342ddbb5e1e3 (patch)
tree4336af2b357c4f45532248c313457c845e3f3ec3
parentAdd save() and reset() methods to ConfigFile (diff)
downloadconfig-file-df7a92116ed5b939593f29ef5097342ddbb5e1e3.zip
Update README and CHANGELOG with changes
-rw-r--r--CHANGELOG.md13
-rw-r--r--README.md23
2 files changed, 28 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e699e5..5898f60 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## Unreleased
+
+ - Change Travis CI to lint all files as well as run the tests.
+ - Add `reset()` and `save()` methods to `ConfigFile`. This allows you to reset your
+ configuration file to an "original state," given the original config file path.
+ However, say you have a `config/config.json` file. Then it will automatically try
+ to look for `config/config.original.json` if no file path is specified. The `save()`
+ method should be called after your changes to the config file. It will write them
+ back out.
+ - Raise test coverage to 93% (`BaseParser` is abstract so it isn't tested and some
+ methods in `ConfigFile` simply use the same method in the parser so it doesn't make
+ sense to test those methods.)
+
## 0.3.3
Fixed
diff --git a/README.md b/README.md
index 83a5e76..2d3ae16 100644
--- a/README.md
+++ b/README.md
@@ -11,14 +11,6 @@
Config File allows you to use the same simple API for manipulating INI, JSON,
YAML, and TOML configuration files. For the time being, it only supports INI.
-## Motivation
-
-With applications I was building, I found myself frequently having to use some sort of configuration folder with an object that modeled the configuration file. I did this to help more easily manipulate my configuration. However, I found myself needing this sort of thing for several different applications and would end up rewriting something similar. So ended up deciding to create a package out of it so I could focus more on the application I was building instead.
-
-## Why not just use configparser, ConfigObj, etc.
-
-I wanted something a bit cleaner to use than configparser. The ini parser uses configparser under the hood, but it provides some niceties such as automatically parsing configuration values into their native types when you retrieve them. However, I also wanted something more flexible, and ini files aren't the only common configuration format. That is why Config File uses an adapter pattern to swap in and out the right parser for various file types you give it. This allows you to use the same API for all of your configuration needs.
-
## Installation
```bash
$ pip install config_file
@@ -92,4 +84,19 @@ config.has('week')
>>> False
config.has('calendar.start_week_on_sunday')
>>> True
+
+# The file is only written back out when you call save()
+config.save()
+>>> True
+
+# You can also reset the file back to its original state. The current configuration file
+# would be deleted and replaced by a copy of the original. By default, since our passed in
+# config file was at path `~/.config/test/config.ini`, `reset()` will look for
+# `~/.config/test/config.original.ini`
+config.reset()
+>>> True
+
+# Or you can specify the file path explicitly
+config.reset(original_file_path="~/some_other_directory/this_is_actually_the_original.ini")
+>>> True
```