[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8101":3},{"id":4,"name":5,"fullName":6,"owner":5,"repo":5,"description":7,"homepage":8,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":15,"starSnapshotCount":15,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},8101,"maid","maid\u002Fmaid","Be lazy.  Let Maid clean up after you, based on rules you define.  Think of it as \"Hazel for hackers\".","http:\u002F\u002Frubygems.org\u002Fgems\u002Fmaid",null,"Ruby",1906,85,35,46,0,1,18.8,"GNU General Public License v2.0",false,"master",true,[],"2026-06-12 02:01:49","# Maid\n\n[![Gem Version](https:\u002F\u002Fbadge.fury.io\u002Frb\u002Fmaid.svg)](https:\u002F\u002Fbadge.fury.io\u002Frb\u002Fmaid)\n![GitHub Release](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002Fmaid\u002Fmaid)\n[![Test](https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid\u002Factions\u002Fworkflows\u002Ftest.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid\u002Factions\u002Fworkflows\u002Ftest.yml)\n[![Maintainability](https:\u002F\u002Fqlty.sh\u002Fgh\u002Fmaid\u002Fprojects\u002Fmaid\u002Fmaintainability.svg)](https:\u002F\u002Fqlty.sh\u002Fgh\u002Fmaid\u002Fprojects\u002Fmaid)\n[![Code Coverage](https:\u002F\u002Fqlty.sh\u002Fgh\u002Fmaid\u002Fprojects\u002Fmaid\u002Fcoverage.svg)](https:\u002F\u002Fqlty.sh\u002Fgh\u002Fmaid\u002Fprojects\u002Fmaid)\n[![StackOverflow](http:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fstackoverflow-maid-blue.svg)](http:\u002F\u002Fstackoverflow.com\u002Fquestions\u002Ftagged\u002Fmaid)\n\n**Be lazy!**  Let Maid clean up after you, based on rules you define.\n\n[Installation](#installation)\n| [Tutorial](#tutorial)\n| [Example](https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid-example)\n| [User Community](https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid\u002Fwiki)\n| [Documentation][]\n| [Changelog](CHANGELOG.md)\n\nMaid keeps files from sitting around too long, untouched.  Many of the downloads and temporary files you collect can\neasily be categorized and handled appropriately by rules you define.  Let the `maid` in your computer take care of the\neasy stuff, so you can spend more of your time on what matters.\n\nThink of it like the email filters you might already have, but for files.  Worried about things happening that you don't\nexpect?  Maid doesn't overwrite files and actions are logged so you can tell what happened.\n\nMaid is inspired by the Mac OS X shareware program [Hazel](http:\u002F\u002Fwww.noodlesoft.com\u002Fhazel.php).  Think of Maid as\n**\"Hazel for hackers\"**.\n\nYour rules are defined in Ruby, so simple rules are easy and difficult rules are possible.  This also makes Maid a great\ngeneral-purpose **advanced file renaming tool**.\n\n## Want to help?\n\nThis project wouldn't be where it is today without its users and contributors.  Thank you!  See [AUTHORS][] and the\n[contributors graph][] for more info.\n\n  [authors]: https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid\u002Fblob\u002Fmaster\u002FAUTHORS.md\n  [contributors graph]: https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid\u002Fgraphs\u002Fcontributors\n\n### For Users\n\n* Participate in [beta testing](https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid\u002Fissues\u002F10)\n* [Report an issue](https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid\u002Fissues) (bug or feature request)\n* Read through the [wiki](https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid\u002Fwiki)\n* Even just [share a link to Maid](https:\u002F\u002Ftwitter.com\u002Fintent\u002Ftweet?related=maidgem&text=Be+lazy%21+Let+Maid+clean+up+after+you%2C+based+on+rules+you+define&url=https%3A%2F%2Fgithub.com%2Fmaid%2Fmaid) :)\n\n### For Developers\n\n* Address a `TODO` or `FIXME` in the code (list them with `rake notes`.)\n* Fix an [existing issue](https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid\u002Fissues)\n* **Working on an issue?** Please leave a comment so others know.\n* See the [Contributing guide](https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid\u002Fwiki\u002FContributing)\n\n## Buzz\n\n[\n![Hacker News Logo](https:\u002F\u002Fraw.github.com\u002Fmaid\u002Fmaid\u002Fmaster\u002Fresources\u002Fhacker-news.png)\n](http:\u002F\u002Fnews.ycombinator.com\u002F)\n\n[Hazel for hackers](http:\u002F\u002Fnews.ycombinator.com\u002Fitem?id=4928605) - December 16th, 2012 (peaked at #2)\n\n[![Ruby5 Logo](https:\u002F\u002Fraw.github.com\u002Fmaid\u002Fmaid\u002Fmaster\u002Fresources\u002Fruby5.gif)](http:\u002F\u002Fruby5.envylabs.com\u002F)\n\n[Podcast #302](http:\u002F\u002Fruby5.envylabs.com\u002Fepisodes\u002F306-episode-302-august-31st-2012) (at 2:45) - August 31st, 2012\n\n[\n![OneThingWell Logo](https:\u002F\u002Fraw.github.com\u002Fmaid\u002Fmaid\u002Fmaster\u002Fresources\u002FOneThingWell.png)\n](http:\u002F\u002Fonethingwell.org\u002F)\n\n[Maid](http:\u002F\u002Fonethingwell.org\u002Fpost\u002F30455088809\u002Fmaid) - August 29th, 2012\n\n[More...](https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid\u002Fwiki\u002FIn-the-Media)\n\n## Installation\n\nMaid is a gem, so just `gem install maid` like normal.  If you're unfamiliar with Ruby, please see below for details.\n\n#### Requirements\n\nModern Ruby versions and Unix-like operating systems should work, but only OS X and Ubuntu are tested regularly.\n\nOffically supported:\n\n* **OS:** Mac OS X, Ubuntu\n* **Ruby:** 2.7.0+ (3.0.0+ preferred)\n\nSome features require OS X.  See the [documentation][] for more details.\n\n### Manual Installation\n\nFirst, you need Ruby 2.7 or 3. If you're starting without any Rubies, we\nstrongly recommend going for Ruby 3 as 2.7 is EOL.\n\nConsider using [`rvm`](https:\u002F\u002Frvm.io\u002Frvm\u002Finstall), [`rbenv`](https:\u002F\u002Fgithub.com\u002Frbenv\u002Frbenv#installation), [`rtx`](https:\u002F\u002Fgithub.com\u002Fjdxcode\u002Frtx), or [any other version management tool](https:\u002F\u002Fgithub.com\u002Fbernardoduarte\u002Fawesome-version-managers).\n\nThen, install via RubyGems.  Open a terminal and run:\n\n```bash\ngem install maid\n```\n\nAt a later date, you can update by running:\n\n```bash\ngem update maid\n```\n\nIf you decide you don't want Maid installed anymore, remove it:\n\n```bash\ngem uninstall maid\n```\n\n**NOTE:** This does not remove any files under `~\u002F.maid` or crontab entries.  Please remove them at your convenience.\n\n### Install through RVM and a dedicated gemset\n\nInstall Ruby 3.2 and create a gemset:\n\n`rvm install ruby-3.2 && rvm use 3.2 && rvm gemset create maid && rvm alias create maid ruby-3.2@maid`\n\nInstall maid:\n\n`rvm use maid && gem install maid`\n\nUpdate maid:\n\n`rvm use maid && gem update maid`\n\nUpdate ruby:\n\n`rvm install ruby-3.3 && rvm gemset copy 3.{2,3}@maid && rvm alias maid 3.3@maid`\n\n## Tutorial\n\nIn a nutshell, Maid uses \"rules\" to define how files are handled.  Once you have rules defined, you can either test what\ncleaning would do (`maid clean -n`) or actually clean (`maid clean -f`).\n\nTo generate a [sample rules file](lib\u002Fmaid\u002Frules.sample.rb), run:\n\n```bash\nmaid sample\n```\n\nMaid rules are defined using Ruby, with some common operations made easier with a small DSL (Domain Specific Language).\n\nFor example, this is a rule:\n\n```ruby\nMaid.rules do\n  rule 'Old files downloaded while developing\u002Ftesting' do\n    dir('~\u002FDownloads\u002F*').each do |path|\n      if downloaded_from(path).any? {|u| u.match 'http:\u002F\u002Flocalhost'} && 1.week.since?(accessed_at(path))\n        trash(path)\n      end\n    end\n  end\nend\n```\n\nIf you're new to Ruby and would prefer a more traditional `for` loop, you can also do this:\n\n```ruby\nMaid.rules do\n  rule 'My rule' do\n    for path in dir('~\u002FDownloads\u002F*')\n      # ...\n    end\n  end\nend\n```\n\nBefore you start running your rules, you'll likely want to be able to test them.  Here's how:\n\n```bash\n# No actions are taken; you just see what would happen with your rules as defined.\nmaid clean --dry-run # Synonyms: -n, --noop\n```\n\nTo run your rules on demand, you can run `maid` manually:\n\n```bash\nmaid clean -f                 # Run the rules at ~\u002F.maid\u002Frules.rb, logging to ~\u002F.maid\u002Fmaid.log\nmaid clean -fr some_rules.rb  # Run the rules in the file 'some_rules.rb', logging to ~\u002F.maid\u002Fmaid.log\n```\n\nSo, for example, if this is `some_rules.rb`:\n\n```ruby\nMaid.rules do\n  rule 'downloaded PDF books' do\n    move(dir('~\u002FDownloads\u002F*.pdf'), '~\u002FBooks')\n  end\nend\n```\n\nThen, this is the command to test, as well as some sample output:\n\n```bash\n$ maid clean -nr some_rules.rb\nRule: downloaded PDF books\nmv \"\u002FUsers\u002Fben\u002FDownloads\u002Fbook.pdf\" \"\u002FUsers\u002Fben\u002FBooks\u002F\"\nmv \"\u002FUsers\u002Fben\u002FDownloads\u002Fissue12.pdf\" \"\u002FUsers\u002Fben\u002FBooks\u002F\"\nmv \"\u002FUsers\u002Fben\u002FDownloads\u002Fspring2011newsletter.pdf\" \"\u002FUsers\u002Fben\u002FBooks\u002F\"\n```\n\nFor help with command line usage, run `maid help`.  For more help, please see the links at the top of this README.\n\n### Automation\n\nOnce you get a hang for what you can do with Maid, let it do its stuff automatically throughout the day.  You'll find\nyour computer stays a little tidier with as you teach it how to handle your common files.\n\n**Note:** Daemon support (using `fsevent`\u002F`inotify`) was recently added.  That said, `cron` takes care of the needs of many users.\n\nTo do this, edit your crontab in your tool of choice:\n\n```bash\ncrontab -e\n```\n\n...and have it invoke the `maid clean -f` command.  The `--silent` option is provided to keep this from emailing you, if\ndesired.  A log of the actions taken is kept at `~\u002F.maid\u002Fmaid.log`.\n\nExample for every day at 1am:\n\n```cron\n# minute hour day_of_month month day_of_week command_to_execute\n0 1 * * * \u002Fbin\u002Fbash -li -c \"maid clean --force --silent\"\n```\n\n### Running as a daemon\n\nTo run Maid as a daemon you first have to specify watch\u002Frepeat rules.\n\nThey are defined like this:\n\n```ruby\nMaid.rules do\n  repeat '1s' do\n    rule 'This rule will run every second' do\n      # some task\n    end\n  end\n\n  watch '\u002Fhome\u002Fuser\u002FDownloads' do\n    rule 'This rule will run on every change to the downloads directory' do\n      # another task\n    end\n  end\n\n  watch '~\u002FDesktop', ignore: \u002Fsome_directory\u002F do\n    # rules in here\n  end\nend\n```\n\nHere's a simple \"watch\" rule that organizes images by dimensions as soon as they're added to `~\u002FPictures`:\n\n```ruby\nMaid.rules do\n  watch '~\u002FPictures' do\n    rule 'organize images by dimensions' do\n      where_content_type(dir('~\u002FPictures\u002F*'), 'image').each do |image|\n        width, height = dimensions_px(image)\n        move(image, mkdir(\"~\u002FPictures\u002F#{width}x#{height}\"))\n      end\n    end\n  end\nend\n```\n\nThe command to run the daemon is `maid daemon`.  Starting the daemon on login depends on the platform.\n\n#### With RVM and cron\n\nSee [above](#install-through-rvm-and-a-dedicated-gemset) to install RVM and\nmaid in its own gemset.\n\nRun maid daily in a cron:\n\n```cron\n# \u002Fetc\u002Fcron.daily\u002Fmaid\n\n#!\u002Fusr\u002Fbin\u002Fenv bash\nsudo -Hu \u003Cyour username> bash -li -c \"\u003Cyour username>\u002F.rvm\u002Fwrappers\u002Fmaid\u002Fmaid clean --force --silent --rules ~\u002F.maid\u002Frules.rb\"\n```\n\n#### Ubuntu\n\nYou can run `maid daemon` as a normal startup application (Power\u002FGear Menu -> Startup Applications... -> Add).\n\n#### OS X\n\nPlease see Jurriaan Pruis' blog post, [Maid as a Daemon on OS X](https:\u002F\u002Fweb.archive.org\u002Fweb\u002F20191228181605\u002Fjurriaan.ninja\u002F2015\u002F01\u002F01\u002Fmaid-on-os-x.html).  ([Automating this setup would be welcome as a pull request!](https:\u002F\u002Fgithub.com\u002Fmaid\u002Fmaid\u002Fissues\u002F136))\n\n### Rake Tasks\n\nMaid includes helpers that make file managment easier.  You may find them useful if you need to automate tasks in your Ruby projects.  This is available via support for Maid-based Rake tasks:\n\n```ruby\n# File: Rakefile\nrequire 'maid'\n\nMaid::Rake::Task.new :clean do\n  # Clean up Rubinius-compilied Ruby\n  trash(dir('**\u002F*.rbc'))\nend\n```\n\nIn fact, the Maid project uses Maid in [its Rakefile](Rakefile).\n\nYou can also provide a custom description:\n\n```ruby\nMaid::Rake::Task.new clean_torrents: [:dependency], description: 'Clean Torrents' do\n  trash(dir('~\u002FDownloads\u002F*.torrent'))\nend\n```\n\n## Warranty\n\nTHERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING\nTHE COPYRIGHT HOLDERS AND\u002FOR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR\nIMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\nTHE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU\nASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n## License\n\nGPLv2.  See LICENSE for a copy.\n\n  [documentation]: https:\u002F\u002Fwww.rubydoc.info\u002Fgithub\u002Fmaid\u002Fmaid\u002Fmaster\n","Maid 是一个基于用户自定义规则来自动清理文件的工具，旨在帮助开发者自动化管理文件。它使用 Ruby 语言编写规则，允许用户根据文件类型、修改时间等条件设定清理策略，支持高级文件重命名功能。Maid 适用于需要定期清理临时文件或下载内容的工作环境，尤其适合那些希望减少手动整理文件时间的技术人员。其设计灵感来源于 Mac OS X 上的 Hazel 软件，但更侧重于满足编程爱好者的需求。通过日志记录所有操作，确保透明度和安全性。",2,"2026-06-11 03:16:05","top_language"]