Sha256: fcc41d7b54fa0fcac6da55e3605017588d9905eec2c9615b68c1a742b92e5f8f

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require 'jenkins_api_client'
require 'lhj/helper/apple/token'

module Lhj
  class Command
    class JenkinsBuild < Command
      self.summary = '执行jenkins的build任务'

      self.arguments = [
        CLAide::Argument.new('--server_url=http://www.jenkins.com', true),
        CLAide::Argument.new('--job=job1', true)
      ]

      def self.options
        [
          %w[--server_url jenkins的地址],
          %w[--job 运行的任务名]
        ]
      end

      def validate!
        super
        help! '输入jenkins的地址' unless @server_url
        help! '输入任务名' unless @job
      end

      def initialize(argv)
        @server_url = argv.option('server_url')
        @job = argv.option('job')
        super
      end

      def handle
        res = Lhj::ConnectAPI.get('https://api.appstoreconnect.apple.com/v1/apps')
        puts res.read_body

        # client = JenkinsApi::Client.new(server_ip: 'ip', server_port: 0, username: 'xx', password: 'xx')
        # puts client.user.get('aomi')
        # puts client.job.list_all
        # client.job.build('aomi_uat')
        # puts client.job.get_console_output('aomi_uat', 253)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lhj-tools-0.2.23 lib/lhj/command/jenkins/jenkins_build.rb