torna_sdk 0.1.5 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b4d4a03c2ef4aadc323910b7eb5b6ee2333e9f5395325a48bfed93b5dc64182
4
- data.tar.gz: 14eecb646289bb8c51de5a9ceaaffd45b74fbbcf2dad3484a75e16c25ebba7c4
3
+ metadata.gz: 90a478f5afc982b3e00dd59c68046c37c271e1bc44b7ca81522ec6f0c878f952
4
+ data.tar.gz: 15d5e33a8b65552d594f6b1db53704c480b7dd6fafc8b5aa10a4013af535b447
5
5
  SHA512:
6
- metadata.gz: 799227d3cc14f0a84b59dd7a55c97321ed0ac8889af3fefb9ed758c4080517de32d096417226826a20ef67891b7426e48f711917bded4afa22e654510e002031
7
- data.tar.gz: d9b8f13a5c39e0225b4ed5e6a4dd2867374b2996ccc9f33243a37c7f79fd5dbd80ccb8e1a07a8041dfb653bc989c4591cbe9ba88cd8f6aa885dee24fa719c91e
6
+ metadata.gz: 4ceb8783141f2a83b2658a3a0e7932662a1e931743f2cde69369f0a647778b5c0fee9f2d5213144011fd584497f4917b04864f91a3710de5170a7f43aa195f4c
7
+ data.tar.gz: 603ac8635761acc1f8e7fd39d32060d08a11718c9f7e7524c81a60a746bdc484545d792cec97d0b6c282ae920a316c1d775138f856e903c4d7f4a94bb89019ce
data/.cz.yaml CHANGED
@@ -4,5 +4,5 @@ commitizen:
4
4
  name: cz_conventional_commits
5
5
  tag_format: 0.1.5
6
6
  update_changelog_on_bump: true
7
- version: 0.4.0
7
+ version: 0.5.0
8
8
  version_scheme: semver
data/CHANGELOG.md CHANGED
@@ -64,3 +64,60 @@
64
64
  - **railtie**: load torna.rake exactly
65
65
  - **log**: remove unnecessary logs
66
66
  - **gemspec**: remove Appraisals corectlly
67
+
68
+ ## 0.1.5 (2025-01-15)
69
+
70
+ ### Feat
71
+
72
+ - **torna.rake**: add more fields to documents
73
+
74
+ ## 0.1.5 (2024-12-29)
75
+
76
+ ### Feat
77
+
78
+ - torna api
79
+
80
+ ### Fix
81
+
82
+ - **torna.rake**: should depends_on :environment
83
+ - **railtie**: load torna.rake exactly
84
+ - **log**: remove unnecessary logs
85
+ - **gemspec**: remove Appraisals corectlly
86
+
87
+ ## 0.1.5 (2025-01-15)
88
+
89
+ ### Feat
90
+
91
+ - **torna.rake**: add more fields to documents
92
+
93
+ ## 0.1.5 (2024-12-29)
94
+
95
+ ### Feat
96
+
97
+ - torna api
98
+
99
+ ### Fix
100
+
101
+ - **torna.rake**: should depends_on :environment
102
+ - **railtie**: load torna.rake exactly
103
+ - **log**: remove unnecessary logs
104
+ - **gemspec**: remove Appraisals corectlly
105
+
106
+ ## 0.1.5 (2025-01-15)
107
+
108
+ ### Feat
109
+
110
+ - **torna.rake**: add more fields to documents
111
+
112
+ ## 0.1.5 (2024-12-29)
113
+
114
+ ### Feat
115
+
116
+ - torna api
117
+
118
+ ### Fix
119
+
120
+ - **torna.rake**: should depends_on :environment
121
+ - **railtie**: load torna.rake exactly
122
+ - **log**: remove unnecessary logs
123
+ - **gemspec**: remove Appraisals corectlly
data/lib/tasks/torna.rake CHANGED
@@ -6,6 +6,8 @@ namespace :torna do
6
6
  Rails.application.reload_routes!
7
7
  routes = Rails.application.routes.routes
8
8
 
9
+ author = ENV["AUTHOR"] || ""
10
+
9
11
  torna_apis = routes.map do |route|
10
12
  # {
11
13
  # "name": "获取商品信息",
@@ -163,13 +165,14 @@ namespace :torna do
163
165
  # "items": []
164
166
  # }
165
167
  {
166
- "name" => "#{route.verb} #{route.path.spec}",
168
+ "isFolder" => 0,
169
+ "isShow" => 1,
167
170
  "type" => 0,
171
+ "author" => author,
172
+ "name" => "#{route.verb} #{route.path.spec}",
168
173
  "url" => route.path.spec.to_s,
169
174
  "httpMethod" => route.verb.to_s,
170
175
  "contentType" => route.defaults[:format] || "application/json",
171
- "isFolder" => 0,
172
- "isShow" => 1,
173
176
  "pathParams" => route.path.required_names.map { |name| { "name" => name, "type" => "string" } }
174
177
  }
175
178
  end
@@ -180,6 +183,11 @@ namespace :torna do
180
183
 
181
184
  uri = URI.parse(ENV["TORNADO_URL"])
182
185
  access_token = ENV["TORNADO_ACCESS_TOKEN"]
186
+ git_url = ENV["GIT_URL"]
187
+ branch = ENV["GIT_BRANCH"]
188
+
189
+ is_replace = ENV["IS_REPLACE"] || "1"
190
+ is_override = ENV["IS_OVERRIDE"] || "0"
183
191
 
184
192
  raise "Please set TORNADO_URL and TORNADO_ACCESS_TOKEN" if uri.nil? || access_token.nil?
185
193
 
@@ -188,23 +196,32 @@ namespace :torna do
188
196
  data = {
189
197
  "debugEnvs" => [],
190
198
  "commonErrorCodes" => [],
191
- "isReplace" => 0,
192
- "isOverride" => 0,
199
+ "isReplace" => is_replace.to_i,
200
+ "isOverride" => is_override.to_i,
193
201
  "apis" => torna_apis
194
202
  }
195
203
 
204
+ data["gitUrl"] = git_url if git_url
205
+ data["moduleName"] = branch if branch
206
+
196
207
  request_body = {
197
208
  access_token: access_token,
198
209
  name: "doc.push",
199
210
  version: "1.0",
200
- data: URI.encode_www_form_component(data.to_json)
211
+ data: URI.encode_www_form_component(data.to_json),
212
+ timestamp: Time.now.strftime("%Y-%m-%d %H:%M:%S")
201
213
  }
202
214
 
203
- http = Net::HTTP.new(uri.host, uri.port)
215
+ # print request body
216
+ puts "========== Request:"
217
+ puts request_body.to_json
218
+ puts "=========="
219
+
204
220
  request = Net::HTTP::Post.new(uri.request_uri, header)
205
221
  request.body = request_body.to_json
206
-
207
- response = http.request(request)
222
+ response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
223
+ http.request(request)
224
+ end
208
225
 
209
226
  if response.code == "200"
210
227
  puts "Success: #{response.code} #{response.body}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TornaSdk
4
- VERSION = "0.1.5"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torna_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JustQyx
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-29 00:00:00.000000000 Z
11
+ date: 2025-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -143,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - ">="
145
145
  - !ruby/object:Gem::Version
146
- version: 2.6.6
146
+ version: 2.6.0
147
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - ">="