exercism_config 0.18.0 → 0.23.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: 555be062390d82c5998c347d504b0e158388bdc4cd6be78b696b05d6e64a4583
4
- data.tar.gz: 4379e460085f1a7024ebf93a96380ec7bcd68392c7117cf9c3e13d7cac527944
3
+ metadata.gz: d5babef3a3749dac8779c483f8afaa93df5b1c11a07fb1c79e6bfa8a0ad628e3
4
+ data.tar.gz: 30d6b0c117bf61cadbcafbd2756c955eb7d57fddf77a3e9f6da47da2ac18afc5
5
5
  SHA512:
6
- metadata.gz: fd335e5943218e1316c45c598d45940f4da31f193d30d6f2b7c271081553d770ecc886f59ebd6ab27be5a04088e84ea5d450adb2c3a7b2190e404c508d709968
7
- data.tar.gz: e80961c8c6ff6a55f3eb272027611e6b575c5c365fb81b7f8a901694997dfb4628b8ec7d96943621bf6cae9063e8cf496274a5eef1e21cfae513e680d258e78f
6
+ metadata.gz: 6baf1d362986f1d905fa4c3579cc5f24ae2d654c302ad7074660ba2019d74516713f4802e9a33b7258c0273a18ba483f70511efe5c2795039aaddd34f730d0da
7
+ data.tar.gz: d73f47b8063a043feb2dbebe3972fa6edff048aeee4aad0e175a8c22edd24b364a5bb944a0fea4b0385b1be90802288584da06f89663ef0a33982f69e3ff89c6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exercism_config (0.18.0)
4
+ exercism_config (0.21.0)
5
5
  aws-sdk-dynamodb (~> 1.0)
6
6
  mandate
7
7
  zeitwerk
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "bundler/setup"
4
4
  require "exercism_config"
5
+ require 'erb'
5
6
  require 'yaml'
6
7
 
7
8
  env = ExercismConfig::DetermineEnvironment.()
@@ -64,20 +65,19 @@ rescue Aws::DynamoDB::Errors::ResourceInUseException => e
64
65
  end
65
66
 
66
67
  settings_file_arg = ARGV.select{|arg|arg.start_with?("--settings-file=")}.first
67
- if settings_file_arg
68
- settings_file = settings_file_arg.split("=").last
69
- settings = YAML.load(File.read(settings_file))
70
- else
71
- settings = {
72
- aws_iterations_bucket: "exercism-staging-iterations",
73
- dynamodb_tooling_jobs_table: "tooling_jobs",
74
- tooling_orchestrator_url: "http://127.0.0.1:3021",
75
- anycable_redis_url: 'redis://127.0.0.1:6379/1',
76
- anycable_rpc_host: '127.0.0.1:50051',
77
- rds_master_endpoint: "localhost",
78
- mysql_socket: "/tmp/mysql.sock"
79
- }
80
- end
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
81
 
82
82
  settings.each do |key, value|
83
83
  set_config_value(client, key, value)
@@ -30,4 +30,9 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "rake", "~> 12.3"
31
31
  spec.add_development_dependency "minitest", "~> 5.0"
32
32
  spec.add_development_dependency "mocha"
33
+
34
+ # This isn't a compulsary dependency
35
+ # but can be used if someone puts it in their
36
+ # own gemfile
37
+ spec.add_development_dependency "aws-sdk-s3"
33
38
  end
@@ -6,6 +6,7 @@ require 'json'
6
6
  require_relative 'exercism_config/determine_environment'
7
7
  require_relative 'exercism_config/generate_aws_settings'
8
8
  require_relative 'exercism_config/setup_dynamodb_client'
9
+ require_relative 'exercism_config/setup_s3_client'
9
10
  require_relative 'exercism_config/retrieve'
10
11
  require_relative 'exercism_config/generate_aws_settings'
11
12
  require_relative "exercism_config/version"
@@ -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:3040"
26
+ "http://#{host}"
29
27
  end
30
28
  end
31
29
  end
@@ -0,0 +1,33 @@
1
+ module ExercismConfig
2
+ class SetupS3Client
3
+ include Mandate
4
+
5
+ def call
6
+ require 'aws-sdk-s3'
7
+
8
+ aws_settings = GenerateAwsSettings.().merge(
9
+ endpoint: config_endpoint,
10
+ force_path_style: true,
11
+
12
+ # We don't want a profile for this AWS service
13
+ # as we run it locally. But we do normally, so
14
+ # we locally override this here.
15
+ profile: nil
16
+ ).select {|k,v|v}
17
+ Aws::S3::Client.new(aws_settings)
18
+ end
19
+
20
+ private
21
+ attr_reader :environment
22
+
23
+ memoize
24
+ def config_endpoint
25
+ return nil unless %i[development test].include?(Exercism.environment)
26
+ return "http://127.0.0.1:#{ENV["S3_PORT"]}" if ENV["EXERCISM_CI"]
27
+
28
+ host = ENV["EXERCISM_DOCKER"] ? "s3:3041" : "lvh.me:3041"
29
+ "http://#{host}"
30
+ end
31
+ end
32
+ end
33
+
@@ -1,3 +1,3 @@
1
1
  module ExercismConfig
2
- VERSION = "0.18.0"
2
+ VERSION = "0.23.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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exercism_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Walker
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: aws-sdk-s3
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description:
112
126
  email:
113
127
  - jez.walker@gmail.com
@@ -132,7 +146,11 @@ files:
132
146
  - lib/exercism_config/generate_aws_settings.rb
133
147
  - lib/exercism_config/retrieve.rb
134
148
  - lib/exercism_config/setup_dynamodb_client.rb
149
+ - lib/exercism_config/setup_s3_client.rb
135
150
  - lib/exercism_config/version.rb
151
+ - settings/ci.yml
152
+ - settings/development.yml
153
+ - settings/docker.yml
136
154
  homepage: https://exercism.io
137
155
  licenses: []
138
156
  metadata: