{"id":17003824,"url":"https://github.com/cldwalker/console_update","last_synced_at":"2025-03-22T16:30:46.097Z","repository":{"id":511460,"uuid":"139197","full_name":"cldwalker/console_update","owner":"cldwalker","description":"A gem to edit your database records via the console and your favorite editor.","archived":false,"fork":false,"pushed_at":"2012-09-14T02:16:42.000Z","size":199,"stargazers_count":21,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T13:32:18.610Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://tagaholic.me/console_update/","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/cldwalker.png","metadata":{"files":{"readme":"README.rdoc","changelog":"CHANGELOG.rdoc","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-02-27T16:59:39.000Z","updated_at":"2022-06-06T04:05:39.000Z","dependencies_parsed_at":"2022-07-04T21:30:37.751Z","dependency_job_id":null,"html_url":"https://github.com/cldwalker/console_update","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cldwalker%2Fconsole_update","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cldwalker%2Fconsole_update/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cldwalker%2Fconsole_update/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cldwalker%2Fconsole_update/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cldwalker","download_url":"https://codeload.github.com/cldwalker/console_update/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244986301,"owners_count":20542991,"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-14T04:32:48.724Z","updated_at":"2025-03-22T16:30:45.666Z","avatar_url":"https://github.com/cldwalker.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"== Description\n\nUpdates records from the console via your preferred editor. You can update a record's columns as\nwell as \u003ci\u003eany attribute\u003c/i\u003e that has accessor methods.  Records are edited via a temporary file and\nonce saved, the records are updated. Records go through a filter before and after editing the file. Yaml is\nthe default filter, but you can define your own filter simply with a module and 2 expected methods.\nSee ConsoleUpdate::Filter for more details. Compatible with all major Ruby versions and Rails 2.3.x\nand up.\n\n== Install\n\nInstall as a gem\n\n    $ gem install console_update\n\n    # with bundler: add in Gemfile\n    gem 'console_update'\n\n    # without bundler: add in config/environment.rb\n    config.gem \"console_update\"\n\nOr as a plugin\n\n    $ script/plugin install git://github.com/cldwalker/console_update.git\n\n== Examples\n\nFor a given model Url, update your records as you please:\n\n  $ script/console\n\n  # Update a record from the object\n  \u003e\u003e Url.first.console_update\n\n  # Update a group of records\n  \u003e\u003e records = Url.all :limit=\u003e10\n  \u003e\u003e Url.console_update records\n\n  # Find and update by a given id\n  \u003e\u003e Url.find_and_console_update 10\n\n  # Update through any named_scope ie tagged_with()\n  \u003e\u003e Url.tagged_with(\"sweetness\").console_update\n  \n== Setup\n\nDefine your editor if not already picked up by environment variable $EDITOR:\n\n  ConsoleUpdate.editor = 'vim'\n\nConfigure model(s) to update from the console:\n\n  class Url\n    can_console_update\n  end\n\nBy default, can_console_update() has sensical defaults for what attributes to update.\nBut you can setup your own defaults as needed:\n\n  can_console_update :only=\u003e%w{column1 column2 relation_accessor1}\n  can_console_update :except=\u003e%w{column2}\n\nTo use the named_scope chaining, enable it once.\n  ConsoleUpdate.enable_named_scope\n\n== More Examples\n\nAlthough console_update() uses the default editable columns, it can take options to override\nthese as needed. Note these options can be passed to any of the console_update-like methods shown\nabove:\n\n  records = Url.all :limit=\u003e100\n  # Only edit this one attribute\n  Url.console_update records, :only=\u003e%w{description}\n  # Edit all the default attributes except this one\n  Url.console_update records, :except=\u003e%w{description}\n\nAs mentioned above, any attribute can be edited. This means it's possible to edit associated\nvalues as well as column values.\n\nSay we have a Url that has many tags and accessor methods to edit them ie tag_list() and\ntag_list=():\n\n  @url.tag_list = ['tag1', 'tag2']\n  @url.save\n  @url.tag_list # =\u003e['tag1', 'tag2']\n\nBy simply passing 'tag_list' as another attribute to console_update() or can_console_update(),\nwe can edit these associated values:\n   class Url\n     can_console_update :only=\u003e%w{column1 column2 tag_list}\n   end\n\n   Url.console_update records, :only=\u003e%w{column1 column2 tag_list}\n\n== Caveats\nSo should you be updating production records with this plugin? Yes and no.\nYes, if you're updating some simple string/text values. If editing more complex objects\nie non-string objects and associated objects, try edge cases to ensure the updates work as expected.\nAlthough this plugin already comes with decent tests, I'm always open to patches for edge cases I\nmay have missed.\n\n== Motivation\nThe need for editing speed in my {console-based project}[http://github.com/cldwalker/tag-tree].\n\n== Bugs/Issues\nPlease report them {on github}[http://github.com/cldwalker/console_update/issues].\n\n== Links\n* http://tagaholic.me/2009/02/28/Console-Update-With-Your-Editor.html\n\n== Todo\n\n* Have a config file as an alternative configuration method which\n  doesn't clutter models with can_console_update() calls.\n* Make ORM-agnostic.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcldwalker%2Fconsole_update","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcldwalker%2Fconsole_update","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcldwalker%2Fconsole_update/lists"}