bigkeeper 0.7.5 → 0.7.6

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: da570e5e33eb967d29da59f451cdf6e0576296e3
4
- data.tar.gz: 042531a18b3acf3acb37dceb2635599e17de7c86
3
+ metadata.gz: 4edeeb8d082f8fb0f11ead86d138df2495d7d95f
4
+ data.tar.gz: 453186ec769bb6796be140554f744b1058f4769a
5
5
  SHA512:
6
- metadata.gz: c4dae8988e739591c9f831067ed27d094ecc4ab36a0a278b49c734eaff7d41eb4485ba05fe1c068e91c222f0dfb31050ea984d8af2f63dd07174efbb385d8f22
7
- data.tar.gz: a086662146ebe5a2618dd78e1eec97c5010c17790a91bb419c7845586c451c9ad7044eb71b3fe4203ff271dc3c7ae8c3619b4af5664f0bd567cb94fd98264506
6
+ metadata.gz: 5d0a063e3a386f4bda808202e6caf49054fb62f0c0cf2eafe98e172762f2ecd71f622c147d5d38f75422e2e4f1689db111776a0460a48064c2717b52eaa5676a
7
+ data.tar.gz: d08a0e038c04cbf4203215c458f96abf3c7e02751b6c9d5baefaab2aa793bdfef82fb60037b0e26bdaa984f3e392377e222e73ffd8e2e14459dbb8185f22ccb6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bigkeeper (0.7.4)
4
+ bigkeeper (0.7.5)
5
5
  big_stash (~> 0.1)
6
6
  cocoapods
7
7
  colorize
@@ -36,7 +36,7 @@ module BigKeeper
36
36
  Logger.highlight("Publish branch '#{branch_name}' for 'Home'")
37
37
 
38
38
  # pod install
39
- DepService.dep_operator(path).install(false)
39
+ DepService.dep_operator(path).install(false, user)
40
40
 
41
41
  # Recover podfile
42
42
  DepService.dep_operator(path).recover
@@ -3,7 +3,7 @@ require 'big_keeper/util/logger'
3
3
  require 'big_keeper/dependency/dep_service'
4
4
 
5
5
  module BigKeeper
6
- def self.reabse(path, user, type)
6
+ def self.rebase(path, user, type)
7
7
  begin
8
8
  # Parse Bigkeeper file
9
9
  BigkeeperParser.parse("#{path}/Bigkeeper")
@@ -18,9 +18,12 @@ module BigKeeper
18
18
  ModuleService.new.rebase(path, user, module_name, branch_name, type)
19
19
  end
20
20
 
21
+ Logger.highlight("Rebase '#{GitflowType.base_branch(type)}' "\
22
+ "to branch '#{branch_name}' for 'Home'...")
23
+
21
24
  # Rebase Home
