Class: MultiRepo::RemoveCommand
- Inherits:
-
Command
- Object
- CLAide::Command
- Command
- MultiRepo::RemoveCommand
show all
- Defined in:
- lib/multirepo/commands/remove-command.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
#ensure_in_work_tree, #ensure_multirepo_enabled, #ensure_multirepo_tracked, #install_hooks, #multirepo_enabled_dependencies, report_error, #uninstall_hooks, #update_gitconfig
Constructor Details
Returns a new instance of RemoveCommand.
16
17
18
19
20
|
# File 'lib/multirepo/commands/remove-command.rb', line 16
def initialize(argv)
@path = argv.shift_argument
@delete = argv.flag?("delete")
super
end
|
Class Method Details
.options ⇒ Object
9
10
11
12
13
14
|
# File 'lib/multirepo/commands/remove-command.rb', line 9
def self.options
[
['<path>', 'The relative path to the dependency to remove (e.g. ../MyOldDependency).'],
['[--delete]', 'Delete the dependency on disk in addition to removing it from the multirepo config.']
].concat(super)
end
|
Instance Method Details
#run ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/multirepo/commands/remove-command.rb', line 27
def run
ensure_in_work_tree
ensure_multirepo_enabled
repo = Repo.new(@path)
entry = ConfigEntry.new(repo)
config_file = ConfigFile.new(".")
if config_file.entry_exists?(entry)
config_file.remove_entry(entry)
Console.log_step("Removed '#{@path}' from the .multirepo file")
if @delete
FileUtils.rm_rf(@path)
Console.log_step("Deleted '#{@path}' from disk")
end
else
fail MultiRepoException, "'#{@path}' isn't tracked by multirepo"
end
end
|
#validate! ⇒ Object
22
23
24
25
|
# File 'lib/multirepo/commands/remove-command.rb', line 22
def validate!
super
help! "You must specify a dependency repository to remove" unless @path
end
|