Skip to content

Add rails db:migrate to Spring-enhanced commands #640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Next Release

## 2.1.2

* Add `rails db:migrate` to Spring-enhanced commands

## 2.1.1

* Avoid -I rubylibdir with default-gem bundler
Expand Down
4 changes: 2 additions & 2 deletions lib/spring/client/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Spring
module Client
class Rails < Command
COMMANDS = Set.new %w(console runner generate destroy test)
COMMANDS = Set.new %w(console runner generate destroy test db:migrate)

ALIASES = {
"c" => "console",
Expand All @@ -21,7 +21,7 @@ def call
command_name = ALIASES[args[1]] || args[1]

if COMMANDS.include?(command_name)
Run.call(["rails_#{command_name}", *args.drop(2)])
Run.call(["rails_#{command_name.gsub(':', '_')}", *args.drop(2)])
else
require "spring/configuration"
ARGV.shift
Expand Down
17 changes: 12 additions & 5 deletions lib/spring/commands/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ def command_name
end
end

class RailsDbMigrate < Rails
def command_name
"db:migrate"
end
end

class RailsGenerate < Rails
def command_name
"generate"
Expand Down Expand Up @@ -103,10 +109,11 @@ def command_name
end
end

Spring.register_command "rails_console", RailsConsole.new
Spring.register_command "rails_generate", RailsGenerate.new
Spring.register_command "rails_destroy", RailsDestroy.new
Spring.register_command "rails_runner", RailsRunner.new
Spring.register_command "rails_test", RailsTest.new
Spring.register_command "rails_console", RailsConsole.new
Spring.register_command "rails_db_migrate", RailsDbMigrate.new
Spring.register_command "rails_generate", RailsGenerate.new
Spring.register_command "rails_destroy", RailsDestroy.new
Spring.register_command "rails_runner", RailsRunner.new
Spring.register_command "rails_test", RailsTest.new
end
end