lhj-tools 0.1.37 → 0.1.40

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00bcfbfc57ef29c17ccb992fe52decd1dc169a2f4595c6c291edc99e8d5516b4
4
- data.tar.gz: 48ea09b1938d81b27293719247d9382d1b92627ccb4e9544a312d0c00029a942
3
+ metadata.gz: ece2424980560cc08874ad875b48bbe10430ac55004ab9e1a1999d7b3fd2595b
4
+ data.tar.gz: 353552a9c1da8537b64befffeae9bcb9b89d86c1a1d9e70f0545933ef105eb68
5
5
  SHA512:
6
- metadata.gz: 19fa3572c6c8cf794f74299710c5b2a0a0e24d4ac25abec6a7d0e5bce4ef339d039aa86418a228c039b999fb63b2e00423674c584e9e1ee8cc476597da5cb180
7
- data.tar.gz: d65ecfea427f73d635670475c9b811e4f998358de57ac1a27e9091489bf877d998008c9454e2e207e6661e74a8201192701c3e1c9d97998e61a665b84e38d90d
6
+ metadata.gz: 54b3713b1593883316dade8c04e69ad7b97de6fcc1e70c457fb61b6732cf907f3ecae44bd5281db9470e3632d533a76a03968dd342ac9863e903dcb78bd68f11
7
+ data.tar.gz: 4c11133c0fdfddf32b1f87fbcd9b0d669b35740b4d8ae3c2b9f488316afb454630779ca2121943776575da7b2f46d1759195fa9cc02f75ea732042e8218f1b03
@@ -21,7 +21,7 @@
21
21
  dispatch_source_set_timer(self.timer, DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC, 0);
22
22
  __weak __typeof(self)weakSelf = self;
23
23
  dispatch_source_set_event_handler(self.timer, ^{
24
- if(weakSelf.leftTime <= 0){ //倒計時結束,關閉
24
+ if(weakSelf.leftTime <= 0){
25
25
  [[NSNotificationCenter defaultCenter] postNotificationName:kOrderTimerFinishedNotification object:nil];
26
26
  dispatch_source_cancel(weakSelf.timer);
27
27
  }else{
@@ -0,0 +1,37 @@
1
+
2
+ module Lhj
3
+ class Command
4
+ class JenkinsBuild < Command
5
+ self.summary = '执行jenkins的build任务'
6
+
7
+ self.arguments = [
8
+ CLAide::Argument.new('--server_url=http://www.jenkins.com', true),
9
+ CLAide::Argument.new('--job=job1', true)
10
+ ]
11
+
12
+ def self.options
13
+ [
14
+ %w[--server_url jenkins的地址],
15
+ %w[--job 运行的任务名]
16
+ ]
17
+ end
18
+
19
+ def validate!
20
+ super
21
+ help! '输入jenkins的地址' unless @server_url
22
+ help! '输入任务名' unless @job
23
+ end
24
+
25
+ def initialize(argv)
26
+ @server_url = argv.option('server_url')
27
+ @job = argv.option('job')
28
+ super
29
+ end
30
+
31
+ def handle
32
+ client = Lhj::JenkinsApi::Client.new(:server_url => @server_url)
33
+ client.job.build(@job)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -6,7 +6,6 @@ module Lhj
6
6
  class Command
7
7
  class OSS < Command
8
8
  class Del < OSS
9
- self.summary = '删除OSS的key'
10
9
 
11
10
  def initialize(argv)
12
11
  @cli = HighLine.new
@@ -0,0 +1,37 @@
1
+
2
+ # frozen_string_literal: true
3
+ require 'lhj/helper/oss_helper'
4
+ require 'highline'
5
+
6
+ module Lhj
7
+ class Command
8
+ class OSS < Command
9
+ class Download < OSS
10
+
11
+ def initialize(argv)
12
+ @current_path = argv.shift_argument || Dir.pwd
13
+ @cli = HighLine.new
14
+ super
15
+ end
16
+
17
+ def handle
18
+ objects = Lhj::OSS::Helper.instance.list
19
+ obj_keys = []
20
+ objects.each_with_index do |o, i|
21
+ obj_keys << o.key
22
+ puts "#{i}.#{o.key}".yellow
23
+ end
24
+ idx = @cli.ask('请选择下载的序号: '.green).strip.to_i
25
+ oss_key = obj_keys[idx]
26
+ puts "下载的key为:#{oss_key}".yellow
27
+
28
+ file_key = oss_key.split('/').last
29
+ file = File.join(@current_path, file_key)
30
+ Lhj::OSS::Helper.instance.down_load(oss_key, file)
31
+ puts "下载文件到目录: #{file}\n".yellow
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+ end
@@ -5,7 +5,6 @@ module Lhj
5
5
  class Command
6
6
  class OSS < Command
7
7
  class List < OSS
8
- self.summary = '查看oss列表'
9
8
 
10
9
  def handle
11
10
  objects = Lhj::OSS::Helper.instance.list
@@ -8,7 +8,6 @@ module Lhj
8
8
  class OSS < Command
9
9
  # OSS file upload
10
10
  class Upload < OSS
11
- self.summary = '上传文件'
12
11
 
13
12
  self.arguments = [
14
13
  CLAide::Argument.new('tag', false)
@@ -3,7 +3,6 @@ module Lhj
3
3
  class Command
4
4
  # sync config
5
5
  class OSS < Command
6
- self.summary = 'oss操作'
7
6
  self.abstract_command = true
8
7
  end
9
8
  end
data/lib/lhj/command.rb CHANGED
@@ -17,6 +17,7 @@ module Lhj
17
17
  require 'lhj/command/oss/del'
18
18
  require 'lhj/command/oss/upload'
19
19
  require 'lhj/command/oss/list'
20
+ require 'lhj/command/oss/download'
20
21
  require 'lhj/command/code/view'
21
22
  require 'lhj/command/code/code_template'
22
23
  require 'lhj/command/rename_image'
@@ -28,6 +29,7 @@ module Lhj
28
29
  require 'lhj/command/sync_pod_version'
29
30
  require 'lhj/command/pgyer_upload'
30
31
  require 'lhj/command/duplicate_imageset'
32
+ require 'lhj/command/jenkins_build'
31
33
 
32
34
  self.abstract_command = true
33
35
  self.command = 'lhj'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lhj
4
4
  module Tools
5
- VERSION = "0.1.37"
5
+ VERSION = "0.1.40"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhj-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.37
4
+ version: 0.1.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-27 00:00:00.000000000 Z
11
+ date: 2022-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -305,6 +305,7 @@ files:
305
305
  - lib/lhj/command/head_import.rb
306
306
  - lib/lhj/command/http.rb
307
307
  - lib/lhj/command/init.rb
308
+ - lib/lhj/command/jenkins_build.rb
308
309
  - lib/lhj/command/local/fetch.rb
309
310
  - lib/lhj/command/local/filter.rb
310
311
  - lib/lhj/command/local/local.rb
@@ -312,6 +313,7 @@ files:
312
313
  - lib/lhj/command/local/micro_service.rb
313
314
  - lib/lhj/command/oss.rb
314
315
  - lib/lhj/command/oss/del.rb
316
+ - lib/lhj/command/oss/download.rb
315
317
  - lib/lhj/command/oss/list.rb
316
318
  - lib/lhj/command/oss/upload.rb
317
319
  - lib/lhj/command/pgyer_upload.rb