Class: Beeta::Model::App

Inherits:
Sequel::Model
  • Object
show all
Includes:
Mixin
Defined in:
lib/beeta/model.rb

Constant Summary collapse

PublicProperties =
[
	:owner,
	:name,
	:max_instances,
	:min_instances,
	:git_repo,
]

Instance Method Summary collapse

Methods included from Mixin

#to_json

Instance Method Details

#git_repoObject

The address of the git repository.



69
70
71
72
73
74
# File 'lib/beeta/model.rb', line 69

def git_repo
	# TODO:  Don't hard-code the git user?  For the sake of simplicity,
	# I think it's okay to say that the gitolite user has to be named
	# 'git' for now.
	"git@#{Beeta::Config.gitolite_host}:#{name}"
end

#validateObject



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/beeta/model.rb', line 76

def validate
	super
	errors.add(:name, "can't be empty.") if(name.nil? || name.empty?)
	if(((App[:name => name].id != id) rescue nil))
		errors.add(:name, "must be unique.")
	end

	errors.add(:owner, "can't be blank.") unless owner

	errors.empty?
end