Skip to content

Commit

Permalink
Added project skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
bkuhlmann committed Sep 26, 2023
1 parent dd6c6f5 commit 8d655c6
Show file tree
Hide file tree
Showing 25 changed files with 341 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: 2.1
jobs:
build:
working_directory: ~/project
docker:
- image: bkuhlmann/alpine-ruby:latest
steps:
- checkout

- restore_cache:
name: Bundler Restore
keys:
- gem-cache-{{.Branch}}-{{checksum "Gemfile"}}-{{checksum "dry-operation.gemspec"}}
- gem-cache-

- run:
name: Bundler Install
command: |
gem update --system
bundle config set path "vendor/bundle"
bundle install
- save_cache:
name: Bundler Store
key: gem-cache-{{.Branch}}-{{checksum "Gemfile"}}-{{checksum "dry-operation.gemspec"}}
paths:
- vendor/bundle

- run:
name: Build
command: bundle exec rake

- store_artifacts:
name: SimpleCov Artifacts Upload
path: ~/project/coverage
destination: coverage
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: hanami
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Overview
<!-- Required. Describe, briefly, the behavior experienced and desired. -->

## Screenshots/Screencasts
<!-- Optional. Attach screenshot(s) and/or screencast(s) that demo the behavior. -->

## Steps to Recreate
<!-- Required. List exact steps (numbered list) to reproduce errant behavior. -->

## Environment
<!-- Required. What is your operating system, software version(s), etc. -->
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 @@
## Overview
<!-- Required. Why is this important/necessary and what is the overarching architecture. -->

## Screenshots/Screencasts
<!-- Optional. Provide supporting image/video. -->

## Details
<!-- Optional. List the key features/highlights as bullet points. -->
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Continuous Integration

on: [push, pull_request]

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Rake
run: bundle exec rake

- name: Archive SimpleCov Report
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.gem
.bundle
Gemfile.lock
pkg
tmp
7 changes: 7 additions & 0 deletions .reek.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
exclude_paths:
- tmp
- vendor

detectors:
LongParameterList:
enabled: false
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
inherit_gem:
caliber: config/all.yml
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.2
28 changes: 28 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

ruby File.read(".ruby-version").strip

source "https://rubygems.org"

gemspec

group :code_quality do
gem "caliber", "~> 0.35"
gem "git-lint", "~> 6.0"
gem "reek", "~> 6.1", require: false
gem "simplecov", "~> 0.22", require: false
end

group :development do
gem "rake", "~> 13.0"
end

group :test do
gem "guard-rspec", "~> 4.7", require: false
gem "rspec", "~> 3.12"
end

group :tools do
gem "amazing_print", "~> 1.4"
gem "debug", "~> 1.8"
end
7 changes: 7 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

guard :rspec, cmd: "NO_COVERAGE=true bin/rspec --format documentation" do
watch %r(^spec/.+_spec\.rb$)
watch(%r(^lib/(.+)\.rb$)) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch("spec/spec_helper.rb") { "spec" }
end
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2015-2023 dry-rb team

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
# dry-operation
<!--- this file is synced from dry-rb/template-gem project -->
[gem]: https://rubygems.org/gems/dry-operation
[actions]: https://github.com/dry-rb/dry-operation/actions

# dry-operation [![Gem Version](https://badge.fury.io/rb/dry-operation.svg)][gem] [![CI Status](https://github.com/dry-rb/dry-operation/workflows/ci/badge.svg)][actions]

## Links

