bigkeeper 0.8.6 → 0.8.7

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: f110eccd6b2a0185f889a7af2324d30da13c9477
4
- data.tar.gz: 40582adaa6066a3710e6b2f3ea7686b2ef7e991e
3
+ metadata.gz: de93b6981bad3cd5f43cdbe6e5712a67600f9263
4
+ data.tar.gz: a68797291ccc46b21d05c9a410f5349fd6c26312
5
5
  SHA512:
6
- metadata.gz: b3d3418c579636978d527e9618c4d2a0157e609d08e41213c1af69fb3f339bf281c15cc62c53dbb6dbc2985f5a91425597239d5eb71e53b6610e608bda7c3184
7
- data.tar.gz: f6e1804ea25f309520dbafa108b192a26d6f54a7c52dd610e0efff8ba748b69893dfe9776ee70dfd2e004d76f1f74ed49e6619aab0e7b89f5136cb7544edcb07
6
+ metadata.gz: 4e710fb6b2f19b5b550751e3c680c34af4729545e85c21929de5ff761084b8f7f2b4dbb3537ce2be6ae8a718d3990bdc649e36b6dfaa2d8fcc8b4c7e7b486158
7
+ data.tar.gz: 79f59e5f641e8710984efd88e9720885b2dd58267736b3ff5cf279c2ed5d5d3b61e9e80de82f0371eee886f611754eee95ecf301247d8838f53bd1b1b11eac34
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bigkeeper (0.8.5)
4
+ bigkeeper (0.8.6)
5
5
  big_resources
6
6
  big_stash (~> 0.1)
7
7
  cocoapods
@@ -120,4 +120,4 @@ DEPENDENCIES
120
120
  rubocop (~> 0.50.0)
121
121
 
122
122
  BUNDLED WITH
123
- 1.16.1
123
+ 1.16.2
data/README.md CHANGED
@@ -23,12 +23,13 @@ bigkeeper 是一个 **iOS&Android 模块化项目**效率提升工具,旨在
23
23
 
24
24
  在模块化项目的过渡阶段,我们往往会碰到业务拆分不是那么彻底的情况(PS:比如主项目中仍然存在业务相关代码),这样就会导致一系列问题:
25
25
 
26
- - 开发者开发一个 feature 时需要维护多个项目的分支,同时还要频繁修改主项目的 `Podfile`;
26
+ - 开发流程方面:开发者在开发一个 feature 时需要维护多个项目的分支,同时还要频繁修改主项目的 `Podfile`;
27
27
  - 项目管理者需要花很大精力去和团队成员同步项目管理规范流程,尤其对于新人,挑战很大;
28
28
  - 开发过程中如果碰到突发情况需要开新分支处理问题时对当前工作区的保存操作会很繁琐(PS:因为涉及到多个项目);
29
29
  - 日常开发过程中类似 commit、pull、push 等操作比较繁琐(PS:因为涉及到多个项目);
30
30
  - 资源(比如图片)散落在各个业务模块,可能存在重名、重复等问题,难以管理;
31
31
  - 业务模块可能存在横向依赖的问题,导致业务模块间耦合严重,不能单独编译运行。
32
+ - 各模块依赖的版本没有统一的同步更新方式,导致各个模块的开发环境不一致,问题百出。
32
33
 
33
34
  bigkeeper 的出现就是为了解决这些问题。
34
35
 
@@ -53,10 +54,6 @@ bigkeeper 的出现就是为了解决这些问题。
53
54
 
54
55
  ## 使用方法
55
56
 
56
- > 注:每个流程我们都提供详细的流程图来让你了解我们都做了些什么,为了方便你更好的了解我们的流程,我们提供了一个流程参考图,如下:
57
- >
58
- > ![](./resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.001.jpeg)
59
-
60
57
  - [Bigkeeper 文件配置](./docs/zh-CN/BIGKEEPER_FILE.md)
61
58
  - `bigkeeper` 工具使用:
62
59
 
@@ -107,6 +104,7 @@ bigkeeper 的出现就是为了解决这些问题。
107
104
  ## 其他
108
105
 
109
106
  - [一些建议](./docs/zh-CN/RECOMMEND.md)
107
+ - [一些思考]()
110
108
 
111
109
  ## 协议
112
110
 
