Class: List_p
- Inherits:
-
Object
- Object
- List_p
- Defined in:
- lib/list.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
-
#initialize(value) ⇒ List_p
constructor
A new instance of List_p.
- #list_all ⇒ Object
-
#list_project(value) ⇒ Object
find project and list records.
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
#project ⇒ Object
Returns the value of attribute project.
5 6 7 |
# File 'lib/list.rb', line 5 def project @project end |
Instance Method Details
#list_all ⇒ Object
12 13 14 15 16 17 |
# File 'lib/list.rb', line 12 def list_all project_path = File.("~/.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.("~/.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 |