Class: List_p

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ List_p

Returns a new instance of List_p.



8
9
10
# File 'lib/list.rb', line 8

def initialize(value)
  self.project = value
end

Instance Attribute Details

#projectObject

Returns the value of attribute project.



5
6
7
# File 'lib/list.rb', line 5

def project
  @project
end

Instance Method Details

#list_allObject



12
13
14
15
16
17
# File 'lib/list.rb', line 12

def list_all
  project_path = File.expand_path("~/.loginx/projects/")
    Find.find("#{project_path}") do |filename|
    puts File.basename(filename,'.yml')
  end
end

#list_project(value) ⇒ Object

find project and list records



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/list.rb', line 20

def list_project(value)
  if Loginx::Exist.project_exist?(value)
    project_path = File.expand_path("~/.loginx/projects/")
      projects =  YAML::load (File.open("#{project_path}/#{value}.yml"))
      if projects == nil
        puts "no servers in this project"
        exit 1
      end
      projects.each do |item|
        puts item
      end
  else
    puts "cant find this project"
    exit 1
  end
end