{"id":29954991,"url":"https://github.com/foca/migrake","last_synced_at":"2025-08-03T17:09:02.874Z","repository":{"id":3001136,"uuid":"4019008","full_name":"foca/migrake","owner":"foca","description":"Rake tasks that act as ActiveRecord::Migrations, useful for running after a deploy","archived":false,"fork":false,"pushed_at":"2012-04-15T23:49:50.000Z","size":96,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-28T03:47:36.470Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foca.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-13T18:25:45.000Z","updated_at":"2015-10-14T11:30:49.000Z","dependencies_parsed_at":"2022-09-21T08:02:15.885Z","dependency_job_id":null,"html_url":"https://github.com/foca/migrake","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/foca/migrake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmigrake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmigrake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmigrake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmigrake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foca","download_url":"https://codeload.github.com/foca/migrake/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmigrake/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268207603,"owners_count":24213015,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-08-03T17:08:59.174Z","updated_at":"2025-08-03T17:09:02.850Z","avatar_url":"https://github.com/foca.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Migrake\n\n[![Build Status](https://secure.travis-ci.org/foca/migrake.png?branch=master)](http://travis-ci.org/foca/migrake)\n\nA simple [Rake][rake] extension that lets you define tasks that are divided into\nmultiple smaller \"versions\". When you run the task in a given host, it will only\nrun the \"versions\" that haven't yet been run in that host. Think something\nsimilar to [ActiveRecord::Migration][migrations] for Rake tasks.\n\nThis is specially useful to define tasks that should be run on deploy, in order\nto do some sort of house cleaning that should be run once. For example, some\ncomplex data migrations, or re-processing your user avatars because now the UI\nshows them in a different size.\n\nThe important thing is these tasks should only be run once when you deploy to a\ngiven environment, and they should be run immediately.\n\n[rake]:       http://rake.rubyforge.org\n[migrations]: http://api.rubyonrails.org/classes/ActiveRecord/Migration.html\n\n## An example\n\nIn `lib/tasks/migrake.rake`:\n\n``` ruby\nrequire \"migrake\"\n\nmigrake Set.new([\n  \"data:set_default_user_state\",\n  \"twitter:purge_cache\",\n  # etc, etc\n])\n```\n\nThis would define a task called `:migrake` that, when called, will invoke the\ntasks in that set _unless they have been invoked before_. This means that after\neach deploy you can run this task (with a capistrano hook, for example) and any\ntasks that need to be run in this environment will be run.\n\n## How it works\n\nThis will keep a file named `MIGRAKE_STATUS`, that will contain the name of the\ntasks that were ran in the past. Whenever you run `rake migrake` migrake will\ncheck that file, see which tasks in the set aren't in it, and will run those\ntasks (no order is guaranteed, if you need tasks to run in order, define the\ndependencies in the task themselves.)\n\n## Overriding the file where tasks are stored\n\nThe file will be located, by default, at whichever directory `rake` is invoked\nfrom. In order to change the path to the file, you can do this:\n\n``` ruby\nMigrake.store = Migrake::FileSystemStore.new(\"./config/migrake\")\n```\n\nThis *must* be called in your Rakefile before you define the tasks to be run by\n`migrake`. Like this:\n\n``` ruby\nrequire \"migrake\"\n\nMigrake.store = Migrake::FileSystemStore.new(\"./config/migrake\")\n\nmigrake Set.new([\n  # ...\n])\n```\n\nAs an alternative, you can make `MIGRAKE_STATUS_DIR` available to your\nenvironment, and migrake will use a `MIGRAKE_STATUS` file in that directory.\n\n``` shell\nMIGRAKE_STATUS_DIR=./some/path bundle exec rake migrake\n```\n\nThis is particularly useful to use with capistrano, since you probably want to\nuse cap's `shared` directory to store your migrake file. For example:\n\n``` ruby\nnamespace :deploy do\n  task :migrake do\n    run \"MIGRAKE_STATUS_DIR=#{shared_path} bundle exec rake migrake\"\n  end\nend\n\nafter \"deploy:migrations\", \"deploy:migrake\"\n```\n\n## Heroku and other environments where you can't easily write to the filesystem\n\nThe `FileSystemStore` is easily swappable. For the particular case of Heroku and\nsimilar servers we provide the [Migrake::SQLStore][sql-store] gem, that\nimplements the storage API using a database table.\n\nWriting a new storage engine should be trivial. Use either `FileSystemStore` or\n`SQLStore` as an example.\n\n[sql-store]: http://github.com/foca/migrake-sql_store\n\n## Bootstrapping a new environment\n\nWhen you bootstrap a new environment you don't need to run migrake tasks that\nhave been already run. For this, when the `migrake` method is invoked we also\ndefine a `migrake:ready` task, that forces all tasks defined in the migrake set\ninto the `MIGRAKE_STATUS` file.\n\nThis way you can just run that when you bootstrap the environment and then keep\nrunning `rake migrake` when you deploy.\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012 [Nicolas Sanguinetti][me], with the support of [Cubox][cubox]\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[me]:    http://nicolassanguinetti.info\n[cubox]: http://cuboxlabs.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoca%2Fmigrake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoca%2Fmigrake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoca%2Fmigrake/lists"}