oci_config_reader 0.0.4

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5e3b5fb4f78faaadc5381c354c396c6a335c08f2ebe4d18796dd45971ef14da2
4
+ data.tar.gz: 26366d52b1695f201cd8a7113d094cad2f050fd74fba2116172f33008a92d67b
5
+ SHA512:
6
+ metadata.gz: 27c3f0017b67049c0e6036f7d71b93eed96c85b1cba9e588afb9fdba47e2c35574dc509377315031e2eec4027561676556c404d51368be40646f27e6b19e8672
7
+ data.tar.gz: 87faaa69e6461b355f7780c045e1485d40e2c94865511f4d903f45331c31345a1b9fca755cc8bda8ecfa1e5cfb0d7307fc9a05e6b036cba259085cdb118a2749
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in oci_config_reader.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,19 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ oci_config_reader (0.0.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (12.3.3)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ oci_config_reader!
16
+ rake (~> 12.0)
17
+
18
+ BUNDLED WITH
19
+ 2.1.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Szabolcs Toth
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,34 @@
1
+ # OciConfigReader
2
+
3
+ A simple gem to read data from oci config file. So in Ruby sample codes you don't need to write down/copy-paste the same information again-and-again.
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'oci_config_reader'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle install
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install oci_config_reader
21
+
22
+ ## Usage
23
+
24
+ OciConfigReader.oci_config_data["user/fingerprint/key_file/tenancy/region"]
25
+
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kicsipixel/oci_config_reader.
30
+
31
+
32
+ ## License
33
+
34
+ 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,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "oci_config_reader"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ 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,26 @@
1
+ require "oci_config_reader/version"
2
+
3
+ module OciConfigReader
4
+ class Error < StandardError; end
5
+ def self.version
6
+ OciConfigReader::VERSION
7
+ end
8
+
9
+ def self.oci_config_data
10
+ oci_config_path = "#{Dir.home}/.oci/config"
11
+ oci_config_data = {}
12
+
13
+ file = File.open(oci_config_path)
14
+ file_data = file.readlines.map(&:chomp)
15
+ file_data.each do |line|
16
+ if line !=~ /[DEFAULT]/
17
+ oci_config_data["user"] = "#{line.match(/(?<==).+/)}" if line =~ /user/
18
+ oci_config_data["fingerprint"] = "#{line.match(/(?<==).+/)}" if line =~ /fingerprint/
19
+ oci_config_data["key_file"] = ("#{line.match(/(?<==).+/)}").gsub(/~/, "#{Dir.home}") if line =~ /key_file/
20
+ oci_config_data["tenancy"] = "#{line.match(/(?<==).+/)}" if line =~ /tenancy/
21
+ oci_config_data["region"] = "#{line.match(/(?<==).+/)}" if line =~ /region/
22
+ end
23
+ end
24
+ return oci_config_data
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module OciConfigReader
2
+ VERSION = "0.0.4"
3
+ end
@@ -0,0 +1,29 @@
1
+ require_relative 'lib/oci_config_reader/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "oci_config_reader"
5
+ spec.version = OciConfigReader::VERSION
6
+ spec.authors = ["Szabolcs Toth"]
7
+ spec.email = ["tsz@purzelbaum.hu"]
8
+
9
+ spec.summary = %q{A Ruby gem to read out oci config data.}
10
+ spec.description = %q{A simple gem to read data from oci config file. So in Ruby sample codes you don't need to write down/copy-paste the same information again-and-again.}
11
+ spec.homepage = "https://github.com/kicsipixel/oci_config_reader"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ # spec.metadata["allowed_push_host"] = "Set to 'http://mygemserver.com'"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/kicsipixel/oci_config_reader"
19
+ spec.metadata["changelog_uri"] = "https://github.com/kicsipixel/oci_config_reader"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: oci_config_reader
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Szabolcs Toth
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-04-16 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple gem to read data from oci config file. So in Ruby sample codes
14
+ you don't need to write down/copy-paste the same information again-and-again.
15
+ email:
16
+ - tsz@purzelbaum.hu
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ".gitignore"
22
+ - Gemfile
23
+ - Gemfile.lock
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - bin/console
28
+ - bin/setup
29
+ - lib/oci_config_reader.rb
30
+ - lib/oci_config_reader/version.rb
31
+ - oci_config_reader.gemspec
32
+ homepage: https://github.com/kicsipixel/oci_config_reader
33
+ licenses:
34
+ - MIT
35
+ metadata:
36
+ homepage_uri: https://github.com/kicsipixel/oci_config_reader
37
+ source_code_uri: https://github.com/kicsipixel/oci_config_reader
38
+ changelog_uri: https://github.com/kicsipixel/oci_config_reader
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 2.3.0
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubygems_version: 3.0.3
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: A Ruby gem to read out oci config data.
58
+ test_files: []