Class: DeepThought::Project

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/deep_thought/models/project.rb

Instance Method Summary collapse

Instance Method Details

#delete_repoObject



26
27
28
29
30
# File 'lib/deep_thought/models/project.rb', line 26

def delete_repo
  if File.directory?(".projects/#{self.name}")
    FileUtils.rm_rf(".projects/#{self.name}")
  end
end

#setupObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/deep_thought/models/project.rb', line 14

def setup
  if DeepThought::Git.setup(self)
    if !File.exists?(".projects/#{self.name}/.deepthought.yml")
      delete_repo

      raise DeepThought::ProjectConfigNotFoundError, "#{self.name} does not appear to have a .deepthought.yml config file. Add one and try again."
    end
  else
    raise DeepThought::Git::GitRepositoryNotFoundError, "I can't seem to access that repo. Are you sure the URL is correct and that I have access to it?"
  end
end