Class: Peacock::StartupManager

Inherits:
Object
  • Object
show all
Defined in:
lib/peacock/startup_manager.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.check_peacock_requirementsObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/peacock/startup_manager.rb', line 5

def self.check_peacock_requirements
  startup = StartupManager.new
  
  begin
    startup.check_git_repository
  rescue PeacockError
    puts 'An error occured. Make sure you are in a git repository and git is installed.'
    exit 1
  end
end

Instance Method Details

#check_git_repositoryObject

Raises:



16
17
18
# File 'lib/peacock/startup_manager.rb', line 16

def check_git_repository
  raise PeacockError unless git_repository?
end

#git_repository?Boolean

checks if current directory is a git repository

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
# File 'lib/peacock/startup_manager.rb', line 21

def git_repository?
  begin
    Git.open Dir.pwd
    true
  rescue
    false
  end
end