docman 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/application.rb +3 -1
- data/lib/docman/git_util.rb +16 -19
- data/lib/docman/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e87d9c175a4024bd789e088d61fc1f492db5d95
|
4
|
+
data.tar.gz: 539ec6f6f39e0ad0c0893394c9e9c4df8c8713c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 179e3da3714364be4062cfacba7e069499b4c9edd9aa3e68ab1b6c4eb555683ba16b3e3bf95f4dfb6637eb5e57e22c766d0d0e53f56fd7cff97d09772d27a2f2
|
7
|
+
data.tar.gz: 174cc27a2d507a8c65568916c09af35527dd63acc9590f2ca7a237577628000f5ffade7b8541adf062c230b4dd54fb2a5016cd44007a66fa59f5e8143a48ba49
|
data/lib/application.rb
CHANGED
@@ -47,7 +47,9 @@ module Docman
|
|
47
47
|
|
48
48
|
def init(name, repo, options)
|
49
49
|
branch = options['branch'] ? options['branch'] : 'master'
|
50
|
-
`mkdir #{name}
|
50
|
+
`mkdir #{name}`
|
51
|
+
Dir.chdir name
|
52
|
+
GitUtil.clone_repo(repo, 'config', 'branch', branch, true, 1)
|
51
53
|
#Dir.chdir File.join(name, 'config')
|
52
54
|
#`git checkout #{branch} & git branch -u origin #{branch}`
|
53
55
|
end
|
data/lib/docman/git_util.rb
CHANGED
@@ -5,18 +5,12 @@ module Docman
|
|
5
5
|
module GitUtil
|
6
6
|
|
7
7
|
@logger = Logger.new(STDOUT)
|
8
|
+
@git = ENV.has_key?('GIT_CMD') ? ENV['GIT_CMD'] : 'git'
|
8
9
|
|
9
|
-
def self.
|
10
|
-
|
11
|
-
|
12
|
-
@logger.info
|
13
|
-
result
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.exec(command)
|
17
|
-
@logger.info command
|
18
|
-
result = `#{git} #{command}`.delete!("\n")
|
19
|
-
@logger.info result if result
|
10
|
+
def self.exec(command, show_result = true)
|
11
|
+
@logger.info "#{@git} #{command}"
|
12
|
+
result = `#{@git} #{command}`.delete!("\n")
|
13
|
+
@logger.info result if show_result and result
|
20
14
|
raise "ERROR: #{result}" unless $?.exitstatus == 0
|
21
15
|
result
|
22
16
|
end
|
@@ -43,14 +37,7 @@ module Docman
|
|
43
37
|
end
|
44
38
|
else
|
45
39
|
FileUtils.rm_rf path if File.directory? path
|
46
|
-
|
47
|
-
single_branch = single_branch ? "-b #{version} --single-branch" : ''
|
48
|
-
depth = (depth and depth.is_a? Integer) ? "--depth #{depth}" : ''
|
49
|
-
else
|
50
|
-
single_branch=''
|
51
|
-
depth=''
|
52
|
-
end
|
53
|
-
exec "clone #{single_branch} #{depth} #{repo} #{path}"
|
40
|
+
clone_repo(repo, path, type, version, single_branch, depth)
|
54
41
|
Dir.chdir path
|
55
42
|
exec "checkout #{version}"
|
56
43
|
end
|
@@ -58,6 +45,16 @@ module Docman
|
|
58
45
|
result
|
59
46
|
end
|
60
47
|
|
48
|
+
def self.clone_repo(repo, path, type, version, single_branch = nil, depth = nil)
|
49
|
+
if type == 'branch'
|
50
|
+
single_branch = single_branch ? "-b #{version} --single-branch" : ''
|
51
|
+
depth = (depth and depth.is_a? Integer) ? "--depth #{depth}" : ''
|
52
|
+
else
|
53
|
+
single_branch=''
|
54
|
+
depth=''
|
55
|
+
end
|
56
|
+
exec("clone #{single_branch} #{depth} #{repo} #{path}")
|
57
|
+
end
|
61
58
|
|
62
59
|
def self.last_revision(path = nil)
|
63
60
|
result = nil
|
data/lib/docman/version.rb
CHANGED