flow-cli 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flow/cli/cmd_manager.rb +23 -5
- data/lib/flow/cli/constant.rb +5 -0
- data/lib/flow/cli/flow_yaml_builder.rb +1 -1
- data/lib/flow/cli/ios_build_step_generator.rb +13 -18
- data/lib/flow/cli/version.rb +1 -1
- data/lib/flow/cli.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21fd812ff71af588d84221a5db5edff651e5fe85
|
4
|
+
data.tar.gz: 83886130d5a88d1d594a425d6ab0db2aa427fae2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e312ff26145629f00ae94d5894561bb954c5359db18fde128eec3107da3d7cdd6aaa2d959ecd1e59478799d7172b39e2fa3f8a0675b766cd23a8598f0c356cc2
|
7
|
+
data.tar.gz: a9b08da5091376a43217d14c5018a5bd9a8e96dd192befec7a4e301f56927a15d45b6298d6043072fcb14dced5d47440aee4bc291ee7bb1a6e1b3e7b287bc45e
|
data/lib/flow/cli/cmd_manager.rb
CHANGED
@@ -15,9 +15,14 @@ module Flow::Cli
|
|
15
15
|
desc "build_yaml_file", "build flow ci project yaml"
|
16
16
|
def build_yaml_file
|
17
17
|
config = ProjectAnalytics.new.config
|
18
|
+
|
19
|
+
# 用来交互
|
20
|
+
# TODO: 优化点,以后放到其他地方
|
21
|
+
config[:gym_config] = ask_gym_build_options if config[:flow_language] == "objc" && ENV["FLOW_CLI_TEST"] != "TRUE"
|
22
|
+
|
18
23
|
str = FlowYamlBuilder.new(config).build_yaml
|
19
|
-
raise YamlError, "存在
|
20
|
-
File.open(
|
24
|
+
raise YamlError, "存在 #{FLOW_YML_NAME}, 删除后才能重新生成" if File.file?(FLOW_YML_NAME)
|
25
|
+
File.open(FLOW_YML_NAME, "wb") do |file|
|
21
26
|
file.write(str)
|
22
27
|
end
|
23
28
|
@warning.call "yaml created...\n#{str}"
|
@@ -44,6 +49,11 @@ module Flow::Cli
|
|
44
49
|
puts VERSION
|
45
50
|
end
|
46
51
|
|
52
|
+
desc "upgrade", "upgrade flow-cli"
|
53
|
+
def upgrade
|
54
|
+
run_script "gem install flow-cli"
|
55
|
+
end
|
56
|
+
|
47
57
|
desc 'help', 'Describe available commands or one specific command (aliases: `h`).'
|
48
58
|
map Thor::HELP_MAPPINGS => :help
|
49
59
|
def help(command = nil, subcommand = false)
|
@@ -55,8 +65,8 @@ module Flow::Cli
|
|
55
65
|
|
56
66
|
no_commands do
|
57
67
|
def select_yml_steps(step_name)
|
58
|
-
raise YamlError, "Can not found flow.yml" unless File.file?(
|
59
|
-
dict = YAML.safe_load(File.read(
|
68
|
+
raise YamlError, "Can not found flow.yml" unless File.file?(FLOW_YML_NAME)
|
69
|
+
dict = YAML.safe_load(File.read(FLOW_YML_NAME))
|
60
70
|
|
61
71
|
the_steps = []
|
62
72
|
dict["flows"].map do |flow|
|
@@ -81,7 +91,7 @@ module Flow::Cli
|
|
81
91
|
end
|
82
92
|
|
83
93
|
def yml_build_script
|
84
|
-
if File.file?(
|
94
|
+
if File.file?(FLOW_YML_NAME) == false
|
85
95
|
return unless @prompt.yes?('no flow.yml found, need to build . y/n')
|
86
96
|
build_yaml_file
|
87
97
|
end
|
@@ -98,6 +108,14 @@ module Flow::Cli
|
|
98
108
|
def print_line
|
99
109
|
puts "*" * 30
|
100
110
|
end
|
111
|
+
|
112
|
+
def ask_gym_build_options
|
113
|
+
user_gym_config = {}
|
114
|
+
user_gym_config[:export_method] = @prompt.select("export_method? ", %w[development app-store ad-hoc package enterprise developer-id])
|
115
|
+
user_gym_config[:silent] = "" if @prompt.yes?("less log?")
|
116
|
+
|
117
|
+
user_gym_config
|
118
|
+
end
|
101
119
|
end
|
102
120
|
end
|
103
121
|
end
|
@@ -49,7 +49,7 @@ module Flow::Cli
|
|
49
49
|
|
50
50
|
# 生成编译脚本
|
51
51
|
def generate_custom_build_step
|
52
|
-
script = IosBuildStepGenerator.new(flow_cli_config
|
52
|
+
script = IosBuildStepGenerator.new(flow_cli_config).generate_gym_script
|
53
53
|
{
|
54
54
|
name: "build",
|
55
55
|
scripts: [script]
|
@@ -3,40 +3,35 @@ require 'gym'
|
|
3
3
|
|
4
4
|
module Flow::Cli
|
5
5
|
class IosBuildStepGenerator
|
6
|
-
attr_accessor :
|
7
|
-
|
8
|
-
|
9
|
-
if
|
6
|
+
attr_accessor :cli_config
|
7
|
+
def initialize(cli_config = {})
|
8
|
+
self.cli_config = cli_config
|
9
|
+
if ENV["FLOW_CLI_TEST"] != "TRUE"
|
10
10
|
Gym.config = FastlaneCore::Configuration.create(Gym::Options.available_options, {})
|
11
11
|
config = Gym.config.values(ask: false).reject { |_k, v| v.nil? }
|
12
12
|
allowed_params = %i[workspace project scheme clean output_name configuration
|
13
13
|
codesigning_identity include_symbols include_bitcode
|
14
14
|
export_method export_options export_xcargs]
|
15
|
-
|
15
|
+
@gym_config = config.select { |k, _v| allowed_params.include? k }
|
16
16
|
else
|
17
|
-
|
17
|
+
@gym_config = {}
|
18
18
|
end
|
19
|
-
|
20
|
-
self.config = default_config
|
21
19
|
end
|
22
20
|
|
23
|
-
def generate_gym_script
|
24
|
-
|
21
|
+
def generate_gym_script
|
22
|
+
merge_user_cli_gym_config
|
25
23
|
"fastlane gym build #{build_gym_params}"
|
26
24
|
end
|
27
25
|
|
28
26
|
# 返回 由 gym 调用的 core 的生成的相关参数
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
config[:export_method] = category
|
35
|
-
config
|
27
|
+
def merge_user_cli_gym_config
|
28
|
+
user_gym_config = { export_method: 'ad-hoc' }.merge(cli_config[:gym_config] || {} )
|
29
|
+
@gym_config.merge!(user_gym_config)
|
30
|
+
@gym_config
|
36
31
|
end
|
37
32
|
|
38
33
|
def build_gym_params
|
39
|
-
|
34
|
+
@gym_config.map { |k, v| "--#{k} #{v}".rstrip }.join(' ')
|
40
35
|
end
|
41
36
|
end
|
42
37
|
end
|
data/lib/flow/cli/version.rb
CHANGED
data/lib/flow/cli.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flow-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- atpking
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- flow-cli.gemspec
|
160
160
|
- lib/flow/cli.rb
|
161
161
|
- lib/flow/cli/cmd_manager.rb
|
162
|
+
- lib/flow/cli/constant.rb
|
162
163
|
- lib/flow/cli/exception.rb
|
163
164
|
- lib/flow/cli/flow_yaml_builder.rb
|
164
165
|
- lib/flow/cli/ios_build_step_generator.rb
|