Skip to content

Commit

Permalink
Configure build (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie authored Sep 16, 2024
1 parent fb559ea commit 7b4e4b4
Show file tree
Hide file tree
Showing 32 changed files with 748 additions and 53 deletions.
17 changes: 17 additions & 0 deletions .github/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Dependabot auto-merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: 'bundler'
directory: '/'
schedule:
interval: 'daily'
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build

on: push

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Run specs
run: bundle exec rake
57 changes: 6 additions & 51 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,56 +1,11 @@
*.gem
*.rbc
/.config
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/InstalledFiles
/doc/
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

# Used by dotenv library to load environment variables.
# .env

# Ignore Byebug command history file.
.byebug_history

## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/

## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# Used by RuboCop. Remote config files pulled in from inherit_from directive.
# .rubocop-https?--*
# rspec failure tracking
.rspec_status
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
26 changes: 26 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require:
- rubocop-rspec
- rubocop-performance

# Omakase Ruby styling for Rails
inherit_gem:
rubocop-rails-omakase: rubocop.yml

AllCops:
NewCops: enable
TargetRubyVersion: 3.3

Lint:
Enabled: true

Style/FrozenStringLiteralComment:
Enabled: false

RSpec/DescribedClass:
Enabled: false

RSpec/ExampleLength:
Enabled: false

RSpec/MultipleExpectations:
Enabled: false
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.3.5
12 changes: 12 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

source "https://rubygems.org"

# Specify your gem's dependencies in tts_voices.gemspec
gemspec

gem "rake"
gem "rspec"
gem "rubocop-rails-omakase", require: false
gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
129 changes: 129 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
PATH
remote: .
specs:
encrypted_credentials (0.1.0)

GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.3.3)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
ast (2.4.2)
aws-eventstream (1.3.0)
aws-partitions (1.975.0)
aws-sdk-core (3.205.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-ssm (1.178.0)
aws-sdk-core (~> 3, >= 3.205.0)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.9.1)
aws-eventstream (~> 1, >= 1.0.2)
base64 (0.2.0)
bigdecimal (3.1.8)
concurrent-ruby (1.3.1)
connection_pool (2.4.1)
diff-lcs (1.5.1)
drb (2.2.1)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.7.2)
language_server-protocol (3.17.0.3)
minitest (5.23.0)
mutex_m (0.2.0)
parallel (1.24.0)
parser (3.3.1.0)
ast (~> 2.4.1)
racc
racc (1.7.3)
rack (3.0.11)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.1)
rexml (3.2.8)
strscan (>= 3.0.9)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.63.5)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-minitest (0.35.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.21.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.24.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails-omakase (1.0.0)
rubocop
rubocop-minitest
rubocop-performance
rubocop-rails
rubocop-rspec (2.29.2)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.3)
rubocop (~> 1.40)
ruby-progressbar (1.13.0)
strscan (3.1.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)

PLATFORMS
arm64-darwin-22
ruby

DEPENDENCIES
aws-sdk-ssm
encrypted_credentials!
rake
rspec
rubocop-performance
rubocop-rails-omakase
rubocop-rspec

BUNDLED WITH
2.5.18
101 changes: 99 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,99 @@
# encrypted_credentials
Encrypted credentials without Rails
# EncryptedCredentials

[![Build](https://github.com/somleng/encrypted_credentials/actions/workflows/main.yml/badge.svg)](https://github.com/somleng/encrypted_credentials/actions/workflows/main.yml)

Rails like [Encrypted credentials](https://guides.rubyonrails.org/security.html#environmental-security) for plain ruby with no dependencies.

## Installation

Add to the application's Gemfile:

```rb
# Gemfile

gem "encrypted_credentials", github: "somleng/encrypted_credentials"
```

## Usage

Given the following files:

```yml
# config/app_settings.yml

default: &default
foo: "bar"
password: "secret"

production: &production
<<: *default
password: "<%= AppSettings.credentials.fetch('password') %>"

staging:
<<: *production

development: &development
<<: *default

test:
<<: *development
```
```yml
# config/credentials.yml.enc
# edit this file by running:
# bundle exec edit_credentials -f config/credentials.yml.enc -k config/master.key

production: &production
password: "super-secret"

staging:
<<: *production
```
```rb
# config/app_settings.rb
require "encrypted_credentials/app_settings"
require "encrypted_credentials/encrypted_file"

AppSettings = Class.new(EncryptedCredentials::AppSettings) do
def initialize(**)
super(
file: Pathname(File.expand_path("app_settings.yml", __dir__)),
encrypted_file: EncryptedCredentials::EncryptedFile.new(
file: Pathname(File.expand_path("credentials.yml.enc", __dir__))
)
**
)
end
end.new
```

```bash
APP_ENV=production ./bin/console
```

```rb
AppSettings.env
# "production"

AppSettings.fetch(:password)
# "super-secret"

AppSettings.fetch(:foo)
# "bar"
```

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/somleng/encrypted_credentials.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task default: :spec
Loading

0 comments on commit 7b4e4b4

Please sign in to comment.