clean_rails_schema 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1b2256d65bb36d74d0f965bd04b60abae918e38a90777e7482ea3ed7a4665b23
4
+ data.tar.gz: 229a7ddb20da6c64270180dba1263f86bdf404e8e81cffc392f94d45f8ba3695
5
+ SHA512:
6
+ metadata.gz: 12623c8dc104ec261d73c2e2371f9a4efe10f1f93e84423b6b8b6065f7516192ebefeb8b786da3feb64520efdac5e318c7be2b86b8c831cb4c2fe1abe0678f7a
7
+ data.tar.gz: c77280fe7c9909941229ba91212242ed1b3f62f89cd8e4ddba710bedabd84d241fbda2818fb833ae9f54c30bfda265f461d4f5e7a405d85ed0e5ca8f8dbbd84b
data/.crs.yml ADDED
@@ -0,0 +1,8 @@
1
+ # Default configuration for clean_rails_schema
2
+ database:
3
+ name: development
4
+ temp_suffix: _temp
5
+
6
+ # Specific branch configurations
7
+ branches:
8
+ - main
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,71 @@
1
+ # AllCops settings
2
+ AllCops:
3
+ NewCops: enable
4
+
5
+ # Layout cops
6
+ Layout/EndOfLine:
7
+ Enabled: true
8
+ EnforcedStyle: lf
9
+
10
+ Layout/IndentationConsistency:
11
+ Enabled: true
12
+
13
+ Layout/IndentationWidth:
14
+ Enabled: true
15
+ Width: 2
16
+
17
+ Layout/SpaceInsideBlockBraces:
18
+ Enabled: true
19
+
20
+ Layout/SpaceInsideHashLiteralBraces:
21
+ Enabled: true
22
+
23
+ Layout/SpaceInsideParens:
24
+ Enabled: true
25
+
26
+ Layout/LineLength:
27
+ Enabled: true
28
+ Max: 120
29
+
30
+ # Metrics cops
31
+ Metrics/BlockLength:
32
+ Enabled: true
33
+ Max: 200
34
+
35
+ Metrics/ClassLength:
36
+ Enabled: true
37
+ Max: 200
38
+
39
+ Metrics/CyclomaticComplexity:
40
+ Enabled: true
41
+ Max: 20
42
+
43
+ Metrics/MethodLength:
44
+ Enabled: true
45
+ Max: 50
46
+
47
+ Metrics/ModuleLength:
48
+ Enabled: true
49
+ Max: 200
50
+
51
+ Metrics/AbcSize:
52
+ Enabled: false
53
+
54
+ Metrics/PerceivedComplexity:
55
+ Enabled: true
56
+ Max: 20
57
+
58
+ # Disable Style/Documentation cop
59
+ Style/Documentation:
60
+ Enabled: false
61
+
62
+ # Disable Style/FrozenStringLiteralComment cop
63
+ Style/FrozenStringLiteralComment:
64
+ Enabled: false
65
+
66
+ # Disable Style/ClassAndModuleChildren cop
67
+ Style/ClassAndModuleChildren:
68
+ Enabled: false
69
+
70
+ Style/GlobalStdStream:
71
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-08-27
4
+
5
+ - Initial release
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 luhluh-17
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # CleanRailsSchema
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up
6
+ your Ruby library into a gem. Put your Ruby code in the file `lib/clean_rails_schema`. To experiment
7
+ with that code, run `bin/console` for an interactive prompt.
8
+
9
+ ## Installation
10
+
11
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem
12
+ name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons.
13
+ Alternatively, replace this section with instructions to install your gem from git if you don't plan
14
+ to release to RubyGems.org.
15
+
16
+ Install the gem and add to the application's Gemfile by executing:
17
+
18
+ ```bash
19
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
20
+ ```
21
+
22
+ If bundler is not being used to manage dependencies, install the gem by executing:
23
+
24
+ ```bash
25
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ TODO: Write usage instructions here
31
+
32
+ ## Development
33
+
34
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run
35
+ the tests. You can also run `bin/console` for an interactive prompt that will allow you to
36
+ experiment.
37
+
38
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new
39
+ version, update the version number in `version.rb`, and then run `bundle exec rake release`, which
40
+ will create a git tag for the version, push git commits and the created tag, and push the `.gem`
41
+ file to [rubygems.org](https://rubygems.org).
42
+
43
+ ## Contributing
44
+
45
+ Bug reports and pull requests are welcome on GitHub at
46
+ https://github.com/[USERNAME]/clean_rails_schema. This project is intended to be a safe, welcoming
47
+ space for collaboration, and contributors are expected to adhere to the
48
+ [code of conduct](https://github.com/[USERNAME]/clean_rails_schema/blob/main/CODE_OF_CONDUCT.md).
49
+
50
+ ## License
51
+
52
+ The gem is available as open source under the terms of the
53
+ [MIT License](https://opensource.org/licenses/MIT).
54
+
55
+ ## Code of Conduct
56
+
57
+ Everyone interacting in the CleanRailsSchema project's codebases, issue trackers, chat rooms and
58
+ mailing lists is expected to follow the
59
+ [code of conduct](https://github.com/[USERNAME]/clean_rails_schema/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,13 @@
1
+ module CleanRailsSchema
2
+ module ColorHelper
3
+ # Adds ANSI color codes to the given text based on the specified type.
4
+ #
5
+ # @param type [Symbol] The color type to apply. Supported values are :green, :yellow, :cyan, and :red.
6
+ # @param text [String] The text to colorize.
7
+ # @return [String] The colorized text with ANSI escape codes.
8
+ def color(type, text)
9
+ codes = { green: 32, yellow: 33, cyan: 36, red: 31 }
10
+ "\e[#{codes[type]}m#{text}\e[0m"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+
5
+ module CleanRailsSchema
6
+ class DatabaseConfigEditor
7
+ # Appends "_temp" to the 'database' name in the 'development' section of a YAML database config file.
8
+ #
9
+ # @param path [String] The file path to the YAML database configuration file.
10
+ # @return [void]
11
+ # @example
12
+ # CleanRailsSchema::DatabaseConfigEditor.append_temp_to_development_database('config/database.yml')
13
+ #
14
+ # This method loads the YAML file at the given path, modifies the 'development' database name
15
+ # by appending "_temp" to it, and writes the updated configuration back to the file.
16
+ # If the 'development' section or its 'database' key is missing, the method does nothing.
17
+ def self.append_temp_to_development_database(path)
18
+ config = YAML.safe_load_file(path, aliases: true)
19
+ dev = config['development']
20
+ return if dev.nil? || dev['database'].nil?
21
+
22
+ dev['database'] = "#{dev['database']}_temp"
23
+ File.write(path, config.to_yaml)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CleanRailsSchema
4
+ class InitConfigurator
5
+ include ColorHelper
6
+
7
+ # Runs the initialization configurator.
8
+ #
9
+ # This class method creates a new instance of the configurator with the specified
10
+ # configuration and gitignore file paths, then executes its `run` method.
11
+ #
12
+ # @param config_path [String] the path to the configuration file (default: '.csr.yml')
13
+ # @param gitignore_path [String] the path to the .gitignore file (default: '.gitignore')
14
+ # @return [Object] the result of the instance's `run` method
15
+ def self.run(config_path = '.csr.yml', gitignore_path = '.gitignore')
16
+ new(config_path, gitignore_path).run
17
+ end
18
+
19
+ # Initializes a new instance of the configurator.
20
+ #
21
+ # @param config_path [String] the path to the configuration file
22
+ # @param gitignore_path [String] the path to the .gitignore file
23
+ def initialize(config_path, gitignore_path)
24
+ @config_path = config_path
25
+ @gitignore_path = gitignore_path
26
+ end
27
+
28
+ # Executes the configuration setup process by creating the configuration file
29
+ # and ensuring that the necessary entries are present in the .gitignore file.
30
+ #
31
+ # @return [void]
32
+ def run
33
+ create_config_file
34
+ ensure_gitignore
35
+ end
36
+
37
+ private
38
+
39
+ # Creates a configuration file at the specified path.
40
+ # If the file already exists, notifies the user with a warning message.
41
+ # Otherwise, writes the default configuration content to the file and confirms creation.
42
+ #
43
+ # @return [void]
44
+ def create_config_file
45
+ if File.exist?(@config_path)
46
+ puts color(:yellow, "#{@config_path} already exists.")
47
+ else
48
+ File.write(@config_path, default_config_content)
49
+ puts color(:green, "Created #{@config_path}")
50
+ end
51
+ end
52
+
53
+ # Ensures that the `.csr.yml` file is listed in the `.gitignore` file.
54
+ #
55
+ # - If the `.gitignore` file exists and does not already include `.csr.yml`, it appends `.csr.yml` to the file.
56
+ # - If the `.gitignore` file does not exist, it creates the file and adds `.csr.yml` as its first entry.
57
+ # - Outputs a colored message indicating whether `.csr.yml` was added or the `.gitignore` file was created.
58
+ #
59
+ # @return [void]
60
+ def ensure_gitignore
61
+ if File.exist?(@gitignore_path)
62
+ gitignore_content = File.read(@gitignore_path)
63
+ unless gitignore_content.include?('.csr.yml')
64
+ File.open(@gitignore_path, 'a') { |f| f.puts '.csr.yml' }
65
+ puts color(:cyan, "Added .csr.yml to #{@gitignore_path}")
66
+ end
67
+ else
68
+ File.write(@gitignore_path, ".csr.yml\n")
69
+ puts color(:green, "Created #{@gitignore_path} and added .csr.yml")
70
+ end
71
+ end
72
+
73
+ # Returns the default YAML configuration content for the clean_rails_schema gem.
74
+ #
75
+ # The configuration includes:
76
+ # - Database settings with a default name ("development") and a temporary suffix ("_temp").
77
+ # - A list of specific branch configurations, defaulting to "main".
78
+ #
79
+ # @return [String] The default YAML configuration as a heredoc string.
80
+ def default_config_content
81
+ <<~YAML
82
+ # Default configuration for clean_rails_schema
83
+ database:
84
+ name: development
85
+ temp_suffix: _temp
86
+
87
+ # Specific branch configurations
88
+ branches:
89
+ - main
90
+ YAML
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CleanRailsSchema
4
+ class MigrateRunner
5
+ include ColorHelper
6
+
7
+ # Initializes a new instance of the class with the given options.
8
+ #
9
+ # @param options [Hash] Options hash, expects a :file key for the database config path.
10
+ # @option options [String] :file (optional) Path to the database configuration file.
11
+ # Defaults to 'config/database.yml' if not provided.
12
+ def initialize(options)
13
+ @db_config_path = options[:file] || 'config/database.yml'
14
+ end
15
+
16
+ # Runs the migration process on both the original and a temporary development database.
17
+ #
18
+ # Steps performed:
19
+ # 1. Runs `rails db:migrate` on the original database.
20
+ # 2. Appends `_temp` to the development database name in the database configuration file.
21
+ # 3. Runs `rails db:migrate` on the temporary database.
22
+ # 4. Restores the original `config/database.yml` using git.
23
+ #
24
+ # Outputs progress messages to the console with colored formatting.
25
+ def run
26
+ require 'yaml'
27
+
28
+ puts color(:cyan, 'Step 1: Running rails db:migrate on original database...')
29
+ system('rails db:migrate')
30
+
31
+ puts color(:cyan, "Step 2: Appending _temp to development database name in #{@db_config_path}...")
32
+ CleanRailsSchema::DatabaseConfigEditor.append_temp_to_development_database(@db_config_path)
33
+ puts color(:green, "Appended _temp to development database name in #{@db_config_path}")
34
+
35
+ puts color(:cyan, 'Step 3: Running rails db:migrate on temp database...')
36
+ system('rails db:migrate')
37
+
38
+ puts color(:yellow, 'Step 4: Reverting config/database.yml to original...')
39
+ system('git restore config/database.yml')
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'color_helper'
4
+
5
+ module CleanRailsSchema
6
+ class SetupRunner
7
+ include ColorHelper
8
+
9
+ # Initializes a new instance of the class with the provided options.
10
+ #
11
+ # @param options [Hash] Options hash, expects a :file key for the database config path.
12
+ # @option options [String] :file (optional) Path to the database configuration file.
13
+ # Defaults to 'config/database.yml' if not provided.
14
+ def initialize(options)
15
+ @db_config_path = options[:file] || 'config/database.yml'
16
+ end
17
+
18
+ # Runs the setup process for the Rails Clean Schema tool.
19
+ #
20
+ # This method performs the following steps:
21
+ # 1. Loads the current Git branch and prints it.
22
+ # 2. Appends '_temp' to the development database name in the database configuration file.
23
+ # 3. Creates the development database using `rails db:create`.
24
+ # 4. Stashes any uncommitted changes (including untracked files) using Git.
25
+ # 5. Loads the list of branches from the `.csr.yml` configuration file.
26
+ # 6. Iterates over each branch:
27
+ # - Checks out the branch.
28
+ # - Appends '_temp' to the development database name again (after checkout).
29
+ # - Runs database migrations (`rails db:migrate`).
30
+ # - Restores all files to match the checked-out branch, discarding any changes.
31
+ # 7. If any branch checkout fails, it aborts the operation, returns to the starting branch,
32
+ # and pops the stashed changes.
33
+ #
34
+ # Outputs status messages to the console with colored formatting.
35
+ #
36
+ # @raise [SystemExit] if a branch checkout fails.
37
+ def run
38
+ require 'yaml'
39
+ starting_branch = current_branch
40
+ puts color(:cyan, "Starting branch: #{starting_branch}")
41
+
42
+ append_temp_to_db
43
+ puts color(:green, "Appended _temp to development database name in #{@db_config_path}")
44
+
45
+ puts color(:cyan, 'Creating database (rails db:create)...')
46
+ system('rails db:create')
47
+
48
+ puts color(:yellow, 'Stashing changes...')
49
+ system('git stash --include-untracked')
50
+
51
+ config = YAML.load_file('.csr.yml')
52
+ branches = config['branches'] || []
53
+
54
+ branches.each do |branch|
55
+ puts color(:cyan, "\n=========================\n")
56
+ puts color(:cyan, "Checking out branch: #{branch}")
57
+ unless system("git checkout #{branch}")
58
+ warn color(:red, "Failed to checkout branch: #{branch}. Aborting operation.")
59
+ puts color(:yellow, "Returning to starting branch: #{starting_branch}")
60
+ system("git checkout #{starting_branch}")
61
+ puts color(:yellow, 'Popping stashed changes...')
62
+ system('git stash pop')
63
+ exit(1)
64
+ end
65
+
66
+ append_temp_to_db
67
+ puts color(:green, "Appended _temp to development database name in #{@db_config_path} (after checkout)")
68
+
69
+ puts color(:cyan, "Running rails db:migrate on #{branch}")
70
+ warn color(:red, "Migration failed on branch: #{branch}") unless system('rails db:migrate')
71
+ puts color(:yellow, 'Restoring all files to match branch (discarding changes)...')
72
+ system('git restore .')
73
+ end
74
+ end
75
+
76
+ private
77
+
78
+ # Appends a temporary configuration to the development database settings.
79
+ # Delegates the operation to CleanRailsSchema::DatabaseConfigEditor.
80
+ #
81
+ # @return [void]
82
+ def append_temp_to_db
83
+ CleanRailsSchema::DatabaseConfigEditor.append_temp_to_development_database(@db_config_path)
84
+ end
85
+
86
+ # Returns the name of the current Git branch as a string.
87
+ #
88
+ # @return [String] the current Git branch name
89
+ def current_branch
90
+ `git rev-parse --abbrev-ref HEAD`.strip
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CleanRailsSchema
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'clean_rails_schema/color_helper'
4
+ require_relative 'clean_rails_schema/database_config_editor'
5
+ require_relative 'clean_rails_schema/init_configurator'
6
+ require_relative 'clean_rails_schema/setup_runner'
7
+ require_relative 'clean_rails_schema/migrate_runner'
8
+ require_relative 'clean_rails_schema/version'
9
+
10
+ module CleanRailsSchema
11
+ class Error < StandardError; end
12
+ # Your code goes here...
13
+ end
@@ -0,0 +1,4 @@
1
+ module CleanRailsSchema
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: clean_rails_schema
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - luhluh-17
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: |-
13
+ This gem provides tasks and utilities to help manage and clean up Rails database schemas,
14
+ making it easier to maintain and evolve your database structure over time.
15
+ email:
16
+ - castro.ralph17@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ".crs.yml"
22
+ - ".rspec"
23
+ - ".rubocop.yml"
24
+ - CHANGELOG.md
25
+ - CODE_OF_CONDUCT.md
26
+ - LICENSE.txt
27
+ - README.md
28
+ - Rakefile
29
+ - lib/clean_rails_schema.rb
30
+ - lib/clean_rails_schema/color_helper.rb
31
+ - lib/clean_rails_schema/database_config_editor.rb
32
+ - lib/clean_rails_schema/init_configurator.rb
33
+ - lib/clean_rails_schema/migrate_runner.rb
34
+ - lib/clean_rails_schema/setup_runner.rb
35
+ - lib/clean_rails_schema/version.rb
36
+ - sig/clean_rails_schema.rbs
37
+ homepage: https://github.com/luhluh-17/clean_rails_schema
38
+ licenses:
39
+ - MIT
40
+ metadata:
41
+ allowed_push_host: https://rubygems.org
42
+ homepage_uri: https://github.com/luhluh-17/clean_rails_schema
43
+ source_code_uri: https://github.com/luhluh-17/clean_rails_schema
44
+ changelog_uri: https://github.com/luhluh-17/clean_rails_schema/blob/main/CHANGELOG.md
45
+ rubygems_mfa_required: 'true'
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 3.1.0
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubygems_version: 3.6.7
61
+ specification_version: 4
62
+ summary: A gem to help clean up and manage Rails database schemas.
63
+ test_files: []