{"id":17680276,"url":"https://github.com/kostya/bin_script","last_synced_at":"2025-06-11T16:33:51.590Z","repository":{"id":2944517,"uuid":"3957693","full_name":"kostya/bin_script","owner":"kostya","description":"Easy writing and executing bins(executable scripts) in Rails Application (especially for crontab or god). For my purposes much better than Rake, Thor and Rails Runner.","archived":false,"fork":false,"pushed_at":"2013-08-24T11:40:27.000Z","size":105,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-02T13:34:05.996Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/kostya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-07T12:47:33.000Z","updated_at":"2013-10-25T13:23:07.000Z","dependencies_parsed_at":"2022-07-19T02:32:20.572Z","dependency_job_id":null,"html_url":"https://github.com/kostya/bin_script","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostya%2Fbin_script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostya%2Fbin_script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostya%2Fbin_script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostya%2Fbin_script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kostya","download_url":"https://codeload.github.com/kostya/bin_script/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223835370,"owners_count":17211158,"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":[],"created_at":"2024-10-24T09:06:24.938Z","updated_at":"2024-11-09T14:04:11.540Z","avatar_url":"https://github.com/kostya.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Rails BinScript\n===============\n\nGem for easy writing and executing scripts in Rails Application. For my purposes much better than Rake, Thor and Rails Runner.\n\nFeatures:\n\n1. Each bin is a class\n2. Easy writing tests\n3. Custom lock file\n4. Custom logger with formatter for each script\n5. Can be daemonized\n\nTested on Rails 2.3 and 3.2\n\n``` ruby\ngem 'bin_script'\n```\n\n    rails generate bin:bin bla\n\nCall like:\n\n    $ cd project \u0026\u0026 ./bin/bla -e production --test -d \"2012-04-07\" -u \"asdf\"\n\nCall examples:\n\n    $ ./bin/bla -h\n    $ ./bin/bla -e production\n    $ ./bin/bla -e production -L ./locks/bla.lock\n    $ ./bin/bla -e production -l ./log/bla.log\n    $ ./bin/bla -e production --daemonize --pidfile ./tmp/bla.pid\n\n\nExample Bin\n-----------\napp/bins/bla_script.rb\n\n``` ruby\nclass BlaScript \u003c BinScript\n  optional :u, \"Update string\"\n  required :d, :description =\u003e \"Date in format YYYY-MM-DD or YYYY-MM\", :default =\u003e \"2012-04-01\"\n  noarg    :t, :decription =\u003e \"Test run\", :alias =\u003e 'test'\n\n  self.description = \"Super Bla script\"\n\n  def test?\n    params(:t)\n  end\n\n  def do!\n    if test?\n      logger.info \"update string #{params(:u)}\"\n    else\n      logger.info \"data #{params(:d)}\"\n    end\n  end\nend\n```\n\n### Options\n\n``` ruby\nclass BlaScript \u003c BinScript\n  self.log_level = Logger::DEBUG\n  self.enable_locking = false\n  self.enable_logging = false\nend\n```\n\n### Custom exception notifier (create initializer with:)\n\n``` ruby\nclass BinScript\n  def notify_about_error(exception)\n    Mailter.some_notification(exception)...\n  end\nend\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkostya%2Fbin_script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkostya%2Fbin_script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkostya%2Fbin_script/lists"}