maptool 17.12.12

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c17454daf4c02e6b26fab0ecda5d4e101df625dc
4
+ data.tar.gz: a7c4db2727da2fc3b9bba4b6eb568b1866bcdb34
5
+ SHA512:
6
+ metadata.gz: 3a6e72495f1b8c9c8a5bd607f2db9fc0708b86f590e342657bc3ebcbe8cc0404db0009f15a03e7321d05682415740b63e880f0ac24ea0659b2de3b64093d4d81
7
+ data.tar.gz: ded851b75fc799e82351de12a2e8ac034d727ca846d54e714e65a5bf92794950c2509fbac41908648e95636cfc26a1b665cb934341302de54712f847ca50b4f8
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 阳君
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # MapTool
2
+
3
+ [![Language: Ruby](https://img.shields.io/badge/language-Ruby-orange.svg?style=flat)](https://www.ruby-lang.org/zh_cn/)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/937447974/YJCocoaGem/blob/master/LICENSE)
5
+ [![](https://img.shields.io/badge/gem-17.11.17-orange.svg?style=flat)](http://apparch.xiaojukeji.com:9292/gems/maptool)
6
+
7
+ 地图事业部 iOS 脚本工具,使用 gem 安装。
8
+
9
+ ```vim
10
+ gem install maptool
11
+ ```
12
+
13
+ ## 1 Dependency 命令
14
+
15
+ Dependency 命令主要用于代码依赖分析。支持如下两个功能:
16
+
17
+ 1. 分析库之间的依赖关系;
18
+ 2. 搜索不符合规范的 import 导入,库正确导入方式为 `#import <Foundation/Foundation.h>`,错误的方式是 `#import "Foundation.h"`。
19
+
20
+ 执行 Dependency 命令指定库文件夹即可,分析完毕会自动生成日志并打开。
21
+
22
+ ```
23
+ maptool dependency --dir=/Users/didi/Desktop/Pods/MapAnalogNavigation/Pod
24
+ ```
25
+
26
+ ## 2 Release 命令
27
+
28
+ Release 命令主要用于发版时收集 pod 内 tag,并使用[飞歌服务](http://wiki.intra.xiaojukeji.com/pages/viewpage.action?pageId=111910871)推送到钉钉群。
29
+
30
+ 执行 Tag 收集命令
31
+
32
+ ```
33
+ maptool release --sender=员工号 --podfile=/Users/didi/Desktop/DiDi/one-integration/OnePods.rb
34
+ ```
35
+
36
+ ## 3 Tag 命令
37
+
38
+ Tag 命令主要用于规范开发人员的 tag。生成 tag 的样式:库名-version-stage-时间戳-suffix
39
+
40
+ 首次打tag或升级版本号
41
+
42
+ ```
43
+ maptool tag --version=x.xx.xxx --stage=阶段 --suffix=后缀
44
+ ```
45
+
46
+ 只更新时间戳打 Tag:
47
+
48
+ ```
49
+ maptool tag
50
+ ```
51
+
52
+ ----------
53
+
54
+ # Appendix
55
+
56
+ ## Author
57
+
58
+ 阳君 <yangjunyang@didichuxing.com>
59
+
60
+ ## GitLab
61
+
62
+ [https://git.xiaojukeji.com/mapkit-ios/maptool](https://git.xiaojukeji.com/mapkit-ios/maptool)
63
+
64
+ ## Copyright
65
+
66
+ maptool 是滴滴内部项目,默认不对外开源。
data/bin/maptool ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby_executable_hooks
2
+ #
3
+ # maptool
4
+ # maptool
5
+ #
6
+ # Created by 阳君 on 17/11/8.
7
+ # Copyright © 2017年 DiDiChuXing. All rights reserved.
8
+ #
9
+
10
+ if $PROGRAM_NAME == __FILE__
11
+ lib = File.expand_path('../../lib', __FILE__)
12
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
13
+ end
14
+
15
+ require 'maptool'
16
+ MapTool::Command.run(ARGV)
data/lib/maptool.rb ADDED
@@ -0,0 +1,13 @@
1
+ #
2
+ # gem_version.rb
3
+ #
4
+ # Created by 阳君 on 17/8/1.
5
+ # Copyright © 2017年 DiDiChuXing. All rights reserved.
6
+ #
7
+
8
+ require 'claide'
9
+ require 'colored2'
10
+
11
+ module YJCocoa
12
+ require 'maptool/command'
13
+ end
@@ -0,0 +1,38 @@
1
+ #
2
+ # command.rb
3
+ #
4
+ # Created by 阳君 on 17/11/8.
5
+ # Copyright © 2017年 DiDiChuXing. All rights reserved.
6
+ #
7
+
8
+ require 'maptool/gem_version'
9
+
10
+ module MapTool
11
+
12
+ # Usage
13
+ class Command < CLAide::Command
14
+
15
+ DEFAULT_OPTIONS = [['--help', 'Show help banner of specified command'],]
16
+
17
+ self.abstract_command = true
18
+ self.command = 'maptool'
19
+ self.version = VERSION
20
+ self.description = 'MapTool, the Map developer managment tool.'
21
+
22
+ def self.options
23
+ if root_command?
24
+ DEFAULT_ROOT_OPTIONS + DEFAULT_OPTIONS
25
+ else
26
+ DEFAULT_OPTIONS
27
+ end
28
+ end
29
+ end
30
+
31
+ # Commands
32
+ require 'maptool/dependency/dependency'
33
+ require 'maptool/log/log'
34
+ require 'maptool/release/release'
35
+ require 'maptool/tag/tag'
36
+
37
+ end
38
+
@@ -0,0 +1,167 @@
1
+ #
2
+ # dependency.rb
3
+ #
4
+ # Created by 阳君 on 17/11/15.
5
+ # Copyright © 2017年 DiDiChuXing. All rights reserved.
6
+ #
7
+
8
+ require 'maptool/dependency/product_class'
9
+
10
+ module MapTool
11
+
12
+ # Usage
13
+ class Dependency < Command
14
+
15
+ self.command = 'dependency'
16
+ self.summary = '代码依赖分析'
17
+ self.description = <<-DESC
18
+ 代码依赖分析\n
19
+ 1. 分析库之间的依赖关系;\n
20
+ 2. 搜索不符合规范的 import 导入,库正确导入方式为 '#import <Foundation/Foundation.h>',错误的方式是'#import "Foundation.h"'.
21
+ DESC
22
+
23
+ def self.options
24
+ [['--dir', '库路径,多个库用’,‘号分割'],
25
+ ['--output', '日志存放路径,默认当前路径']] + super
26
+ end
27
+
28
+ attr_accessor :dir_array # 目录
29
+ attr_accessor :output # 输出地址
30
+ attr_accessor :ignore_frameworks # 忽略的外部库
31
+
32
+ def initialize(argv)
33
+ super
34
+ self.dir_array = argv.option('dir')
35
+ self.output = argv.option('output')
36
+ if self.dir_array
37
+ self.dir_array = self.dir_array.split(",").reject {|i|
38
+ i.empty? || !Dir.exist?(i)
39
+ }
40
+ end
41
+ self.output = Dir.pwd unless self.output
42
+ self.output << "/MapToolDependency.log"
43
+ self.ignore_frameworks = ["AppKit", "Foundation", "UIKit", "WatchKit"]
44
+ end
45
+
46
+ def validate!
47
+ super
48
+ unless self.dir_array && !self.dir_array.empty?
49
+ puts "库路径为空或不存在".red
50
+ self.banner!
51
+ end
52
+ end
53
+
54
+ def run
55
+ log = "MapTool 代码依赖分析\n"
56
+ files = self.search_files
57
+ log << "文件数:#{files.size}\n"
58
+ products = self.parsing_files(files)
59
+ log << "class数:#{products.size}\n"
60
+ log << self.parsing_class(products)
61
+ puts "\n分析完毕,打开日志:#{self.output}".green
62
+ File.write(self.output, log)
63
+ `open #{self.output}`
64
+ end
65
+
66
+ def search_files
67
+ puts "\n搜索文件...".green
68
+ files = []
69
+ for dir in self.dir_array do
70
+ Dir.chdir(dir) {
71
+ puts dir
72
+ for path in Dir["**/*.{h,m,mm}"] do
73
+ files << "#{dir}/#{path}"
74
+ end
75
+ }
76
+ end
77
+ files.uniq!
78
+ files.sort!
79
+ end
80
+
81
+ def parsing_files(files)
82
+ puts "\n分析文件...".green
83
+ hash = {}
84
+ for file in files
85
+ puts file
86
+ fileName = File.basename(file).split(".").first
87
+ product_class = hash[fileName]
88
+ unless product_class
89
+ product_class = ProductClass.new(fileName)
90
+ hash[fileName] = product_class
91
+ end
92
+ case File.extname(file)
93
+ when ".h"
94
+ product_class.h_path = file
95
+ when ".m"
96
+ product_class.m_path = file
97
+ when ".mm"
98
+ product_class.mm_path = file
99
+ end
100
+ end
101
+ return hash
102
+ end
103
+
104
+ def parsing_class(products)
105
+ puts "\n分析文件内容...".green
106
+ log = ""
107
+ all_frameworks = []
108
+ for project in products.values
109
+ puts project.name
110
+ templog = ""
111
+ hlog = self.parsing_content(project.h_path, all_frameworks, products) if project.h_path
112
+ templog << hlog if hlog
113
+ mlog = self.parsing_content(project.m_path, all_frameworks, products) if project.m_path
114
+ templog << mlog if mlog
115
+ mmlog = self.parsing_content(project.mm_path, all_frameworks, products) if project.mm_path
116
+ templog << mmlog if mmlog
117
+ log << "\n#{project.name}\n#{templog}" unless templog.empty?
118
+ end
119
+ all_frameworks.uniq!
120
+ all_frameworks.sort!
121
+ return "外部依赖汇总:#{all_frameworks.size} #{all_frameworks.to_s}\n\n" + log
122
+ end
123
+
124
+ def parsing_content(file, all_frameworks, products)
125
+ frameworks = []
126
+ warning = []
127
+ error = []
128
+ File.open(file, "r") { |file|
129
+ while line = file.gets
130
+ if line.include?("#import")
131
+ if line.include?("<")
132
+ import = line[/<.*>/][/<.*\//]
133
+ if import
134
+ import[0] = ""
135
+ import[-1] = ""
136
+ frameworks << import unless self.ignore_frameworks.include?(import)
137
+ else
138
+ error << line.chomp
139
+ end
140
+ elsif line.include?(".h\"")
141
+ import = line[/".*.h"/]
142
+ import[0] = ""
143
+ import[-1] = ""
144
+ warning << import unless products[import[0..import.size-3]]
145
+ end
146
+ elsif line.include?("@protocol") || line.include?("@interface") || line.include?("@implementation")
147
+ break
148
+ end
149
+ end
150
+ }
151
+ all_frameworks.concat(frameworks)
152
+ frameworks.uniq!
153
+ frameworks.sort!
154
+ if !frameworks.empty? || !warning.empty? || !error.empty?
155
+ log = "#{file}\n"
156
+ log << "外部依赖:#{frameworks.to_s}\n" unless frameworks.empty?
157
+ log << "错误依赖:#{error.to_s}\n" unless error.empty?
158
+ log << "不合理依赖:#{warning.to_s}\n" unless warning.empty?
159
+ return log
160
+ end
161
+ return nil
162
+ end
163
+
164
+ end
165
+
166
+ end
167
+
@@ -0,0 +1,24 @@
1
+ #
2
+ # dependency.rb
3
+ #
4
+ # Created by 阳君 on 17/11/15.
5
+ # Copyright © 2017年 DiDiChuXing. All rights reserved.
6
+ #
7
+
8
+ module MapTool
9
+
10
+ # Usage
11
+ class ProductClass
12
+
13
+ attr_accessor :name
14
+ attr_accessor :h_path
15
+ attr_accessor :m_path
16
+ attr_accessor :mm_path
17
+
18
+ def initialize(name)
19
+ self.name = name
20
+ end
21
+
22
+ end
23
+
24
+ end
@@ -0,0 +1,15 @@
1
+ #
2
+ # gem_version.rb
3
+ #
4
+ # Created by 阳君 on 17/11/8.
5
+ # Copyright © 2017年 DiDiChuXing. All rights reserved.
6
+ #
7
+
8
+ require 'date'
9
+
10
+ module MapTool
11
+
12
+ # %y.%m.%d.%H
13
+ VERSION = Time.now.strftime("%y.%m.%d").freeze unless defined? MapTool::VERSION
14
+
15
+ end
@@ -0,0 +1,74 @@
1
+ #
2
+ # log.rb
3
+ #
4
+ # Created by 阳君 on 17/12/12.
5
+ # Copyright © 2017年 DiDiChuXing. All rights reserved.
6
+ #
7
+
8
+ require 'date'
9
+ require 'json'
10
+
11
+ module MapTool
12
+
13
+ # Usage
14
+ class Log < Command
15
+
16
+ self.command = 'log'
17
+ self.summary = 'log 日志解析,并保留需要的记录'
18
+ self.description = <<-DESC
19
+ log 日志解析,并保留需要的记录\n
20
+ 1. 以文件夹的方式解析,并将解析后的日志存放在文件夹内。\n
21
+ 2. 解析时使用字符串匹配,匹配成功的记录会保留 MapTool.log 中。
22
+ DESC
23
+
24
+ def self.options
25
+ [['--dir', '文件夹地址'],
26
+ ['--match', '匹配的字符串']] + super
27
+ end
28
+
29
+ attr_accessor :dir # 文件夹地址
30
+ attr_accessor :match # 匹配的字符串
31
+
32
+ # 初始化
33
+ def initialize(argv)
34
+ super
35
+ self.dir = argv.option('dir')
36
+ self.match = argv.option('match')
37
+ end
38
+
39
+ # businrss
40
+ def validate!
41
+ super
42
+ unless self.dir && Dir.exist?(dir) {
43
+ puts "dir:#{dir} 文件夹不存在".red
44
+ self.banner!
45
+ }
46
+ unless self.match && self.match.length > 0 {
47
+ puts "match 为空".red
48
+ self.banner!
49
+ }
50
+ end
51
+
52
+ def run
53
+ Dir.chdir(dir) {
54
+ log = ""
55
+ File.delete(LOG_FILE) if File.exist?(LOG_FILE)
56
+ for path in Dir["**/*.log"] do
57
+ puts "解析 #{path}"
58
+ File.open(path, "r") { |file|
59
+ while line = file.gets
60
+ if line.include?(match)
61
+ log << line
62
+ end
63
+ end
64
+ }
65
+ end
66
+ File.write(LOG_FILE, log)
67
+ `open #{LOG_FILE}`
68
+ }
69
+ end
70
+
71
+ end
72
+
73
+ end
74
+
@@ -0,0 +1,141 @@
1
+ #
2
+ # release.rb
3
+ #
4
+ # Created by 阳君 on 17/11/14.
5
+ # Copyright © 2017年 DiDiChuXing. All rights reserved.
6
+ #
7
+
8
+ require 'json'
9
+ require 'net/https'
10
+ require 'uri'
11
+
12
+ module MapTool
13
+
14
+ # Usage
15
+ class Release < Command
16
+
17
+ self.command = 'release'
18
+ self.summary = '收集 pod 的 tag 并发送到钉钉群'
19
+ self.description = <<-DESC
20
+ 收集 pod 的 tag 并发送到钉钉群。
21
+
22
+ 注意事项: podfil 和 sender 不可为空。
23
+ DESC
24
+
25
+ def self.options
26
+ [['--sender', '发送者员工号,如D11221,必须是群内人员'],
27
+ ['--podfile', '包含 pods 库的 Podfile 路径'],
28
+ ['--pods', "pods 库,“,”分割。默认地图事业部的库"],
29
+ ['--content', "内容,默认“@所有人 有更新吗?今天发版,请尽快确认 Tag。”"]] + super
30
+ end
31
+
32
+ attr_accessor :podfile # 文件路径
33
+ attr_accessor :pods # pod 库
34
+ attr_accessor :sender # 发送者员工号
35
+ attr_accessor :content # 默认内容
36
+
37
+ # 初始化
38
+ def initialize(argv)
39
+ super
40
+ self.podfile = argv.option('podfile')
41
+ self.pods = argv.option('pods')
42
+ self.sender = argv.option('sender')
43
+ self.content = argv.option('content')
44
+ self.pods = self.pods.split(",").reject {|i| i.empty? } if self.pods
45
+ # default
46
+ self.content = "@所有人 有更新吗?今天发版,请尽快确认 Tag。" unless self.content
47
+ self.content << "\n\n"
48
+ unless self.pods
49
+ self.pods = ['DiDiHomePageMapManager',
50
+ 'DiDiLocationMiddleware',
51
+ 'DiDiMapBusiness',
52
+ 'DMPoiService',
53
+ 'OneKeyReport',
54
+ 'ONEPassengerOrderMap',
55
+ 'ONESelectAddressModule',
56
+ 'ONESTakeCarPlaceBusiness',
57
+ 'DiDiMap',
58
+ 'DiDiLocation',
59
+ 'MapAnalogNavigation',
60
+ 'DMap',
61
+ 'ONESOSOMap',
62
+ 'DiMapKit']
63
+ end
64
+ end
65
+
66
+ # businrss
67
+ def validate!
68
+ super
69
+ puts "podfile 为空".red unless self.podfile
70
+ puts "sender 为空".red unless self.sender
71
+ self.banner! unless self.podfile && self.sender
72
+ end
73
+
74
+ def run
75
+ if File.exist?(self.podfile)
76
+ self.gitPull
77
+ File.open(self.podfile, "r") { |file|
78
+ while line = file.gets #标准输入流
79
+ result = check(line)
80
+ self.content << "#{result}\n" if result
81
+ end
82
+ }
83
+ self.send
84
+ else
85
+ puts "文件# {filePath} 不存在".red
86
+ end
87
+ end
88
+
89
+ def gitPull
90
+ puts "#{self.podfile} git pull".green
91
+ Dir.chdir(File.dirname(self.podfile)) {| path |
92
+ system("yjcocoa git pull")
93
+ }
94
+ end
95
+
96
+ private def check (line)
97
+ pods.each { |pod|
98
+ if line.include?(pod)
99
+ pods.delete(pod)
100
+ line.split(',').each { |item|
101
+ if item.include?("tag")
102
+ return "#{pod}, #{item.chomp}"
103
+ end
104
+ }
105
+ end
106
+ }
107
+ return nil
108
+ end
109
+
110
+ def send
111
+ params = {}
112
+ params["token"] = 'y2uxndvkoweyndixmdaw'
113
+ # 测试 chat206c428d46590571b24cb54b1318a040
114
+ # 发版 chat326235a84efbc799daaf5d72522cb8fd
115
+ params["chatId"] = 'chat326235a84efbc799daaf5d72522cb8fd'
116
+ params["retry"] = 'false'
117
+ params["sender"] = self.sender
118
+ params["content"] = self.content
119
+ puts "\nsend 钉钉".green
120
+ puts self.content
121
+ # send
122
+ base_path = 'http://api-kylin.intra.xiaojukeji.com/prod_feige_service'
123
+ uri = URI.parse("#{base_path}/feige/sendDingGroup")
124
+ req = Net::HTTP::Post.new(uri.path, {'Content-Type' => 'application/json'})
125
+ req.body = params.to_json
126
+ res = Net::HTTP.new(uri.host, uri.port).start{|http|
127
+ http.request(req)
128
+ }
129
+ # resbody
130
+ resbody = JSON.parse(res.body)
131
+ puts resbody
132
+ if resbody["code"].to_s == "0"
133
+ puts "send succeed: #{resbody['message']}".green
134
+ else
135
+ puts "send error: #{resbody['message']}".red
136
+ end
137
+ end
138
+
139
+ end
140
+
141
+ end
@@ -0,0 +1,110 @@
1
+ #
2
+ # tag.rb
3
+ #
4
+ # Created by 阳君 on 17/11/14.
5
+ # Copyright © 2017年 DiDiChuXing. All rights reserved.
6
+ #
7
+
8
+ require 'date'
9
+ require 'json'
10
+
11
+ module MapTool
12
+
13
+ # Usage
14
+ class Tag < Command
15
+
16
+ self.command = 'tag'
17
+ self.summary = '生成 tag 并推送到 GitLab'
18
+ self.description = <<-DESC
19
+ 生成 tag 并推送到 GitLab。\n
20
+ 生成的 tag 样式: 库名-version-stage-时间戳-suffix\n
21
+ 使用方式:首次或更新版本提交“maptool tag --version=? --stage=? --suffix=?”;只更新时间戳提交“maptool tag”。\n
22
+ 注意事项: version标准写法: x.xx.xxx。重大需求和重构升级第一位,第二位和第三位设为00.000;pm 一般需求升级第二位,第三位设为000;bug 修复升级第三位。
23
+ DESC
24
+
25
+ def self.options
26
+ [['--version', '版本号:x.xx.xxx,默认 1.00.000'],
27
+ ['--stage', '用于区分是否正式: 开发阶段/提测后 (dev/release),默认 release'],
28
+ ['--suffix', '可扩展的后缀']] + super
29
+ end
30
+
31
+ TAG_FILE = ".tagfile"
32
+
33
+ attr_accessor :name # 名称
34
+ attr_accessor :version # 版本号
35
+ attr_accessor :stage # 阶段
36
+ attr_accessor :suffix # 后缀
37
+
38
+ # 初始化
39
+ def initialize(argv)
40
+ super
41
+ self.version = argv.option('version')
42
+ self.stage = argv.option('stage')
43
+ self.suffix = argv.option('suffix')
44
+ end
45
+
46
+ # businrss
47
+ def validate!
48
+ super
49
+ unless File.exist?('.git')
50
+ puts "需在项目根目录执行".red
51
+ self.banner!
52
+ end
53
+ if self.version && self.version.size < 8 #x.xx.xxx
54
+ puts "版本号 #{self.version} 不符合规范 x.xx.xxx".red
55
+ self.banner!
56
+ end
57
+ end
58
+
59
+ def run
60
+ if File.exist?(TAG_FILE) # 文件存在
61
+ save = self.version || self.stage || self.suffix
62
+ self.read_file
63
+ self.commit_file if save
64
+ else
65
+ self.name = File.basename(Dir.pwd)
66
+ self.version = "1.00.000" unless self.version
67
+ self.stage = "release" unless self.stage
68
+ self.commit_file
69
+ end
70
+ self.commit_tag
71
+ end
72
+
73
+ def read_file
74
+ hash = JSON.parse(File.read(TAG_FILE))
75
+ self.name = hash["name"]
76
+ self.version = hash["version"] unless self.version
77
+ self.stage = hash["stage"] unless self.stage
78
+ self.suffix = hash["suffix"] unless self.suffix
79
+ end
80
+
81
+ def commit_file
82
+ puts "update #{TAG_FILE}".green
83
+ localChanges = !(`git stash` =~ /No local changes to save/)
84
+ self.write_file
85
+ `git add .`
86
+ `git commit -m "update #{TAG_FILE}"`
87
+ `git push`
88
+ `git stash pop` if localChanges
89
+ end
90
+
91
+ def write_file
92
+ params = {}
93
+ params["name"] = self.name
94
+ params["version"] = self.version
95
+ params["stage"] = self.stage
96
+ params["suffix"] = self.suffix
97
+ File.write(TAG_FILE, JSON.pretty_generate(params))
98
+ end
99
+
100
+ def commit_tag
101
+ tag = "#{self.name}-#{self.version}-"
102
+ tag << "#{self.stage}-" if self.stage && self.stage.size > 0
103
+ tag << Time.now.strftime("%Y%m%d%H%M")
104
+ tag << "-#{self.suffix}" if self.suffix && self.suffix.size > 0
105
+ puts "build tag #{tag}".green
106
+ system("yjcocoa git tag --add=#{tag}")
107
+ end
108
+ end
109
+
110
+ end
@@ -0,0 +1,12 @@
1
+
2
+
3
+
4
+
5
+ LOG_FILE = "MapTool.log"
6
+
7
+ dir="/Users/didi/Desktop/未命名文件夹"
8
+ match="[SCTX]"
9
+
10
+ puts Dir.exist?(dir)
11
+
12
+
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: maptool
3
+ version: !ruby/object:Gem::Version
4
+ version: 17.12.12
5
+ platform: ruby
6
+ authors:
7
+ - 阳君
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-12-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: claide
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.2
33
+ - !ruby/object:Gem::Dependency
34
+ name: colored2
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.1.2
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '3.1'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 3.1.2
53
+ - !ruby/object:Gem::Dependency
54
+ name: yjcocoa
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '17.8'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 17.8.26
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '17.8'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 17.8.26
73
+ description: 地图事业部 iOS 脚本工具
74
+ email:
75
+ - yangjunyang@didichuxing.com
76
+ executables:
77
+ - maptool
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - LICENSE
82
+ - README.md
83
+ - bin/maptool
84
+ - lib/maptool.rb
85
+ - lib/maptool/command.rb
86
+ - lib/maptool/dependency/dependency.rb
87
+ - lib/maptool/dependency/product_class.rb
88
+ - lib/maptool/gem_version.rb
89
+ - lib/maptool/log/log.rb
90
+ - lib/maptool/release/release.rb
91
+ - lib/maptool/tag/tag.rb
92
+ - lib/maptool/test.rb
93
+ homepage: https://git.xiaojukeji.com/mapkit-ios/maptool
94
+ licenses:
95
+ - MIT
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 2.0.0
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.4.8
114
+ signing_key:
115
+ specification_version: 3
116
+ summary: MapTool, the Map developer managment tool.
117
+ test_files: []