Method: Cnvrg::Project.clone_dir_remote

Defined in:
lib/cnvrg/project.rb

.clone_dir_remote(project_slug, project_owner, project_name, is_git = false) ⇒ Object



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/cnvrg/project.rb', line 266

def self.clone_dir_remote(project_slug, project_owner, project_name, is_git = false)
  cli = Cnvrg::CLI.new()
  begin
    list_dirs = [
      ".cnvrg"
    ]

    list_files = [
      ".cnvrg/config.yml",

    ]

    config = { project_name: project_name,
               project_slug: project_slug,
               owner: project_owner,
               git: is_git
    }
    FileUtils.mkdir_p list_dirs
    FileUtils.touch list_files

    File.open(".cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
    if !File.exist? ".cnvrgignore"
      FileUtils.touch ".cnvrgignore"
      list_files << ".cnvrgignore"
      cnvrgignore = Helpers.cnvrgignore_content
      File.open(".cnvrgignore", "w+") { |f| f.write cnvrgignore }

    end
    true
  rescue => e
    cli.log_message(e.message)
    cli.log_error(e)
    false
  end
end