@@ -23,12 +23,13 @@ bigkeeper 是一个 **iOS&Android 模块化项目**效率提升工具,旨在
23
23
 
24
24
  在模块化项目的过渡阶段,我们往往会碰到业务拆分不是那么彻底的情况(PS:比如主项目中仍然存在业务相关代码),这样就会导致一系列问题:
25
25
 
26
- - 开发者开发一个 feature 时需要维护多个项目的分支,同时还要频繁修改主项目的 `Podfile`;
26
+ - 开发流程方面:开发者在开发一个 feature 时需要维护多个项目的分支,同时还要频繁修改主项目的 `Podfile`;
27
27
  - 项目管理者需要花很大精力去和团队成员同步项目管理规范流程,尤其对于新人,挑战很大;
28
28
  - 开发过程中如果碰到突发情况需要开新分支处理问题时对当前工作区的保存操作会很繁琐(PS:因为涉及到多个项目);
29
29
  - 日常开发过程中类似 commit、pull、push 等操作比较繁琐(PS:因为涉及到多个项目);
30
30
  - 资源(比如图片)散落在各个业务模块,可能存在重名、重复等问题,难以管理;
31
31
  - 业务模块可能存在横向依赖的问题,导致业务模块间耦合严重,不能单独编译运行。
32
+ - 各模块依赖的版本没有统一的同步更新方式,导致各个模块的开发环境不一致,问题百出。
32
33
 
33
34
  bigkeeper 的出现就是为了解决这些问题。
34
35
 
@@ -103,6 +104,7 @@ bigkeeper 的出现就是为了解决这些问题。
103
104
  ## 其他
104
105
 
105
106
  - [一些建议](RECOMMEND.md)
107
+ - [一些思考]()
106
108
 
107
109
  ## 协议
108
110
 
@@ -15,6 +15,7 @@ require 'big_keeper/command/spec'
15
15
  require 'big_keeper/command/image'
16
16
 
17
17
  require 'big_keeper/service/git_service'
18
+ require 'big_keeper/util/leancloud_logger'
18
19
 
19
20
  require 'gli'
20
21
 
@@ -38,6 +39,14 @@ module BigKeeper
38
39
  exit
39
40
  end
40
41
 
42
+ pre do |global_options,command,options,args|
43
+ LeanCloudLogger.instance.start_log(global_options, args)
44
+ end
45
+
46
+ post do |global_options,command,options,args|
47
+ LeanCloudLogger.instance.end_log(true)
48
+ end
49
+
41
50
  feature_and_hotfix_command(GitflowType::FEATURE)
42
51
 
43
52
  feature_and_hotfix_command(GitflowType::HOTFIX)
@@ -8,6 +8,7 @@ require 'big_keeper/command/feature&hotfix/rebase'
8
8
  require 'big_keeper/command/feature&hotfix/publish'
9
9
  require 'big_keeper/command/feature&hotfix/delete'
10
10
  require 'big_keeper/command/feature&hotfix/list'
11
+ require 'big_keeper/util/leancloud_logger'
11
12
 
12
13
  module BigKeeper
13
14
  def self.feature_and_hotfix_command(type)
@@ -19,6 +20,7 @@ module BigKeeper
19
20
  path = File.expand_path(global_options[:path])
20
21
  version = global_options[:ver]
21
22
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
23
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/start")
22
24
 
23
25
  help_now!('user name is required') if user and user.empty?
24
26
  help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
@@ -33,6 +35,7 @@ module BigKeeper
33
35
  update.action do |global_options, options, args|
34
36
  path = File.expand_path(global_options[:path])
35
37
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
38
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/update")
36
39
 
37
40
  help_now!('user name is required') if user and user.empty?
38
41
  modules = args[(0...args.length)] if args.length > 0
@@ -46,6 +49,7 @@ module BigKeeper
46
49
  path = File.expand_path(global_options[:path])
47
50
  version = global_options[:ver]
48
51
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
52
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/switch")
49
53
 
50
54
  help_now!('user name is required') if user and user.empty?
51
55
  help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
@@ -59,6 +63,7 @@ module BigKeeper
59
63
  pull.action do |global_options, options, args|
60
64
  path = File.expand_path(global_options[:path])
61
65
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
66
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/pull")
62
67
 
63
68
  help_now!('user name is required') if user and user.empty?
64
69
  pull(path, user, type)