* [User documentation](https://dry-rb.org/gems/dry-operation)
* [API documentation](http://rubydoc.info/gems/dry-operation)
* [Forum](https://discourse.dry-rb.org)

## Supported Ruby versions

This library officially supports the following Ruby versions:

* MRI `>= 3.0.0`
* jruby `>= 9.4` (not tested on CI)

## License

See `LICENSE` file.
17 changes: 17 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

require "bundler/setup"
require "git/lint/rake/register"
require "reek/rake/task"
require "rspec/core/rake_task"
require "rubocop/rake_task"

Git::Lint::Rake::Register.call
Reek::Rake::Task.new
RSpec::Core::RakeTask.new { |task| task.verbose = false }
RuboCop::RakeTask.new

desc "Run code quality checks"
task code_quality: %i[git_lint reek rubocop]

task default: %i[code_quality spec]
5 changes: 5 additions & 0 deletions VERSIONS.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
= Versions

== 0.0.0 (2023-09-26)

* Added initial implementation.
10 changes: 10 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
Bundler.require :tools

require "dry/operation"
require "irb"

IRB.start __FILE__
6 changes: 6 additions & 0 deletions bin/guard
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"

load Gem.bin_path "guard", "guard"
6 changes: 6 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"

load Gem.bin_path "rake", "rake"
6 changes: 6 additions & 0 deletions bin/rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"

load Gem.bin_path "rspec-core", "rspec"
6 changes: 6 additions & 0 deletions bin/rubocop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"

load Gem.bin_path "rubocop", "rubocop"
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /usr/bin/env bash

set -o nounset
set -o errexit
set -o pipefail
IFS=$'\n\t'

bundle install
31 changes: 31 additions & 0 deletions dry-operation.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frozen_string_literal: true

Gem::Specification.new do |spec|
spec.name = "dry-operation"
spec.version = "0.0.0"
spec.authors = ["Tim Riley", "Marc Busque", "Brooke Kuhlmann"]
spec.email = ["[email protected]", "[email protected]", "[email protected]"]
spec.homepage = "https://dry-rb.org/gems/dry-operation"
spec.summary = "A domain specific language for composable business transaction workflows."
spec.license = "MIT"

spec.metadata = {
"bug_tracker_uri" => "https://github.com/dry-rb/dry-operation/issues",
"changelog_uri" => "https://github.com/dry-rb/dry-operation/blob/main/CHANGELOG.md",
"documentation_uri" => "https://dry-rb.org/gems/dry-operation",
"funding_uri" => "https://github.com/sponsors/hanami",
"label" => "Dry Operation",
"rubygems_mfa_required" => "true",
"source_code_uri" => "https://github.com/dry-rb/dry-operation"
}

spec.signing_key = Gem.default_key_path
spec.cert_chain = [Gem.default_cert_path]

spec.required_ruby_version = "~> 3.2"
spec.add_dependency "refinements", "~> 11.0"
spec.add_dependency "zeitwerk", "~> 2.6"

spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
spec.files = Dir["*.gemspec", "lib/**/*"]
end
14 changes: 14 additions & 0 deletions lib/dry/operation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

require "zeitwerk"

Zeitwerk::Loader.new.then do |loader|
loader.push_dir "#{__dir__}/.."
loader.setup
end

module Dry
# Main namespace.
module Operation
end
end
44 changes: 44 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# frozen_string_literal: true

require "simplecov"

unless ENV["NO_COVERAGE"]
SimpleCov.start do
add_filter %r(^/spec/)
enable_coverage :branch
enable_coverage_for_eval
minimum_coverage_by_file line: 95, branch: 95
end
end

Bundler.require :tools

require "dry/operation"
require "refinements"

SPEC_ROOT = Pathname(__dir__).realpath.freeze

using Refinements::Pathnames

Pathname.require_tree SPEC_ROOT.join("support/shared_contexts")

RSpec.configure do |config|
config.color = true
config.disable_monkey_patching!
config.example_status_persistence_file_path = "./tmp/rspec-examples.txt"
config.filter_run_when_matching :focus
config.formatter = ENV.fetch("CI", false) == "true" ? :progress : :documentation
config.order = :random
config.shared_context_metadata_behavior = :apply_to_host_groups
config.warnings = true

config.expect_with :rspec do |expectations|
expectations.syntax = :expect
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end

config.mock_with :rspec do |mocks|
mocks.verify_doubled_constant_names = true
mocks.verify_partial_doubles = true
end
end
13 changes: 13 additions & 0 deletions spec/support/shared_contexts/temp_dir.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

RSpec.shared_context "with temporary directory" do
using Refinements::Pathnames

let(:temp_dir) { Bundler.root.join "tmp/rspec" }

around do |example|
temp_dir.make_path
example.run
temp_dir.remove_tree
end
end

0 comments on commit 8d655c6

Please sign in to comment.