gct 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gct/command.rb +11 -7
- data/lib/gct/command/analyze.rb +1 -0
- data/lib/gct/command/config.rb +2 -29
- data/lib/gct/command/config/get.rb +1 -1
- data/lib/gct/command/config/set.rb +1 -1
- data/lib/gct/command/update.rb +5 -0
- data/lib/gct/command/update/version.rb +4 -2
- data/lib/gct/file_base.rb +48 -21
- data/lib/gct/gct_version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4c7ac5d299bdcd12bcf268d4f7d703d3cc928ec1bdf68a6a7607eb88776bfa1
|
4
|
+
data.tar.gz: ec3a3e19a4934758f25b7782b18033a6b5ae7b4011fe7f72a9a0600c6e31ca52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ee1ec1276911016661047a4e3b85a78e51fbc8fee6d08531075bd26c43d598e4cf066a33712e9af51e9c6a317b5621e76d964a4c931a131f4952295696b4a2d
|
7
|
+
data.tar.gz: 3a10b473568f55e49de457f50f367010db7742eaf2ecde4684703a66835cbc7a7d10b1dcf8f33c41721a286c660b0aa9c682018e8db0585d4043f5b43f57ff3e
|
data/lib/gct/command.rb
CHANGED
@@ -50,8 +50,6 @@ module Gct
|
|
50
50
|
Colored2.disable!
|
51
51
|
String.send(:define_method, :colorize) { |string, _| string }
|
52
52
|
end
|
53
|
-
|
54
|
-
config_gitlab
|
55
53
|
end
|
56
54
|
|
57
55
|
def file_contents(project_id, file, branch)
|
@@ -61,11 +59,17 @@ module Gct
|
|
61
59
|
end
|
62
60
|
|
63
61
|
def config_gitlab
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
62
|
+
if FileBase.exist_root
|
63
|
+
token = FileBase.get_config("token")
|
64
|
+
if 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
|
+
else
|
71
|
+
raise "请先运行命令:gct set token xxx,参考文档:http://febase.crgt.xyz/docs/app_ios/base".red
|
72
|
+
end
|
69
73
|
end
|
70
74
|
end
|
71
75
|
|
data/lib/gct/command/analyze.rb
CHANGED
data/lib/gct/command/config.rb
CHANGED
@@ -4,39 +4,12 @@ require 'gct/command/config/get'
|
|
4
4
|
module Gct
|
5
5
|
class Command
|
6
6
|
class Config < Command
|
7
|
+
self.abstract_command = true
|
7
8
|
self.summary = 'gct 配置'
|
8
9
|
self.description = <<-DESC
|
9
10
|
配置全局链接等
|
10
11
|
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
13
|
end
|
41
14
|
end
|
42
15
|
end
|
data/lib/gct/command/update.rb
CHANGED
@@ -19,7 +19,6 @@ module Gct
|
|
19
19
|
name = @name ||= "iLife"
|
20
20
|
@project_id = "#{Constant.NameSpace}#{name}"
|
21
21
|
@file = "#{name}.xcodeproj/project.pbxproj"
|
22
|
-
@branch = current_branch.rstrip
|
23
22
|
super
|
24
23
|
end
|
25
24
|
|
@@ -28,6 +27,7 @@ module Gct
|
|
28
27
|
end
|
29
28
|
|
30
29
|
def run
|
30
|
+
@branch = current_branch
|
31
31
|
update_version
|
32
32
|
end
|
33
33
|
|
@@ -54,7 +54,9 @@ module Gct
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def current_branch
|
57
|
-
"#{`git branch | awk '$1 == "*" {print $2}'`}"
|
57
|
+
branch = "#{`git branch | awk '$1 == "*" {print $2}'`}".rstrip
|
58
|
+
raise "该文件夹不是一个git仓库".red if branch.empty?
|
59
|
+
branch
|
58
60
|
end
|
59
61
|
end
|
60
62
|
end
|
data/lib/gct/file_base.rb
CHANGED
@@ -1,29 +1,56 @@
|
|
1
1
|
module Gct
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
module FileBase
|
3
|
+
class << self
|
4
|
+
attr_reader :path
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
def initialize(path)
|
7
|
+
@path = path
|
8
|
+
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
+
if yaml_file
|
25
|
+
yaml_file[key]
|
26
|
+
end
|
27
|
+
rescue IOError => e
|
28
|
+
raise e.message
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_config(key)
|
33
|
+
if exist_root
|
34
|
+
@path = config_path
|
35
|
+
yaml_read(key)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def set_config(key, value)
|
40
|
+
if exist_root
|
41
|
+
@path = config_path
|
42
|
+
yaml_write(key, value)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def config_path
|
47
|
+
"#{Generator::GctFile.config_file_path}"
|
18
48
|
end
|
19
|
-
end
|
20
49
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
rescue IOError => e
|
26
|
-
raise e.message
|
50
|
+
def exist_root
|
51
|
+
root_exist = File.exist?(Generator::GctFile.root_folder_path)
|
52
|
+
raise "请先运行命令:gct setup".red if !root_exist
|
53
|
+
root_exist
|
27
54
|
end
|
28
55
|
end
|
29
56
|
end
|
data/lib/gct/gct_version.rb
CHANGED