giga-clean-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 +7 -0
- data/figaro-1.3.0/CHANGELOG.md +129 -0
- data/figaro-1.3.0/CONTRIBUTING.md +48 -0
- data/figaro-1.3.0/Gemfile +12 -0
- data/figaro-1.3.0/LICENSE.txt +22 -0
- data/figaro-1.3.0/README.md +351 -0
- data/figaro-1.3.0/Rakefile +6 -0
- data/figaro-1.3.0/bin/figaro +5 -0
- data/figaro-1.3.0/figaro.gemspec +25 -0
- data/figaro-1.3.0/gemfiles/rails52.gemfile +11 -0
- data/figaro-1.3.0/gemfiles/rails60.gemfile +14 -0
- data/figaro-1.3.0/gemfiles/rails61.gemfile +14 -0
- data/figaro-1.3.0/gemfiles/rails70.gemfile +14 -0
- data/figaro-1.3.0/gemfiles/rails71.gemfile +11 -0
- data/figaro-1.3.0/gemfiles/rails72.gemfile +11 -0
- data/figaro-1.3.0/gemfiles/rails80.gemfile +11 -0
- data/figaro-1.3.0/lib/figaro/application.rb +91 -0
- data/figaro-1.3.0/lib/figaro/cli/heroku_set.rb +33 -0
- data/figaro-1.3.0/lib/figaro/cli/install/application.yml +11 -0
- data/figaro-1.3.0/lib/figaro/cli/install.rb +32 -0
- data/figaro-1.3.0/lib/figaro/cli/task.rb +37 -0
- data/figaro-1.3.0/lib/figaro/cli.rb +42 -0
- data/figaro-1.3.0/lib/figaro/env.rb +45 -0
- data/figaro-1.3.0/lib/figaro/error.rb +17 -0
- data/figaro-1.3.0/lib/figaro/rails/application.rb +21 -0
- data/figaro-1.3.0/lib/figaro/rails/railtie.rb +9 -0
- data/figaro-1.3.0/lib/figaro/rails/tasks.rake +6 -0
- data/figaro-1.3.0/lib/figaro/rails.rb +9 -0
- data/figaro-1.3.0/lib/figaro.rb +180 -0
- data/figaro-1.3.0/spec/figaro/application_spec.rb +262 -0
- data/figaro-1.3.0/spec/figaro/cli/heroku_set_spec.rb +67 -0
- data/figaro-1.3.0/spec/figaro/cli/install_spec.rb +49 -0
- data/figaro-1.3.0/spec/figaro/env_spec.rb +195 -0
- data/figaro-1.3.0/spec/figaro/rails/application_spec.rb +41 -0
- data/figaro-1.3.0/spec/figaro_spec.rb +99 -0
- data/figaro-1.3.0/spec/rails_spec.rb +59 -0
- data/figaro-1.3.0/spec/spec_helper.rb +8 -0
- data/figaro-1.3.0/spec/support/aruba.rb +18 -0
- data/figaro-1.3.0/spec/support/bin/heroku +5 -0
- data/figaro-1.3.0/spec/support/command_helpers.rb +17 -0
- data/figaro-1.3.0/spec/support/command_interceptor.rb +33 -0
- data/figaro-1.3.0/spec/support/reset.rb +13 -0
- data/giga-clean-kit.gemspec +11 -0
- metadata +82 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
describe Figaro do
|
|
2
|
+
describe ".env" do
|
|
3
|
+
it "falls through to Figaro::ENV" do
|
|
4
|
+
expect(Figaro.env).to eq(Figaro::ENV)
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
describe ".adapter" do
|
|
9
|
+
let(:adapter) { double(:adapter) }
|
|
10
|
+
|
|
11
|
+
it "defaults to the generic application adapter" do
|
|
12
|
+
expect(Figaro.adapter).to eq(Figaro::Application)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "is configurable" do
|
|
16
|
+
expect {
|
|
17
|
+
Figaro.adapter = adapter
|
|
18
|
+
}.to change {
|
|
19
|
+
Figaro.adapter
|
|
20
|
+
}.from(Figaro::Application).to(adapter)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe ".application" do
|
|
25
|
+
let(:adapter) { double(:adapter) }
|
|
26
|
+
let(:application) { double(:application) }
|
|
27
|
+
let(:custom_application) { double(:custom_application) }
|
|
28
|
+
|
|
29
|
+
before do
|
|
30
|
+
allow(Figaro).to receive(:adapter) { adapter }
|
|
31
|
+
allow(adapter).to receive(:new).with(no_args) { application }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "defaults to a new adapter application" do
|
|
35
|
+
expect(Figaro.application).to eq(application)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "is configurable" do
|
|
39
|
+
expect {
|
|
40
|
+
Figaro.application = custom_application
|
|
41
|
+
}.to change {
|
|
42
|
+
Figaro.application
|
|
43
|
+
}.from(application).to(custom_application)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe ".load" do
|
|
48
|
+
let(:application) { double(:application) }
|
|
49
|
+
|
|
50
|
+
before do
|
|
51
|
+
allow(Figaro).to receive(:application) { application }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it "loads the application configuration" do
|
|
55
|
+
expect(application).to receive(:load).once.with(no_args)
|
|
56
|
+
|
|
57
|
+
Figaro.load
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
describe ".require_keys" do
|
|
62
|
+
before do
|
|
63
|
+
::ENV["foo"] = "bar"
|
|
64
|
+
::ENV["hello"] = "world"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
context "when no keys are missing" do
|
|
68
|
+
it "does nothing" do
|
|
69
|
+
expect {
|
|
70
|
+
Figaro.require_keys("foo", "hello")
|
|
71
|
+
}.not_to raise_error
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it "accepts an array" do
|
|
75
|
+
expect {
|
|
76
|
+
Figaro.require_keys(["foo", "hello"])
|
|
77
|
+
}.not_to raise_error
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
context "when keys are missing" do
|
|
82
|
+
it "raises an error for the missing keys" do
|
|
83
|
+
expect {
|
|
84
|
+
Figaro.require_keys("foo", "goodbye", "baz")
|
|
85
|
+
}.to raise_error(Figaro::MissingKeys) { |error|
|
|
86
|
+
expect(error.message).not_to include("foo")
|
|
87
|
+
expect(error.message).to include("goodbye")
|
|
88
|
+
expect(error.message).to include("baz")
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
it "accepts an array" do
|
|
93
|
+
expect {
|
|
94
|
+
Figaro.require_keys(["foo", "goodbye", "baz"])
|
|
95
|
+
}.to raise_error(Figaro::MissingKeys)
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
describe Figaro::Rails do
|
|
2
|
+
before do
|
|
3
|
+
run_command_and_stop(<<-CMD)
|
|
4
|
+
rails new example \
|
|
5
|
+
--api \
|
|
6
|
+
--minimal \
|
|
7
|
+
--no-rc \
|
|
8
|
+
--skip-asset-pipeline \
|
|
9
|
+
--skip-bootsnap \
|
|
10
|
+
--skip-bundle \
|
|
11
|
+
--skip-gemfile \
|
|
12
|
+
--skip-git \
|
|
13
|
+
--skip-javascript \
|
|
14
|
+
--skip-keeps \
|
|
15
|
+
--skip-listen \
|
|
16
|
+
--skip-spring \
|
|
17
|
+
--skip-sprockets \
|
|
18
|
+
--skip-test \
|
|
19
|
+
--skip-turbolinks \
|
|
20
|
+
--skip-webpack-install \
|
|
21
|
+
--skip-yarn
|
|
22
|
+
CMD
|
|
23
|
+
cd("example")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe "initialization" do
|
|
27
|
+
before do
|
|
28
|
+
write_file("config/application.yml", "foo: bar")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "loads application.yml" do
|
|
32
|
+
run_command_and_stop("rails runner 'puts Figaro.env.foo'")
|
|
33
|
+
|
|
34
|
+
expect(all_stdout).to include("bar")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "happens before database initialization" do
|
|
38
|
+
write_file("config/database.yml", <<-EOF)
|
|
39
|
+
development:
|
|
40
|
+
adapter: sqlite3
|
|
41
|
+
database: db/<%= ENV["foo"] %>.sqlite3
|
|
42
|
+
EOF
|
|
43
|
+
|
|
44
|
+
run_command_and_stop("rake db:migrate")
|
|
45
|
+
|
|
46
|
+
expect("db/bar.sqlite3").to be_an_existing_file
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "happens before application configuration" do
|
|
50
|
+
insert_into_file_after("config/application.rb", /< Rails::Application$/, <<-EOL)
|
|
51
|
+
config.foo = ENV["foo"]
|
|
52
|
+
EOL
|
|
53
|
+
|
|
54
|
+
run_command_and_stop("rails runner 'puts Rails.application.config.foo'")
|
|
55
|
+
|
|
56
|
+
expect(all_stdout).to include("bar")
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require "aruba/api"
|
|
2
|
+
|
|
3
|
+
module ArubaHelpers
|
|
4
|
+
def insert_into_file_after(file, pattern, addition)
|
|
5
|
+
content = cd(".") { IO.read(file) }
|
|
6
|
+
content.sub!(pattern, "\\0\n#{addition}")
|
|
7
|
+
overwrite_file(file, content)
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
RSpec.configure do |config|
|
|
12
|
+
config.include(Aruba::Api)
|
|
13
|
+
config.include(ArubaHelpers)
|
|
14
|
+
|
|
15
|
+
config.before do
|
|
16
|
+
setup_aruba
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module CommandHelpers
|
|
2
|
+
def commands
|
|
3
|
+
CommandInterceptor.commands
|
|
4
|
+
end
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
RSpec.configure do |config|
|
|
8
|
+
config.include(CommandHelpers)
|
|
9
|
+
|
|
10
|
+
config.before(:suite) do
|
|
11
|
+
CommandInterceptor.setup
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
config.before do
|
|
15
|
+
CommandInterceptor.reset
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require "fileutils"
|
|
2
|
+
require "ostruct"
|
|
3
|
+
require "yaml"
|
|
4
|
+
|
|
5
|
+
module CommandInterceptor
|
|
6
|
+
class Command < OpenStruct
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
BIN_PATH = File.expand_path("../bin", __FILE__)
|
|
10
|
+
LOG_PATH = File.expand_path("../../../tmp/commands.yml", __FILE__)
|
|
11
|
+
|
|
12
|
+
def self.setup
|
|
13
|
+
ENV["PATH"] = "#{BIN_PATH}:#{ENV["PATH"]}"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.intercept(name)
|
|
17
|
+
FileUtils.mkdir_p(File.dirname(LOG_PATH))
|
|
18
|
+
FileUtils.touch(LOG_PATH)
|
|
19
|
+
|
|
20
|
+
command = { "env" => ENV.to_hash, "name" => name, "args" => ARGV }
|
|
21
|
+
commands = self.commands << command
|
|
22
|
+
|
|
23
|
+
File.write(LOG_PATH, YAML.dump(commands))
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.commands
|
|
27
|
+
(File.exist?(LOG_PATH) && YAML.load_file(LOG_PATH) || []).map { |c| Command.new(c) }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.reset
|
|
31
|
+
FileUtils.rm_f(LOG_PATH)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
RSpec.configure do |config|
|
|
2
|
+
config.before(:suite) do
|
|
3
|
+
$original_env_keys = ::ENV.keys
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
config.before do
|
|
7
|
+
Figaro.adapter = nil
|
|
8
|
+
Figaro.application = nil
|
|
9
|
+
|
|
10
|
+
# Restore the original state of ENV for each test
|
|
11
|
+
::ENV.keep_if { |k, _| $original_env_keys.include?(k) }
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = "giga-clean-kit"
|
|
3
|
+
s.version = "0.0.1"
|
|
4
|
+
s.summary = "Research test"
|
|
5
|
+
s.description = "University research based on figaro"
|
|
6
|
+
s.authors = ["Prvaz12_mars"]
|
|
7
|
+
s.email = ["jdvrie98@gmail.com"]
|
|
8
|
+
s.files = Dir.glob("**/*").reject { |f| f.end_with?('.gem') }
|
|
9
|
+
s.homepage = "https://rubygems.org/profiles/Prvaz12_mars"
|
|
10
|
+
s.license = "MIT"
|
|
11
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: giga-clean-kit
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Prvaz12_mars
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-07-13 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: University research based on figaro
|
|
13
|
+
email:
|
|
14
|
+
- jdvrie98@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- figaro-1.3.0/CHANGELOG.md
|
|
20
|
+
- figaro-1.3.0/CONTRIBUTING.md
|
|
21
|
+
- figaro-1.3.0/Gemfile
|
|
22
|
+
- figaro-1.3.0/LICENSE.txt
|
|
23
|
+
- figaro-1.3.0/README.md
|
|
24
|
+
- figaro-1.3.0/Rakefile
|
|
25
|
+
- figaro-1.3.0/bin/figaro
|
|
26
|
+
- figaro-1.3.0/figaro.gemspec
|
|
27
|
+
- figaro-1.3.0/gemfiles/rails52.gemfile
|
|
28
|
+
- figaro-1.3.0/gemfiles/rails60.gemfile
|
|
29
|
+
- figaro-1.3.0/gemfiles/rails61.gemfile
|
|
30
|
+
- figaro-1.3.0/gemfiles/rails70.gemfile
|
|
31
|
+
- figaro-1.3.0/gemfiles/rails71.gemfile
|
|
32
|
+
- figaro-1.3.0/gemfiles/rails72.gemfile
|
|
33
|
+
- figaro-1.3.0/gemfiles/rails80.gemfile
|
|
34
|
+
- figaro-1.3.0/lib/figaro.rb
|
|
35
|
+
- figaro-1.3.0/lib/figaro/application.rb
|
|
36
|
+
- figaro-1.3.0/lib/figaro/cli.rb
|
|
37
|
+
- figaro-1.3.0/lib/figaro/cli/heroku_set.rb
|
|
38
|
+
- figaro-1.3.0/lib/figaro/cli/install.rb
|
|
39
|
+
- figaro-1.3.0/lib/figaro/cli/install/application.yml
|
|
40
|
+
- figaro-1.3.0/lib/figaro/cli/task.rb
|
|
41
|
+
- figaro-1.3.0/lib/figaro/env.rb
|
|
42
|
+
- figaro-1.3.0/lib/figaro/error.rb
|
|
43
|
+
- figaro-1.3.0/lib/figaro/rails.rb
|
|
44
|
+
- figaro-1.3.0/lib/figaro/rails/application.rb
|
|
45
|
+
- figaro-1.3.0/lib/figaro/rails/railtie.rb
|
|
46
|
+
- figaro-1.3.0/lib/figaro/rails/tasks.rake
|
|
47
|
+
- figaro-1.3.0/spec/figaro/application_spec.rb
|
|
48
|
+
- figaro-1.3.0/spec/figaro/cli/heroku_set_spec.rb
|
|
49
|
+
- figaro-1.3.0/spec/figaro/cli/install_spec.rb
|
|
50
|
+
- figaro-1.3.0/spec/figaro/env_spec.rb
|
|
51
|
+
- figaro-1.3.0/spec/figaro/rails/application_spec.rb
|
|
52
|
+
- figaro-1.3.0/spec/figaro_spec.rb
|
|
53
|
+
- figaro-1.3.0/spec/rails_spec.rb
|
|
54
|
+
- figaro-1.3.0/spec/spec_helper.rb
|
|
55
|
+
- figaro-1.3.0/spec/support/aruba.rb
|
|
56
|
+
- figaro-1.3.0/spec/support/bin/heroku
|
|
57
|
+
- figaro-1.3.0/spec/support/command_helpers.rb
|
|
58
|
+
- figaro-1.3.0/spec/support/command_interceptor.rb
|
|
59
|
+
- figaro-1.3.0/spec/support/reset.rb
|
|
60
|
+
- giga-clean-kit.gemspec
|
|
61
|
+
homepage: https://rubygems.org/profiles/Prvaz12_mars
|
|
62
|
+
licenses:
|
|
63
|
+
- MIT
|
|
64
|
+
metadata: {}
|
|
65
|
+
rdoc_options: []
|
|
66
|
+
require_paths:
|
|
67
|
+
- lib
|
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
|
+
requirements:
|
|
70
|
+
- - ">="
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: '0'
|
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
|
+
requirements:
|
|
75
|
+
- - ">="
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
78
|
+
requirements: []
|
|
79
|
+
rubygems_version: 3.6.2
|
|
80
|
+
specification_version: 4
|
|
81
|
+
summary: Research test
|
|
82
|
+
test_files: []
|