exercism_config 0.17.0 → 0.22.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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +0 -5
- data/bin/setup +1 -1
- data/bin/setup_exercism_config +84 -0
- data/exercism_config.gemspec +2 -2
- data/lib/exercism_config/setup_dynamodb_client.rb +5 -7
- data/lib/exercism_config/version.rb +1 -1
- data/settings/ci.yml +7 -0
- data/settings/development.yml +7 -0
- data/settings/docker.yml +7 -0
- metadata +8 -4
- data/bin/run +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d04d6dcac3ff734c956cc7c17dfb5b89189d6eed7155b10bd16d4c32f614803
|
4
|
+
data.tar.gz: '097db1c56e98ae198500107728f42ff66644e63ca701984d8c011967997ec50e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2641075761befa26d18ce70585b44cec77ae173f5776d0803a8cfe82b300f350704192dc786511ef899218aaa0059d5ddd08d692a3ace4ec9f1b0cf7ed35d7ee
|
7
|
+
data.tar.gz: 868cf09c1a605b02b547290221081afee195ff9367955be86ac3924d791f6eaf2662398679edea0cc28c7fd26e2718a3acb1c9039109129640113fcbf837d3d9
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/bin/setup
CHANGED
@@ -0,0 +1,84 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "exercism_config"
|
5
|
+
require 'erb'
|
6
|
+
require 'yaml'
|
7
|
+
|
8
|
+
env = ExercismConfig::DetermineEnvironment.()
|
9
|
+
if env == :production
|
10
|
+
puts "Aborted! This script should not be run in production."
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_table(client)
|
15
|
+
client.create_table(
|
16
|
+
table_name: :config,
|
17
|
+
attribute_definitions: [
|
18
|
+
{
|
19
|
+
attribute_name: "id",
|
20
|
+
attribute_type: "S",
|
21
|
+
},
|
22
|
+
],
|
23
|
+
key_schema: [
|
24
|
+
{
|
25
|
+
attribute_name: "id",
|
26
|
+
key_type: "HASH",
|
27
|
+
}
|
28
|
+
],
|
29
|
+
provisioned_throughput: {
|
30
|
+
read_capacity_units: 1,
|
31
|
+
write_capacity_units: 1,
|
32
|
+
}
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def delete_table(client)
|
37
|
+
client.delete_table(
|
38
|
+
table_name: :config,
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def set_config_value(client, id, value)
|
43
|
+
client.put_item(
|
44
|
+
table_name: :config,
|
45
|
+
item: {
|
46
|
+
id: id,
|
47
|
+
value: value
|
48
|
+
}
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
client = ExercismConfig::SetupDynamoDBClient.()
|
53
|
+
|
54
|
+
begin
|
55
|
+
create_table(client)
|
56
|
+
rescue Aws::DynamoDB::Errors::ResourceInUseException => e
|
57
|
+
if ARGV.include?("--force")
|
58
|
+
puts "Table exists. Recreating..."
|
59
|
+
delete_table(client)
|
60
|
+
create_table(client)
|
61
|
+
puts "Table recreated."
|
62
|
+
else
|
63
|
+
puts "Table exists. Not recreating."
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
settings_file_arg = ARGV.select{|arg|arg.start_with?("--settings-file=")}.first
|
68
|
+
settings_file =
|
69
|
+
if settings_file_arg
|
70
|
+
settings_file_arg.split("=").last
|
71
|
+
elsif ENV["EXERCISM_DOCKER"]
|
72
|
+
File.expand_path("../../settings/docker.yml", __FILE__)
|
73
|
+
elsif ENV["EXERCISM_CI"]
|
74
|
+
File.expand_path("../../settings/ci.yml", __FILE__)
|
75
|
+
else
|
76
|
+
File.expand_path("../../settings/development.yml", __FILE__)
|
77
|
+
end
|
78
|
+
|
79
|
+
puts "Using settings file: #{settings_file}"
|
80
|
+
settings = YAML.load(ERB.new(File.read(settings_file)).result)
|
81
|
+
|
82
|
+
settings.each do |key, value|
|
83
|
+
set_config_value(client, key, value)
|
84
|
+
end
|
data/exercism_config.gemspec
CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
19
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
20
|
end
|
21
|
-
spec.bindir = "
|
22
|
-
spec.executables =
|
21
|
+
spec.bindir = "bin"
|
22
|
+
spec.executables = ["setup_exercism_config"]
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
25
|
spec.add_dependency "aws-sdk-dynamodb", "~> 1.0"
|
@@ -19,13 +19,11 @@ module ExercismConfig
|
|
19
19
|
|
20
20
|
memoize
|
21
21
|
def config_endpoint
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
nil
|
28
|
-
end
|
22
|
+
return nil unless %i[development test].include?(Exercism.environment)
|
23
|
+
return "http://127.0.0.1:#{ENV["DYNAMODB_PORT"]}" if ENV["EXERCISM_CI"]
|
24
|
+
|
25
|
+
host = ENV["EXERCISM_DOCKER"] ? "dynamodb:8000" : "localhost:3039"
|
26
|
+
"http://#{host}"
|
29
27
|
end
|
30
28
|
end
|
31
29
|
end
|
data/settings/ci.yml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
aws_iterations_bucket: exercism-staging-iterations
|
2
|
+
dynamodb_tooling_jobs_table: tooling_jobs
|
3
|
+
tooling_orchestrator_url: http://127.0.0.1:3021
|
4
|
+
anycable_redis_url: redis://127.0.0.1:6379/1
|
5
|
+
anycable_rpc_host: 127.0.0.1:50051
|
6
|
+
rds_master_endpoint: 127.0.0.1
|
7
|
+
rds_port: <%= ENV["MYSQL_PORT"] %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
aws_iterations_bucket: exercism-staging-iterations
|
2
|
+
dynamodb_tooling_jobs_table: tooling_jobs
|
3
|
+
tooling_orchestrator_url: http://127.0.0.1:3021
|
4
|
+
anycable_redis_url: 'redis://127.0.0.1:6379/1'
|
5
|
+
anycable_rpc_host: '127.0.0.1:50051'
|
6
|
+
rds_master_endpoint: localhost
|
7
|
+
mysql_socket: /tmp/mysql.sock
|
data/settings/docker.yml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
aws_iterations_bucket: exercism-staging-iterations
|
2
|
+
dynamodb_tooling_jobs_table: tooling_jobs
|
3
|
+
tooling_orchestrator_url: http://tooling-orchestrator:3021
|
4
|
+
anycable_redis_url: redis://redis:6379/1
|
5
|
+
anycable_rpc_host: 0.0.0.0:50051
|
6
|
+
rds_master_endpoint: mysql
|
7
|
+
rds_port: 3306
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exercism_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Walker
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
@@ -111,7 +111,8 @@ dependencies:
|
|
111
111
|
description:
|
112
112
|
email:
|
113
113
|
- jez.walker@gmail.com
|
114
|
-
executables:
|
114
|
+
executables:
|
115
|
+
- setup_exercism_config
|
115
116
|
extensions: []
|
116
117
|
extra_rdoc_files: []
|
117
118
|
files:
|
@@ -122,8 +123,8 @@ files:
|
|
122
123
|
- README.md
|
123
124
|
- Rakefile
|
124
125
|
- bin/console
|
125
|
-
- bin/run
|
126
126
|
- bin/setup
|
127
|
+
- bin/setup_exercism_config
|
127
128
|
- exercism_config.gemspec
|
128
129
|
- lib/exercism/config.rb
|
129
130
|
- lib/exercism_config.rb
|
@@ -132,6 +133,9 @@ files:
|
|
132
133
|
- lib/exercism_config/retrieve.rb
|
133
134
|
- lib/exercism_config/setup_dynamodb_client.rb
|
134
135
|
- lib/exercism_config/version.rb
|
136
|
+
- settings/ci.yml
|
137
|
+
- settings/development.yml
|
138
|
+
- settings/docker.yml
|
135
139
|
homepage: https://exercism.io
|
136
140
|
licenses: []
|
137
141
|
metadata:
|