Class: Reposit::SetupChecker

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSetupChecker

Returns a new instance of SetupChecker.



59
60
61
# File 'lib/reposit.rb', line 59

def initialize
  @lines = 0
end

Instance Attribute Details

#linesObject

Returns the value of attribute lines.



57
58
59
# File 'lib/reposit.rb', line 57

def lines
  @lines
end

Class Method Details

.checkObject



63
64
65
# File 'lib/reposit.rb', line 63

def self.check
  new.check
end

Instance Method Details

#both_lines_have_text?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/reposit.rb', line 84

def both_lines_have_text?
  lines.all? {|line| line && line.size > 0}
end

#checkObject



67
68
69
70
71
72
73
# File 'lib/reposit.rb', line 67

def check
  if file_exists?
    has_two_lines? && both_lines_have_text?
  else
    false
  end
end

#file_exists?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/reposit.rb', line 75

def file_exists?
  File.exist?(File.expand_path('~') + '/.reposit')
end

#has_two_lines?Boolean

Returns:

  • (Boolean)


79
80
81
82
# File 'lib/reposit.rb', line 79

def has_two_lines?
  self.lines = Reposit::CredentialsReader.new.get_credentials
  lines.size == 2
end