diff --git a/app/models/app.rb b/app/models/app.rb index ed11466..ef9058d 100644 --- a/app/models/app.rb +++ b/app/models/app.rb @@ -25,7 +25,7 @@ class App before_validation :generate_api_key, :on => :create before_save :normalize_github_url - + validates_presence_of :name, :api_key validates_uniqueness_of :name, :allow_blank => true validates_uniqueness_of :api_key, :allow_blank => true @@ -60,15 +60,15 @@ class App !(self[:notify_on_deploys] == false) end alias :notify_on_deploys? :notify_on_deploys - + def github_url? self.github_url.present? end - + def github_url_to_file(file) "#{self.github_url}/blob/master#{file}" end - + protected def generate_api_key @@ -83,12 +83,12 @@ class App end if issue_tracker.errors end end - + def normalize_github_url return if self.github_url.blank? self.github_url.gsub!(%r{^http://|git@}, 'https://') self.github_url.gsub!(/github\.com:/, 'github.com/') self.github_url.gsub!(/\.git$/, '') end - + end -- libgit2 0.21.2