@@ -70,6 +75,7 @@ module BigKeeper
70
75
  push.action do |global_options, options, args|
71
76
  path = File.expand_path(global_options[:path])
72
77
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
78
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/push")
73
79
 
74
80
  help_now!('user name is required') if user and user.empty?
75
81
  help_now!('comment message is required') if args.length < 1
@@ -84,6 +90,7 @@ module BigKeeper
84
90
  rebase.action do |global_options, options, args|
85
91
  path = File.expand_path(global_options[:path])
86
92
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
93
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/rebase")
87
94
 
88
95
  help_now!('user name is required') if user and user.empty?
89
96
  rebase(path, user, type)
@@ -95,6 +102,7 @@ module BigKeeper
95
102
  finish.action do |global_options, options, args|
96
103
  path = File.expand_path(global_options[:path])
97
104
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
105
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/finish")
98
106
 
99
107
  help_now!('user name is required') if user and user.empty?
100
108
  finish(path, user, type)
@@ -106,6 +114,7 @@ module BigKeeper
106
114
  publish.action do |global_options, options, args|
107
115
  path = File.expand_path(global_options[:path])
108
116
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
117
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/publish")
109
118
 
110
119
  help_now!('user name is required') if user and user.empty?
111
120
  publish(path, user, type)
@@ -117,6 +126,7 @@ module BigKeeper
117
126
  delete.action do |global_options, options, args|
118
127
  path = File.expand_path(global_options[:path])
119
128
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
129
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/delete")
120
130
 
121
131
  help_now!('user name is required') if user and user.empty?
122
132
  help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
@@ -131,6 +141,8 @@ module BigKeeper
131
141
  list.desc "Print list of TREE format."
132
142
  list.command :tree do |tree|
133
143
  tree.action do |global_options, options, args|
144
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/list/tree")
145
+
134
146
  Logger.highlight("Generating #{GitflowType.name(type)} tree of all version...") if args.length < 1
135
147
  path = File.expand_path(global_options[:path])
136
148
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
@@ -141,6 +153,8 @@ module BigKeeper
141
153
  list.desc "Print list of JSON format."
142
154
  list.command :json do |json|
143
155
  json.action do |global_options, options, args|
156
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/list/json")
157
+
144
158
  options[:json] = true
145
159
  path = File.expand_path(global_options[:path])
146
160
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
@@ -40,6 +40,10 @@ module BigKeeper
40
40
  # Start home feature
41
41
  GitService.new.start(path, full_name, type)
42
42
 
43
+ if FileOperator.definitely_exists?("#{path}/.bigkeeper")
44
+ p "rm -rf #{path}/.bigkeeper"
45
+ end
46
+
43
47
  # Cache all path modules
44
48
  ModuleCacheOperator.new(path).cache_path_modules(modules, modules, [])
45
49
  modules = ModuleCacheOperator.new(path).remain_path_modules
@@ -1,4 +1,5 @@
1
1
  require 'big_resources/util/image/name_analyze_util'
2
+ require 'big_keeper/util/leancloud_logger'
2
3
 
3
4
  module BigKeeper
4
5
  def self.image_command
@@ -7,6 +8,8 @@ module BigKeeper
7
8
  c.desc "Detect duplicate name images."
8
9
  c.command :name do | name |
9
10
  name.action do | global_options, options, args |
11
+ LeanCloudLogger.instance.set_command("image/name")
12
+
10
13
  path = File.expand_path(global_options[:path])
11
14
  BigResources::ImageAnalyzeUtil.get_duplicate_name_file_with_type(path, BigResources::PNG)
12
15
  end
@@ -15,6 +18,7 @@ module BigKeeper
15
18
  c.desc "Detect duplicate content images."
16
19
  c.command :content do | content |
17
20
  content.action do | global_options, options, args |
21
+ LeanCloudLogger.instance.set_command("image/content")
18
22
  path = File.expand_path(global_options[:path])
19
23
  BigResources::ImageAnalyzeUtil.get_duplicate_content_file_with_type(path, BigResources::PNG)
20
24
  end
@@ -1,4 +1,5 @@
1
1
  require 'big_keeper/command/pod/podfile'
2
+ require 'big_keeper/util/leancloud_logger'
2
3
 
3
4
  module BigKeeper
4
5
 
