mitwelt 0.1.0

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: 8e7676b9a2344a648ea1bf32c22e48a7e19cb19157680f0607bf00c4ac9b8c34
4
+ data.tar.gz: 72affa0f80cba48be6a8d9dde3a55b0adb9a106c74fd48515c28ab8f925b8559
5
+ SHA512:
6
+ metadata.gz: d743224185482d59f2686f9dd7c0e19a1eaa39b967f05456a2f82f3d2660144051cf576d819adb833adea5f074d82d07046ac2b457006207684a22a8fb4c2430
7
+ data.tar.gz: 4fd00b0d65e6f98ee97f4d6b387bbf285046ff1d5e233b1c694a65a8570b2bc73452adc5b3d0614f8d2cea871dc4d5bff381590545b1386e2bb4dbb201368b36
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,161 @@
1
+ # Common configuration.
2
+
3
+ inherit_gem:
4
+ standard: config/base.yml
5
+
6
+ require:
7
+ - rubocop-performance
8
+ - rubocop-rspec
9
+ - standard/cop/block_single_line_braces
10
+
11
+ AllCops:
12
+ RubyInterpreters:
13
+ - ruby
14
+ - macruby
15
+ - rake
16
+ - jruby
17
+ - rbx
18
+ # Include common Ruby source files.
19
+ Include:
20
+ - '**/*.rb'
21
+ - '**/*.arb'
22
+ - '**/*.axlsx'
23
+ - '**/*.builder'
24
+ - '**/*.fcgi'
25
+ - '**/*.gemfile'
26
+ - '**/*.gemspec'
27
+ - '**/*.god'
28
+ - '**/*.jb'
29
+ - '**/*.jbuilder'
30
+ - '**/*.mspec'
31
+ - '**/*.opal'
32
+ - '**/*.pluginspec'
33
+ - '**/*.podspec'
34
+ - '**/*.rabl'
35
+ - '**/*.rake'
36
+ - '**/*.rbuild'
37
+ - '**/*.rbw'
38
+ - '**/*.rbx'
39
+ - '**/*.ru'
40
+ - '**/*.ruby'
41
+ - '**/*.spec'
42
+ - '**/*.thor'
43
+ - '**/*.watchr'
44
+ - '**/.irbrc'
45
+ - '**/.pryrc'
46
+ - '**/.simplecov'
47
+ - '**/buildfile'
48
+ - '**/Appraisals'
49
+ - '**/Berksfile'
50
+ - '**/Brewfile'
51
+ - '**/Buildfile'
52
+ - '**/Capfile'
53
+ - '**/Cheffile'
54
+ - '**/Dangerfile'
55
+ - '**/Deliverfile'
56
+ - '**/Fastfile'
57
+ - '**/*Fastfile'
58
+ - '**/Gemfile'
59
+ - '**/Guardfile'
60
+ - '**/Jarfile'
61
+ - '**/Mavenfile'
62
+ - '**/Podfile'
63
+ - '**/Puppetfile'
64
+ - '**/Rakefile'
65
+ - '**/rakefile'
66
+ - '**/Snapfile'
67
+ - '**/Steepfile'
68
+ - '**/Thorfile'
69
+ - '**/Vagabondfile'
70
+ - '**/Vagrantfile'
71
+ Exclude:
72
+ - 'node_modules/**/*'
73
+ - 'tmp/**/*'
74
+ - 'vendor/**/*'
75
+ - '.git/**/*'
76
+ # Default formatter will be used if no `-f/--format` option is given.
77
+ DefaultFormatter: progress
78
+ # Cop names are displayed in offense messages by default. Change behavior
79
+ # by overriding DisplayCopNames, or by giving the `--no-display-cop-names`
80
+ # option.
81
+ DisplayCopNames: true
82
+ # Style guide URLs are not displayed in offense messages by default. Change
83
+ # behavior by overriding `DisplayStyleGuide`, or by giving the
84
+ # `-S/--display-style-guide` option.
85
+ DisplayStyleGuide: false
86
+ # When specifying style guide URLs, any paths and/or fragments will be
87
+ # evaluated relative to the base URL.
88
+ StyleGuideBaseURL: https://rubystyle.guide
89
+ # Extra details are not displayed in offense messages by default. Change
90
+ # behavior by overriding ExtraDetails, or by giving the
91
+ # `-E/--extra-details` option.
92
+ ExtraDetails: false
93
+ # Additional cops that do not reference a style guide rule may be enabled by
94
+ # default. Change behavior by overriding `StyleGuideCopsOnly`, or by giving
95
+ # the `--only-guide-cops` option.
96
+ StyleGuideCopsOnly: false
97
+ # All cops except the ones configured `Enabled: false` in this file are enabled by default.
98
+ # Change this behavior by overriding either `DisabledByDefault` or `EnabledByDefault`.
99
+ # When `DisabledByDefault` is `true`, all cops in the default configuration
100
+ # are disabled, and only cops in user configuration are enabled. This makes
101
+ # cops opt-in instead of opt-out. Note that when `DisabledByDefault` is `true`,
102
+ # cops in user configuration will be enabled even if they don't set the
103
+ # Enabled parameter.
104
+ # When `EnabledByDefault` is `true`, all cops, even those configured `Enabled: false`
105
+ # in this file are enabled by default. Cops can still be disabled in user configuration.
106
+ # Note that it is invalid to set both EnabledByDefault and DisabledByDefault
107
+ # to true in the same configuration.
108
+ EnabledByDefault: false
109
+ DisabledByDefault: true
110
+ # New cops introduced between major versions are set to a special pending status
111
+ # and are not enabled by default with warning message.
112
+ # Change this behavior by overriding either `NewCops: enable` or `NewCops: disable`.
113
+ # When `NewCops` is `enable`, pending cops are enabled in bulk. Can be overridden by
114
+ # the `--enable-pending-cops` command-line option.
115
+ # When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
116
+ # the `--disable-pending-cops` command-line option.
117
+ NewCops: disable
118
+ # Enables the result cache if `true`. Can be overridden by the `--cache` command
119
+ # line option.
120
+ UseCache: true
121
+ # Threshold for how many files can be stored in the result cache before some
122
+ # of the files are automatically removed.
123
+ MaxFilesInCache: 20000
124
+ # The cache will be stored in "rubocop_cache" under this directory. If
125
+ # CacheRootDirectory is ~ (nil), which it is by default, the root will be
126
+ # taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
127
+ # `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
128
+ # The CacheRootDirectory can be overwritten by passing the `--cache-root` command
129
+ # line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.
130
+ CacheRootDirectory: ~
131
+ # It is possible for a malicious user to know the location of RuboCop's cache
132
+ # directory by looking at CacheRootDirectory, and create a symlink in its
133
+ # place that could cause RuboCop to overwrite unintended files, or read
134
+ # malicious input. If you are certain that your cache location is secure from
135
+ # this kind of attack, and wish to use a symlinked cache location, set this
136
+ # value to "true".
137
+ AllowSymlinksInCacheRootDirectory: false
138
+ # What MRI version of the Ruby interpreter is the inspected code intended to
139
+ # run on? (If there is more than one, set this to the lowest version.)
140
+ # If a value is specified for TargetRubyVersion then it is used. Acceptable
141
+ # values are specificed as a float (i.e. 2.5); the teeny version of Ruby
142
+ # should not be included. If the project specifies a Ruby version in the
143
+ # .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
144
+ # try to determine the desired version of Ruby by inspecting the
145
+ # .tool-versions file first, then .ruby-version, followed by the Gemfile.lock
146
+ # or gems.locked file. (Although the Ruby version is specified in the Gemfile
147
+ # or gems.rb file, RuboCop reads the final value from the lock file.) If the
148
+ # Ruby version is still unresolved, RuboCop will use the oldest officially
149
+ # supported Ruby version (currently Ruby 2.4).
150
+ TargetRubyVersion: 2.7
151
+ # Determines if a notification for extension libraries should be shown when
152
+ # rubocop is run. Keys are the name of the extension, and values are an array
153
+ # of gems in the Gemfile that the extension is suggested for, if not already
154
+ # included.
155
+ SuggestExtensions:
156
+ rubocop-rails: []
157
+
158
+ #################### Bundler ###############################
159
+
160
+ RSpec/AnyInstance:
161
+ Enabled: true
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/testdouble/standard
3
+ ruby_version: 2.6
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in mitwelt.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "standard", "~> 1.3"
data/Gemfile.lock ADDED
@@ -0,0 +1,81 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mitwelt (0.1.0)
5
+ dry-types (~> 1.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ concurrent-ruby (1.1.10)
12
+ diff-lcs (1.5.0)
13
+ dry-configurable (0.15.0)
14
+ concurrent-ruby (~> 1.0)
15
+ dry-core (~> 0.6)
16
+ dry-container (0.9.0)
17
+ concurrent-ruby (~> 1.0)
18
+ dry-configurable (~> 0.13, >= 0.13.0)
19
+ dry-core (0.7.1)
20
+ concurrent-ruby (~> 1.0)
21
+ dry-inflector (0.2.1)
22
+ dry-logic (1.2.0)
23
+ concurrent-ruby (~> 1.0)
24
+ dry-core (~> 0.5, >= 0.5)
25
+ dry-types (1.5.1)
26
+ concurrent-ruby (~> 1.0)
27
+ dry-container (~> 0.3)
28
+ dry-core (~> 0.5, >= 0.5)
29
+ dry-inflector (~> 0.1, >= 0.1.2)
30
+ dry-logic (~> 1.0, >= 1.0.2)
31
+ parallel (1.22.1)
32
+ parser (3.1.2.0)
33
+ ast (~> 2.4.1)
34
+ rainbow (3.1.1)
35
+ rake (13.0.6)
36
+ regexp_parser (2.5.0)
37
+ rexml (3.2.5)
38
+ rspec (3.11.0)
39
+ rspec-core (~> 3.11.0)
40
+ rspec-expectations (~> 3.11.0)
41
+ rspec-mocks (~> 3.11.0)
42
+ rspec-core (3.11.0)
43
+ rspec-support (~> 3.11.0)
44
+ rspec-expectations (3.11.0)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.11.0)
47
+ rspec-mocks (3.11.1)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.11.0)
50
+ rspec-support (3.11.0)
51
+ rubocop (1.29.1)
52
+ parallel (~> 1.10)
53
+ parser (>= 3.1.0.0)
54
+ rainbow (>= 2.2.2, < 4.0)
55
+ regexp_parser (>= 1.8, < 3.0)
56
+ rexml (>= 3.2.5, < 4.0)
57
+ rubocop-ast (>= 1.17.0, < 2.0)
58
+ ruby-progressbar (~> 1.7)
59
+ unicode-display_width (>= 1.4.0, < 3.0)
60
+ rubocop-ast (1.18.0)
61
+ parser (>= 3.1.1.0)
62
+ rubocop-performance (1.13.3)
63
+ rubocop (>= 1.7.0, < 2.0)
64
+ rubocop-ast (>= 0.4.0)
65
+ ruby-progressbar (1.11.0)
66
+ standard (1.12.1)
67
+ rubocop (= 1.29.1)
68
+ rubocop-performance (= 1.13.3)
69
+ unicode-display_width (2.2.0)
70
+
71
+ PLATFORMS
72
+ x86_64-darwin-21
73
+
74
+ DEPENDENCIES
75
+ mitwelt!
76
+ rake (~> 13.0)
77
+ rspec (~> 3.0)
78
+ standard (~> 1.3)
79
+
80
+ BUNDLED WITH
81
+ 2.3.17
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Julian Fahrer
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,33 @@
1
+ # Mitwelt
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/mitwelt`. 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 mitwelt
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install mitwelt
16
+
17
+ ## Usage
18
+
19
+ TODO: Write usage instructions here
20
+
21
+ ## Development
22
+
23
+ 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.
24
+
25
+ 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).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/mitwelt.
30
+
31
+ ## License
32
+
33
+ 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,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "standard/rake"
9
+
10
+ task default: %i[spec standard]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Mitwelt
4
+ VERSION = "0.1.0"
5
+ end
data/lib/mitwelt.rb ADDED
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry-types"
4
+ require_relative "mitwelt/version"
5
+
6
+ class Mitwelt
7
+ class Error < StandardError; end
8
+
9
+ module Types
10
+ include Dry.Types()
11
+ end
12
+
13
+ def self.fetch(key, type: :string, default: nil, required: false)
14
+ new(key, type: type, default: default, required: required).fetch
15
+ end
16
+
17
+ def initialize(key, type:, default:, required:)
18
+ @key = key
19
+ @type = type
20
+ @default = default.freeze
21
+ @required = required
22
+ end
23
+
24
+ def fetch
25
+ value = parsed_value
26
+ raise(Error.new("#{@key} is required but not in ENV")) if @required && value.nil?
27
+ value
28
+ end
29
+
30
+ def parsed_value
31
+ parser[value]
32
+ rescue Dry::Types::CoercionError => error
33
+ raise Error.new "Unable to parse #{@key} from ENV as #{@type}: #{error.message}"
34
+ end
35
+
36
+ def parser
37
+ {
38
+ string: Types::Coercible::String,
39
+ symbol: Types::Coercible::Symbol,
40
+ integer: Types::Params::Integer,
41
+ boolean: Types::Params::Bool,
42
+ timestamp: Types::Params::Time,
43
+ date: Types::Params::Date
44
+ }[@type].optional
45
+ end
46
+
47
+ def value
48
+ ENV[@key].nil? ? @default : ENV[@key]
49
+ end
50
+ end
data/mitwelt.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/mitwelt/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "mitwelt"
7
+ spec.version = Mitwelt::VERSION
8
+ spec.authors = ["Julian Fahrer"]
9
+ spec.email = ["julian@fahrer.net"]
10
+
11
+ spec.summary = "Ensure and parse Enviroment variables"
12
+ spec.description = "Mitwelt provides a wrapper around ENV to easily ensure and parse environment"
13
+ spec.homepage = "https://github.com/codetales/mitwelt"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = spec.homepage
21
+ # spec.metadata["changelog_uri"] = "TODO: 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(__dir__) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
+ end
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ spec.add_dependency "dry-types", "~> 1.2"
36
+
37
+ # For more information and examples about making a new gem, check out our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ end
data/sig/mitwelt.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Mitwelt
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mitwelt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Julian Fahrer
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-06-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dry-types
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ description: Mitwelt provides a wrapper around ENV to easily ensure and parse environment
28
+ email:
29
+ - julian@fahrer.net
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rspec"
35
+ - ".rubocop.yml"
36
+ - ".standard.yml"
37
+ - Gemfile
38
+ - Gemfile.lock
39
+ - LICENSE.txt
40
+ - README.md
41
+ - Rakefile
42
+ - lib/mitwelt.rb
43
+ - lib/mitwelt/version.rb
44
+ - mitwelt.gemspec
45
+ - sig/mitwelt.rbs
46
+ homepage: https://github.com/codetales/mitwelt
47
+ licenses:
48
+ - MIT
49
+ metadata:
50
+ homepage_uri: https://github.com/codetales/mitwelt
51
+ source_code_uri: https://github.com/codetales/mitwelt
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.6.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.3.7
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: Ensure and parse Enviroment variables
71
+ test_files: []