docman 0.0.20 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/docman/git_util.rb +22 -17
- data/lib/docman/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4c50dbfd87dade81189504fa7e32d506b7122ee
|
4
|
+
data.tar.gz: 46856e9a4d984dbf04378e0499f229bfa9b3b04f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e508ebe5e3a8730ccccfee87d6e85d264780b260a9b55f1995b2f3dbb85faf18826a3e61b1c7fdbf4cf21bf2714f97410f89ac7ad676537ab41c33c2306527b3
|
7
|
+
data.tar.gz: 9254c6dca2694a1f9ba5ff45d40ebbfccf836c7c6b303d9e6ff568eeef9a86f10a4606dbb04acb9770cf6e5e77c261f0d76c6131d084c800b9ec6bfec5c853ee
|
data/lib/docman/git_util.rb
CHANGED
@@ -6,9 +6,14 @@ module Docman
|
|
6
6
|
|
7
7
|
@logger = Logger.new(STDOUT)
|
8
8
|
|
9
|
+
def self.git
|
10
|
+
result = ENV['GIT_CMD'] ? ENV['git_cmd'] : 'git'
|
11
|
+
result
|
12
|
+
end
|
13
|
+
|
9
14
|
def self.exec(command)
|
10
15
|
@logger.info command
|
11
|
-
result = `#{command}`.delete!("\n")
|
16
|
+
result = `#{git} #{command}`.delete!("\n")
|
12
17
|
@logger.info result if result
|
13
18
|
raise "ERROR: #{result}" unless $?.exitstatus == 0
|
14
19
|
result
|
@@ -16,8 +21,8 @@ module Docman
|
|
16
21
|
|
17
22
|
def self.reset_repo(path)
|
18
23
|
Dir.chdir path
|
19
|
-
exec '
|
20
|
-
exec '
|
24
|
+
exec 'reset --hard'
|
25
|
+
exec 'clean -f -d'
|
21
26
|
end
|
22
27
|
|
23
28
|
def self.get(repo, path, type, version, single_branch = nil, depth = nil, reset = false)
|
@@ -26,13 +31,13 @@ module Docman
|
|
26
31
|
Dir.chdir path
|
27
32
|
self.reset_repo(path) #if self.repo_changed?(path)
|
28
33
|
if type == 'branch'
|
29
|
-
exec "
|
30
|
-
exec "
|
31
|
-
exec "
|
34
|
+
exec "fetch"
|
35
|
+
exec "checkout #{version}"
|
36
|
+
exec "pull origin #{version}"
|
32
37
|
end
|
33
38
|
if type == 'tag'
|
34
|
-
exec '
|
35
|
-
exec "
|
39
|
+
exec 'fetch --tags'
|
40
|
+
exec "checkout tags/#{version}"
|
36
41
|
end
|
37
42
|
else
|
38
43
|
FileUtils.rm_rf path if File.directory? path
|
@@ -43,9 +48,9 @@ module Docman
|
|
43
48
|
single_branch=''
|
44
49
|
depth=''
|
45
50
|
end
|
46
|
-
exec "
|
51
|
+
exec "clone #{single_branch} #{depth} #{repo} #{path}"
|
47
52
|
Dir.chdir path
|
48
|
-
exec "
|
53
|
+
exec "checkout #{version}"
|
49
54
|
end
|
50
55
|
result = type == 'branch' ? self.last_revision(path) : version
|
51
56
|
result
|
@@ -70,15 +75,15 @@ module Docman
|
|
70
75
|
if repo_changed? path
|
71
76
|
# puts message
|
72
77
|
pull root_path
|
73
|
-
exec %Q(
|
74
|
-
exec %Q(
|
78
|
+
exec %Q(add --all #{path.slice "#{root_path}/"})
|
79
|
+
exec %Q(commit -m "#{message}") if repo_changed? path
|
75
80
|
self.tag(root_path, tag) if tag
|
76
81
|
end
|
77
82
|
end
|
78
83
|
|
79
84
|
def self.pull(path)
|
80
85
|
Dir.chdir path
|
81
|
-
exec '
|
86
|
+
exec 'pull'
|
82
87
|
end
|
83
88
|
|
84
89
|
def self.repo?(path)
|
@@ -97,14 +102,14 @@ module Docman
|
|
97
102
|
|
98
103
|
def self.push(root_path, version)
|
99
104
|
Dir.chdir root_path
|
100
|
-
exec "
|
101
|
-
exec "
|
105
|
+
exec "pull origin #{version}"
|
106
|
+
exec "push origin #{version}"
|
102
107
|
end
|
103
108
|
|
104
109
|
def self.tag(root_path, tag)
|
105
110
|
Dir.chdir root_path
|
106
|
-
exec %Q(
|
107
|
-
exec "
|
111
|
+
exec %Q(tag -a -m "Tagged to #{tag}" "#{tag}")
|
112
|
+
exec "push origin #{tag}"
|
108
113
|
end
|
109
114
|
end
|
110
115
|
|
data/lib/docman/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Tolstikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|