Class: PGit::Project::Remove

Inherits:
Object
  • Object
show all
Includes:
Interactive
Defined in:
lib/pgit/project/remove.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Remove

Returns a new instance of Remove.

Raises:



8
9
10
11
12
13
# File 'lib/pgit/project/remove.rb', line 8

def initialize(app)
  @project = app.project
  @projects = app.projects

  raise PGit::Error::User, "#{@project.path} is not in the configuration file." unless @project.exists?
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



7
8
9
# File 'lib/pgit/project/remove.rb', line 7

def project
  @project
end

#projectsObject (readonly)

Returns the value of attribute projects.



7
8
9
# File 'lib/pgit/project/remove.rb', line 7

def projects
  @projects
end

Instance Method Details

#execute!Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/pgit/project/remove.rb', line 15

def execute!
  confirm.ask_and_wait_for_valid_response do |confirm_response|
    if confirm_response.yes?
      puts "Removing #{path} from the configuration file..."
      project.remove!
      puts "Removed."
    elsif confirm_response.no?
      puts "Cancelling..."
    end
  end
end