class DailyLog::ScmCheck

Source-Code management check. Make sure the entries aren't being checked into Git. # TODO: Allow devs to disable this in as an option # TODO: Allow devs to disable this in a .daily_log file # TODO: Add support for other SCM

Public Instance Methods

perform!() click to toggle source

Perform the check. Print to STDOUT if there is a warning

# File lib/daily_log/scm_check.rb, line 13
    def perform!
      return unless git_project?
      return if has_gitignore? && has_ignored_daily_logs?
      warn <<~TEXT
        You should add .daily_logs to your .gitignore file
      TEXT
    end

Private Instance Methods

git_project?() click to toggle source
# File lib/daily_log/scm_check.rb, line 23
def git_project?
  Dir.exists?("./.git")
end
has_gitignore?() click to toggle source
# File lib/daily_log/scm_check.rb, line 27
def has_gitignore?
  File.exists?("./.gitignore")
end
has_ignored_daily_logs?() click to toggle source
# File lib/daily_log/scm_check.rb, line 31
def has_ignored_daily_logs?
  File.read(".gitignore").include?(DailyLog::Pathname::dirname)
end