exercism_config 0.17.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c094d61eb0003e49c33c3f1398167c15888c46824271fec7ad761747d31487c
4
- data.tar.gz: 310a0343c3962799b65b6b52446fb2056ee7b1af54c904c4a7ba7bbe4093dbb5
3
+ metadata.gz: 9d04d6dcac3ff734c956cc7c17dfb5b89189d6eed7155b10bd16d4c32f614803
4
+ data.tar.gz: '097db1c56e98ae198500107728f42ff66644e63ca701984d8c011967997ec50e'
5
5
  SHA512:
6
- metadata.gz: 0f62ce107a3a34874b6d661e2930e68be15c502ac6264146485f593d4c274f6f33600e6da165efe1c1a67be742d7d17da05e85c66430b36696ea2a0b00a18199
7
- data.tar.gz: 55abe5deff25311edab033ac5eb96ced241df33471839bc4f95b204b93dfaf84c7ada5965a4cbe70ab6e56b2c59a4fc0e503226f430e9346260c3477f7015b37
6
+ metadata.gz: 2641075761befa26d18ce70585b44cec77ae173f5776d0803a8cfe82b300f350704192dc786511ef899218aaa0059d5ddd08d692a3ace4ec9f1b0cf7ed35d7ee
7
+ data.tar.gz: 868cf09c1a605b02b547290221081afee195ff9367955be86ac3924d791f6eaf2662398679edea0cc28c7fd26e2718a3acb1c9039109129640113fcbf837d3d9
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exercism_config (0.16.0)
4
+ exercism_config (0.21.0)
5
5
  aws-sdk-dynamodb (~> 1.0)
6
6
  mandate
7
7
  zeitwerk
data/README.md CHANGED
@@ -19,8 +19,3 @@ require 'exercism_config'
19
19
  ExercismConfig.config.webservers_alb_dns_name
20
20
  ```
21
21
 
22
- To print out all the config from the command-line, you can run:
23
-
24
- ```bash
25
- AWS_PROFILE=exercism_terraform ./bin/run
26
- ```
data/bin/setup CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env bash
1
+ setup_#!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
  set -vx
@@ -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
@@ -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 = "exe"
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
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
- case Exercism.environment
23
- when :development, :test
24
- host = ENV["EXERCISM_DOCKER"] ? "dynamodb:8000" : "localhost:3039"
25
- "http://#{host}"
26
- else
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
@@ -1,3 +1,3 @@
1
1
  module ExercismConfig
2
- VERSION = "0.17.0"
2
+ VERSION = "0.22.0"
3
3
  end
@@ -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
@@ -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.17.0
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Walker
8
8
  autorequire:
9
- bindir: exe
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:
data/bin/run DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "exercism_config"
5
-
6
- p ExercismConfig.config.to_h