Class: Databasion::SvnCommitter
- Inherits:
-
Object
- Object
- Databasion::SvnCommitter
show all
- Defined in:
- lib/databasion/svn_committer.rb
Defined Under Namespace
Classes: SvnCommitterError
Constant Summary
collapse
- @@config =
nil
Class Method Summary
collapse
Class Method Details
.check_lock? ⇒ Boolean
42
43
44
|
# File 'lib/databasion/svn_committer.rb', line 42
def self.check_lock?
File.exist?('svn.lock') ? true : false
end
|
.commit(path = Dir.pwd) ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/databasion/svn_committer.rb', line 23
def self.commit(path=Dir.pwd)
raise SvnCommitterError, "A file lock is in place. Cannot commit." if check_lock?
create_lock
svn_add_files(path)
Databasion::LOGGER.info 'running: svn commit -m "databasion auto commit"'
system svn_path + ' commit -m "databasion auto commit"'
Databasion::LOGGER.info 'running: svn update'
system svn_path + ' update'
remove_lock
end
|
.config ⇒ Object
15
16
17
|
# File 'lib/databasion/svn_committer.rb', line 15
def self.config
@@config
end
|
.config=(config) ⇒ Object
11
12
13
|
# File 'lib/databasion/svn_committer.rb', line 11
def self.config=(config)
@@config = config
end
|
.create_lock ⇒ Object
46
47
48
|
# File 'lib/databasion/svn_committer.rb', line 46
def self.create_lock
File.new('svn.lock', 'w') unless check_lock?
end
|
.remove_lock ⇒ Object
50
51
52
|
# File 'lib/databasion/svn_committer.rb', line 50
def self.remove_lock
FileUtils.rm 'svn.lock'
end
|
.svn_add_files(path) ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/databasion/svn_committer.rb', line 34
def self.svn_add_files(path)
files = Dir[path + "/**/*"]
files.each do |file|
Databasion::LOGGER.info 'running: svn add %s' % file unless file =~ /svn.lock/
system svn_path + ' add %s' % file unless file =~ /svn.lock/
end
end
|
.svn_path ⇒ Object
19
20
21
|
# File 'lib/databasion/svn_committer.rb', line 19
def self.svn_path
@@config['svn']['bin']
end
|