@@ -10,6 +11,8 @@ module BigKeeper
10
11
  podfile.desc 'Detect podname should be locked.'
11
12
  podfile.command :detect do |detect|
12
13
  detect.action do |global_options, options, args|
14
+ LeanCloudLogger.instance.set_command("podfile/detect")
15
+
13
16
  path = File.expand_path(global_options[:path])
14
17
  podfile_detect(path)
15
18
  end
@@ -18,14 +21,18 @@ module BigKeeper
18
21
  podfile.desc 'Lock podname should be locked.'
19
22
  podfile.command :lock do |lock|
20
23
  lock.action do |global_options, options, args|
24
+ LeanCloudLogger.instance.set_command("podfile/lock")
25
+
21
26
  path = File.expand_path(global_options[:path])
22
27
  podfile_lock(path)
23
28
  end
24
29
  end
25
30
 
26
31
  podfile.desc 'Update modules should be upgrade.'
27
- podfile.command :update do |lock|
28
- lock.action do |global_options, options, args|
32
+ podfile.command :update do |update|
33
+ update.action do |global_options, options, args|
34
+ LeanCloudLogger.instance.set_command("podfile/update")
35
+
29
36
  path = File.expand_path(global_options[:path])
30
37
  podfile_modules_update(path)
31
38
  end
@@ -1,5 +1,6 @@
1
1
  require 'big_keeper/command/release/home'
2
2
  require 'big_keeper/command/release/module'
3
+ require 'big_keeper/util/leancloud_logger'
3
4
 
4
5
  module BigKeeper
5
6
  def self.release_command
@@ -14,6 +15,7 @@ module BigKeeper
14
15
  path = File.expand_path(global_options[:path])
15
16
  version = global_options[:ver]
16
17
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
18
+ LeanCloudLogger.instance.set_command("release/home/start")
17
19
 
18
20
  help_now!('user name is required') if user and user.empty?
19
21
  raise Logger.error("release version is required") if version == nil
@@ -26,6 +28,7 @@ module BigKeeper
26
28
  finish.action do |global_options, options, args|
27
29
  path = File.expand_path(global_options[:path])
28
30
  version = global_options[:ver]
31
+ LeanCloudLogger.instance.set_command("release/home/finish")
29
32
 
30
33
  raise Logger.error("release version is required") if version == nil
31
34
  release_home_finish(path, version)
@@ -42,6 +45,7 @@ module BigKeeper
42
45
  path = File.expand_path(global_options[:path])
43
46
  version = global_options[:ver]
44
47
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
48
+ LeanCloudLogger.instance.set_command("release/module/start")
45
49
 
46
50
  help_now!('module name is required') if args.length != 1
47
51
  raise Logger.error("release version is required") if version == nil
@@ -57,6 +61,7 @@ module BigKeeper
57
61
  path = File.expand_path(global_options[:path])
58
62
  version = global_options[:ver]
59
63
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
64
+ LeanCloudLogger.instance.set_command("release/module/finish")
60
65
 
61
66
  help_now!('module name is required') if args.length != 1
62
67
  raise Logger.error("release version is required") if version == nil
@@ -3,6 +3,8 @@ require 'big_keeper/command/spec/list'
3
3
  require 'big_keeper/command/spec/add'
4
4
  require 'big_keeper/command/spec/delete'
5
5
  require 'big_keeper/command/spec/search'
6
+ require 'big_keeper/command/spec/sync'
7
+ require 'big_keeper/util/leancloud_logger'
6
8
 
7
9
  module BigKeeper
8
10
 
@@ -14,6 +16,8 @@ module BigKeeper
14
16
  spec.desc 'Analyze spec dependency infomation.'
15
17
  spec.command :analyze do |analyze|
16
18
  analyze.action do |global_options, options, args|
19
+ LeanCloudLogger.instance.set_command("spec/analyze")
20
+
17
21
  path = File.expand_path(global_options[:path])
18
22
  is_all = options[:all]
19
23
  module_names = args
@@ -24,6 +28,8 @@ module BigKeeper
24
28
  spec.desc 'List all the specs.'
25
29
  spec.command :list do | list |
26
30
  list.action do |global_options, options, args|
31
+ LeanCloudLogger.instance.set_command("spec/list")
32
+
27
33
  path = File.expand_path(global_options[:path])
