Skip to content

Commit 091e787

Browse files
committed
Add CLI instructions to README
1 parent 0489937 commit 091e787

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

Diff for: README.md

+20-6
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,32 @@ And then execute:
2020

2121
$ bundle install
2222

23-
Or install it yourself as:
23+
Or install it globally (to use the CLI from any project):
2424

2525
$ gem install diffcrypt
2626

2727

2828

2929
## Usage
3030

31+
There are a few ways to use the library, depending on how advanced your use case is.
3132

32-
### Encrypt existing file
33+
34+
### CLI
35+
36+
The easiest way to get started is to use the CLI.
37+
38+
```shell
39+
diffcrypt decrypt -k $(cat test/fixtures/master.key) test/fixtures/example.yml.enc
40+
diffcrypt encrypt -k $(cat test/fixtures/master.key) test/fixtures/example.yml
41+
```
42+
43+
44+
### Ruby
45+
46+
A direct API is exposed so `Diffcrypt::Encryptor` can be used in any ruby project.
47+
48+
**NOTE:** This API may change any time until v1.0
3349

3450
```ruby
3551
encryptor = Diffcrypt::Encryptor.new('99e1f86b9e61f24c56ff4108dd415091')
@@ -38,18 +54,16 @@ encrypted = encryptor.encrypt(yaml)
3854
File.write('tmp/example.yml.enc', encrypted)
3955
```
4056

41-
### Decrypt a file
42-
4357
```ruby
4458
encryptor = Diffcrypt::Encryptor.new('99e1f86b9e61f24c56ff4108dd415091')
4559
yaml = File.read('test/fixtures/example.yml.enc')
4660
config = YAML.safe_load(encryptor.decrypt(yaml))
4761
```
4862

49-
### Rails
63+
### Ruby on Rails
5064

5165
Currently there is not native support for rails, but ActiveSupport can be monkeypatched to override
52-
the built in encrypter.
66+
the built in encrypter. All existing `rails credentials:edit` also work with this method.
5367

5468
```ruby
5569
require 'diffcrypt/rails/encrypted_configuration'

0 commit comments

Comments
 (0)