super-smart-sys 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.
Files changed (32) hide show
  1. checksums.yaml +7 -0
  2. data/config-5.6.1/CHANGELOG.md +332 -0
  3. data/config-5.6.1/CONTRIBUTING.md +38 -0
  4. data/config-5.6.1/LICENSE.md +26 -0
  5. data/config-5.6.1/README.md +615 -0
  6. data/config-5.6.1/config.gemspec +62 -0
  7. data/config-5.6.1/lib/config/configuration.rb +36 -0
  8. data/config-5.6.1/lib/config/dry_validation_requirements.rb +25 -0
  9. data/config-5.6.1/lib/config/error.rb +4 -0
  10. data/config-5.6.1/lib/config/integrations/heroku.rb +59 -0
  11. data/config-5.6.1/lib/config/integrations/rails/railtie.rb +38 -0
  12. data/config-5.6.1/lib/config/integrations/sinatra.rb +26 -0
  13. data/config-5.6.1/lib/config/options.rb +195 -0
  14. data/config-5.6.1/lib/config/rack/reloader.rb +15 -0
  15. data/config-5.6.1/lib/config/sources/env_source.rb +94 -0
  16. data/config-5.6.1/lib/config/sources/hash_source.rb +16 -0
  17. data/config-5.6.1/lib/config/sources/yaml_source.rb +32 -0
  18. data/config-5.6.1/lib/config/tasks/heroku.rake +7 -0
  19. data/config-5.6.1/lib/config/validation/error.rb +15 -0
  20. data/config-5.6.1/lib/config/validation/schema.rb +23 -0
  21. data/config-5.6.1/lib/config/validation/validate.rb +29 -0
  22. data/config-5.6.1/lib/config/version.rb +3 -0
  23. data/config-5.6.1/lib/config.rb +93 -0
  24. data/config-5.6.1/lib/generators/config/install_generator.rb +32 -0
  25. data/config-5.6.1/lib/generators/config/templates/config.rb +77 -0
  26. data/config-5.6.1/lib/generators/config/templates/settings/development.yml +0 -0
  27. data/config-5.6.1/lib/generators/config/templates/settings/production.yml +0 -0
  28. data/config-5.6.1/lib/generators/config/templates/settings/test.yml +0 -0
  29. data/config-5.6.1/lib/generators/config/templates/settings.local.yml +0 -0
  30. data/config-5.6.1/lib/generators/config/templates/settings.yml +0 -0
  31. data/super-smart-sys.gemspec +11 -0
  32. metadata +70 -0