28
34
  version = global_options[:ver]
29
35
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
@@ -32,6 +38,20 @@ module BigKeeper
32
38
  end
33
39
  end
34
40
 
41
+ spec.desc 'Sync Module dependency from Home.'
42
+ spec.command :sync do | sync|
43
+ sync.action do |global_options, options, args|
44
+ LeanCloudLogger.instance.set_command("spec/sync")
45
+
46
+ path = File.expand_path(global_options[:path])
47
+ version = global_options[:ver]
48
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
49
+ module_name = args
50
+
51
+ spec_sync(path, version, user, module_name)
52
+ end
53
+ end
54
+
35
55
  spec.desc 'Add a spec (Coming soon).'
36
56
  spec.command :add do |add|
37
57
  add.action do
@@ -5,6 +5,9 @@ require 'big_keeper/model/library_model'
5
5
 
6
6
  module BigKeeper
7
7
  def self.spec_analyze(path,is_all,find_module_names)
8
+ # Parse Bigkeeper file
9
+ BigkeeperParser.parse("#{path}/Bigkeeper")
10
+
8
11
  is_default = !is_all&&find_module_names.size==0
9
12
  if is_all && find_module_names.size>0
10
13
  Logger.error("parameter conflict: [--all] | [module_names]")
@@ -4,6 +4,7 @@ require 'json'
4
4
  module BigKeeper
5
5
  def self.spec_list(path, user, options)
6
6
  BigkeeperParser.parse("#{path}/Bigkeeper")
7
+
7
8
  module_dic = BigkeeperParser.parse_modules
8
9
  module_list = Array.new
9
10
  module_dic.keys.each do | key |
@@ -0,0 +1,12 @@
1
+ require 'big_keeper/util/bigkeeper_parser'
2
+ require 'big_keeper/dependency/dep_type'
3
+ require 'big_keeper/util/logger'
4
+
5
+ module BigKeeper
6
+ def self.spec_sync(path, version, user, module_name)
7
+ # Parse Bigkeeper file
8
+ BigkeeperParser.parse("#{path}/Bigkeeper")
9
+
10
+ Logger.default('Coming soon.')
11
+ end
12
+ end
@@ -64,10 +64,6 @@ module BigKeeper
64
64
  verify_checkout(path, name)
65
65
  git.push_to_remote(path, name)
66
66
  end
67
-
68
- if FileOperator.definitely_exists?("#{path}/.bigkeeper/module.cache")
69
- Logger.error(%Q('#{name}' has '.bigkeeper/module.cache' cache path, you should fix it manually...))
70
- end
71
67
  end
72
68
 
73
69
  def verify_home_branch(path, branch_name, type)
@@ -30,6 +30,16 @@ module BigKeeper
30
30
  yield if block_given?
31
31
  end
32
32
 
33
+ def self.configs
34
+ BigkeeperParser.parse_configs
35
+ yield if block_given?
36
+ end
37
+
38
+ def self.param(key, value)
39
+ BigkeeperParser.parse_param(key, value)
40
+ yield if block_given?
41
+ end
42
+
33
43
  # Bigkeeper file parser
34
44
  class BigkeeperParser
35
45
  @@config = {}
@@ -47,6 +57,8 @@ module BigKeeper
47
57
  content.gsub!(/source\s/, 'BigKeeper::source ')
48
58
  content.gsub!(/mod\s/, 'BigKeeper::mod ')
49
59
  content.gsub!(/modules\s/, 'BigKeeper::modules ')
60
+ content.gsub!(/configs\s/, 'BigKeeper::configs ')
61
+ content.gsub!(/param\s/, 'BigKeeper::param ')
50
62
  eval content
51
63
  end
52
64
  end
@@ -113,6 +125,14 @@ module BigKeeper
113
125
  @@config[:modules] = modules
114
126
  end
115
127
 
128
+ def self.parse_configs
129
+ @@config[:configs] = {}
130
+ end
131
+
132
+ def self.parse_param(key, value)
133
+ @@config[:configs] = @@config[:configs].merge(key => value)
134
+ end
135
+
116
136
  def self.version
117
137
  @@config[:version]
118
138
  end
@@ -142,6 +162,13 @@ module BigKeeper
142
162
  @@config[:source].keys
143
163
  end
144
164
 
