gct 0.3.2 → 0.3.3

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
  SHA256:
3
- metadata.gz: a648ad54002c10e7bca827874e2337664c37dc5a8ead58a1cdd8812e3440ba22
4
- data.tar.gz: 001e5c7c782b750bb32ac0ad18c2510d0f6f1792d8ceb6bd53463cf1b5e2692f
3
+ metadata.gz: a0f7fd4929009c39da92495a65340bad50a94efb0fb82fae4e2e3414a77f296c
4
+ data.tar.gz: d8aeb513fefded8048dd91087d716518f00d620dc2e7db0ef8f02164422110d2
5
5
  SHA512:
6
- metadata.gz: 265ee8a53c3682419d8be2e9a223e44d70cbd3a314cc10e8db270566f2389bb2f0adc7c879c53984d5fce867130b8ac0e4586417f8b44f6f93660c216867590d
7
- data.tar.gz: 8c0e81952eeb1d9807598c4bfd3afe67d0a252c7739065130d60d67c56eb67aafeab91c872f81890222d034c40240dc53f87880da4a47166a764a80f253601c5
6
+ metadata.gz: baac27cf9bf1de60ac52f4edf41ca0fb42f3ac7807e004bdb43670d3eab3afede65f18d74d966be1c16e00a28ee13be455d60ebd9d0b01fe051590f294777c45
7
+ data.tar.gz: 8a6953a83ec3191fce0f93e8a8ca865c0f4f7eb5ed2557a5937c125ca67f4a4d70656063849fd6b22520aa43bd7152c018b2edca9d596b0bbaa4444786cb73b7
data/lib/gct.rb CHANGED
@@ -1,7 +1,16 @@
1
1
 
2
2
  module Gct
3
- require "gct/version"
3
+ require "gct/gct_version"
4
4
  require "gct/constant"
5
- autoload :Command, 'gct/command'
5
+ require "gct/specification"
6
+ require "gct/temp_local_file"
7
+ require "gct/temp_remote_file"
8
+ require "gct/file_base"
9
+
10
+ autoload :Command, 'gct/command'
11
+
12
+ module Generator
13
+ require "gct/generator/gct_file"
14
+ end
6
15
 
7
16
  end
@@ -2,6 +2,7 @@ require 'colored2'
2
2
  require 'claide'
3
3
  require 'molinillo/errors'
4
4
  require 'xcodeproj'
5
+ require 'gitlab'
5
6
 
6
7
  module Molinillo
7
8
  class ResolverError
@@ -17,13 +18,14 @@ module Gct
17
18
  class Command < CLAide::Command
18
19
  require 'gct/command/create'
19
20
  require 'gct/command/init'
20
- # require 'gct/command/config'
21
- require 'gct/command/analyze'
21
+ require 'gct/command/config'
22
+ # require 'gct/command/analyze'
22
23
  require 'gct/command/op'
23
24
  require 'gct/command/build'
24
25
  require 'gct/command/spec'
25
26
  require 'gct/command/repo'
26
- require 'gct/command/tag'
27
+ require 'gct/command/setup'
28
+ require 'gct/command/update'
27
29
 
28
30
  self.abstract_command = true
29
31
  self.command = 'gct'
@@ -48,6 +50,53 @@ module Gct
48
50
  Colored2.disable!
49
51
  String.send(:define_method, :colorize) { |string, _| string }
50
52
  end
53
+
54
+ config_gitlab
55
+ end
56
+
57
+ def file_contents(project_id, file, branch)
58
+ file_contents ||= Gitlab.file_contents(project_id, file, branch)
59
+ rescue Gitlab::Error::NotFound => error
60
+ raise error.message
61
+ end
62
+
63
+ def config_gitlab
64
+ token = Config.get_config("token")
65
+ raise "请先配置token!gct config set token GITLAB_PERSON_TOKEN".red if token.nil?
66
+ Gitlab.configure do |config|
67
+ config.endpoint = 'https://gi-dev.ccrgt.com/api/v4'
68
+ config.private_token = token
69
+ end
70
+ end
71
+
72
+ def get_project
73
+ proj = nil
74
+ Dir.entries(Dir.pwd).each do |subfile|
75
+ if subfile.include? '.xcodeproj'
76
+ proj = subfile
77
+ end
78
+ end
79
+ if proj.nil?
80
+ puts '没有找到.xcodeproj文件'.red if proj.nil?
81
+ nil
82
+ else
83
+ project_path = File.join(Dir.pwd, "./" + proj)
84
+ project = Xcodeproj::Project.open(project_path)
85
+ project
86
+ end
87
+ end
88
+
89
+ def auto_add_tag(tag)
90
+ tag_points = tag.to_s.split('.')
91
+ index = tag_points.length - 1
92
+ need_add_point = tag_points[index].to_i + 1
93
+ tag_points[index] = need_add_point == 10 ? 0 : need_add_point
94
+ while need_add_point == 10 && index > 0
95
+ index = index - 1
96
+ need_add_point = tag_points[index].to_i + 1
97
+ tag_points[index] = need_add_point == 10 && index != 0 ? 0 : need_add_point
98
+ end
99
+ tag_points.join('.')
51
100
  end
