Skip to content

Commit

Permalink
Add mkpath to Rake task for Hanami 2
Browse files Browse the repository at this point in the history
  • Loading branch information
svoop committed Mar 7, 2024
1 parent 9bcac67 commit 65279d5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ The [bridgetown_credentials gem](https://github.com/svoop/bridgetown_credentials

### Hanami 2

To use credentials in a [Hanami 2](https//hanami.org) app, first add this gem to the gemfile of the app and then create a provider `config/providers/credentials.rb`:
To use credentials in a [Hanami 2](https//hanami.org) app, first add this gem to the Gemfile of the app and then create a provider `config/providers/credentials.rb`:

```ruby
# frozen_string_literal: true
Expand All @@ -182,12 +182,13 @@ Hanami.app.register_provider :credentials do
end
```

You might want to add a Rake task `lib/tasks/credentials.rake` as well:
Next up are Rake tasks `lib/tasks/credentials.rake`:

```ruby
namespace :credentials do
desc "Edit (or create) the encrypted credentials file"
task :edit, [:env] => [:environment] do |_, args|
Hanami.app.root.join(Hanami.app["credentials"][:dir]).mkpath
Hanami.app.prepare(:credentials)
Hanami.app['credentials'].edit! args[:env]
end
Expand Down

0 comments on commit 65279d5

Please sign in to comment.