165
+ def self.global_configs(key)
166
+ if @@config[:configs] == nil
167
+ return
168
+ end
169
+ @@config[:configs][key]
170
+ end
171
+
145
172
  def self.module_full_path(home_path, user_name, module_name)
146
173
  if @@config[:users] \
147
174
  && @@config[:users][user_name] \
@@ -192,15 +219,4 @@ module BigKeeper
192
219
  end
193
220
  end
194
221
 
195
- # BigkeeperParser.parse('/Users/mmoaay/Documents/eleme/BigKeeperMain/Bigkeeper')
196
- # BigkeeperParser.parse('/Users/mmoaay/Documents/eleme/BigKeeperMain/Bigkeeper')
197
- #
198
- # p BigkeeperParser.home_git()
199
- # p BigkeeperParser.home_pulls()
200
- # p BigkeeperParser.module_path('perry', 'BigKeeperModular')
201
- # p BigkeeperParser.module_path('', 'BigKeeperModular')
202
- # p BigkeeperParser.module_git('BigKeeperModular')
203
- # pulls = BigkeeperParser.module_pulls('BigKeeperModular')
204
- # `open #{pulls}`
205
- # p BigkeeperParser.module_names
206
222
  end
@@ -70,7 +70,7 @@ module BigKeeper
70
70
  def commit(path, message)
71
71
  Dir.chdir(path) do
72
72
  `git add .`
73
- `git commit -m "#{message}"`
73
+ `git commit -m "#{Logger.formatter_output(message)}"`
74
74
  end
75
75
  end
76
76
 
@@ -0,0 +1,72 @@
1
+ require 'Singleton'
2
+ require 'net/http'
3
+ require 'net/https'
4
+ require 'big_keeper/util/logger'
5
+
6
+ module BigKeeper
7
+ class LeanCloudLogger
8
+ include Singleton
9
+
10
+ attr_accessor :user, :version, :start_timestamp, :end_timestamp, :command, :parameter, :is_success, :path
11
+
12
+ def set_command(set_command)
13
+ @command = set_command
14
+ end
15
+
16
+ def start_log(global_options, args)
17
+ @start_timestamp = Time.new.to_i
18
+ @user = global_options['user'].to_s
19
+ @parameter = args.join(",")
20
+ @version = global_options['ver']
21
+ @path = global_options['path']
22
+ end
23
+
24
+ def end_log(is_success)
25
+ @end_timestamp = Time.new.to_i
26
+ @is_success = is_success
27
+ @version = BigkeeperParser.version if @version == 'Version in Bigkeeper file'
28
+
29
+ # require
30
+ parameter = {'start_timestamp' => @start_timestamp, 'end_timestamp' =>@end_timestamp, 'user' =>@user, 'is_success' =>@is_success}
31
+
32
+ # optional
33
+ parameter = parameter.merge('command' => @command) unless @command == nil
34
+ parameter = parameter.merge('version' => @version) unless @version == nil || @version == ""
35
+ parameter = parameter.merge('parameter' => @parameter) unless @parameter == nil || @parameter == ""
36
+
37
+ leancloud_file = @command.split("/").first
38
+
39
+ send_log_cloud(leancloud_file, parameter)
40
+ end
41
+
42
+ def send_log_cloud(file_name, parameter)
43
+ if file_name == nil
44
+ return
45
+ end
46
+
47
+ if BigkeeperParser.global_configs("LeanCloudId") == nil || BigkeeperParser.global_configs("LeanCloudKey") == nil
48
+ return
49
+ end
50
+
51
+ header = assemble_request
52
+
53
+ uri = URI.parse("https://api.leancloud.cn/1.1/classes/#{file_name}")
54
+
55
+ https = Net::HTTP.new(uri.host, 443)
56
+ https.use_ssl = true
57
+ https.ssl_version = :TLSv1
58
+ https.verify_mode = OpenSSL::SSL::VERIFY_PEER
59
+ req = Net::HTTP::Post.new(uri.path, header)
60
+ req.body = parameter.to_json
61
+ res = https.request(req)
62
+
63
+ Logger.highlight("Send LeanCloud success, response #{res.body}")
64
+ end
65
+
66
+ def assemble_request
67
+ return {'Content-Type' =>'application/json', 'X-LC-Id' =>BigkeeperParser.global_configs("LeanCloudId"), 'X-LC-Key' =>BigkeeperParser.global_configs("LeanCloudKey")}
68
+ end
69
+
70
+ protected :send_log_cloud, :assemble_request
71
+ end
72
+ end
@@ -1,4 +1,5 @@
1
1
  require 'colorize'
