scaleway_data 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +52 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/scaleway_data.rb +29 -0
- data/lib/scaleway_data/version.rb +3 -0
- data/scaleway_data.gemspec +26 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 677a1c198e572ddae053eb18d139e07fa548264eb94eecde8ae4c59640d5564c
|
4
|
+
data.tar.gz: 6a939a946bd65092700d74028a7b81245ec3b304d279dc6a7572dad4c82eccdd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 128cb689ce3fee721cd786fad6f186f7d05fd4c5e189b6ef8e2d1bbc13f1e1b208be184a8351086ec322eb0c104877964cb68c3b8330f4c15efbc561a402c865
|
7
|
+
data.tar.gz: 68b3e4c3010b34613a93c1bbe65ed587684a1b47dbe2de890b80f32da0c740612588b753d72369c34e3456c2db532cd4fd582b1a768e1ceaa7e6e6b244b3c9d3
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Tung Nguyen
|
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,52 @@
|
|
1
|
+
# ScalewayData
|
2
|
+
|
3
|
+
Simple library to get current scaleway data like project and region.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'scaleway_data'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install scaleway_data
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
ScalewayData.organization
|
25
|
+
ScalewayData.project
|
26
|
+
ScalewayData.region
|
27
|
+
ScalewayData.zone
|
28
|
+
```
|
29
|
+
|
30
|
+
## Precedence
|
31
|
+
|
32
|
+
This library will return project, region and zone info using different sources with this precedence:
|
33
|
+
|
34
|
+
1. Environment variables: SCW_DEFAULT_ORGANIZATION_ID, SCW_DEFAULT_PROJECT_ID, SCW_DEFAULT_REGION, SCW_DEFAULT_ZONE
|
35
|
+
2. Defaults: region=fr-par and zone=fr-par-1
|
36
|
+
|
37
|
+
### 1. Environment variables
|
38
|
+
|
39
|
+
The environment variables take the highest precedence:
|
40
|
+
|
41
|
+
SCW_DEFAULT_ORGANIZATION_ID, SCW_DEFAULT_PROJECT_ID, SCW_DEFAULT_REGION, SCW_DEFAULT_ZONE
|
42
|
+
|
43
|
+
### 2. Defaults
|
44
|
+
|
45
|
+
The library will fallback to default values when it's unable to lookup the region and zone. The default values are:
|
46
|
+
|
47
|
+
region=fr-par
|
48
|
+
zone=fr-par-1
|
49
|
+
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/synalabs/scaleway_data.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "scaleway_data"
|
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,29 @@
|
|
1
|
+
require "json"
|
2
|
+
require "memoist"
|
3
|
+
|
4
|
+
module ScalewayData
|
5
|
+
class Error < StandardError; end
|
6
|
+
extend Memoist
|
7
|
+
|
8
|
+
def organization
|
9
|
+
ENV['SCW_DEFAULT_ORGANIZATION_ID'] || raise("Unable to look up scaleway organization_id")
|
10
|
+
end
|
11
|
+
memoize :organization
|
12
|
+
|
13
|
+
def project
|
14
|
+
ENV['SCW_DEFAULT_PROJECT_ID'] || raise("Unable to look up scaleway project_id")
|
15
|
+
end
|
16
|
+
memoize :project
|
17
|
+
|
18
|
+
def region
|
19
|
+
ENV['SCW_DEFAULT_REGION'] || 'fr-par'
|
20
|
+
end
|
21
|
+
memoize :region
|
22
|
+
|
23
|
+
def zone
|
24
|
+
ENV['SCW_DEFAULT_ZONE'] || 'fr-par-1'
|
25
|
+
end
|
26
|
+
memoize :zone
|
27
|
+
|
28
|
+
extend self
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative 'lib/scaleway_data/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "scaleway_data"
|
5
|
+
spec.version = ScalewayData::VERSION
|
6
|
+
spec.authors = ["Francois Baligant"]
|
7
|
+
spec.email = ["fbaligant@synalabs.com"]
|
8
|
+
|
9
|
+
spec.summary = "Simple module to get current scaleway data project and region"
|
10
|
+
spec.homepage = "https://github.com/synalabs/scaleway_data"
|
11
|
+
spec.license = "MIT"
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
|
+
|
14
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_dependency "memoist"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scaleway_data
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Francois Baligant
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-03-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: memoist
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- fbaligant@synalabs.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- ".rspec"
|
36
|
+
- ".travis.yml"
|
37
|
+
- CHANGELOG.md
|
38
|
+
- Gemfile
|
39
|
+
- LICENSE.txt
|
40
|
+
- README.md
|
41
|
+
- Rakefile
|
42
|
+
- bin/console
|
43
|
+
- bin/setup
|
44
|
+
- lib/scaleway_data.rb
|
45
|
+
- lib/scaleway_data/version.rb
|
46
|
+
- scaleway_data.gemspec
|
47
|
+
homepage: https://github.com/synalabs/scaleway_data
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
metadata:
|
51
|
+
homepage_uri: https://github.com/synalabs/scaleway_data
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.3.0
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubygems_version: 3.1.4
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: Simple module to get current scaleway data project and region
|
71
|
+
test_files: []
|