{"id":17226601,"url":"https://github.com/zimbix/renamespace","last_synced_at":"2025-03-25T17:47:33.331Z","repository":{"id":56891774,"uuid":"360936263","full_name":"ZimbiX/renamespace","owner":"ZimbiX","description":"A command-line tool to help Ruby developers refactor class/module namespacing.","archived":false,"fork":false,"pushed_at":"2023-01-21T04:43:52.000Z","size":132,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-01T14:19:27.338Z","etag":null,"topics":["refactoring","ruby","tool"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZimbiX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["ZimbiX"]}},"created_at":"2021-04-23T15:57:59.000Z","updated_at":"2022-04-22T14:04:36.000Z","dependencies_parsed_at":"2023-02-12T08:00:41.301Z","dependency_job_id":null,"html_url":"https://github.com/ZimbiX/renamespace","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZimbiX%2Frenamespace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZimbiX%2Frenamespace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZimbiX%2Frenamespace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZimbiX%2Frenamespace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZimbiX","download_url":"https://codeload.github.com/ZimbiX/renamespace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245514388,"owners_count":20627962,"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":["refactoring","ruby","tool"],"created_at":"2024-10-15T04:16:42.572Z","updated_at":"2025-03-25T17:47:33.293Z","avatar_url":"https://github.com/ZimbiX.png","language":"Ruby","funding_links":["https://github.com/sponsors/ZimbiX"],"categories":[],"sub_categories":[],"readme":"# Renamespace\n\n[![CI status](https://github.com/ZimbiX/renamespace/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/ZimbiX/renamespace/actions/workflows/main.yml) [![Gem Version](https://badge.fury.io/rb/renamespace.svg)](https://rubygems.org/gems/renamespace)\n\nA command-line tool to help Ruby developers refactor class/module namespacing.\n\n## Contents\n\n\u003c!-- MarkdownTOC autolink=true --\u003e\n\n- [Intro](#intro)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Example](#example)\n- [More usage info](#more-usage-info)\n- [Development](#development)\n  - [Pre-push hook](#pre-push-hook)\n  - [Release](#release)\n\n\u003c!-- /MarkdownTOC --\u003e\n\n## Intro\n\nRenamespaces a Ruby source file:\n\n- Moves the file\n- Updates, to match the new location, the name of the class/module within the file, including its namespacing\n- Updates usages of the class/module\n- Updates the path to the file in all requires\n- Moves the associated spec file\n\nClass/module namespaces are derived from the paths provided.\n\nIf you change the number of namespaces, expect to have to run RuboCop autocorrect afterwards to clean up formatting.\n\nThe namespace replacing is not super smart yet, so it might get it wrong sometimes. If it does, see `renamespace --help` for some options that might help.\n\n## Installation\n\nThe executable is distributed as a gem. You can install it from RubyGems directly like so:\n\n```bash\n$ gem install renamespace\n```\n\nAnd then if you're using rbenv:\n\n```bash\n$ rbenv rehash\n```\n\n## Usage\n\n```bash\n$ renamespace SOURCE_FILE_PATH DESTINATION_FILE_PATH\n```\n\n## Example\n\nWith:\n\n```ruby\n# lib/my_app/models/site.rb\n\nmodule MyApp\n  module Models\n    class Site \u003c BaseModel\n    end\n  end\nend\n```\n\nRun:\n\n```bash\n$ renamespace lib/my_app/models/site.rb lib/my_app/sites/model.rb\n```\n\nResult:\n\n```ruby\n# lib/my_app/sites/model.rb\n\nmodule MyApp\n  module Sites\n    class Model \u003c Models::BaseModel\n    end\n  end\nend\n```\n\n## More usage info\n\nSee:\n\n```bash\n$ renamespace --help\n```\n\n## Development\n\n### Pre-push hook\n\nThis hook runs style checks and tests.\n\nTo set up the pre-push hook:\n\n```bash\n$ echo -e \"#\\!/bin/bash\\n\\$(dirname \\$0)/../../auto/pre-push-hook\" \u003e .git/hooks/pre-push\nchmod +x .git/hooks/pre-push\n```\n\n### Release\n\nTo release a new version:\n\n```bash\n$ auto/release/update-version \u0026\u0026 auto/release/tag \u0026\u0026 auto/release/publish\n```\n\nThis takes care of the whole process:\n\n- Incrementing the version number (the patch number by default)\n- Tagging \u0026 pushing commits\n- Publishing the gem to RubyGems\n- Creating a draft GitHub release\n\nTo increment the minor or major versions instead of the patch number, run `auto/release/update-version` with `--minor` or `--major`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzimbix%2Frenamespace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzimbix%2Frenamespace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzimbix%2Frenamespace/lists"}