lhj-tools 0.1.36 → 0.1.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lhj/command/code/code_template.rb +2 -2
- data/lib/lhj/command/code/template/dispatch_source.erb +6 -6
- data/lib/lhj/command/code/template/message_query.erb +58 -0
- data/lib/lhj/command/jenkins_build.rb +37 -0
- data/lib/lhj/command/oss/del.rb +12 -29
- data/lib/lhj/command/oss/download.rb +38 -0
- data/lib/lhj/command/oss/list.rb +2 -2
- data/lib/lhj/command/oss/upload.rb +14 -20
- data/lib/lhj/command/refactor_rename.rb +2 -0
- data/lib/lhj/command/trans.rb +2 -1
- data/lib/lhj/command.rb +2 -0
- data/lib/lhj/tools/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1016401e08b49467fcbd6362af988daaeec6d5f9272b58eaf19ddf0c10d002b
|
4
|
+
data.tar.gz: a4d51e70f9c75217efbb6f94cf84fdaa8a3cfce04ef3cee33c4c205b5895830b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7904a6b62c5a5a418a0ee5cc642ebd2dcea0b138aad1f19b2a2f352bee72011b15e3dff0022946cc762a578aefb0c6622001aa451e6a8267d963d8156980bde
|
7
|
+
data.tar.gz: 31a2943539fd9e629a89c3abb3b0e3fe65e5a61b683fdc485c356ed64ba45c895f4df87794aa2d4b29cb2c0f827629ae91a516aa4aa320c8c26faf83f07147fb
|
@@ -5,8 +5,8 @@ module Lhj
|
|
5
5
|
self.description = '生成的代码模板'
|
6
6
|
|
7
7
|
CODE_TEMPLATE_INDEX = [{ name: 'dispatch Source 模板', template: 'dispatch_source.erb' },
|
8
|
-
{ name: '
|
9
|
-
{ name: '代码模板', template: '
|
8
|
+
{ name: '消息队列', template: 'message_query.erb' },
|
9
|
+
{ name: '代码模板', template: 'test.erb' }].freeze
|
10
10
|
|
11
11
|
def initialize(argv)
|
12
12
|
@cli = HighLine.new
|
@@ -1,12 +1,12 @@
|
|
1
1
|
@implementation ODOrderTimerManager
|
2
2
|
|
3
3
|
+ (instancetype)sharedInstance {
|
4
|
-
static dispatch_once_t onceToken;
|
5
|
-
static ODOrderTimerManager *instance = nil;
|
6
|
-
dispatch_once(&onceToken,^{
|
7
|
-
|
8
|
-
});
|
9
|
-
return instance;
|
4
|
+
static dispatch_once_t onceToken;
|
5
|
+
static ODOrderTimerManager *instance = nil;
|
6
|
+
dispatch_once(&onceToken,^{
|
7
|
+
instance = [[ODOrderTimerManager alloc] init];
|
8
|
+
});
|
9
|
+
return instance;
|
10
10
|
}
|
11
11
|
|
12
12
|
- (void)calcOrderPay:(NSString *)orderId timeout:(NSInteger)timeout
|
@@ -0,0 +1,58 @@
|
|
1
|
+
- (void)handleWithBlock:(void (^)(AMGoodsSellingMessageModel *, void(^completion)(BOOL finished, AMGoodsSellingMessageModel *current)))block completion:(void (^)(AMGoodsSellingMessageModel *, void(^)(BOOL)))completion
|
2
|
+
{
|
3
|
+
dispatch_once(&onceMessageQueueManagerToken, ^{
|
4
|
+
[self processWithPreModel:nil block:block completion:completion];
|
5
|
+
});
|
6
|
+
}
|
7
|
+
|
8
|
+
- (void)processWithPreModel:(AMGoodsSellingMessageModel *)preModel block:(void (^)(AMGoodsSellingMessageModel *, void(^completion)(BOOL finished, AMGoodsSellingMessageModel *current)))block completion:(void (^)(AMGoodsSellingMessageModel *, void(^)(BOOL)))completion
|
9
|
+
{
|
10
|
+
AMGoodsSellingMessageModel *next = [self popModel];
|
11
|
+
if(next && block){
|
12
|
+
__weak __typeof(self)weakSelf = self;
|
13
|
+
if(preModel){
|
14
|
+
if(![next isEqual:preModel]){
|
15
|
+
next.animationType = AMMessageAnimationTypeReShowAndAnimation;
|
16
|
+
next.currentNum = MAX(1, [next.sellingNumber integerValue]);
|
17
|
+
}else{
|
18
|
+
next.animationType = AMMessageAnimationTypeAnimation;
|
19
|
+
NSInteger num = MAX(1, [next.sellingNumber integerValue]);
|
20
|
+
next.currentNum = preModel.currentNum + num;
|
21
|
+
}
|
22
|
+
}else{
|
23
|
+
next.animationType = AMMessageAnimationTypeShowAndAnimation;
|
24
|
+
next.currentNum = MAX(1, [next.sellingNumber integerValue]);
|
25
|
+
}
|
26
|
+
next.displayNumber = [NSString stringWithFormat:@"%ld", next.currentNum];
|
27
|
+
block(next, ^(BOOL finished, AMGoodsSellingMessageModel *current){
|
28
|
+
if(finished){
|
29
|
+
[weakSelf processWithPreModel:next block:block completion:completion];
|
30
|
+
}
|
31
|
+
});
|
32
|
+
}else{
|
33
|
+
if(completion){
|
34
|
+
completion(preModel, ^(BOOL finished){
|
35
|
+
onceMessageQueueManagerToken = 0;
|
36
|
+
});
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
-(void)beginProductSoldOutAnimation
|
42
|
+
{
|
43
|
+
__weak __typeof(self)weakSelf = self;
|
44
|
+
[[AMMessageQueueManager sharedInstance] handleWithBlock:^(AMGoodsSellingMessageModel * model, void (^ _Nonnull completion)(BOOL ,AMGoodsSellingMessageModel *)) {
|
45
|
+
if(model){
|
46
|
+
[weakSelf productSoldOutViewAnimation:model completion:^(BOOL finished, AMGoodsSellingMessageModel *current) {
|
47
|
+
completion(finished, current);
|
48
|
+
}];
|
49
|
+
}
|
50
|
+
} completion:^(AMGoodsSellingMessageModel *preModel, void (^ _Nonnull finishCallback)(BOOL)) {
|
51
|
+
NSInteger des = preModel ? preModel.dismissSec : 3;
|
52
|
+
[[AMMessageTimerManager sharedInstance] scheduledWithMessageType:AMCustomMessageTypeGoodsSelling timeout:des completion:^{
|
53
|
+
[weakSelf hideProductSoldOutView:^(BOOL finished) {
|
54
|
+
finishCallback(finished);
|
55
|
+
}];
|
56
|
+
}];
|
57
|
+
}];
|
58
|
+
}
|
@@ -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
|
data/lib/lhj/command/oss/del.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'lhj/helper/oss_helper'
|
3
|
+
require 'highline'
|
3
4
|
|
4
5
|
module Lhj
|
5
6
|
class Command
|
@@ -7,42 +8,24 @@ module Lhj
|
|
7
8
|
class Del < OSS
|
8
9
|
self.summary = '删除OSS的key'
|
9
10
|
|
10
|
-
self.arguments = [
|
11
|
-
CLAide::Argument.new('--key=XX', true),
|
12
|
-
CLAide::Argument.new('--type=XX', true)
|
13
|
-
]
|
14
|
-
|
15
|
-
def self.options
|
16
|
-
[
|
17
|
-
%w[--key OSS对应的key],
|
18
|
-
%w[--type OSS对应的类型]
|
19
|
-
]
|
20
|
-
end
|
21
|
-
|
22
11
|
def initialize(argv)
|
23
|
-
@
|
24
|
-
@type = argv.option('type')
|
25
|
-
super
|
26
|
-
end
|
27
|
-
|
28
|
-
def validate!
|
29
|
-
help! '请输入key或者类型' unless @key || @type
|
12
|
+
@cli = HighLine.new
|
30
13
|
super
|
31
14
|
end
|
32
15
|
|
33
16
|
def handle
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
Lhj::OSS::Helper.instance.delete(o.key)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
else
|
43
|
-
Lhj::OSS::Helper.instance.delete(@key)
|
17
|
+
objects = Lhj::OSS::Helper.instance.list
|
18
|
+
obj_keys = []
|
19
|
+
objects.each_with_index do |o, i|
|
20
|
+
obj_keys << o.key
|
21
|
+
puts "#{i}.#{o.key}".yellow
|
44
22
|
end
|
23
|
+
idx = @cli.ask('请选择删除的key: '.green).strip.to_i
|
24
|
+
oss_key = obj_keys[idx]
|
25
|
+
puts "删除的key为:#{oss_key}".red
|
26
|
+
Lhj::OSS::Helper.instance.delete(oss_key)
|
45
27
|
end
|
28
|
+
|
46
29
|
end
|
47
30
|
end
|
48
31
|
end
|
@@ -0,0 +1,38 @@
|
|
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
|
+
self.summary = '下载OSS'
|
11
|
+
|
12
|
+
def initialize(argv)
|
13
|
+
@current_path = argv.shift_argument || Dir.pwd
|
14
|
+
@cli = HighLine.new
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def handle
|
19
|
+
objects = Lhj::OSS::Helper.instance.list
|
20
|
+
obj_keys = []
|
21
|
+
objects.each_with_index do |o, i|
|
22
|
+
obj_keys << o.key
|
23
|
+
puts "#{i}.#{o.key}".yellow
|
24
|
+
end
|
25
|
+
idx = @cli.ask('请选择下载的序号: '.green).strip.to_i
|
26
|
+
oss_key = obj_keys[idx]
|
27
|
+
puts "下载的key为:#{oss_key}".yellow
|
28
|
+
|
29
|
+
file_key = oss_key.split('/').last
|
30
|
+
file = File.join(@current_path, file_key)
|
31
|
+
Lhj::OSS::Helper.instance.down_load(oss_key, file)
|
32
|
+
puts "下载文件到目录: #{file}\n".yellow
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/lhj/command/oss/list.rb
CHANGED
@@ -10,8 +10,8 @@ module Lhj
|
|
10
10
|
def handle
|
11
11
|
objects = Lhj::OSS::Helper.instance.list
|
12
12
|
rows = []
|
13
|
-
objects.
|
14
|
-
path = "#{Lhj::OSS::Helper.instance.url_path}/#{o.key}"
|
13
|
+
objects.each_with_index do |o, i|
|
14
|
+
path = "#{i}.#{Lhj::OSS::Helper.instance.url_path}/#{o.key}"
|
15
15
|
rows << [path]
|
16
16
|
end
|
17
17
|
table = Terminal::Table.new title: 'OSS List', headings: ['URL'], rows: rows
|
@@ -1,50 +1,44 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'lhj/helper/oss_helper'
|
4
|
+
require 'highline'
|
4
5
|
|
5
6
|
module Lhj
|
6
7
|
class Command
|
7
8
|
class OSS < Command
|
8
9
|
# OSS file upload
|
9
10
|
class Upload < OSS
|
10
|
-
self.summary = '上传文件'
|
11
|
+
self.summary = '上传文件(添加标签 --tag=XX)'
|
11
12
|
|
12
13
|
self.arguments = [
|
13
|
-
CLAide::Argument.new('type', false),
|
14
|
-
CLAide::Argument.new('name', false),
|
15
14
|
CLAide::Argument.new('tag', false)
|
16
15
|
]
|
17
16
|
|
18
17
|
def self.options
|
19
18
|
[
|
20
|
-
%w[--type 文件类型],
|
21
|
-
%w[--name 文件名],
|
22
19
|
%w[--tag 标签]
|
23
20
|
]
|
24
21
|
end
|
25
22
|
|
26
|
-
def validate!
|
27
|
-
super
|
28
|
-
help! '类型或名字必须输入' unless @name || @type
|
29
|
-
end
|
30
|
-
|
31
23
|
def initialize(argv)
|
32
24
|
@current_path = argv.shift_argument || Dir.pwd
|
33
|
-
@type = argv.option('type')
|
34
|
-
@name = argv.option('name')
|
35
25
|
@tag = argv.option('tag')
|
26
|
+
@cli = HighLine.new
|
36
27
|
super
|
37
28
|
end
|
38
29
|
|
39
30
|
def handle
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
31
|
+
file_list = []
|
32
|
+
file_name_list = []
|
33
|
+
Dir.glob("#{@current_path}/*").each_with_index do |f, i|
|
34
|
+
file_base_name = File.basename(f)
|
35
|
+
file_list << f
|
36
|
+
file_name_list << file_base_name
|
37
|
+
puts "#{i}.#{file_base_name}".yellow
|
47
38
|
end
|
39
|
+
idx = @cli.ask('请选择上传文件序号: '.green).strip.to_i
|
40
|
+
puts "上传的文件名:#{file_name_list[idx]}".yellow
|
41
|
+
upload(file_list[idx], file_name_list[idx])
|
48
42
|
end
|
49
43
|
|
50
44
|
private
|
@@ -54,7 +48,7 @@ module Lhj
|
|
54
48
|
oss_key = "#{@tag}/#{file_name}" if @tag
|
55
49
|
Lhj::OSS::Helper.instance.upload(oss_key, file)
|
56
50
|
url = Lhj::OSS::Helper.instance.object_url(oss_key)
|
57
|
-
puts "云端上传成功:#{url}\n"
|
51
|
+
puts "云端上传成功:#{url}\n".yellow
|
58
52
|
end
|
59
53
|
end
|
60
54
|
end
|
data/lib/lhj/command/trans.rb
CHANGED
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'
|
data/lib/lhj/tools/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.39
|
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-
|
11
|
+
date: 2022-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: claide
|
@@ -296,6 +296,7 @@ files:
|
|
296
296
|
- lib/lhj/command.rb
|
297
297
|
- lib/lhj/command/code/code_template.rb
|
298
298
|
- lib/lhj/command/code/template/dispatch_source.erb
|
299
|
+
- lib/lhj/command/code/template/message_query.erb
|
299
300
|
- lib/lhj/command/code/view.rb
|
300
301
|
- lib/lhj/command/config.rb
|
301
302
|
- lib/lhj/command/config/info.rb
|
@@ -304,6 +305,7 @@ files:
|
|
304
305
|
- lib/lhj/command/head_import.rb
|
305
306
|
- lib/lhj/command/http.rb
|
306
307
|
- lib/lhj/command/init.rb
|
308
|
+
- lib/lhj/command/jenkins_build.rb
|
307
309
|
- lib/lhj/command/local/fetch.rb
|
308
310
|
- lib/lhj/command/local/filter.rb
|
309
311
|
- lib/lhj/command/local/local.rb
|
@@ -311,6 +313,7 @@ files:
|
|
311
313
|
- lib/lhj/command/local/micro_service.rb
|
312
314
|
- lib/lhj/command/oss.rb
|
313
315
|
- lib/lhj/command/oss/del.rb
|
316
|
+
- lib/lhj/command/oss/download.rb
|
314
317
|
- lib/lhj/command/oss/list.rb
|
315
318
|
- lib/lhj/command/oss/upload.rb
|
316
319
|
- lib/lhj/command/pgyer_upload.rb
|