Method: Cnvrg::Project#initialize

Defined in:
lib/cnvrg/project.rb

#initialize(project_home = nil, slug: nil, owner: nil) ⇒ Project

Returns a new instance of Project.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cnvrg/project.rb', line 13

def initialize(project_home=nil, slug: nil, owner: nil)
  begin
    @local_path = project_home
    @working_dir = project_home
    config = YAML.load_file(project_home + "/.cnvrg/config.yml") rescue {owner: owner, project_slug: slug}
    @title = config[:project_name]
    @slug = config[:project_slug]
    @owner = config[:owner]
    @is_branch = config[:is_branch]
    @is_git = config[:git] || false
    @base_resource = "users/#{@owner}/projects/#{@slug}/"
    @machines = nil
  rescue => e
  end
end