Class: Flow::Cli::CmdManager
- Inherits:
-
Thor
- Object
- Thor
- Flow::Cli::CmdManager
- Defined in:
- lib/flow/cli/cmd_manager.rb
Instance Method Summary collapse
- #build_yaml_file ⇒ Object
- #help(command = nil, subcommand = false) ⇒ Object
-
#initialize(*args) ⇒ CmdManager
constructor
A new instance of CmdManager.
- #run_build_script ⇒ Object
- #show_build_script ⇒ Object
- #upgrade ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(*args) ⇒ CmdManager
Returns a new instance of CmdManager.
8 9 10 11 12 13 14 15 16 |
# File 'lib/flow/cli/cmd_manager.rb', line 8 def initialize(*args) super(*args) @prompt = TTY::Prompt.new @pastel = Pastel.new @error = @pastel.red.bold.detach @warning = @pastel.yellow.detach @db_manager = Utils::DbManager @api_manager = Utils::FlowApiManager.load_from_db end |
Instance Method Details
#build_yaml_file ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/flow/cli/cmd_manager.rb', line 22 def build_yaml_file config = ProjectAnalytics.new.config # 用来交互 # TODO: 优化点,以后放到其他地方 config[:gym_config] = if config[:flow_language] == "objc" && ENV["FLOW_CLI_TEST"] != "TRUE" str = FlowYamlBuilder.new(config).build_yaml raise YamlError, "存在 #{FLOW_YML_NAME}, 删除后才能重新生成" if File.file?(FLOW_YML_NAME) File.open(FLOW_YML_NAME, "wb") do |file| file.write(str) end @warning.call "yaml created...\n#{str}" end |
#help(command = nil, subcommand = false) ⇒ Object
64 65 66 67 68 69 |
# File 'lib/flow/cli/cmd_manager.rb', line 64 def help(command = nil, subcommand = false) print_line puts @error.call("VERSION ALPHA\n Support IOS project ONLY, temporarily.") print_line super end |
#run_build_script ⇒ Object
37 38 39 40 |
# File 'lib/flow/cli/cmd_manager.rb', line 37 def run_build_script show_build_script try_run_yml_build_script end |
#show_build_script ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/flow/cli/cmd_manager.rb', line 43 def show_build_script script = yml_build_script puts @warning.call "This is the build script in yaml" print_line puts script print_line end |
#upgrade ⇒ Object
58 59 60 |
# File 'lib/flow/cli/cmd_manager.rb', line 58 def upgrade run_script "gem install flow-cli" end |
#version ⇒ Object
53 54 55 |
# File 'lib/flow/cli/cmd_manager.rb', line 53 def version puts VERSION end |