Sha256: 329f5318d4815534dbf23c79547deec7951a6c07940496d56a24938744747a31
Contents?: true
Size: 1.92 KB
Versions: 3
Compression:
Stored size: 1.92 KB
Contents
#!/usr/bin/env ruby require 'gli' require 'zci' include GLI::App include ZCI program_desc 'is a command line tool that allows you to manage and synchronize your Zendesk localization with Crowdin project' sort_help :manually # help commands are ordered in the order declared version ZCI::VERSION subcommand_option_handling :normal arguments :strict desc 'Be verbose' switch [:v, :verbose], negatable: false desc 'Project-specific configuration file' default_value File.join(Dir.pwd, 'zci.yml') arg_name '<s>' flag [:c, :config] commands_from 'zci/commands' pre do |global, command, options, args| # Pre logic here # Return true to proceed; false to abort and not call the # chosen command # Use skips_pre before a command to skip this block # on that command only unless File.exists?(global[:config]) exit_now! <<-EOS.strip_heredoc Can't find configuration file (default `zci.yml'). Type `zci help` to know how to specify custom configuration file EOS end # load project-specific configuration begin @cli_config = YAML.load(File.read(global[:config])) || {} rescue Psych::SyntaxError => err exit_now! <<-EOS Could not parse YAML: #{err.message} EOS end # Global Zendesk Client @zendesk = ZCI.initialize_zendesk_client( @cli_config['zendesk_base_url'], @cli_config['zendesk_username'], @cli_config['zendesk_password'], global[:verbose] ) if global[:verbose] Crowdin::API.log = Logger.new(STDOUT) if global[:verbose] end @crowdin = Crowdin::API.new(api_key: @cli_config['crowdin_api_key'], project_id: @cli_config['crowdin_project_id'], base_url: @cli_config['crowdin_base_url']) true end post do |global, command, options, args| # Post logic here # Use skips_post before a command to skip this # block on that command only end on_error do |exception| # Error logic here # return false to skip default error handling true end exit run(ARGV)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
zci-0.7.2 | bin/zci |
zci-0.7.1 | bin/zci |
zci-0.7.0 | bin/zci |