Class: T1k::Commands::Validate

Inherits:
Object
  • Object
show all
Defined in:
lib/t1k/commands/validate.rb

Constant Summary collapse

@@messages =
[]
@@errors =
[]

Class Method Summary collapse

Class Method Details

.credentials?Boolean

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
# File 'lib/t1k/commands/validate.rb', line 28

def self.credentials?
  if self.password_from_bitbucket_is_avaliable?
    @@messages << "Password is not avaliable"
  end
  exist = File.exist?(T1k::tthousand_path)
  exist ? @@messages << "T1000 file was found" : @@errors << "T1000 file not found"
  exist
end

.default_repositoryObject



45
46
47
# File 'lib/t1k/commands/validate.rb', line 45

def self.default_repository
  Repository.default_repository
end

.password_from_bitbucket_is_avaliable?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/t1k/commands/validate.rb', line 49

def self.password_from_bitbucket_is_avaliable?
  self.default_repository == T1k::Repositories::Bitbucket and "#{ENV['BITBUCKET_PWD']}".nil?
end

.runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/t1k/commands/validate.rb', line 12

def self.run
  T1k.setup_credentials

  c = Validate.credentials?
  t = Validate.trello?
  g = Validate.valid_keys_on_repository?

  @@messages = @@messages + Trackers::Trello.messages + self.default_repository.messages
  @@errors   = @@errors   + Trackers::Trello.errors   + self.default_repository.errors

  @@messages.each do |m| puts m.green end

  puts "The are some errors listed below:\n".red unless c && t && g
  @@errors.each do |e| puts e.red end
end

.trello?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/t1k/commands/validate.rb', line 37

def self.trello?
  Trackers::Trello.valid_keys?
end

.valid_keys_on_repository?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/t1k/commands/validate.rb', line 41

def self.valid_keys_on_repository?
  self.default_repository.valid_keys?
end