Class: Loginx::Exist

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

Class Method Summary collapse

Class Method Details

.project_exist?(value) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/loginx.rb', line 7

def self.project_exist?(value)
  project_path = File.expand_path("~/.loginx/projects/")
  @flag = 0

  if File.exist?("#{project_path}")
    Find.find("#{project_path}") do |filename|
      if File.basename(filename, '.yml') == value
        @flag = 1
        return true
      end
    end

    if @flag == 0
      return false
    end

  else
    puts "initialize successfully,please try again"
  end
end