{"id":26512988,"url":"https://github.com/rubyrider/clomp","last_synced_at":"2025-03-21T04:19:20.222Z","repository":{"id":59152128,"uuid":"115717852","full_name":"rubyrider/clomp","owner":"rubyrider","description":"Clomp gem provides a smooth, lightweight, productive and reusable way to build an operation using Railway oriented programing paradigm","archived":false,"fork":false,"pushed_at":"2018-02-10T08:25:45.000Z","size":93,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-08-08T17:16:15.600Z","etag":null,"topics":["framework-agnostic","railway-oriented-programming","ruby","serviceobject"],"latest_commit_sha":null,"homepage":"https://rubyrider.github.io/clomp/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rubyrider.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-29T11:42:23.000Z","updated_at":"2019-01-04T05:55:47.000Z","dependencies_parsed_at":"2022-09-13T11:01:06.450Z","dependency_job_id":null,"html_url":"https://github.com/rubyrider/clomp","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyrider%2Fclomp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyrider%2Fclomp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyrider%2Fclomp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyrider%2Fclomp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubyrider","download_url":"https://codeload.github.com/rubyrider/clomp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244734196,"owners_count":20501018,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["framework-agnostic","railway-oriented-programming","ruby","serviceobject"],"created_at":"2025-03-21T04:19:19.588Z","updated_at":"2025-03-21T04:19:20.214Z","avatar_url":"https://github.com/rubyrider.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clomp \n[![CircleCI](https://circleci.com/gh/rubyrider/clomp.svg?style=svg)](https://circleci.com/gh/rubyrider/clomp) [![Issues](http://img.shields.io/github/issues/rubyrider/clomp.svg)]( https://github.com/rubyrider/clomp/issues ) [![Gem Version](https://badge.fury.io/rb/clomp.svg)](https://badge.fury.io/rb/clomp) [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT) [![Maintainability](https://api.codeclimate.com/v1/badges/a7edc252626bdf40d389/maintainability)](https://codeclimate.com/github/rubyrider/clomp/maintainability) [![Chat](https://img.shields.io/badge/gitter.im-rubyrider/clomp-green.svg)]( https://gitter.im/clomp-ruby/Lobby ) [![Code Triagers Badge](https://www.codetriage.com/rubyrider/clomp/badges/users.svg)](https://www.codetriage.com/rubyrider/clomp)\n\n**Clomp gem provides a smooth, lightweight, productive and reusable way to build an operation using Railway oriented programing paradigm.**\nClomp will give you an easy interface to complete your service operation. You can use it with any framework \nor plain ruby object. \n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'clomp'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install clomp\n\n## Usage\nBuild any service with the track! Add as many tracks as you want.\ntracks will be loaded sequentially. You can control success and failure state of any \nspecific step.\n\n### Example application\nYou may check the following rails project for basic understanding.\n[Clomp Usage Example](https://github.com/rubyrider/clomp-example)\n\nClomp is completely framework independent agnostic framework. You can use it with any ruby frameworks\nand even with your raw ruby code.\n\n\nConsider the following class:\n```ruby\nclass AnotherOperation \u003c Clomp::Operation\n  track :track_from_another_operation\n\n  def track_from_another_operation(options)\n    options[:hello_from_another_operation] = true\n  end\nend\n    \nclass SingingOperation \u003c Clomp::Operation\n    # this block only executes on failure step! \n    # pass options to receive the operation states!   \n    add_track :get_lyrics do |options|\n      # we call this a failure state based block!\n      options[:do_some_thing] = 10\n    end\n    \n    add_track :get_instruments_ready\n    \n    add_track :start_signing\n    \n    # We can now share specific step from \n    # outsider operation\n    share :track_from_another_operation, from: AnotherOperation # Or 'AnotherOperation'\n    \n    finally :receive_price #final step, wont execute after this step!\n    \n    def get_instruments_ready(options, params: , **)\n      # do anything!\n    end\n    \n    def get_lyrics(options, params: , **)\n      params[:singer_name] = 'James' #mutate\n    end\n    \n    def start_signing(options)\n      puts options[:params]\n    end\n    \n    def receive_price(options)\n      puts \"I am honored for this awesome price!\"\n    end\nend\n```\n\n```ruby\n@result = SingingOperation[singer_name: 'Bass Baba']\n@result.success? # =\u003e true\n@result.failure? # =\u003e false\n```\n\nTrace the steps:\n```ruby\n@result = SingingOperation[singer_name: 'Bass Baba']\n@result.executed_tracks\n\"first_track:track:success --\u003e track_from_another_operation:track:success --\u003e call_something:track:success\"\n\n@result.to_s\n\"Clomp::Result \u003e Successful: first_track:track:success --\u003e track_from_another_operation:track:success --\u003e call_something:track:success\"\n```\n\n## Configuration\nYou can set custom step name(s), custom fail, pass flow configuration globally and operation wise!\n\n```ruby\nClomp::Configuration.setup do |config|\n# You can set as many step name as you want\nconfig.custom_step_names =+ [:my_own_step_name]\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/rubyrider/clomp. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the TheRailway project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rubyrider/clomp/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyrider%2Fclomp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubyrider%2Fclomp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyrider%2Fclomp/lists"}