decode_xlog 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +39 -0
- data/bin/decode_xlog +13 -0
- data/lib/decode_xlog/version.rb +5 -0
- data/lib/decode_xlog.rb +34 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b11c60e91c73444b22284615ffb85d4d1baf9fa8124a66a645b2da45d3c8b572
|
4
|
+
data.tar.gz: 43f9edb2e90ad21db898952c18cbdcd4b1e8c4b1d06daaff32074aa6dc54c408
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 92dd5409b61f9778f916dc7aad4eb8dc2c409f904bae49e85e5333c3a6ac54c7ceaf4b27450fc091688290624fc995f6d08e3060ce1649ace54c5a0a5f39a5c6
|
7
|
+
data.tar.gz: 3ca4b3dd0207f0580ddbe014e69adc0a97f1bff6937aabc2f412593490a38011859a21b571cc2a3c003412d8b5fa4bbb303fe7046b5ee67e2a248e12894ec459
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# DecodeXlog
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/decode_xlog`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
|
11
|
+
$ bundle add decode_xlog
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
$ gem install decode_xlog
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
decode_xlog 日志路径
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
## Development
|
24
|
+
|
25
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
26
|
+
|
27
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/decode_xlog. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/decode_xlog/blob/main/CODE_OF_CONDUCT.md).
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
36
|
+
|
37
|
+
## Code of Conduct
|
38
|
+
|
39
|
+
Everyone interacting in the DecodeXlog project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/decode_xlog/blob/main/CODE_OF_CONDUCT.md).
|
data/bin/decode_xlog
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'decode_xlog'
|
4
|
+
|
5
|
+
|
6
|
+
# 参数传入需要解码的 xlog文件路径
|
7
|
+
DecodeXlog::Decode.decode(ARGV[0])
|
8
|
+
|
9
|
+
# DecodeXlog::Decode.decode('/Users/meme/Downloads/log_20220608.xlog')
|
10
|
+
|
11
|
+
|
12
|
+
# bundle install
|
13
|
+
# 终端执行 bundle exec decode_xlog /Users/meme/Downloads/log_20220608.xlog"
|
data/lib/decode_xlog.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
|
4
|
+
require_relative "decode_xlog/version"
|
5
|
+
require 'uri'
|
6
|
+
require 'net/http'
|
7
|
+
|
8
|
+
module DecodeXlog
|
9
|
+
class Decode
|
10
|
+
def self.decode(file_path)
|
11
|
+
|
12
|
+
url = URI("http://192.168.11.61:8080/decode")
|
13
|
+
# 这边修改了端口号 nginx 进行了端口转发
|
14
|
+
# url = URI("http://192.168.11.61:8080/decode/")
|
15
|
+
|
16
|
+
http = Net::HTTP.new(url.host, url.port);
|
17
|
+
request = Net::HTTP::Post.new(url)
|
18
|
+
form_data = [['file', File.open(file_path)]]
|
19
|
+
request.set_form form_data, 'multipart/form-data'
|
20
|
+
response = http.request(request)
|
21
|
+
data = response.read_body
|
22
|
+
|
23
|
+
to_file_path = file_path + '.log'
|
24
|
+
file = File.new to_file_path, 'w+'
|
25
|
+
file.binmode
|
26
|
+
file << data
|
27
|
+
file.flush
|
28
|
+
file.close
|
29
|
+
|
30
|
+
puts file.path
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: decode_xlog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- 华惠友
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-12-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: uri
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: net-http
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Write a longer description or delete this line.
|
84
|
+
email:
|
85
|
+
- huiyou.hua@2339.com
|
86
|
+
executables:
|
87
|
+
- decode_xlog
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- README.md
|
92
|
+
- bin/decode_xlog
|
93
|
+
- lib/decode_xlog.rb
|
94
|
+
- lib/decode_xlog/version.rb
|
95
|
+
homepage: https://github.com/HuiYouHua/decode_xlog
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
metadata: {}
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: 2.6.0
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubygems_version: 3.2.32
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: Write a short summary, because RubyGems requires one.
|
118
|
+
test_files: []
|