Class: Rails::Worktrees::Command
- Inherits:
-
Object
- Object
- Rails::Worktrees::Command
- Includes:
- EnvironmentSupport, GitOperations, NamePicking, Output, PostCreateSupport, WorkspacePaths
- Defined in:
- lib/rails/worktrees/command.rb,
lib/rails/worktrees/command/output.rb,
lib/rails/worktrees/command/name_picking.rb,
lib/rails/worktrees/command/git_operations.rb,
lib/rails/worktrees/command/workspace_paths.rb,
lib/rails/worktrees/command/environment_support.rb,
lib/rails/worktrees/command/post_create_support.rb
Overview
Creates or attaches worktrees for the current repository. rubocop:disable Metrics/ClassLength
Defined Under Namespace
Modules: EnvironmentSupport, GitOperations, NamePicking, Output, PostCreateSupport, WorkspacePaths
Constant Summary collapse
- REMOVE_SUBCOMMANDS =
%w[remove delete].freeze
- DOCTOR_SUBCOMMAND =
'doctor'.freeze
- SETUP_SUBCOMMAND =
'setup'.freeze
- UPDATE_SUBCOMMAND =
'update'.freeze
Constants included from NamePicking
Constants included from GitOperations
GitOperations::GIT_REPOSITORY_ENV_KEYS
Instance Method Summary collapse
-
#initialize(argv:, io:, env:, cwd:, configuration:) ⇒ Command
constructor
A new instance of Command.
- #run ⇒ Object
Constructor Details
#initialize(argv:, io:, env:, cwd:, configuration:) ⇒ Command
Returns a new instance of Command.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rails/worktrees/command.rb', line 26 def initialize(argv:, io:, env:, cwd:, configuration:) @argv = argv.dup @stdin = io.fetch(:stdin) @stdout = io.fetch(:stdout) @stderr = io.fetch(:stderr) @env = env @cwd = cwd @configuration = configuration extract_flags! end |
Instance Method Details
#run ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/rails/worktrees/command.rb', line 37 def run = return unless .nil? execute_requested_command rescue Error => e @stderr.puts("Error: #{e.}") 1 end |