{"id":17837177,"url":"https://github.com/okuramasafumi/neco","last_synced_at":"2025-10-10T14:38:20.866Z","repository":{"id":48475220,"uuid":"188059110","full_name":"okuramasafumi/neco","owner":"okuramasafumi","description":"neco is a NEo COmmand library","archived":false,"fork":false,"pushed_at":"2024-08-01T23:06:27.000Z","size":56,"stargazers_count":7,"open_issues_count":7,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T18:56:27.684Z","etag":null,"topics":["business-logic","command-pattern","meta-programming","ruby"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/neco","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/okuramasafumi.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-22T14:49:05.000Z","updated_at":"2021-01-22T08:05:18.000Z","dependencies_parsed_at":"2024-10-27T21:33:44.316Z","dependency_job_id":"9079b5f7-a4e2-4a6a-aa1e-ea7bb7b727cf","html_url":"https://github.com/okuramasafumi/neco","commit_stats":{"total_commits":35,"total_committers":4,"mean_commits":8.75,"dds":0.4571428571428572,"last_synced_commit":"d7a1761aefaa6b0782519978d18e148c2eec934f"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okuramasafumi%2Fneco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okuramasafumi%2Fneco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okuramasafumi%2Fneco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okuramasafumi%2Fneco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/okuramasafumi","download_url":"https://codeload.github.com/okuramasafumi/neco/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244507834,"owners_count":20463689,"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":["business-logic","command-pattern","meta-programming","ruby"],"created_at":"2024-10-27T20:45:48.736Z","updated_at":"2025-10-10T14:38:15.845Z","avatar_url":"https://github.com/okuramasafumi.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/okuramasafumi/neco.svg?branch=master)](https://travis-ci.com/okuramasafumi/neco)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d011a37ef8ebf1ea2afd/maintainability)](https://codeclimate.com/github/okuramasafumi/neco/maintainability)\n\n# Neco\n\nNeco is a NEo COmmand pattern library for Ruby.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'neco'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install neco\n\n## Usage\n\nInclude `Neco::Command` module and define your command with DSLs like below:\n\n```ruby\nclass Foo\n  include Neco::Command\n\n  validates do |name:|\n    name == 'Tama'\n  end\n\n  main do |name:|\n    puts \"Hello, #{name}!\"\n  end\nend\n\nFoo.call(name: 'Tama') # =\u003e 'Hello, Tama!'\n```\n\nHere, `validates` block defines validations and `main` block defines main logic for the command (simple, right?)\n\nYou can also compose multiple commands into one command using `Neco::Composition` module. Neco automatically triggers rollbacks when one of the commands raises an exception.\n\n```ruby\nclass Command1\n  include Neco::Command\n\n  main do\n    set :cat_name, 'Tama'\n  end\n\n  rollback do\n    puts 'Rolling back Command1!'\n  end\nend\n\nclass Command2\n  include Neco::Command\n\n  main do |cat_name:|\n    puts \"Hello, #{cat_name}!\"\n  end\n\n  rollback do\n    puts 'Rolling back Command2!'\n  end\nend\n\nclass Command3\n  include Neco::Command\n\n  # Unused block argument\n  main do |cat_name:|\n    raise 'OMG!!!'\n  end\nend\n\nclass Bar\n  include Neco::Composition\n\n  composes Command1, Command2, Command3\nend\n\nBar.call\n# =\u003e 'Hello, Tama!'\n# =\u003e 'Rolling back Command2!'\n# =\u003e 'Rolling back Command1!'\n```\n\nSee `examples` directory for details.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. 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/okuramasafumi/neco. 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 Neco project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/okuramasafumi/neco/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokuramasafumi%2Fneco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fokuramasafumi%2Fneco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokuramasafumi%2Fneco/lists"}