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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 103f476110120a4e3c22f27b456485adcfdd83ad
4
- data.tar.gz: d11746e3b2708ded9f6e5d444f0c78922e097e88
3
+ metadata.gz: 4e87d9c175a4024bd789e088d61fc1f492db5d95
4
+ data.tar.gz: 539ec6f6f39e0ad0c0893394c9e9c4df8c8713c1
5
5
  SHA512:
6
- metadata.gz: bd04c5684892cc31265c6b4a32f45e246216d986aa7c3096c7735d691a681e5f0109a42da94dbcb8da8d0f5c02279fcb2fe6697a9b0ec3076b32c46ed39b44b4
7
- data.tar.gz: 222ac105c76a2eaa9eafae9fc4063243f0a5b14b31fd530ef2051534baea34d2d9317109d65a464fd9b6eec85bc06c26fbebdbae627c65691fb467da3eec22fd
6
+ metadata.gz: 179e3da3714364be4062cfacba7e069499b4c9edd9aa3e68ab1b6c4eb555683ba16b3e3bf95f4dfb6637eb5e57e22c766d0d0e53f56fd7cff97d09772d27a2f2
7
+ data.tar.gz: 174cc27a2d507a8c65568916c09af35527dd63acc9590f2ca7a237577628000f5ffade7b8541adf062c230b4dd54fb2a5016cd44007a66fa59f5e8143a48ba49
@@ -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} && cd #{name} && git clone -b #{branch} --single-branch --depth 1 #{repo} config`
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
@@ -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.git
10
- result = ENV.has_key?('GIT_CMD') ? ENV['GIT_CMD'] : 'git'
11
- puts result
12
- @logger.info ENV
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
- if type == 'branch'
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
@@ -1,3 +1,3 @@
1
1
  module Docman
2
- VERSION = "0.0.22"
2
+ VERSION = "0.0.23"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Tolstikov