52
101
  end
53
102
  end
@@ -1,5 +1,6 @@
1
1
  require 'pathname'
2
2
  require 'tmpdir'
3
+ require 'parallel'
3
4
 
4
5
  module Gct
5
6
  class Command
@@ -9,7 +10,16 @@ module Gct
9
10
  分析podfile完整依赖链,并输出json文件.
10
11
  DESC
11
12
 
13
+ self.arguments = [
14
+ CLAide::Argument.new('PROJECT_ID', true),
15
+ CLAide::Argument.new('FILE', true),
16
+ CLAide::Argument.new('BRANCH', true),
17
+ ]
18
+
12
19
  def initialize(argv)
20
+ @project_id = argv.shift_argument
21
+ @file = argv.shift_argument
22
+ @branch = argv.shift_argument
13
23
  super
14
24
  end
15
25
 
@@ -19,11 +29,98 @@ module Gct
19
29
  end
20
30
 
21
31
  def validate!
32
+ help! '必须输入项目名.' unless @project_id
33
+ help! '必须输入读取文件的相对路径.' unless @file
34
+ help! '必须输入读取文件的项目分支.' unless @branch
22
35
  super
23
36
  end
24
37
 
25
38
  def run
26
- system "pod dep"
39
+ analyze_dependencies
40
+ # update_podspec_version()
41
+ end
42
+
43
+ def podfile
44
+ contents = file_contents(@project_id, @file, @branch)
45
+ contents.force_encoding('UTF-8')
46
+
47
+ temp_local_file = TempLocalFile.new(contents, @file)
48
+ temp_local_file.write
49
+ full_path = temp_local_file.full_path
50
+
51
+ @podfile ||= begin
52
+ podfile = Pod::Podfile.from_ruby(full_path, contents)
53
+ podfile
54
+ end
55
+ end
56
+
57
+ def analyze_dependencies
58
+ untagged_git_dependencies = podfile.dependencies.select { |dependency| dependency.external? && dependency.external_source[:tag].nil? && dependency.external_source[:branch] == Constant.DefaultTagBranch}
59
+ puts untagged_git_dependencies
60
+ # untagged_specs = Parallel.map(untagged_git_dependencies, in_threads: 1) do |dep|
61
+ # require 'json'
62
+ # puts "#{Constant.NameSpace}#{dep.name}"
63
+ # puts "#{dep.name}.podspec"
64
+ # puts Constant.DefaultTagBranch
65
+
66
+ # contents_json = file_contents("#{Constant.NameSpace}#{dep.name}", "#{dep.name}.podspec", Constant.DefaultTagBranch)
67
+ # podspec = system contents_json
68
+ # puts podspec.class
69
+ # puts podspec
70
+ # podspec = from_string("", contents_json)
71
+ # podspec = Pod::Spec.new do |spec|
72
+
73
+ # end
74
+
75
+
76
+ # puts podspec.class.to_s
77
+ # puts podspec.to_s
78
+ # gct_spec = Specification.new()
79
+ # gct_spec.specification = podspec
80
+ # gct_spec.priority = 1000
81
+ # gct_spec.status = SpecPublishStatus::CREATED
82
+ # gct_spec.tag = "0"
83
+
84
+ # update_podspec_version(spec)
85
+ # gct_spec
86
+ # end
87
+ end
88
+
89
+ def update_podspec_version(spec)
90
+ content = file_contents("#{Constant.NameSpace}#{dep.name}", "#{spec.name}.podspec", Constant.DefaultTagBranch)
91
+ now_version = spec.version
92
+ version = auto_add_tag(now_version)
93
+ require_variable_prefix = true
94
+ version_var_name = 'version'
95
+ variable_prefix = require_variable_prefix ? /\w\./ : //
96
+ version_regex = /^(?<begin>[^#]*#{variable_prefix}#{version_var_name}\s*=\s*['"])(?<value>(?<major>[0-9]+)(\.(?<minor>[0-9]+))?(\.(?<patch>[0-9]+))?(?<appendix>(\.[0-9]+)*)?(-(?<prerelease>(.+)))?)(?<end>['"])/i
97
+ version_match = version_regex.match(content)
98
+ updated_podspec_content = content.gsub(version_regex, "#{version_match[:begin]}#{version}#{version_match[:end]}")
99
+ updated_podspec_content
100
+
101
+ edit_file(spec, updated_podspec_content, version)
102
+ mr_to_master(spec)
103
+ end
104
+
105
+
106
+
107
+ def edit_file(spec, content, version)
108
+ Gitlab.edit_file("#{Constant.NameSpace}#{dep.name}", "#{spec.name}.podspec", Constant.DefaultTagBranch, content, "@config 升级版本号:#{version}")
109
+ end
110
+
111
+ def mr_to_master(spec)
112
+ mr = Gitlab.create_merge_request("#{Constant.NameSpace}#{dep.name}", "podpesc修改", { source_branch: 'develop', target_branch: 'master' })
113
+ id = mr.iid
114
+ puts mr.to_hash
115
+ if mr.merge_status == 'cannot_be_merged'
116
+ raise "Merge有冲突,请前往 https://gi-dev.ccrgt.com/#{Constant.NameSpace}#{spec.name}/merge_requests/#{id} 解决".red
117
+ end
118
+
119
+ accept_merge_request(spec, id)
120
+ end
121
+
122
+ def accept_merge_request(spec, id)
123
+ Gitlab.accept_merge_request("#{Constant.NameSpace}#{dep.name}", id)
27
124
  end
28
125
  end
29
126
  end
@@ -24,19 +24,8 @@ module Gct
24
24
 
25
25
  def buildR
26
26
  puts "starting search R script ...".green
27
- proj = ''
28
- Dir.entries(Dir.pwd).each do |subfile|
29
- if subfile.include? '.xcodeproj'
30
- proj = subfile
31
- end
32
- end
33
-
34
- if proj == ''
35
- puts '没有找到.xcodeproj文件'.red
36
- else
37
- project_path = File.join(Dir.pwd, "./" + proj)
38
- project = Xcodeproj::Project.open(project_path)
39
-
27
+ project = get_project
28
+ if project
40
29
  objects = project.objects
41
30
  findR = false
42
31
  objects.each do |obj|
@@ -4,11 +4,39 @@ require 'gct/command/config/get'
4
4
  module Gct
5
5
  class Command
6
6
  class Config < Command
7
- self.abstract_command = true
8
7
  self.summary = 'gct 配置'
9
8
  self.description = <<-DESC
10
9
  配置全局链接等
11
10
  DESC
11
+
12
+ def initialize(argv)
13
+ @list = argv.flag?('list', false)
14
+ super
15
+ end
16
+
17
+ def run
18
+ # get_all_config if @list
19
+ end
20
+
21
+ def self.options
22
+ [
23
+ ['--list', '打印config所有信息'],
24
+ ].concat(super)
25
+ end
26
+
27
+ def self.get_config(key)
28
+ file_base = FileBase.new(config_path)
29
+ file_base.yaml_read(key)
30
+ end
31
+
32
+ def self.set_config(key, value)
33
+ file_base = FileBase.new(config_path)
34
+ file_base.yaml_write(key, value)
35
+ end
36
+
37
+ def self.config_path
38
+ "#{Generator::GctFile.config_file_path}"
39
+ end
12
40
  end
13
41
  end
14
42
  end
@@ -9,25 +9,21 @@ module Gct
9
9
  DESC
10
10
 
11
11
  self.arguments = [
12
- CLAide::Argument.new('NAME', true),
12
+ CLAide::Argument.new('KEY', true),
13
13
  ]
14
14
 
15
15
  def initialize(argv)
16
- @name = argv.shift_argument
16
+ @key = argv.shift_argument
17
17
  super
18
- @additional_args = argv.remainder!
19
18
  end
20
19
 
21
20
  def validate!
22
21
  super
23
- help! 'A name for the Pod is required.' unless @name
24
- help! 'The Pod name cannot contain spaces.' if @name =~ /\s/
25
- help! 'The Pod name cannot contain plusses.' if @name =~ /\+/
26
- help! "The Pod name cannot begin with a '.'" if @name[0, 1] == '.'
22
+ help! '请输入key.' unless @key
27
23
  end
28
24
 
29
25
  def run
30
- puts "获取全局配置成功".green
26
+ puts "#{@key}: #{get_config(@key)}"
31
27
  end
32
28
  end
33
29
  end
@@ -8,26 +8,25 @@ module Gct
8
8
  设置gct全局配置.
9
9
  DESC
10
10
 
11
- # self.arguments = [
12
- # CLAide::Argument.new('NAME', true),
13
- # ]
11
+ self.arguments = [
12
+ CLAide::Argument.new('KEY', true),
13
+ CLAide::Argument.new('VALUE', true),
14
+ ]
14
15
 
15
16
  def initialize(argv)
16
- @name = argv.shift_argument
17
+ @key = argv.shift_argument
18
+ @value = argv.shift_argument
17
19
  super
18
- # @additional_args = argv.remainder!
19
20
  end
20
21
 
21
22
  def validate!
22
23
  super
23
- # help! 'A name for the Pod is required.' unless @name
24
- # help! 'The Pod name cannot contain spaces.' if @name =~ /\s/
25
- # help! 'The Pod name cannot contain plusses.' if @name =~ /\+/
26
- # help! "The Pod name cannot begin with a '.'" if @name[0, 1] == '.'
24
+ help! '请输入key.' unless @key
25
+ help! '请输入value.' unless @value
27
26
  end
28
27
 
29
28
  def run
30
- puts "设置全局配置成功".green
29
+ set_config(@key, @value)
31
30
  end
32
31
  end
33
32
  end
@@ -1,6 +1,7 @@
1
1
  require 'gct/command/op/gems'
2
2
  require 'gct/command/op/gitconf'
3
3
  require 'gct/command/op/xcache'
4
+ require 'gct/command/op/root'
4
5
 
5
6
  module Gct
6
7
  class Command
@@ -10,6 +11,7 @@ module Gct
10
11
  self.description = <<-DESC
11
12
  打开常用文件夹,并输出路径
12
13
  DESC
14
+
13
15
  end
14
16
  end
15
17
  end
@@ -0,0 +1,33 @@
1
+ module Gct
2
+ class Command
3
+ class Op < Command
4
+ class Root < Op
5
+
6
+ self.summary = '打开gct文件夹'
7
+ self.description = <<-DESC
8
+ 打开gct文件夹
9
+ DESC
10
+
11
+ self.arguments = [
12
+ ]
13
+
14
+ def initialize(argv)
15
+ super
16
+ end
17
+
18
+ def validate!
19
+ super
20
+ end
21
+
22
+ def run
23
+ openGct
24
+ end
25
+
26
+ def openGct
27
+ root_path = Generator::GctFile.root_folder_path
28
+ system "open #{root_path}"
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,46 @@
1
+ module Gct
2
+ class Command
3
+ class Setup < Command
4
+
5
+ self.summary = '设置Gct'
6
+ self.description = <<-DESC
7
+ 创建gct的全局隐藏文件,配置全局参数,缓存文件等
8
+ DESC
9
+
10
+ def initialize(argv)
11
+ super
12
+ end
13
+
14
+ def run
15
+ create_root_folder
16
+ create_temp_folder
17
+ create_config_file
18
+ puts "setup success!".green
19
+ end
20
+
21
+ def create_root_folder
22
+ gct_path = Generator::GctFile.root_folder_path
23
+ if !File.exist?(gct_path)
24
+ system "mkdir #{gct_path}", exception: true
25
+ puts "#{gct_path} 创建成功!".green
26
+ end
27
+ end
28
+
29
+ def create_temp_folder
30
+ temp_path = Generator::GctFile.temp_folder_path
31
+ if !File.exist?(temp_path)
32
+ system "mkdir #{temp_path}", exception: true
33
+ puts "#{temp_path} 创建成功!".green
34
+ end
35
+ end
36
+
37
+ def create_config_file
38
+ config_path = Generator::GctFile.config_file_path
39
+ if !File.exist?(config_path)
40
+ system "touch #{config_path}", exception: true
41
+ puts "#{config_path} 创建成功!".green
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,14 @@
1
+ require 'gct/command/update/tag'
2
+ require 'gct/command/update/version'
3
+
4
+ module Gct
5
+ class Command
6
+ class Update < Command
7
+ self.abstract_command = true
8
+ self.summary = '更新操作'
9
+ self.description = <<-DESC
10
+ 更新组件tag、主工程版本号等
11
+ DESC
12
+ end
13
+ end
14
+ end
@@ -1,7 +1,8 @@
1
1
  module Gct
2
- class Command
3
- class Tag < Command
4
-
2
+ class Command
3
+ class Update < Command
4
+ class Tag < Update
5
+
5
6
  self.summary = '添加tag'
6
7
  self.description = <<-DESC
7
8
  十进制增加tag版本
@@ -39,24 +40,12 @@ module Gct
39
40
  end
40
41
 
41
42
  def add_push_new_tag
42
- @new_tag = @tag || autoAddTag(@now_tag.to_s)
43
+ @new_tag = @tag || auto_add_tag(@now_tag.to_s)
43
44
  update_tag_podspec
44
45
  `git tag #{@new_tag}`
45
46
  `git push origin #{@new_tag} || { exit 1; }`
46
47
  end
47
-
48
- def autoAddTag(tag)
49
- tag_points = tag.to_s.split('.')
50
- index = tag_points.length - 1
51
- need_add_point = tag_points[index].to_i + 1
52
- tag_points[index] = need_add_point == 10 ? 0 : need_add_point
53
- while need_add_point == 10 && index > 0
54
- index = index - 1
55
- need_add_point = tag_points[index].to_i + 1
56
- tag_points[index] = need_add_point == 10 && index != 0 ? 0 : need_add_point
57
- end
58
- tag_points.join('.')
59
- end
60
48
  end
61
49
  end
62
- end
50
+ end
51
+ end
@@ -0,0 +1,62 @@
1
+ module Gct
2
+ class Command
3
+ class Update < Command
4
+ class Version < Update
5
+
6
+ self.summary = '更新版本号'
7
+ self.description = <<-DESC
8
+ 更新release分支的版本号
9
+ DESC
10
+
11
+ self.arguments = [
12
+ CLAide::Argument.new('NAME', false),
13
+ CLAide::Argument.new('VERSION', false),
14
+ ]
15
+
16
+ def initialize(argv)
17
+ @name = argv.shift_argument
18
+ @version = argv.shift_argument
19
+ name = @name ||= "iLife"
20
+ @project_id = "#{Constant.NameSpace}#{name}"
21
+ @file = "#{name}.xcodeproj/project.pbxproj"
22
+ @branch = current_branch.rstrip
23
+ super
24
+ end
25
+
26
+ def validate!
27
+ super
28
+ end
29
+
30
+ def run
31
+ update_version
32
+ end
33
+
34
+ def update_version
35
+ if check_branch_can_be_update
36
+ content = file_contents(@project_id, @file, @branch)
37
+ version_var_name = 'MARKETING_VERSION = '
38
+ version_regex = /(?<=#{version_var_name})\w.*(?=;)/
39
+ version_match = version_regex.match(content)
40
+ version = @version ||= auto_add_tag(version_match)
41
+ updated_content = content.gsub(version_regex, version)
42
+ edit_file(updated_content, version)
43
+ else
44
+ puts "当前不是release分支".red
45
+ end
46
+ end
47
+
48
+ def edit_file(content, version)
49
+ Gitlab.edit_file(@project_id, @file, @branch, content, "@config 更新版本号:#{version}")
50
+ end
51
+
52
+ def check_branch_can_be_update
53
+ current_branch.include?('release')
54
+ end
55
+
56
+ def current_branch
57
+ "#{`git branch | awk '$1 == "*" {print $2}'`}"
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -1,6 +1,10 @@
1
1
  module Gct
2
2
  module Constant
3
3
  class << self
4
+ def GitBaseURL
5
+ "https://gi-dev.ccrgt.com/"
6
+ end
7
+
4
8
  def GitThirdURL
5
9
  "https://gi-dev.ccrgt.com/ios-thirdpart/"
6
10
  end
@@ -8,6 +12,18 @@ module Gct
8
12
  def GitURL
9
13
  "https://gi-dev.ccrgt.com/ios/"
10
14
  end
15
+
16
+ def NameSpace
17
+ "ios/"
18
+ end
19
+
20
+ def ThirdNameSpace
21
+ "ios-third/"
22
+ end
23
+
24
+ def DefaultTagBranch
25
+ "develop"
26
+ end
11
27
  end
12
28
  end
13
29
  end
@@ -0,0 +1,30 @@
1
+ module Gct
2
+ class FileBase
3
+
4
+ attr_reader :path
5
+
6
+ def initialize(path)
7
+ @path = path
8
+ end
9
+
10
+ def yaml_write(key, value)
11
+ begin
12
+ yaml_file = File.open(@path, "w")
13
+ YAML::dump({key => value}, yaml_file)
14
+ rescue IOError => e
15
+ raise e.message
16
+ ensure
17
+ yaml_file.close unless yaml_file.nil?
18
+ end
19
+ end
20
+
21
+ def yaml_read(key)
22
+ begin
23
+ yaml_file = YAML.load(File.open(@path, "r"))
24
+ yaml_file[key]
25
+ rescue IOError => e
26
+ raise e.message
27
+ end
28
+ end
29
+ end
30
+ end
@@ -2,5 +2,5 @@ module Gct
2
2
  # freeze 冻结对象,将对象变成一个常量
3
3
  # unless 右边的代码块成立,才会运行左边的代码块
4
4
  # defined? 是用来判断本地变量是否存在,也可用来判断是否存在方法
5
- VERSION = "0.3.2".freeze unless defined? Gct::VERSION
5
+ VERSION = "0.3.3".freeze unless defined? Gct::VERSION
6
6
  end
@@ -0,0 +1,32 @@
1
+ module Gct
2
+ module Generator
3
+ class GctFile
4
+
5
+ def self.root_folder_path
6
+ "/Users/#{get_system_user_name.rstrip}/.gct"
7
+ end
8
+
9
+ def self.temp_folder_path
10
+ "/Users/#{get_system_user_name.rstrip}/.gct/tmp"
11
+ end
12
+
13
+ def self.config_file_path
14
+ "/Users/#{get_system_user_name.rstrip}/.gct/config"
15
+ end
16
+
17
+ # 获取系统用户名
18
+ def self.get_system_user_name
19
+ # windows
20
+ if RUBY_PLATFORM =~ /mswin|mingw/
21
+ query = `reg query HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer /v "Logon User Name"`
22
+ /Logon\ User\ Name\s+REG_SZ\s+(\S+)/ =~ query
23
+ "#{$1}"
24
+ # unix, cygwin, mac
25
+ else
26
+ "#{`whoami`}"
27
+ end
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,39 @@
1
+ module Gct
2
+ # attr_accessor get and set
3
+ # attr_reader only get
4
+ # attr_writer only set
5
+ class Specification
6
+ # Pod::Dependency
7
+ attr_accessor :specification
8
+
9
+ # 优先级
10
+ attr_accessor :priority
11
+
12
+ # tag版本
13
+ attr_accessor :tag
14
+
15
+ # 发布状态
16
+ attr_accessor :status
17
+
18
+ def initialize()
19
+ @specification = specification
20
+ @priority = priority
21
+ @status = status
22
+ @tag = tag
23
+ end
24
+ end
25
+ end
26
+
27
+ module SpecPublishStatus
28
+ CREATED = '待分析'
29
+ ANALYZING = '分析中'
30
+ PREPARING = '准备中'
31
+ PENDING = '等待中'
32
+ WAITING = '待发布'
33
+ SKIPPED = '已忽略'
34
+ MERGED = '已合并'
35
+ DEPLOYING = '发布中'
36
+ SUCCESS = '发布成功'
37
+ FAILED = '发布失败'
38
+ CANCELED = '已取消'
39
+ end
@@ -0,0 +1,42 @@
1
+ module Gct
2
+ class TempLocalFile
3
+ attr_reader :content
4
+
5
+ attr_reader :file_name
6
+
7
+ def initialize(content, file_name)
8
+ @content = content
9
+ @file_name = file_name
10
+ end
11
+
12
+ def write
13
+ begin
14
+ file = File.open(tmp_folder, "w")
15
+ file.write(@content)
16
+ rescue IOError => e
17
+ raise e.message
18
+ ensure
19
+ file.close unless file.nil?
20
+ end
21
+ end
22
+
23
+ def read
24
+ begin
25
+ file = File.open(tmp_folder, "r")
26
+ file.read
27
+ rescue IOError => e
28
+ raise e.message
29
+ ensure
30
+ file.close unless file.nil?
31
+ end
32
+ end
33
+
34
+ def full_path
35
+ tmp_folder
36
+ end
37
+
38
+ def tmp_folder
39
+ "#{Generator::GctFile.temp_folder_path}/#{file_name}"
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,44 @@
1
+ module Gct
2
+ class TempRemoteFile
3
+ attr_reader :uri
4
+
5
+ def initialize(url, content)
6
+ @uri = URI.parse(url)
7
+ @content = content
8
+ end
9
+
10
+ def file
11
+ @file ||= Tempfile.open(tmp_filename, tmp_folder, encoding: encoding) do |f|
12
+ puts f
13
+ io.rewind
14
+ f.write(io.read)
15
+ f.close
16
+ end
17
+ end
18
+
19
+ def close
20
+ @file.close
21
+ @file.unlink
22
+ end
23
+
24
+ def io
25
+ @io ||= uri.open
26
+ end
27
+
28
+ def encoding
29
+ io.rewind
30
+ io.read.encoding
31
+ end
32
+
33
+ def tmp_filename
34
+ [
35
+ Pathname.new(uri.path).basename,
36
+ Pathname.new(uri.path).extname
37
+ ]
38
+ end
39
+
40
+ def tmp_folder
41
+ Generator::GctFile.temp_folder_path
42
+ end
43
+ end
44
+ end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - jieming
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-21 00:00:00.000000000 Z
11
+ date: 2020-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
@@ -106,6 +106,34 @@ dependencies:
106
106
  - - "<"
107
107
  - !ruby/object:Gem::Version
108
108
  version: '2.0'
109
+ - !ruby/object:Gem::Dependency
110
+ name: gitlab
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ type: :runtime
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ - !ruby/object:Gem::Dependency
124
+ name: parallel
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ type: :runtime
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
109
137
  description: '"gct ios 自动化脚本工具"'
110
138
  email:
111
139
  - 307113345@qq.com
@@ -135,16 +163,25 @@ files:
135
163
  - lib/gct/command/op.rb
136
164
  - lib/gct/command/op/gems.rb
137
165
  - lib/gct/command/op/gitconf.rb
166
+ - lib/gct/command/op/root.rb
138
167
  - lib/gct/command/op/xcache.rb
139
168
  - lib/gct/command/repo.rb
140
169
  - lib/gct/command/repo/add.rb
141
170
  - lib/gct/command/repo/push.rb
142
171
  - lib/gct/command/repo/update.rb
172
+ - lib/gct/command/setup.rb
143
173
  - lib/gct/command/spec.rb
144
174
  - lib/gct/command/spec/lint.rb
145
- - lib/gct/command/tag.rb
175
+ - lib/gct/command/update.rb
176
+ - lib/gct/command/update/tag.rb
177
+ - lib/gct/command/update/version.rb
146
178
  - lib/gct/constant.rb
147
- - lib/gct/version.rb
179
+ - lib/gct/file_base.rb
180
+ - lib/gct/gct_version.rb
181
+ - lib/gct/generator/gct_file.rb
182
+ - lib/gct/specification.rb
183
+ - lib/gct/temp_local_file.rb
184
+ - lib/gct/temp_remote_file.rb
148
185
  homepage: https://gi-dev.ccrgt.com/ios-thirdpart/gct
149
186
  licenses: []
150
187
  metadata:
@@ -157,7 +194,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
194
  requirements:
158
195
  - - ">="
159
196
  - !ruby/object:Gem::Version
160
- version: '0'
197
+ version: '2.6'
161
198
  required_rubygems_version: !ruby/object:Gem::Requirement
162
199
  requirements:
163
200
  - - ">="