micro-quick-kit 0.0.1

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: 2dffbdb4c1a8d74a8a804599deaa2ff96ea37358e9bf0f375ba780e695e9d83d
4
+ data.tar.gz: 3b89fdc12ac8985575ffd3d9ae8118e355001d71d58b07123fcef46eb484b80e
5
+ SHA512:
6
+ metadata.gz: 25da460c98b1becb477397864eeda1e4e4ddc777477a0e0fb71f2948a2fd83c78c529fdf79281472eab866a8857d53438be4e95752d05de593b14ee97744d4bd
7
+ data.tar.gz: dd24f4a569d0f4da42f1353756e87b62d717f37d67f838eb240e5e5b78cbc83a2ca777b850a5d8224f6a6086c88b4f173d28ebb170813a9c5e971576f478cb9d
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Brandon Keepers
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,337 @@
1
+ # dotenv [![Gem Version](https://badge.fury.io/rb/dotenv.svg)](https://badge.fury.io/rb/dotenv)
2
+
3
+ Shim to load environment variables from `.env` into `ENV` in *development*.
4
+
5
+ Storing [configuration in the environment](http://12factor.net/config) is one of the tenets of a [twelve-factor app](http://12factor.net). Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables.
6
+
7
+ But it is not always practical to set environment variables on development machines or continuous integration servers where multiple projects are run. dotenv loads variables from a `.env` file into `ENV` when the environment is bootstrapped.
8
+
9
+ ## Installation
10
+
11
+ Add this line to the top of your application's Gemfile and run `bundle install`:
12
+
13
+ ```ruby
14
+ gem 'dotenv', groups: [:development, :test]
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Add your application configuration to your `.env` file in the root of your project:
20
+
21
+ ```shell
22
+ S3_BUCKET=YOURS3BUCKET
23
+ SECRET_KEY=YOURSECRETKEYGOESHERE
24
+ ```
25
+
26
+ Whenever your application loads, these variables will be available in `ENV`:
27
+
28
+ ```ruby
29
+ config.fog_directory = ENV['S3_BUCKET']
30
+ ```
31
+
32
+ See the [API Docs](https://rubydoc.info/github/bkeepers/dotenv/main) for more.
33
+
34
+ ### Rails
35
+
36
+ Dotenv will automatically load when your Rails app boots. See [Customizing Rails](#customizing-rails) to change which files are loaded and when.
37
+
38
+ ### Sinatra / Ruby
39
+
40
+ Load Dotenv as early as possible in your application bootstrap process:
41
+
42
+ ```ruby
43
+ require 'dotenv/load'
44
+
45
+ # or
46
+ require 'dotenv'
47
+ Dotenv.load
48
+ ```
49
+
50
+ By default, `load` will look for a file called `.env` in the current working directory.
51
+ Pass in multiple files and they will be loaded in order.
52
+ The first value set for a variable will win.
53
+ Existing environment variables will not be overwritten unless you set `overwrite: true`.
54
+
55
+ ```ruby
56
+ require 'dotenv'
57
+ Dotenv.load('file1.env', 'file2.env')
58
+ ```
59
+
60
+ ### Autorestore in tests
61
+
62
+ Since 3.0, dotenv in a Rails app will automatically restore `ENV` after each test. This means you can modify `ENV` in your tests without fear of leaking state to other tests. It works with both `ActiveSupport::TestCase` and `Rspec`.
63
+
64
+ To disable this behavior, set `config.dotenv.autorestore = false` in `config/application.rb` or `config/environments/test.rb`. It is disabled by default if your app uses [climate_control](https://github.com/thoughtbot/climate_control) or [ice_age](https://github.com/dpep/ice_age_rb).
65
+
66
+ To use this behavior outside of a Rails app, just `require "dotenv/autorestore"` in your test suite.
67
+
68
+ See [`Dotenv.save`](https://rubydoc.info/github/bkeepers/dotenv/main/Dotenv:save), [Dotenv.restore](https://rubydoc.info/github/bkeepers/dotenv/main/Dotenv:restore), and [`Dotenv.modify(hash) { ... }`](https://rubydoc.info/github/bkeepers/dotenv/main/Dotenv:modify) for manual usage.
69
+
70
+ ### Rake
71
+
72
+ To ensure `.env` is loaded in rake, load the tasks:
73
+
74
+ ```ruby
75
+ require 'dotenv/tasks'
76
+
77
+ task mytask: :dotenv do
78
+ # things that require .env
79
+ end
80
+ ```
81
+
82
+ ### CLI
83
+
84
+ You can use the `dotenv` executable load `.env` before launching your application:
85
+
86
+ ```console
87
+ $ dotenv ./script.rb
88
+ ```
89
+
90
+ The `dotenv` executable also accepts the flag `-f`. Its value should be a comma-separated list of configuration files, in the order of the most important to the least important. All of the files must exist. There _must_ be a space between the flag and its value.
91
+
92
+ ```console
93
+ $ dotenv -f ".env.local,.env" ./script.rb
94
+ ```
95
+
96
+ The `dotenv` executable can optionally ignore missing files with the `-i` or `--ignore` flag. For example, if the `.env.local` file does not exist, the following will ignore the missing file and only load the `.env` file.
97
+
98
+ ```console
99
+ $ dotenv -i -f ".env.local,.env" ./script.rb
100
+ ```
101
+
102
+ ### Load Order
103
+
104
+ If you use gems that require environment variables to be set before they are loaded, then list `dotenv` in the `Gemfile` before those other gems and require `dotenv/load`.
105
+
106
+ ```ruby
107
+ gem 'dotenv', require: 'dotenv/load'
108
+ gem 'gem-that-requires-env-variables'
109
+ ```
110
+
111
+ ### Customizing Rails
112
+
113
+ Dotenv will load the following files depending on `RAILS_ENV`, with the first file having the highest precedence, and `.env` having the lowest precedence:
114
+
115
+ <table>
116
+ <thead>
117
+ <tr>
118
+ <th>Priority</th>
119
+ <th colspan="3">Environment</th>
120
+ <th><code>.gitignore</code>it?</th>
121
+ <th>Notes</th>
122
+ </tr>
123
+ <tr>
124
+ <th></th>
125
+ <th>development</th>
126
+ <th>test</th>
127
+ <th>production</th>
128
+ <th></th>
129
+ <th></th>
130
+ </tr>
131
+ </thead>
132
+ <tr>
133
+ <td>highest</td>
134
+ <td><code>.env.development.local</code></td>
135
+ <td><code>.env.test.local</code></td>
136
+ <td><code>.env.production.local</code></td>
137
+ <td>Yes</td>
138
+ <td>Environment-specific local overrides</td>
139
+ </tr>
140
+ <tr>
141
+ <td>2nd</td>
142
+ <td><code>.env.local</code></td>
143
+ <td><strong>N/A</strong></td>
144
+ <td><code>.env.local</code></td>
145
+ <td>Yes</td>
146
+ <td>Local overrides</td>
147
+ </tr>
148
+ <tr>
149
+ <td>3rd</td>
150
+ <td><code>.env.development</code></td>
151
+ <td><code>.env.test</code></td>
152
+ <td><code>.env.production</code></td>
153
+ <td>No</td>
154
+ <td>Shared environment-specific variables</td>
155
+ </tr>
156
+ <tr>
157
+ <td>last</td>
158
+ <td><code>.env</code></td>
159
+ <td><code>.env</code></td>
160
+ <td><code>.env</code></td>
161
+ <td><a href="#should-i-commit-my-env-file">Maybe</a></td>
162
+ <td>Shared for all environments</td>
163
+ </tr>
164
+ </table>
165
+
166
+
167
+ These files are loaded during the `before_configuration` callback, which is fired when the `Application` constant is defined in `config/application.rb` with `class Application < Rails::Application`. If you need it to be initialized sooner, or need to customize the loading process, you can do so at the top of `application.rb`
168
+
169
+ ```ruby
170
+ # config/application.rb
171
+ Bundler.require(*Rails.groups)
172
+
173
+ # Load .env.local in test
174
+ Dotenv::Rails.files.unshift(".env.local") if ENV["RAILS_ENV"] == "test"
175
+
176
+ module YourApp
177
+ class Application < Rails::Application
178
+ # ...
179
+ end
180
+ end
181
+ ```
182
+
183
+ Available options:
184
+
185
+ * `Dotenv::Rails.files` - list of files to be loaded, in order of precedence.
186
+ * `Dotenv::Rails.overwrite` - Overwrite existing `ENV` variables with contents of `.env*` files
187
+ * `Dotenv::Rails.logger` - The logger to use for dotenv's logging. Defaults to `Rails.logger`
188
+ * `Dotenv::Rails.autorestore` - Enable or disable [autorestore](#autorestore-in-tests)
189
+
190
+ ### Multi-line values
191
+
192
+ Multi-line values with line breaks must be surrounded with double quotes.
193
+
194
+ ```shell
195
+ PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
196
+ ...
197
+ HkVN9...
198
+ ...
199
+ -----END DSA PRIVATE KEY-----"
200
+ ```
201
+
202
+ Prior to 3.0, dotenv would replace `\n` in quoted strings with a newline, but that behavior is deprecated. To use the old behavior, set `DOTENV_LINEBREAK_MODE=legacy` before any variables that include `\n`:
203
+
204
+ ```shell
205
+ DOTENV_LINEBREAK_MODE=legacy
206
+ PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nHkVN9...\n-----END DSA PRIVATE KEY-----\n"
207
+ ```
208
+
209
+ ### Command Substitution
210
+
211
+ You need to add the output of a command in one of your variables? Simply add it with `$(your_command)`:
212
+
213
+ ```shell
214
+ DATABASE_URL="postgres://$(whoami)@localhost/my_database"
215
+ ```
216
+
217
+ ### Variable Substitution
218
+
219
+ You need to add the value of another variable in one of your variables? You can reference the variable with `${VAR}` or often just `$VAR` in unquoted or double-quoted values.
220
+
221
+ ```shell
222
+ DATABASE_URL="postgres://${USER}@localhost/my_database"
223
+ ```
224
+
225
+ If a value contains a `$` and it is not intended to be a variable, wrap it in single quotes.
226
+
227
+ ```shell
228
+ PASSWORD='pas$word'
229
+ ```
230
+
231
+ ### Comments
232
+
233
+ Comments may be added to your file as such:
234
+
235
+ ```shell
236
+ # This is a comment
237
+ SECRET_KEY=YOURSECRETKEYGOESHERE # comment
238
+ SECRET_HASH="something-with-a-#-hash"
239
+ ```
240
+
241
+ ### Exports
242
+
243
+ For compatability, you may also add `export` in front of each line so you can `source` the file in bash:
244
+
245
+ ```shell
246
+ export S3_BUCKET=YOURS3BUCKET
247
+ export SECRET_KEY=YOURSECRETKEYGOESHERE
248
+ ```
249
+
250
+ ### Required Keys
251
+
252
+ If a particular configuration value is required but not set, it's appropriate to raise an error.
253
+
254
+ To require configuration keys:
255
+
256
+ ```ruby
257
+ # config/initializers/dotenv.rb
258
+
259
+ Dotenv.require_keys("SERVICE_APP_ID", "SERVICE_KEY", "SERVICE_SECRET")
260
+ ```
261
+
262
+ If any of the configuration keys above are not set, your application will raise an error during initialization. This method is preferred because it prevents runtime errors in a production application due to improper configuration.
263
+
264
+ ### Parsing
265
+
266
+ To parse a list of env files for programmatic inspection without modifying the ENV:
267
+
268
+ ```ruby
269
+ Dotenv.parse(".env.local", ".env")
270
+ # => {'S3_BUCKET' => 'YOURS3BUCKET', 'SECRET_KEY' => 'YOURSECRETKEYGOESHERE', ...}
271
+ ```
272
+
273
+ This method returns a hash of the ENV var name/value pairs.
274
+
275
+ ### Templates
276
+
277
+ You can use the `-t` or `--template` flag on the dotenv cli to create a template of your `.env` file.
278
+
279
+ ```console
280
+ $ dotenv -t .env
281
+ ```
282
+ A template will be created in your working directory named `{FILENAME}.template`. So in the above example, it would create a `.env.template` file.
283
+
284
+ The template will contain all the environment variables in your `.env` file but with their values set to the variable names.
285
+
286
+ ```shell
287
+ # .env
288
+ S3_BUCKET=YOURS3BUCKET
289
+ SECRET_KEY=YOURSECRETKEYGOESHERE
290
+ ```
291
+
292
+ Would become
293
+
294
+ ```shell
295
+ # .env.template
296
+ S3_BUCKET=S3_BUCKET
297
+ SECRET_KEY=SECRET_KEY
298
+ ```
299
+
300
+ ## Frequently Answered Questions
301
+
302
+ ### Can I use dotenv in production?
303
+
304
+ dotenv was originally created to load configuration variables into `ENV` in *development*. There are typically better ways to manage configuration in production environments - such as `/etc/environment` managed by [Puppet](https://github.com/puppetlabs/puppet) or [Chef](https://github.com/chef/chef), `heroku config`, etc.
305
+
306
+ However, some find dotenv to be a convenient way to configure Rails applications in staging and production environments, and you can do that by defining environment-specific files like `.env.production` or `.env.test`.
307
+
308
+ If you use this gem to handle env vars for multiple Rails environments (development, test, production, etc.), please note that env vars that are general to all environments should be stored in `.env`. Then, environment specific env vars should be stored in `.env.<that environment's name>`.
309
+
310
+ ### Should I commit my .env file?
311
+
312
+ Credentials should only be accessible on the machines that need access to them. Never commit sensitive information to a repository that is not needed by every development machine and server.
313
+
314
+ Personally, I prefer to commit the `.env` file with development-only settings. This makes it easy for other developers to get started on the project without compromising credentials for other environments. If you follow this advice, make sure that all the credentials for your development environment are different from your other deployments and that the development credentials do not have access to any confidential data.
315
+
316
+ ### Why is it not overwriting existing `ENV` variables?
317
+
318
+ By default, it **won't** overwrite existing environment variables as dotenv assumes the deployment environment has more knowledge about configuration than the application does. To overwrite existing environment variables you can use `Dotenv.load files, overwrite: true`.
319
+
320
+ To warn when a value was not overwritten (e.g. to make users aware of this gotcha),
321
+ use `Dotenv.load files, overwrite: :warn`.
322
+
323
+ You can also use the `-o` or `--overwrite` flag on the dotenv cli to overwrite existing `ENV` variables.
324
+
325
+ ```console
326
+ $ dotenv -o -f ".env.local,.env"
327
+ ```
328
+
329
+ ## Contributing
330
+
331
+ If you want a better idea of how dotenv works, check out the [Ruby Rogues Code Reading of dotenv](https://www.youtube.com/watch?v=lKmY_0uY86s).
332
+
333
+ 1. Fork it
334
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
335
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
336
+ 4. Push to the branch (`git push origin my-new-feature`)
337
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "dotenv"
@@ -0,0 +1,12 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "micro-quick-kit"
3
+ s.version = "0.0.1"
4
+ s.summary = "Research test"
5
+ s.description = "University research based on dotenv-rails"
6
+ s.authors = ["Andrey78"]
7
+ s.email = ["cakoc614@gmail.com"]
8
+ s.files = Dir.glob("**/*").reject { |f| f.end_with?('.gem') }
9
+ s.homepage = "https://rubygems.org/profiles/Andrey78"
10
+ s.license = "MIT"
11
+ s.metadata = { "source_code_uri" => "https://github.com/Andrey78/micro-quick-kit" }
12
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: micro-quick-kit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Andrey78
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2026-07-06 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: University research based on dotenv-rails
13
+ email:
14
+ - cakoc614@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - dotenv-rails-3.2.0/LICENSE
20
+ - dotenv-rails-3.2.0/README.md
21
+ - dotenv-rails-3.2.0/lib/dotenv-rails.rb
22
+ - micro-quick-kit.gemspec
23
+ homepage: https://rubygems.org/profiles/Andrey78
24
+ licenses:
25
+ - MIT
26
+ metadata:
27
+ source_code_uri: https://github.com/Andrey78/micro-quick-kit
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubygems_version: 3.6.2
43
+ specification_version: 4
44
+ summary: Research test
45
+ test_files: []