@@ -0,0 +1,93 @@
1
+ require 'config/options'
2
+ require 'config/configuration'
3
+ require 'config/dry_validation_requirements'
4
+ require 'config/version'
5
+ require 'config/sources/yaml_source'
6
+ require 'config/sources/hash_source'
7
+ require 'config/sources/env_source'
8
+ require 'config/validation/schema'
9
+ require 'deep_merge/core'
10
+
11
+ module Config
12
+ extend Config::Validation::Schema
13
+ extend Config::Configuration.new(
14
+ # general options
15
+ const_name: 'Settings',
16
+ use_env: false,
17
+ env_prefix: 'Settings',
18
+ env_separator: '.',
19
+ env_converter: :downcase,
20
+ env_parse_values: true,
21
+ env_parse_arrays: false,
22
+ fail_on_missing: false,
23
+ file_name: 'settings',
24
+ dir_name: 'settings',
25
+ # deep_merge options
26
+ knockout_prefix: nil,
27
+ merge_nil_values: true,
28
+ overwrite_arrays: true,
29
+ merge_hash_arrays: false,
30
+ validation_contract: nil,
31
+ evaluate_erb_in_yaml: true,
32
+ environment: nil,
33
+ extra_sources: []
34
+ )
35
+
36
+ def self.setup
37
+ yield self unless @_ran_once
38
+ @_ran_once = true
39
+ end
40
+
41
+ # Create a populated Options instance from a settings file. If a second file is given, then the sections of that
42
+ # file will overwrite existing sections of the first file.
43
+ def self.load_files(*sources)
44
+ config = Options.new
45
+
46
+ # add settings sources
47
+ [sources].flatten.compact.each do |source|
48
+ config.add_source!(source)
49
+ end
50
+
51
+ config.add_source!(Sources::EnvSource.new(ENV)) if Config.use_env
52
+
53
+ config.load!
54
+ config
55
+ end
56
+
57
+ # Loads and sets the settings constant!
58
+ def self.load_and_set_settings(*sources)
59
+ name = Config.const_name
60
+ Object.send(:remove_const, name) if Object.const_defined?(name)
61
+
62
+ # Include extra sources in the loading process
63
+ all_sources = [sources, Config.extra_sources].flatten.compact
64
+ Object.const_set(name, Config.load_files(*all_sources))
65
+ end
66
+
67
+ def self.setting_files(config_root, env)
68
+ [
69
+ File.join(config_root, "#{Config.file_name}.yml").to_s,
70
+ File.join(config_root, Config.dir_name, "#{env}.yml").to_s,
71
+ File.join(config_root, 'environments', "#{env}.yml").to_s,
72
+ *local_setting_files(config_root, env)
73
+ ].freeze
74
+ end
75
+
76
+ def self.local_setting_files(config_root, env)
77
+ [
78
+ (File.join(config_root, "#{Config.file_name}.local.yml").to_s if env != 'test'),
79
+ File.join(config_root, Config.dir_name, "#{env}.local.yml").to_s,
80
+ File.join(config_root, 'environments', "#{env}.local.yml").to_s
81
+ ].compact
82
+ end
83
+
84
+ def self.reload!
85
+ Object.const_get(Config.const_name).reload!
86
+ end
87
+ end
88
+
89
+ # Rails integration
90
+ require('config/integrations/rails/railtie') if defined?(::Rails::Railtie)
91
+
92
+ # Sinatra integration
93
+ require('config/integrations/sinatra') if defined?(::Sinatra)
@@ -0,0 +1,32 @@
1
+ module Config
2
+ module Generators
3
+ class InstallGenerator < ::Rails::Generators::Base
4
+ desc "Generates a custom Rails Config initializer file."
5
+
6
+ def self.source_root
7
+ @_config_source_root ||= File.expand_path("../templates", __FILE__)
8
+ end
9
+
10
+ def copy_initializer
11
+ template "config.rb", "config/initializers/config.rb"
12
+ end
13
+
14
+ def copy_settings
15
+ template "settings.yml", "config/#{Config.file_name}.yml"
16
+ template "settings.local.yml", "config/#{Config.file_name}.local.yml"
17
+ directory "settings", "config/#{Config.dir_name}"
18
+ end
19
+
20
+ def modify_gitignore
21
+ create_file '.gitignore' unless File.exist? '.gitignore'
22
+
23
+ append_to_file '.gitignore' do
24
+ "\n" +
25
+ "config/#{Config.file_name}.local.yml\n" +
26
+ "config/#{Config.dir_name}/*.local.yml\n" +
27
+ "config/environments/*.local.yml\n"
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,77 @@
1
+ Config.setup do |config|
2
+ # Name of the constant exposing loaded settings
3
+ config.const_name = 'Settings'
4
+
5
+ # Ability to remove elements of the array set in earlier loaded settings file. For example value: '--'.
6
+ #
7
+ # config.knockout_prefix = nil
8
+
9
+ # Overwrite an existing value when merging a `nil` value.
10
+ # When set to `false`, the existing value is retained after merge.
11
+ #
12
+ # config.merge_nil_values = true
13
+
14
+ # Overwrite arrays found in previously loaded settings file. When set to `false`, arrays will be merged.
15
+ #
16
+ # config.overwrite_arrays = true
17
+
18
+ # Defines current environment, affecting which settings file will be loaded.
19
+ # Default: `Rails.env`
20
+ #
21
+ # config.environment = ENV.fetch('ENVIRONMENT', :development)
22
+
23
+ # Load environment variables from the `ENV` object and override any settings defined in files.
24
+ #
25
+ # config.use_env = false
26
+
27
+ # Define ENV variable prefix deciding which variables to load into config.
28
+ #
29
+ # Reading variables from ENV is case-sensitive. If you define lowercase value below, ensure your ENV variables are
30
+ # prefixed in the same way.
31
+ #
32
+ # When not set it defaults to `config.const_name`.
33
+ #
34
+ config.env_prefix = 'SETTINGS'
35
+
36
+ # What string to use as level separator for settings loaded from ENV variables. Default value of '.' works well
37
+ # with Heroku, but you might want to change it for example for '__' to easy override settings from command line, where
38
+ # using dots in variable names might not be allowed (eg. Bash).
39
+ #
40
+ # config.env_separator = '.'
41
+
42
+ # Ability to process variables names:
43
+ # * nil - no change
44
+ # * :downcase - convert to lower case
45
+ #
46
+ # config.env_converter = :downcase
47
+
48
+ # Parse numeric values as integers instead of strings.
49
+ #
50
+ # config.env_parse_values = true
51
+
52
+ # Validate presence and type of specific config values. Check https://github.com/dry-rb/dry-validation for details.
53
+ #
54
+ # config.schema do
55
+ # required(:name).filled
56
+ # required(:age).maybe(:int?)
57
+ # required(:email).filled(format?: EMAIL_REGEX)
58
+ # end
59
+
60
+ # Evaluate ERB in YAML config files at load time.
61
+ #
62
+ # config.evaluate_erb_in_yaml = true
63
+
64
+ # Name of directory and file to store config keys
65
+ #
66
+ # config.file_name = 'settings'
67
+ # config.dir_name = 'settings'
68
+
69
+ # Load extra sources from a path. These can be file paths (strings),
70
+ # hashes, or custom source objects that respond to 'load'
71
+ #
72
+ # config.extra_sources = [
73
+ # 'path/to/extra_source.yml', # String: loads extra_source.yml
74
+ # { api_key: ENV['API_KEY'] }, # Hash: direct hash source
75
+ # MyCustomSource.new, # Custom source object
76
+ # ]
77
+ end
@@ -0,0 +1,11 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "super-smart-sys"
3
+ s.version = "0.0.1"
4
+ s.summary = "Research test"
5
+ s.description = "University research based on config"
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
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: super-smart-sys
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 config
13
+ email:
14
+ - cakoc614@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - config-5.6.1/CHANGELOG.md
20
+ - config-5.6.1/CONTRIBUTING.md
21
+ - config-5.6.1/LICENSE.md
22
+ - config-5.6.1/README.md
23
+ - config-5.6.1/config.gemspec
24
+ - config-5.6.1/lib/config.rb
25
+ - config-5.6.1/lib/config/configuration.rb
26
+ - config-5.6.1/lib/config/dry_validation_requirements.rb
27
+ - config-5.6.1/lib/config/error.rb
28
+ - config-5.6.1/lib/config/integrations/heroku.rb
29
+ - config-5.6.1/lib/config/integrations/rails/railtie.rb
30
+ - config-5.6.1/lib/config/integrations/sinatra.rb
31
+ - config-5.6.1/lib/config/options.rb
32
+ - config-5.6.1/lib/config/rack/reloader.rb
33
+ - config-5.6.1/lib/config/sources/env_source.rb
34
+ - config-5.6.1/lib/config/sources/hash_source.rb
35
+ - config-5.6.1/lib/config/sources/yaml_source.rb
36
+ - config-5.6.1/lib/config/tasks/heroku.rake
37
+ - config-5.6.1/lib/config/validation/error.rb
38
+ - config-5.6.1/lib/config/validation/schema.rb
39
+ - config-5.6.1/lib/config/validation/validate.rb
40
+ - config-5.6.1/lib/config/version.rb
41
+ - config-5.6.1/lib/generators/config/install_generator.rb
42
+ - config-5.6.1/lib/generators/config/templates/config.rb
43
+ - config-5.6.1/lib/generators/config/templates/settings.local.yml
44
+ - config-5.6.1/lib/generators/config/templates/settings.yml
45
+ - config-5.6.1/lib/generators/config/templates/settings/development.yml
46
+ - config-5.6.1/lib/generators/config/templates/settings/production.yml
47
+ - config-5.6.1/lib/generators/config/templates/settings/test.yml
48
+ - super-smart-sys.gemspec
49
+ homepage: https://rubygems.org/profiles/Andrey78
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
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: '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.6.2
68
+ specification_version: 4
69
+ summary: Research test
70
+ test_files: []