diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..31b7f31 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: hanami diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..180d4a1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,11 @@ +## Overview + + +## Screenshots/Screencasts + + +## Steps to Recreate + + +## Environment + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..5bb52a2 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ +## Overview + + +## Screenshots/Screencasts + + +## Details + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6b275a7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a93ca7b --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.gem +.bundle +.rubocop-https* +Gemfile.lock +pkg +tmp diff --git a/.reek.yml b/.reek.yml new file mode 100644 index 0000000..a2736e3 --- /dev/null +++ b/.reek.yml @@ -0,0 +1,7 @@ +exclude_paths: + - tmp + - vendor + +detectors: + LongParameterList: + enabled: false diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..18a0429 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,2 @@ +inherit_from: + - https://raw.githubusercontent.com/dry-rb/template-gem/main/.rubocop.yml diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..be94e6f --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.2 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9028d73 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Versions + +## 0.0.0 (?) + +* Pending... diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..2b6cb65 --- /dev/null +++ b/Gemfile @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +ruby File.read(".ruby-version").strip + +source "https://rubygems.org" + +gemspec + +group :code_quality do + gem "git-lint", "~> 6.0" + gem "reek", "~> 6.1", require: false + gem "rubocop", "~> 1.56" + 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 diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000..a40c245 --- /dev/null +++ b/Guardfile @@ -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 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9f9f214 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md index 21c37f7..e86f51c 100644 --- a/README.md +++ b/README.md @@ -1 +1,22 @@ -# dry-operation + +[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. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..f935f93 --- /dev/null +++ b/Rakefile @@ -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] diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..9fa86b7 --- /dev/null +++ b/bin/console @@ -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__ diff --git a/bin/guard b/bin/guard new file mode 100755 index 0000000..9e8c9cc --- /dev/null +++ b/bin/guard @@ -0,0 +1,6 @@ +#! /usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" + +load Gem.bin_path "guard", "guard" diff --git a/bin/rake b/bin/rake new file mode 100755 index 0000000..9bef742 --- /dev/null +++ b/bin/rake @@ -0,0 +1,6 @@ +#! /usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" + +load Gem.bin_path "rake", "rake" diff --git a/bin/rspec b/bin/rspec new file mode 100755 index 0000000..328edde --- /dev/null +++ b/bin/rspec @@ -0,0 +1,6 @@ +#! /usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" + +load Gem.bin_path "rspec-core", "rspec" diff --git a/bin/rubocop b/bin/rubocop new file mode 100755 index 0000000..fcc59f5 --- /dev/null +++ b/bin/rubocop @@ -0,0 +1,6 @@ +#! /usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" + +load Gem.bin_path "rubocop", "rubocop" diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..8187680 --- /dev/null +++ b/bin/setup @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +set -euxo pipefail +IFS=$'\n\t' + +bundle install diff --git a/dry-operation.gemspec b/dry-operation.gemspec new file mode 100644 index 0000000..fb2fec3 --- /dev/null +++ b/dry-operation.gemspec @@ -0,0 +1,26 @@ +# 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 = ["tim@riley.id.au", "marc@lamarciana.com", "brooke@alchemists.io"] + 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", + "source_code_uri" => "https://github.com/dry-rb/dry-operation" + } + + spec.required_ruby_version = ">= 3.0.0" + spec.add_dependency "zeitwerk", "~> 2.6" + + spec.extra_rdoc_files = Dir["README*", "LICENSE*"] + spec.files = Dir["*.gemspec", "lib/**/*"] +end diff --git a/lib/dry/operation.rb b/lib/dry/operation.rb new file mode 100644 index 0000000..bb19488 --- /dev/null +++ b/lib/dry/operation.rb @@ -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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..fe30b81 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,39 @@ +# 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" + +SPEC_ROOT = Pathname(__dir__).realpath.freeze + +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 = :progress + 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