Class: MiniYard::Folder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Folder

Returns a new instance of Folder.



5
6
7
8
9
10
11
# File 'lib/miniyard/folder.rb', line 5

def initialize(path)
  @path = path
  @name = File.basename(path)
  @doc = File.directory?(File.join(path, 'doc')) ? "yes" : "no"
  @cov = File.directory?(File.join(path, 'cov')) ? "yes" : "no"
  @ci = get_ci_url
end

Instance Attribute Details

#ciObject (readonly)

Returns the value of attribute ci.



3
4
5
# File 'lib/miniyard/folder.rb', line 3

def ci
  @ci
end

#covObject (readonly)

Returns the value of attribute cov.



3
4
5
# File 'lib/miniyard/folder.rb', line 3

def cov
  @cov
end

#docObject (readonly)

Returns the value of attribute doc.



3
4
5
# File 'lib/miniyard/folder.rb', line 3

def doc
  @doc
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/miniyard/folder.rb', line 3

def name
  @name
end

Instance Method Details

#get_ci_urlObject



13
14
15
16
17
18
19
20
# File 'lib/miniyard/folder.rb', line 13

def get_ci_url
  ci_file = File.join(@path, 'ci.url')
  if File.file?(ci_file)
    File.open(ci_file, 'r'){|f| @ci_file = f.read.chop.strip }
  else
    "no"
  end
end