22
- Logger.error("You have some changes in branch '#{home_branch_name}' \
23
- for 'Home'. Use 'push' first please") if GitOperator.new.has_changes(path)
25
+ Logger.error("You have some changes in branch '#{branch_name}' "\
26
+ "for 'Home'. Use 'push' first please") if GitOperator.new.has_changes(path)
24
27
 
25
28
  GitService.new.verify_rebase(path, GitflowType.base_branch(type), 'Home')
26
29
  ensure
@@ -60,13 +60,16 @@ module BigKeeper
60
60
  end
61
61
 
62
62
  # pod install
63
- DepService.dep_operator(path).install(true) unless modules.empty?
63
+ DepService.dep_operator(path).install(true, user)
64
64
 
65
65
  # Open home workspace
66
66
  DepService.dep_operator(path).open
67
67
 
68
68
  # Push home changes to remote
69
- GitService.new.verify_push(path, "init #{GitflowType.name(type)} #{full_name}", branch_name, 'Home')
69
+ GitService.new.verify_push(path,
70
+ "init #{GitflowType.name(type)} #{full_name}",
71
+ branch_name,
72
+ 'Home')
70
73
  ensure
71
74
  end
72
75
  end
@@ -39,7 +39,7 @@ module BigKeeper
39
39
  end
40
40
 
41
41
  # pod install
42
- DepService.dep_operator(path).install(false)
42
+ DepService.dep_operator(path).install(false, user)
43
43
 
44
44
  # Open home workspace
45
45
  DepService.dep_operator(path).open
@@ -60,7 +60,7 @@ module BigKeeper
60
60
  end
61
61
 
62
62
  # pod install
63
- DepService.dep_operator(path).install(false)
63
+ DepService.dep_operator(path).install(false, user)
64
64
 
65
65
  # Open home workspace
66
66
  DepService.dep_operator(path).open
@@ -59,7 +59,7 @@ module BigKeeper
59
59
  # step 3 change Info.plist value
60
60
  InfoPlistOperator.new.change_version_build(project_path, version)
61
61
 
62
- DepService.dep_operator(project_path).install(true)
62
+ DepService.dep_operator(project_path).install(true, user)
63
63
  `open #{project_path}/*.xcworkspace`
64
64
  end
65
65
  end
@@ -26,14 +26,14 @@ module BigKeeper
26
26
  end
27
27
 
28
28
  def modules_with_branch(modules, branch_name)
29
- snapshot_name = "#{branch_name}_SNAPSHOT"
29
+ full_name = branch_name.sub(/([\s\S]*)\/([\s\S]*)/){ $2 }
30
30
  file = "#{@path}/app/build.gradle"
31
31
 
32
32
  matched_modules = []
33
33
  File.open(file, 'r') do |file|
34
34
  file.each_line do |line|
35
35
  modules.each do |module_name|
36
- if line =~ /compile\s*'\S*#{module_name.downcase}:#{snapshot_name}'\S*/
36
+ if line =~ /compile\s*'\S*#{module_name.downcase}:#{full_name}'\S*/
37
37
  matched_modules << module_name
38
38
  break
39
39
  end
@@ -43,14 +43,14 @@ module BigKeeper
43
43
  matched_modules
44
44
  end
45
45
 
46
- def modules_with_type(modules, type)
46
+ def modules_with_type(modules, module_type)
47
47
  file = "#{@path}/app/build.gradle"
48
48
 
49
49
  matched_modules = []
50
50
  File.open(file, 'r') do |file|
51
51
  file.each_line do |line|
52
52
  modules.each do |module_name|
53
- if line =~ regex(type, module_name)
53
+ if line =~ regex(module_type, module_name)
54
54
  matched_modules << module_name
55
55
  break
56
56
  end
@@ -60,19 +60,19 @@ module BigKeeper
60
60
  matched_modules
61
61
  end
62
62
 
63
- def regex(type, module_name)
64
- if ModuleType::PATH == type
63
+ def regex(module_type, module_name)
64
+ if ModuleType::PATH == module_type
65
65
  /compile\s*project\('\S*#{module_name.downcase}'\)\S*/
66
- elsif ModuleType::GIT == type
66
+ elsif ModuleType::GIT == module_type
67
67
  /compile\s*'\S*#{module_name.downcase}\S*'\S*/
68
- elsif ModuleType::SPEC == type
68
+ elsif ModuleType::SPEC == module_type
69
69
  /compile\s*'\S*#{module_name.downcase}\S*'\S*/
70
70
  else
71
71
  //
72
72
  end
73
73
  end
74
74
 
75
- def find_and_replace(module_name, module_type, source)
75
+ def update_module_config(module_name, module_type, source)
76
76
  Dir.glob("#{@path}/*/build.gradle").each do |file|
77
77
  temp_file = Tempfile.new('.build.gradle.tmp')
78
78
  begin
@@ -90,7 +90,7 @@ module BigKeeper
90
90
  end
91
91
  end
92
92
 
93
- def install(addition)
93
+ def install(should_update, user)
94
94
  modules = modules_with_type(BigkeeperParser.module_names, ModuleType::PATH)
95
95
 
96
96
  CacheOperator.new(@path).load('settings.gradle')
@@ -98,9 +98,10 @@ module BigKeeper
98
98
  begin
99
99
  File.open("#{@path}/settings.gradle", 'a') do |file|
100
100
  modules.each do |module_name|
101
- module_path = BigkeeperParser.module_path(user, module_name)
102
- file.puts "include '#{prefix_of_module(module_name)}#{module_name.downcase}'\r\n"
103
- file.puts "project('#{prefix_of_module(module_name)}#{module_name.downcase}').projectDir = new File(rootProject.projectDir, '../#{module_name}/#{module_name.downcase}-lib')\r\n"
101
+ file.puts "include ':#{module_name.downcase}'\r\n"
102
+ file.puts "project(':#{module_name.downcase}')." \
103
+ "projectDir = new File(rootProject.projectDir," \
104
+ "'#{BigkeeperParser.module_path(user, module_name)}/#{module_name.downcase}-lib')\r\n"
104
105
  end
105
106
  end
106
107
  ensure
@@ -108,7 +109,7 @@ module BigKeeper
108
109
  end
109
110
 
110
111
  def prefix_of_module(module_name)
111
- file = "#{@path}/app/build.gradle"
112
+ file = "#{@path}/.bigkeeper/app/build.gradle"
112
113
  prefix = ''
113
114
 
114
115
  File.open(file, 'r') do |file|
@@ -129,35 +130,31 @@ module BigKeeper
129
130
 
130
131
  def generate_build_config(line, module_name, module_type, source)
131
132
  if ModuleType::PATH == module_type
132
- line.sub(/(\s*)compile(\s*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/){
133
- "#{$1}compile project('#{$3}#{module_name.downcase}')"
133
+ line.sub(/(\s*)([\s\S]*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/){
134
+ "#{$1}compile project(':#{module_name.downcase}')"
134
135
  }
135
136
  elsif ModuleType::GIT == module_type
136
137
  branch_name = GitOperator.new.current_branch(@path)
137
- snapshot_name = "SNAPSHOT"
138
+ full_name = ''
138
139
 
139
140
  # Get version part of source.addition
140
141
  if 'develop' == source.addition || 'master' == source.addition
141
- snapshot_name = branch_name.sub(/([\s\S]*)\/(\d+.\d+.\d+)_([\s\S]*)/){
142
- "#{$2}_SNAPSHOT"
143
- }
142
+ full_name = branch_name.sub(/([\s\S]*)\/(\d+.\d+.\d+)_([\s\S]*)/){ $2 }
144
143
  else
145
- snapshot_name = branch_name.sub(/([\s\S]*)\/([\s\S]*)/){
146
- "#{$2}_SNAPSHOT"
147
- }
144
+ full_name = branch_name.sub(/([\s\S]*)\/([\s\S]*)/){ $2 }
148
145
  end
149
146
  line.sub(/(\s*)([\s\S]*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/){
150
- "#{$1}compile '#{$3}#{module_name.downcase}:#{snapshot_name}'"
147
+ "#{$1}compile '#{prefix_of_module(module_name)}#{module_name.downcase}:#{full_name}'"
151
148
  }
152
149
  elsif ModuleType::SPEC == module_type
153
150
  line.sub(/(\s*)([\s\S]*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/){
154
- "#{$1}compile '#{$3}#{module_name.downcase}:#{source}'"
151
+ "#{$1}compile '#{prefix_of_module(module_name)}#{module_name.downcase}:#{source}'"
155
152
  }
156
153
  else
157
154
  line
158
155
  end
159
156
  end
160
157
 
161
- private :generate_build_config, :regex
158
+ private :generate_build_config, :regex, :prefix_of_module
162
159
  end
163
160
  end
@@ -19,15 +19,15 @@ module BigKeeper
19
19
  raise "You should override this method in subclass."
20
20
  end
21
21
 
22
- def modules_with_type(modules, type)
22
+ def modules_with_type(modules, module_type)
23
23
  raise "You should override this method in subclass."
24
24
  end
25
25
 
26
- def find_and_replace(module_name, module_type, source)
26
+ def update_module_config(module_name, module_type, source)
27
27
  raise "You should override this method in subclass."
28
28
  end
29
29
 
30
- def install(addition)
30
+ def install(should_update, user)
31
31
  raise "You should override this method in subclass."
32
32
  end
33
33
 
@@ -33,13 +33,13 @@ module BigKeeper
33
33
  matched_modules
34
34
  end
35
35
 
36
- def modules_with_type(modules, type)
36
+ def modules_with_type(modules, module_type)
37
37
  file = "#{@path}/Podfile"
38
38
  matched_modules = []
39
39
  File.open(file, 'r') do |file|
40
40
  file.each_line do |line|
41
41
  modules.each do |module_name|
42
- if line =~ /pod\s*'#{module_name}'\s*,#{regex(type)}/
42
+ if line =~ /pod\s*'#{module_name}'\s*,#{regex(module_type)}/
43
43
  matched_modules << module_name
44
44
  break
45
45
  end
@@ -49,19 +49,19 @@ module BigKeeper
49
49
  matched_modules
50
50
  end
51
51
 
52
- def regex(type)
53
- if ModuleType::PATH == type
52
+ def regex(module_type)
53
+ if ModuleType::PATH == module_type
54
54
  "\s*:path\s*=>\s*"
55
- elsif ModuleType::GIT == type
55
+ elsif ModuleType::GIT == module_type
56
56
  "\s*:git\s*=>\s*"
57
- elsif ModuleType::SPEC == type
57
+ elsif ModuleType::SPEC == module_type
58
58
  "\s*'"
59
59
  else
60
60
  ""
61
61
  end
62
62
  end
63
63
 
64
- def find_and_replace(module_name, module_type, source)
64
+ def update_module_config(module_name, module_type, source)
65
65
  file = "#{@path}/Podfile"
66
66
  temp_file = Tempfile.new('.Podfile.tmp')
67
67
 
@@ -79,8 +79,8 @@ module BigKeeper
79
79
  end
80
80
  end
81
81
 
82
- def install(addition)
83
- PodOperator.pod_install(@path, addition)
82
+ def install(should_update, user)
83
+ PodOperator.pod_install(@path, should_update)
84
84
  end
85
85
 
86
86
  def open
@@ -162,26 +162,25 @@ module BigKeeper
162
162
  Dir.chdir(path) do
163
163
  IO.popen("git rebase #{branch_name} --ignore-whitespace") do |io|
164
164
  unless io.gets
165
- Logger.error("#{name} is already in a rebase-apply, Please:\n\
166
- 1.Resolve it;\n\
167
- 2.Commit the changes;\n\
168
- 3.Push to remote;\n\
169
- 4.Create a MR;\n\
170
- 5.Run 'finish' again.")
165
+ Logger.error("#{name} is already in a rebase-apply, Please:\n"\
166
+ " 1.Resolve it;\n"\
167
+ " 2.Commit the changes;\n"\
168
+ " 3.Push to remote;\n"\
169
+ " 4.Create a MR;\n"\
170
+ " 5.Run 'finish' again.")
171
171
  end
172
172
  io.each do |line|
173
173
  next unless line.include? 'Merge conflict'
174
- Logger.error("Merge conflict in #{name}, Please:\n\
175
- 1.Resolve it;\n\
176
- 2.Commit the changes;\n\
177
- 3.Push to remote;\n\
178
- 4.Create a MR;\n\
179
- 5.Run 'finish' again.")
174
+ Logger.error("Merge conflict in #{name}, Please:\n"\
175
+ " 1.Resolve it;\n"\
176
+ " 2.Commit the changes;\n"\
177
+ " 3.Push to remote;\n"\
178
+ " 4.Create a MR;\n"\
179
+ " 5.Run 'finish' again.")
180
180
  end
181
181
  end
182
182
  if GitOperator.new.current_branch(path) != 'develop' && GitOperator.new.current_branch(path) != 'master'
183
183
  `git push -f`
184
- GitOperator.new.checkout(path, branch_name)
185
184
  else
186
185
  Logger.error("You should not push 'master' or 'develop'")
187
186
  end
@@ -37,17 +37,17 @@ module BigKeeper
37
37
  end
38
38
 
39
39
  def rebase(path, user, module_name, home_branch_name, type)
40
- Logger.highlight("Rebase '#{GitflowType.base_branch(type)}'\
41
- to branch '#{home_branch_name}' for module \
42
- '#{module_name}'...")
40
+ Logger.highlight("Rebase '#{GitflowType.base_branch(type)}' "\
41
+ "to branch '#{home_branch_name}' for module "\
42
+ "'#{module_name}'...")
43
43
 
44
44
  verify_module(path, user, module_name, home_branch_name, type)
45
45
 
46
46
  module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
47
47
 
48
- Logger.error("You have some changes in branch \
49
- '#{home_branch_name}' for module '#{module_name}'. \
50
- Use 'push' first please") if GitOperator.new.has_changes(module_full_path)
48
+ Logger.error("You have some changes in branch "\
49
+ "'#{home_branch_name}' for module '#{module_name}'. "\
50
+ "Use 'push' first please") if GitOperator.new.has_changes(module_full_path)
51
51
 
52
52
  GitService.new.verify_rebase(module_full_path, GitflowType.base_branch(type), module_name)
53
53
  end
@@ -89,7 +89,7 @@ module BigKeeper
89
89
  GitService.new.verify_push(module_full_path, "finish branch #{home_branch_name}", home_branch_name, module_name)
90
90
 
91
91
  module_git = BigkeeperParser.module_git(module_name)
92
- DepService.dep_operator(path).find_and_replace(
92
+ DepService.dep_operator(path).update_module_config(
93
93
  module_name,
94
94
  ModuleType::GIT,
95
95
  GitInfo.new(module_git, GitType::BRANCH, home_branch_name))
@@ -103,7 +103,7 @@ module BigKeeper
103
103
  verify_module(path, user, module_name, home_branch_name, type)
104
104
 
105
105
  module_path = BigkeeperParser.module_path(user, module_name)
106
- DepService.dep_operator(path).find_and_replace(
106
+ DepService.dep_operator(path).update_module_config(
107
107
  module_name,
108
108
  ModuleType::PATH,
109
109
  module_path)
@@ -123,7 +123,7 @@ module BigKeeper
123
123
 
124
124
  module_git = BigkeeperParser.module_git(module_name)
125
125
 
126
- DepService.dep_operator(path).find_and_replace(
126
+ DepService.dep_operator(path).update_module_config(
127
127
  module_name,
128
128
  ModuleType::GIT,
129
129
  GitInfo.new(module_git, GitType::BRANCH, GitflowType.base_branch(type)))
@@ -16,8 +16,8 @@ module BigKeeper
16
16
  BigkeeperParser.parse_home(name, params)
17
17
  end
18
18
 
19
- def self.pod(name, params)
20
- BigkeeperParser.parse_pod(name, params)
19
+ def self.mod(name, params)
20
+ BigkeeperParser.parse_mod(name, params)
21
21
  end
22
22
 
23
23
  def self.modules
@@ -43,7 +43,7 @@ module BigKeeper
43
43
  content.gsub!(/version\s/, 'BigKeeper::version ')
44
44
  content.gsub!(/user\s/, 'BigKeeper::user ')
45
45
  content.gsub!(/home\s/, 'BigKeeper::home ')
46
- content.gsub!(/pod\s/, 'BigKeeper::pod ')
46
+ content.gsub!(/mod\s/, 'BigKeeper::mod ')
47
47
  content.gsub!(/modules\s/, 'BigKeeper::modules ')
48
48
  content.gsub!(/source\s/, 'BigKeeper::source ')
49
49
  eval content
@@ -75,27 +75,27 @@ module BigKeeper
75
75
  @@config[:name] = name
76
76
  end
77
77
 
78
- def self.parse_pod(name, params)
78
+ def self.parse_mod(name, params)
79
79
  if params[:path]
80
- parse_user_pod(name, params)
80
+ parse_user_mod(name, params)
81
81
  elsif params[:git]
82
- parse_modules_pod(name, params)
82
+ parse_modules_mod(name, params)
83
83
  else
84
- Logger.error(%(There should be ':path =>' or ':git =>' for pod #{name}))
84
+ Logger.error(%(There should be ':path =>' or ':git =>' for mod #{name}))
85
85
  end
86
86
  end
87
87
 
88
- def self.parse_user_pod(name, params)
88
+ def self.parse_user_mod(name, params)
89
89
  users = @@config[:users]
90
90
  user = users[@@current_user]
91
- pods = user[:pods]
92
- pods = {} if pods.nil?
93
- pods[name] = params
94
- user[:pods] = pods
91
+ mods = user[:mods]
92
+ mods = {} if mods.nil?
93
+ mods[name] = params
94
+ user[:mods] = mods
95
95
  @@config[:users] = users
96
96
  end
97
97
 
98
- def self.parse_modules_pod(name, params)
98
+ def self.parse_modules_mod(name, params)
99
99
  modules = @@config[:modules]
100
100
  modules[name] = params
101
101
  @@config[:modules] = modules
@@ -134,10 +134,10 @@ module BigKeeper
134
134
  def self.module_full_path(home_path, user_name, module_name)
135
135
  if @@config[:users] \
136
136
  && @@config[:users][user_name] \
137
- && @@config[:users][user_name][:pods] \
138
- && @@config[:users][user_name][:pods][module_name] \
139
- && @@config[:users][user_name][:pods][module_name][:path]
140
- @@config[:users][user_name][:pods][module_name][:path]
137
+ && @@config[:users][user_name][:mods] \
138
+ && @@config[:users][user_name][:mods][module_name] \
139
+ && @@config[:users][user_name][:mods][module_name][:path]
140
+ @@config[:users][user_name][:mods][module_name][:path]
141
141
  else
142
142
  File.expand_path("#{home_path}/../#{module_name}")
143
143
  end
@@ -146,10 +146,10 @@ module BigKeeper
146
146
  def self.module_path(user_name, module_name)
147
147
  if @@config[:users] \
148
148
  && @@config[:users][user_name] \
149
- && @@config[:users][user_name][:pods] \
150
- && @@config[:users][user_name][:pods][module_name] \
151
- && @@config[:users][user_name][:pods][module_name][:path]
152
- @@config[:users][user_name][:pods][module_name][:path]
149
+ && @@config[:users][user_name][:mods] \
150
+ && @@config[:users][user_name][:mods][module_name] \
151
+ && @@config[:users][user_name][:mods][module_name][:path]
152
+ @@config[:users][user_name][:mods][module_name][:path]
153
153
  else
154
154
  "../#{module_name}"
155
155
  end
@@ -28,7 +28,7 @@ module BigKeeper
28
28
 
29
29
  def replace_all_module_release(path, module_names, version)
30
30
  module_names.each do |module_name|
31
- DepService.dep_operator(path).find_and_replace(
31
+ DepService.dep_operator(path).update_module_config(
32
32
  module_name,
33
33
  ModuleType::GIT,
34
34
  GitInfo.new(BigkeeperParser.module_git(module_name), GitType::TAG, version))
@@ -3,6 +3,11 @@ require 'big_keeper/util/logger'
3
3
  module BigKeeper
4
4
  class XcodeOperator
5
5
  def self.open_workspace(path)
6
+ # Close Xcode
7
+ `pkill Xcode`
8
+
9
+ sleep 0.5
10
+
6
11
  # Open home workspace
7
12
  `open #{path}/*.xcworkspace`
8
13
  end
@@ -1,3 +1,3 @@
1
1
  module BigKeeper
2
- VERSION = "0.7.5"
2
+ VERSION = "0.7.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - mmoaay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-30 00:00:00.000000000 Z
11
+ date: 2018-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli