lhj-tools 0.1.38 → 0.1.41

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: b4b7a07edf3348968838d40729cca25f41ba64ce15e201923d13d931590e7e97
4
- data.tar.gz: 5c5ec0c49a7653d41c07dab04c2838f8b10e94bb986eb645e2eeb3c664a61536
3
+ metadata.gz: c8fa90967ee885cff64ed4b4d175cf1178919449b42aa8e644ad5fedf17386de
4
+ data.tar.gz: 750834e640eb75b5653e4f9639dc9b09bf5c320ac34bf721ab637f881729fc08
5
5
  SHA512:
6
- metadata.gz: 672eee52600ff602c54aa7ae0a98e2dd418b33efac5b0ccbe3dc61ca47008a6af9eb7a124087437265b77663a5f0b92a87a4efef80d852fc38d93717afa66437
7
- data.tar.gz: eac0a1544282d3e4826419fb5e7e8648c067d3664717630d89da95632eae0a69f3eee1931e9cee65d218bc7a33ac0da7dbb53615b1f8adbe06d0dd491a275a08
6
+ metadata.gz: b08ab0ab7d6bb7ac5fe0e38bd823032779370b4e6265444db96f691078502d10c199656297b7190f1eaa1be92a76c701f6ec1c467aede28c49464853ccb1add1
7
+ data.tar.gz: 1a546488cdfca768c14599022da2d80cb5eca23a272d71fbc75b879b74a2f9d99d9574afae62316fad2cd7ebd54010a001396219a5b42eec7f065ba87f09d6cc
@@ -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
@@ -7,7 +7,6 @@ module Lhj
7
7
  class Command
8
8
  class OSS < Command
9
9
  class Download < OSS
10
- self.summary = '下载OSS'
11
10
 
12
11
  def initialize(argv)
13
12
  @current_path = argv.shift_argument || Dir.pwd
@@ -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 = '上传文件(添加标签 --tag=XX)'
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
@@ -29,6 +29,7 @@ module Lhj
29
29
  require 'lhj/command/sync_pod_version'
30
30
  require 'lhj/command/pgyer_upload'
31
31
  require 'lhj/command/duplicate_imageset'
32
+ require 'lhj/command/jenkins_build'
32
33
 
33
34
  self.abstract_command = true
34
35
  self.command = 'lhj'
@@ -18,6 +18,7 @@ module Lhj
18
18
  @api_key = Lhj::PgyerConfig.api_key(env)
19
19
  @user_key = Lhj::PgyerConfig.user_key(env)
20
20
  @password = Lhj::PgyerConfig.password(env)
21
+ @env = env
21
22
  @result = { 'data' => {} }
22
23
  end
23
24
 
@@ -38,7 +39,6 @@ module Lhj
38
39
  end
39
40
 
40
41
  def upload_file(file, des)
41
-
42
42
  update_description = @result[:update_description]
43
43
  update_description = '' if update_description.nil?
44
44
  params = {
@@ -49,6 +49,7 @@ module Lhj
49
49
  'installType' => 2,
50
50
  'file' => Faraday::UploadIO.new(file, 'application/octet-stream')
51
51
  }
52
+ upload_code
52
53
  begin
53
54
  puts 'begin upload...'
54
55
  response = http_client.post API_HOST, params
@@ -65,6 +66,15 @@ module Lhj
65
66
  end
66
67
  end
67
68
 
69
+ def upload_code
70
+ if @env == :release
71
+ # packing
72
+ current_dir = File.dirname(__FILE__)
73
+ puts current_dir
74
+ # upload to oss
75
+ end
76
+ end
77
+
68
78
  def render_template
69
79
  temp_str = File.read(File.join(Lhj::Config.instance.home_dir, 'pgyer.erb'))
70
80
  Lhj::ErbFormatter::Service.new(self).render_template(temp_str)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lhj
4
4
  module Tools
5
- VERSION = "0.1.38"
5
+ VERSION = "0.1.41"
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.38
4
+ version: 0.1.41
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-28 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