bigkeeper 0.9.0 → 0.9.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af5169e70a626a1706572fdf6393a3788165e10f
|
4
|
+
data.tar.gz: 11f54ee3aea3911d82d6a7bf8b0b40f6654b755b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f602f2a150a7fc70c1c11d923ca5f052b453a8cb08fd4f81c4ecb560210b7762e8e15af380c7d448e676c47155142363cfad5bef2857157390986139aa1744b4
|
7
|
+
data.tar.gz: 76e6f74558df7762c76907b23538798122c3817f2b8b842e4297db6ebde4bca17c457f4e767c4b7afac721df7e212df5c27defdae14dc5383a7e220b1d5d416f
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'big_keeper/dependency/dep_operator'
|
2
|
-
|
2
|
+
require 'big_keeper/util/gradle_operator'
|
3
3
|
|
4
4
|
module BigKeeper
|
5
5
|
# Operator for podfile
|
@@ -8,17 +8,30 @@ module BigKeeper
|
|
8
8
|
PATH_VERSION_CONFIG = "doc/config/version-config.gradle"
|
9
9
|
|
10
10
|
def backup
|
11
|
-
|
12
|
-
|
11
|
+
GradleOperator.new(@path).backup
|
12
|
+
modules = ModuleCacheOperator.new(@path).all_path_modules
|
13
|
+
modules.each do |module_name|
|
14
|
+
module_full_path = BigkeeperParser.module_full_path(@path, @user, module_name)
|
15
|
+
GradleOperator.new(module_full_path).backup
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
def recover
|
16
|
-
|
17
|
-
|
18
|
-
|
20
|
+
GradleOperator.new(@path).recover
|
21
|
+
modules = ModuleCacheOperator.new(@path).all_path_modules
|
22
|
+
modules.each do |module_name|
|
23
|
+
module_full_path = BigkeeperParser.module_full_path(@path, @user, module_name)
|
24
|
+
GradleOperator.new(module_full_path).recover
|
25
|
+
end
|
19
26
|
end
|
20
27
|
|
21
28
|
def update_module_config(module_name, module_operate_type)
|
29
|
+
update_project_version_config(module_name, module_operate_type)
|
30
|
+
module_full_path = BigkeeperParser.module_full_path(@path, @user, module_name)
|
31
|
+
GradleOperator.new(module_full_path).update_version_config(module_name, module_operate_type)
|
32
|
+
end
|
33
|
+
|
34
|
+
def update_project_version_config(module_name, module_operate_type)
|
22
35
|
temp_file = Tempfile.new('.version-config.gradle.tmp')
|
23
36
|
begin
|
24
37
|
File.open("#{@path}/#{PATH_VERSION_CONFIG}", 'r') do |file|
|
@@ -45,6 +58,8 @@ module BigKeeper
|
|
45
58
|
# Get version part of source.addition
|
46
59
|
|
47
60
|
if ModuleOperateType::ADD == module_operate_type
|
61
|
+
version_name = branch_name.sub(/([\s\S]*)\/([\s\S]*)/){ $2 }+'-SNAPSHOT'
|
62
|
+
elsif ModuleOperateType::FINISH == module_operate_type
|
48
63
|
version_name = branch_name.sub(/([\s\S]*)\/([\s\S]*)/){ $2 }
|
49
64
|
elsif ModuleOperateType::DELETE == module_operate_type
|
50
65
|
return origin_config_of_module(module_name)
|
@@ -3,5 +3,75 @@ require 'big_keeper/util/cache_operator'
|
|
3
3
|
module BigKeeper
|
4
4
|
# Operator for podfile
|
5
5
|
class GradleOperator
|
6
|
+
|
7
|
+
PATH_VERSION_CONFIG = "doc/config/version-config.gradle"
|
8
|
+
|
9
|
+
def initialize(path)
|
10
|
+
@path = path
|
11
|
+
end
|
12
|
+
|
13
|
+
def backup
|
14
|
+
cache_operator = CacheOperator.new(@path)
|
15
|
+
cache_operator.save(PATH_VERSION_CONFIG)
|
16
|
+
end
|
17
|
+
|
18
|
+
def recover(settings_config, build_config)
|
19
|
+
cache_operator = CacheOperator.new(@path)
|
20
|
+
cache_operator.load(PATH_VERSION_CONFIG)
|
21
|
+
cache_operator.clean
|
22
|
+
end
|
23
|
+
|
24
|
+
def update_version_config(module_name, module_operate_type)
|
25
|
+
temp_file = Tempfile.new('.version-config.gradle.tmp')
|
26
|
+
begin
|
27
|
+
File.open("#{@path}/#{PATH_VERSION_CONFIG}", 'r') do |file|
|
28
|
+
file.each_line do |line|
|
29
|
+
new_line = generate_version_config_of_line(
|
30
|
+
line,
|
31
|
+
module_name,
|
32
|
+
module_operate_type)
|
33
|
+
temp_file.puts(new_line)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
temp_file.close
|
37
|
+
FileUtils.mv(temp_file.path, "#{@path}/#{PATH_VERSION_CONFIG}")
|
38
|
+
ensure
|
39
|
+
temp_file.close
|
40
|
+
temp_file.unlink
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def generate_version_config_of_line(line, module_name, module_operate_type)
|
45
|
+
if line.downcase.match(/([\s\S]*)#{module_name.downcase}version(\s*)=(\s*)('|")(\S*)('|")([\s\S]*)/)
|
46
|
+
branch_name = GitOperator.new.current_branch(@path)
|
47
|
+
version_name = ''
|
48
|
+
|
49
|
+
if ModuleOperateType::DELETE == module_operate_type
|
50
|
+
return origin_config_of_module(module_name)
|
51
|
+
elsif ModuleOperateType::PUBLISH == module_operate_type
|
52
|
+
version_name = branch_name.sub(/([\s\S]*)\/(\d+.\d+.\d+)_([\s\S]*)/){ $2 }
|
53
|
+
else
|
54
|
+
version_name = branch_name.sub(/([\s\S]*)\/([\s\S]*)/){ $2 }
|
55
|
+
end
|
56
|
+
return line.sub(/([\s\S]*)Version(\s*)=(\s*)('|")(\S*)('|")([\s\S]*)/){
|
57
|
+
"#{$1}Version = '#{version_name}'"}
|
58
|
+
end
|
59
|
+
line
|
60
|
+
end
|
61
|
+
|
62
|
+
def origin_config_of_module(module_name)
|
63
|
+
origin_config = ''
|
64
|
+
File.open("#{@path}/.bigkeeper/#{PATH_VERSION_CONFIG}", 'r') do |file|
|
65
|
+
file.each_line do |line|
|
66
|
+
if line.downcase.match(/([\s\S]*)#{module_name.downcase}version(\s*)=(\s*)('|")(\S*)('|")([\s\S]*)/)
|
67
|
+
origin_config = line
|
68
|
+
break
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
origin_config.chop
|
73
|
+
end
|
74
|
+
|
75
|
+
private :generate_version_config_of_line, :origin_config_of_module
|
6
76
|
end
|
7
77
|
end
|
data/lib/big_keeper/version.rb
CHANGED