lhj-tools 0.1.82 → 0.1.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lhj/helper/log_helper.rb +8 -4
- data/lib/lhj/helper/pgyer_helper.rb +0 -9
- data/lib/lhj/tools/version.rb +1 -1
- metadata +1 -8
- data/lib/lhj/command/yapi/formatters/base.rb +0 -15
- data/lib/lhj/command/yapi/formatters/command_context.rb +0 -23
- data/lib/lhj/command/yapi/formatters/service.rb +0 -32
- data/lib/lhj/command/yapi/formatters/template/git.erb +0 -1
- data/lib/lhj/command/yapi/formatters/template/model.erb +0 -10
- data/lib/lhj/command/yapi/formatters/template/pgyer.erb +0 -6
- data/lib/lhj/command/yapi/formatters/template/yapi.erb +0 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ecd3e4d21f8dbd807a46255e7c0994147958c2bb66d66f6d2b99a98f0c0e55ff
|
|
4
|
+
data.tar.gz: 8cc85cd5f91d369a8075db2a1a979cbbe34d9df7cedf3f48f3afdc634428e127
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8847909651378802dc7dd96fe0b6fec13af17e8f699597b1da66a1ecef81f3bfca2636098385ab665e936d81c34f724140839282db797babf78788c573e550dc
|
|
7
|
+
data.tar.gz: 5a206f45dd6af27cc47d35c1240e6a05f173dc22ae27bf932a73bbcaf86cfc71a26679ddd45d8d67fa36d2e329c3016f96be150a6596958b0355a0c9e0baaaed
|
|
@@ -16,7 +16,7 @@ module Lhj
|
|
|
16
16
|
@log = fetch_log
|
|
17
17
|
@feature = fetch_feature
|
|
18
18
|
save_last_commit_hash
|
|
19
|
-
|
|
19
|
+
render_with_template('git_commit_log')
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def fetch_branch
|
|
@@ -88,9 +88,13 @@ module Lhj
|
|
|
88
88
|
File.join(Lhj::Config.instance.home_dir, ".#{@env}_#{branch_name}_last_commit")
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
-
def
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
def render_with_template(template_name = 'git')
|
|
92
|
+
temp = Lhj::ErbTemplateHelper.load(template_name)
|
|
93
|
+
vars = { branch: @branch,
|
|
94
|
+
env: @env,
|
|
95
|
+
feature: @feature,
|
|
96
|
+
log: @log }
|
|
97
|
+
Lhj::ErbTemplateHelper.render(temp, vars, '-')
|
|
94
98
|
end
|
|
95
99
|
|
|
96
100
|
end
|
|
@@ -101,15 +101,6 @@ module Lhj
|
|
|
101
101
|
Actions.sh(update_cmd.join(' '), log: false, error_callback: nil)
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
-
def render_template
|
|
105
|
-
if @result.is_a? Hash
|
|
106
|
-
temp_str = File.read(File.join(Lhj::Config.instance.home_dir, 'pgyer.erb'))
|
|
107
|
-
Lhj::ErbFormatter::Service.new(self).render_template(temp_str)
|
|
108
|
-
else
|
|
109
|
-
@result
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
|
|
113
104
|
def render_with_template(template_name = 'pgyer')
|
|
114
105
|
if @result.is_a? Hash
|
|
115
106
|
temp = Lhj::ErbTemplateHelper.load(template_name)
|
data/lib/lhj/tools/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.83
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- lihaijian
|
|
@@ -360,13 +360,6 @@ files:
|
|
|
360
360
|
- lib/lhj/command/template.rb
|
|
361
361
|
- lib/lhj/command/trans.rb
|
|
362
362
|
- lib/lhj/command/yapi.rb
|
|
363
|
-
- lib/lhj/command/yapi/formatters/base.rb
|
|
364
|
-
- lib/lhj/command/yapi/formatters/command_context.rb
|
|
365
|
-
- lib/lhj/command/yapi/formatters/service.rb
|
|
366
|
-
- lib/lhj/command/yapi/formatters/template/git.erb
|
|
367
|
-
- lib/lhj/command/yapi/formatters/template/model.erb
|
|
368
|
-
- lib/lhj/command/yapi/formatters/template/pgyer.erb
|
|
369
|
-
- lib/lhj/command/yapi/formatters/template/yapi.erb
|
|
370
363
|
- lib/lhj/command/yapi/yapi_init.rb
|
|
371
364
|
- lib/lhj/config.rb
|
|
372
365
|
- lib/lhj/env.rb
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Lhj
|
|
4
|
-
module ErbFormatter
|
|
5
|
-
# context
|
|
6
|
-
class Context
|
|
7
|
-
def initialize(target)
|
|
8
|
-
@target = target
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def fetch_binding
|
|
12
|
-
@target.instance_eval { binding }.tap do |bind|
|
|
13
|
-
decorate_binding(bind)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# 空方法
|
|
18
|
-
def decorate_binding(bind)
|
|
19
|
-
bind.eval('save = 1')
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
require 'erb'
|
|
2
|
-
require_relative 'base'
|
|
3
|
-
require_relative 'command_context'
|
|
4
|
-
|
|
5
|
-
module Lhj
|
|
6
|
-
module ErbFormatter
|
|
7
|
-
# service
|
|
8
|
-
class Service < Base
|
|
9
|
-
# @param [String] name
|
|
10
|
-
def render(name = 'yapi')
|
|
11
|
-
temp_str = template_str(name)
|
|
12
|
-
render_template(temp_str)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def render_template(temp_str)
|
|
16
|
-
template(temp_str).result(Context.new(@runner).fetch_binding)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def template_str(name)
|
|
20
|
-
File.read(File.join(File.dirname(__FILE__), 'template', "#{name}.erb"))
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def template(template_str)
|
|
24
|
-
if RUBY_VERSION < '2.6'
|
|
25
|
-
ERB.new(template_str, nil, '-')
|
|
26
|
-
else
|
|
27
|
-
ERB.new(template_str, trim_mode: '-')
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
【代码分支:<%= @branch %>】【服务环境:<%= @env %>】-【最近更新日志】<%= @log %>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<% if @result_model_name %>
|
|
2
|
-
if (responseMessage.resultCode == 0 && responseMessage.error == nil) {
|
|
3
|
-
if ([responseMessage.detailMsg isKindOfClass:[NSDictionary class]]) {
|
|
4
|
-
<%= @result_model_name %> *info = <%= @result_model_name %> yy_modelWithDictionary:responseMessage.detailMsg];
|
|
5
|
-
callback(info,responseMessage);
|
|
6
|
-
}
|
|
7
|
-
} else {
|
|
8
|
-
callback(nil,responseMessage);
|
|
9
|
-
}
|
|
10
|
-
<% end %>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#### 应用名称:<%= @result['data']['appName'] %>
|
|
2
|
-
#### 版本信息:<%= @result['data']['appVersion'] %>(Build <%= @result['data']['appBuildVersion'] %>)
|
|
3
|
-
#### 更新时间:<%= @result['data']['appCreated'] %>
|
|
4
|
-
#### 更新内容:<%= @result['data']['appUpdateDescription'] %>
|
|
5
|
-
> 
|
|
6
|
-
> [下载](https://www.pgyer.com/<%= @result['data']['appShortcutUrl'] %>)
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* <%= @title %> -- <%= @username %>
|
|
3
|
-
* <%= @desc %>
|
|
4
|
-
*/
|
|
5
|
-
static NSString * const <%= @path_key %> = @"<%= @path %>";
|
|
6
|
-
|
|
7
|
-
<% if @method == 'GET' -%>
|
|
8
|
-
+(void)get<%= @path_name %>:(<%= @param_model_name %> *)param callback:(void (^)(<% unless @result_model_name.empty? -%><%= @result_model_name %> *model, <% end -%>MLResponseMessage *response))callback
|
|
9
|
-
{
|
|
10
|
-
[MLNetworkingManager getWithUrl:<%= @path_key %> params:params response:^(MLResponseMessage *responseMessage) {
|
|
11
|
-
<%= @model_template %>
|
|
12
|
-
}];
|
|
13
|
-
}
|
|
14
|
-
<% elsif @method == 'JSON' -%>
|
|
15
|
-
+(void)postJson<%= @path_name %>:(<%= @param_model_name %> *)param callback:(void (^)(<% unless @result_model_name.empty? -%><%= @result_model_name %> *model, <% end -%>MLResponseMessage *response))callback
|
|
16
|
-
{
|
|
17
|
-
[MLNetworkingManager requestJsonWithUrl:<%= @path_key %> httpMedth:kRequestMethodPOST params:param response:^(MLResponseMessage *responseMessage) {
|
|
18
|
-
<%= @model_template %>
|
|
19
|
-
}];
|
|
20
|
-
}
|
|
21
|
-
<% else -%>
|
|
22
|
-
+(void)post<%= @path_name %>:(<%= @param_model_name %> *)param callback:(void (^)(<% unless @result_model_name.empty? -%><%= @result_model_name %> *model, <% end -%>MLResponseMessage *response))callback
|
|
23
|
-
{
|
|
24
|
-
[MLNetworkingManager postWithUrl:<%= @path_key %> params:params response:^(MLResponseMessage *response) {
|
|
25
|
-
<%= @model_template %>
|
|
26
|
-
}];
|
|
27
|
-
}
|
|
28
|
-
<% end -%>
|