2
+ require 'big_keeper/util/leancloud_logger'
2
3
 
3
4
  module BigKeeper
4
5
  DEFAULT_LOG = 1
@@ -18,23 +19,28 @@ module BigKeeper
18
19
  end
19
20
 
20
21
  def self.default(sentence)
21
- puts sentence.to_s.colorize(:default)
22
+ puts formatter_output(sentence).colorize(:default)
22
23
  end
23
24
 
24
25
  def self.highlight(sentence)
25
- puts sentence.to_s.colorize(:green)
26
+ puts formatter_output(sentence).colorize(:green)
26
27
  end
27
28
 
28
29
  def self.error(sentence)
29
- raise sentence.to_s.colorize(:red)
30
+ LeanCloudLogger.instance.end_log(false)
31
+ raise formatter_output(sentence).colorize(:red)
30
32
  end
31
33
 
32
34
  def self.warning(sentence)
33
- puts sentence.to_s.colorize(:yellow)
35
+ puts formatter_output(sentence).colorize(:yellow)
34
36
  end
35
37
 
36
38
  def self.separator
37
39
  puts "- - - - - - - - - - - - - - - - - - - - - - - - - - -".colorize(:light_blue)
38
40
  end
41
+
42
+ def self.formatter_output(sentence)
43
+ "[big] ".concat(sentence.to_s).to_s
44
+ end
39
45
  end
40
46
  end
@@ -10,12 +10,20 @@ module BigKeeper
10
10
  end
11
11
  Logger.highlight('Start pod install, waiting...')
12
12
  cmd = "pod install --project-directory=#{path}"
13
+ is_success = false
14
+ output_lines = ''
13
15
  Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
14
16
  while line = stdout.gets
15
- puts line
17
+ output_lines.concat("#{line}\n")
18
+ is_success = true if line.include? "Pod installation complete!"
16
19
  end
17
20
  end
18
- Logger.highlight('Finish pod install.')
21
+ if is_success
22
+ Logger.highlight('Finish pod install.')
23
+ else
24
+ puts output_lines
25
+ Logger.error("pod install error, please check your Podfile")
26
+ end
19
27
  end
20
28
 
21
29
  def self.pod_repo_push(path, module_name, source, version)
@@ -65,6 +73,6 @@ module BigKeeper
65
73
  end
66
74
  end
67
75
  end
68
-
76
+
69
77
  end
70
78
  end
@@ -1,3 +1,3 @@
1
1
  module BigKeeper
2
- VERSION = "0.8.6"
2
+ VERSION = "0.8.7"
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.8.6
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - mmoaay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-26 00:00:00.000000000 Z
11
+ date: 2018-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -278,6 +278,7 @@ files:
278
278
  - lib/big_keeper/command/spec/delete.rb
279
279
  - lib/big_keeper/command/spec/list.rb
280
280
  - lib/big_keeper/command/spec/search.rb
281
+ - lib/big_keeper/command/spec/sync.rb
281
282
  - lib/big_keeper/dependency/dep_gradle_operator.rb
282
283
  - lib/big_keeper/dependency/dep_operator.rb
283
284
  - lib/big_keeper/dependency/dep_pod_operator.rb
@@ -298,6 +299,7 @@ files:
298
299
  - lib/big_keeper/util/gitflow_operator.rb
299
300
  - lib/big_keeper/util/gradle_operator.rb
300
301
  - lib/big_keeper/util/info_plist_operator.rb
302
+ - lib/big_keeper/util/leancloud_logger.rb
301
303
  - lib/big_keeper/util/list_generator.rb
302
304
  - lib/big_keeper/util/logger.rb
303
305
  - lib/big_keeper/util/pod_operator.rb
@@ -334,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
334
336
  version: '0'
335
337
  requirements: []
336
338
  rubyforge_project:
337
- rubygems_version: 2.5.1
339
+ rubygems_version: 2.5.2.3
338
340
  signing_key:
339
341
  specification_version: 4
340
342
  summary: Efficiency improvement for iOS&Android modular development.