Module: Relaxo

Extended by:
Console
Defined in:
lib/relaxo/version.rb,
lib/relaxo.rb,
lib/relaxo/logger.rb,
lib/relaxo/dataset.rb,
lib/relaxo/database.rb,
lib/relaxo/changeset.rb,
lib/relaxo/directory.rb

Overview

Released under the MIT License. Copyright, 2012-2020, by Samuel Williams.

Defined Under Namespace

Classes: Changeset, Database, Dataset, Directory

Constant Summary collapse

MASTER =
'master'.freeze
VERSION =
"1.7.0"
HEAD =
'HEAD'.freeze

Class Method Summary collapse

Class Method Details

.connect(path, branch: nil, sync: nil, create: true, **metadata) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/relaxo.rb', line 14

def self.connect(path, branch: nil, sync: nil, create: true, **)
	if !File.exist?(path) || create
		repository = Rugged::Repository.init_at(path, true)
		
		if sync || ENV['RELAXO_SYNC']
			repository.config['core.fsyncObjectFiles'] = true
		end
	end
	
	branch ||= MASTER
	
	database = Database.new(path, branch, )
	
	if config = database.config
		unless config['user.name']
			 = Etc.getpwuid
			hostname = Socket.gethostname
			
			if 
				config['user.name'] = .name
				config['user.email'] = "#{.name}@#{hostname}"
			end
		end
	end
	
	return database
end