bottompad1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9ca2d5c4142c5173385c37ec6c4bc51ee41afabf5f8a95145f934d03bf63be32
4
+ data.tar.gz: 181bef30f37cb539f41cfc222c4cec58d4b08693aeab4f899266ef3ae4efa647
5
+ SHA512:
6
+ metadata.gz: aad7c39a8456a424b707d9a1b9a2de2a14654b264229af8b4fa3f5f60e7fa5b4ef1d7402ed5b7ff899f2fe3871dcf3ee62b96a59d7e6c50e55ee612f06350cfb
7
+ data.tar.gz: ef1f8e7a49cede57048402c294ebd614235823ee3a8fa6592208903915182be1f66e3d878592ed19a54660685d1d48f38313fffb9a9fd09a0736336e284d4e2d
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in bottompad1.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Anchal Gupta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Bottompad1
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/bottompad1`. 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
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'bottompad1'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install bottompad1
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bottompad1.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "bottompad1"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/bottompad1/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "bottompad1"
7
+ spec.version = Bottompad1::VERSION
8
+ spec.authors = ["Anchal Gupta"]
9
+ spec.email = ["anchal.gupta155@gmail.com"]
10
+
11
+ spec.summary = "Utility"
12
+ spec.description = "Utility for sample"
13
+ spec.homepage = "https://github.com/anchalgupta1996/bottompad"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.4.0"
16
+
17
+ # spec.metadata["allowed_push_host"] = "Set to 'https://mygemserver.com'"
18
+
19
+ # spec.metadata["homepage_uri"] = spec.homepage
20
+ # spec.metadata["source_code_uri"] = "Put your gem's public repo URL here."
21
+ # spec.metadata["changelog_uri"] = "Put your gem's CHANGELOG.md URL here."
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ # Uncomment to register a new dependency of your gem
33
+ # spec.add_dependency "example-gem", "~> 1.0"
34
+ spec.add_dependency "elastic-apm", "~> 4.3"
35
+
36
+ # For more information and examples about making a new gem, checkout our
37
+ # guide at: https://bundler.io/guides/creating_gem.html
38
+ end
data/lib/bottompad1.rb ADDED
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "bottompad1/version"
4
+
5
+ module Bottompad1
6
+
7
+ class Error < StandardError; end
8
+
9
+ def self.set_sftrace_config(current_path, env)
10
+
11
+ sftrace_config_file = current_path + "/sftrace-" + env + "-config.yaml"
12
+
13
+ if (File.exist?(sftrace_config_file))
14
+ sftrace_array = YAML.load_file(sftrace_config_file)
15
+ else
16
+ puts "[SFTRACE] Please provide a sftrace config.yaml file."
17
+ return
18
+ end
19
+
20
+ if ((sftrace_array["key"] != nil) &&
21
+ (sftrace_array["tags"] != nil) &&
22
+ (sftrace_array["tags"]["serviceName"] != nil) &&
23
+ (sftrace_array["tags"]["appName"] != nil) &&
24
+ (sftrace_array["tags"]["projectName"] != nil)
25
+ )
26
+
27
+ decoded_key = Base64.decode64("U25hcHB5RmxvdzEyMzQ1Ng==")
28
+ decoded_profile_key = Base64.decode64(sftrace_array["key"])
29
+
30
+ decipher = OpenSSL::Cipher::AES.new(128, :CBC)
31
+ decipher.decrypt
32
+ decipher.key = decoded_key
33
+ decipher.iv = decoded_profile_key[0, 16]
34
+ plain = decipher.update(decoded_profile_key[16..-1]) + decipher.final
35
+ plain_json = JSON.parse(plain)
36
+
37
+ global_labels = "_tag_projectName=" + sftrace_array["tags"]["projectName"] +
38
+ ",_tag_appName=" + sftrace_array["tags"]["appName"] +
39
+ ",_tag_profileId=" + plain_json["profile_id"]
40
+
41
+ ENV['ELASTIC_APM_VERIFY_SERVER_CERT'] = "false"
42
+ ENV['ELASTIC_APM_CENTRAL_CONFIG'] = "false"
43
+ ENV['ELASTIC_APM_SPAN_FRAMES_MIN_DURATION'] = "1s"
44
+ ENV['ELASTIC_APM_STACK_TRACE_LIMIT'] = "2"
45
+
46
+ ENV['ELASTIC_APM_SERVICE_NAME'] = sftrace_array["tags"]["serviceName"]
47
+ ENV['ELASTIC_APM_SERVER_URL'] = plain_json["trace_server_url"]
48
+ ENV['ELASTIC_APM_GLOBAL_LABELS'] = global_labels
49
+
50
+ puts "[SFTRACE] ELASTIC_APM_SERVICE_NAME : " + ENV['ELASTIC_APM_SERVICE_NAME']
51
+ puts "[SFTRACE] ELASTIC_APM_SERVER_URL : " + ENV['ELASTIC_APM_SERVER_URL']
52
+ puts "[SFTRACE] ELASTIC_APM_GLOBAL_LABELS : " + ENV['ELASTIC_APM_GLOBAL_LABELS']
53
+
54
+ else
55
+ puts "[SFTRACE] Add all the required details in sftrace config.yaml file."
56
+ end
57
+
58
+ end
59
+
60
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bottompad1
4
+ VERSION = "0.1.0"
5
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bottompad1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Anchal Gupta
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-08-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: elastic-apm
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.3'
27
+ description: Utility for sample
28
+ email:
29
+ - anchal.gupta155@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - Gemfile
36
+ - LICENSE.txt
37
+ - README.md
38
+ - Rakefile
39
+ - bin/console
40
+ - bin/setup
41
+ - bottompad1.gemspec
42
+ - lib/bottompad1.rb
43
+ - lib/bottompad1/version.rb
44
+ homepage: https://github.com/anchalgupta1996/bottompad
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 2.4.0
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubygems_version: 3.1.6
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: Utility
67
+ test_files: []