exercism-config 0.38.0 → 0.45.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d53a8ce7ad6afe4b50df38aecc7af7708bb1a761749ac35ece53a0615da3f82b
4
- data.tar.gz: 481ca893d9488040b2a7ae2ec842c922aaf8e6eae43e84cbb05933253fabf15c
3
+ metadata.gz: d8059e119b7057a0972501f6f3d0921e575024f3497ffaab9b9e62fa63bd186b
4
+ data.tar.gz: 1ee220aa35d61dbcf41b498ea268b21a0bd0c1cd4d72507993a759d83847faa1
5
5
  SHA512:
6
- metadata.gz: 19e81f83e28fbe70e72b9f65df2802ca0dfa83e14abc69b62166df590464e6b6c5b66cd39897b35b4073f3a111de68a566b0b90a33581faaa0169f901c6fefb9
7
- data.tar.gz: c88d61bec133716c6af5a4308dd883b1a1786a85ba3d3f9b1f4bd302b1ed983181f6a450293a6b467d3f110f634d2da96e806eea5dbb128ae5423a6035b3c9aa
6
+ metadata.gz: '048546048f8700a7156b6b791ebea79a4d622c3f77b997d9a198c975eb4d20571b59c2a97fff65f0c5d3df37179f0fec660f02cdfbb769d8728ae223b999fd55'
7
+ data.tar.gz: 734e6b495e2e67405d3396e8621ee611050c75043f4a7ab2fc43085bbad45603a45777b328967ccc41eebcdd5dfd28ae7004f6b815065cd4a7b58f3f9764f47f
@@ -73,6 +73,7 @@ jobs:
73
73
  ###
74
74
  # Publish the coverage to CodeClimate
75
75
  - name: Publish code coverage
76
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
76
77
  env:
77
78
  GIT_BRANCH: ${GITHUB_REF/refs\/heads\//}
78
79
  CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
@@ -56,6 +56,10 @@ Style/Documentation:
56
56
  Style/DocumentationMethod:
57
57
  Enabled: false
58
58
 
59
+ Style/GuardClause:
60
+ Exclude:
61
+ - lib/exercism_config/environment.rb
62
+
59
63
  Style/IfUnlessModifier:
60
64
  Exclude:
61
65
  - "lib/exercism_config/setup_dynamodb_client.rb"
data/Rakefile CHANGED
@@ -8,3 +8,7 @@ Rake::TestTask.new(:test) do |t|
8
8
  end
9
9
 
10
10
  task default: :test
11
+
12
+ task :lint do
13
+ sh 'bundle exec rubocop --except Metrics -a'
14
+ end
@@ -13,15 +13,18 @@ Exercism.config.dynamodb_client = ExercismConfig::SetupDynamoDBClient.()
13
13
  # Setup local s3 #
14
14
  ##################
15
15
 
16
- # We don't need this running for CI atm as none of our
17
- # tests actually hit s3. Although we might choose to change this
18
- unless ENV["EXERCISM_CI"] || ENV["EXERCISM_SKIP_S3"]
19
- begin
20
- ExercismConfig::SetupS3Client.().create_bucket(bucket: Exercism.config.aws_iterations_bucket)
21
- rescue Seahorse::Client::NetworkingError => e
22
- puts "local S3 not up yet..."
23
- sleep 2 # slighty retry delaty
24
- retry
16
+ unless ENV["EXERCISM_SKIP_S3"]
17
+ [
18
+ Exercism.config.aws_submissions_bucket,
19
+ Exercism.config.aws_tooling_jobs_bucket,
20
+ ].each do |bucket|
21
+ begin
22
+ ExercismConfig::SetupS3Client.().create_bucket(bucket: bucket)
23
+ rescue Seahorse::Client::NetworkingError => e
24
+ puts "local S3 not up yet..."
25
+ sleep 2 # slighty retry delaty
26
+ retry
27
+ end
25
28
  end
26
29
  end
27
30
 
@@ -94,4 +97,43 @@ end
94
97
  }
95
98
  ]
96
99
  )
100
+
101
+ Exercism.config.dynamodb_client.update_table(
102
+ table_name: table_name,
103
+ attribute_definitions: [
104
+ {
105
+ attribute_name: "submission_uuid",
106
+ attribute_type: "S"
107
+ },
108
+ {
109
+ attribute_name: "type",
110
+ attribute_type: "S"
111
+ }
112
+ ],
113
+ global_secondary_index_updates: [
114
+ {
115
+ create: {
116
+ index_name: "submission_type", # required
117
+ key_schema: [ # required
118
+ {
119
+ attribute_name: "submission_uuid", # required
120
+ key_type: "HASH" # required, accepts HASH, RANGE
121
+ },
122
+ {
123
+ attribute_name: "type", # required
124
+ key_type: "RANGE" # required, accepts HASH, RANGE
125
+ }
126
+ ],
127
+ projection: { # required
128
+ projection_type: "INCLUDE",
129
+ non_key_attributes: ["id", "job_status"]
130
+ },
131
+ provisioned_throughput: {
132
+ read_capacity_units: 1, # required
133
+ write_capacity_units: 1 # required
134
+ }
135
+ }
136
+ }
137
+ ]
138
+ )
97
139
  end
@@ -4,6 +4,10 @@ module ExercismConfig
4
4
 
5
5
  def call
6
6
  env = ENV['EXERCISM_ENV'] || ENV['RAILS_ENV'] || ENV['APP_ENV']
7
+ unless env
8
+ env = Rails.env.to_s if Object.const_defined?(:Rails) && Rails.respond_to?(:env)
9
+ end
10
+
7
11
  raise Exercism::ConfigError, 'No environment set - set one of EXERCISM_ENV, RAILS_ENV or APP_ENV' unless env
8
12
 
9
13
  Environment.new(env)
@@ -1,6 +1,6 @@
1
1
  module ExercismConfig
2
2
  class Environment
3
- ALLOWED_ENVS = %{development test production}
3
+ ALLOWED_ENVS = %(development test production).freeze
4
4
  private_constant :ALLOWED_ENVS
5
5
 
6
6
  def initialize(raw_env)
@@ -15,7 +15,6 @@ module ExercismConfig
15
15
  end
16
16
 
17
17
  private
18
-
19
18
  memoize
20
19
  def config_endpoint
21
20
  return nil if Exercism.env.production?
@@ -18,11 +18,10 @@ module ExercismConfig
18
18
  end
19
19
 
20
20
  private
21
-
22
21
  memoize
23
22
  def config_endpoint
24
23
  return nil if Exercism.env.production?
25
- return "http://127.0.0.1:#{ENV['S3_PORT']}" if ENV['EXERCISM_CI']
24
+ return "http://127.0.0.1:#{ENV['S3_PORT']}" if Exercism.env.test? && ENV['EXERCISM_CI']
26
25
 
27
26
  host = ENV['EXERCISM_DOCKER'] ? 's3:9090' : 'localhost:3041'
28
27
  "http://#{host}"
@@ -1,3 +1,3 @@
1
1
  module ExercismConfig
2
- VERSION = '0.38.0'.freeze
2
+ VERSION = '0.45.0'.freeze
3
3
  end
@@ -1,6 +1,7 @@
1
1
  anycable_redis_url: redis://127.0.0.1:6379/1
2
2
  anycable_rpc_host: 127.0.0.1:50051
3
- aws_iterations_bucket: exercism-staging-iterations
3
+ aws_submissions_bucket: exercism-staging-submissions
4
+ aws_tooling_jobs_bucket: exercism-staging-tooling-jobs
4
5
  dynamodb_tooling_jobs_table: tooling_jobs
5
6
  spi_url: http://127.0.0.1:3020
6
7
  tooling_orchestrator_url: http://127.0.0.1:3021
@@ -1,6 +1,7 @@
1
1
  anycable_redis_url: redis://redis:6379/1
2
2
  anycable_rpc_host: 0.0.0.0:50051
3
- aws_iterations_bucket: exercism-staging-iterations
3
+ aws_submissions_bucket: exercism-staging-submissions
4
+ aws_tooling_jobs_bucket: exercism-staging-tooling-jobs
4
5
  dynamodb_tooling_jobs_table: tooling_jobs
5
6
  mysql_master_endpoint: mysql
6
7
  mysql_port: 3306
@@ -1,6 +1,7 @@
1
1
  anycable_redis_url: redis://127.0.0.1:6379/1
2
2
  anycable_rpc_host: 127.0.0.1:50051
3
- aws_iterations_bucket: exercism-staging-iterations
3
+ aws_submissions_bucket: exercism-staging-submissions
4
+ aws_tooling_jobs_bucket: exercism-staging-tooling-jobs
4
5
  dynamodb_tooling_jobs_table: tooling_jobs
5
6
  mysql_master_endpoint: localhost
6
7
  mysql_socket: /tmp/mysql.sock
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exercism-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.38.0
4
+ version: 0.45.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Walker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-11 00:00:00.000000000 Z
11
+ date: 2020-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-dynamodb
@@ -131,7 +131,6 @@ executables:
131
131
  extensions: []
132
132
  extra_rdoc_files: []
133
133
  files:
134
- - ".github/config/rubocop_linter_action.yml"
135
134
  - ".github/workflows/rubocop.yml"
136
135
  - ".github/workflows/tests.yml"
137
136
  - ".gitignore"
@@ -1,12 +0,0 @@
1
- check_name: 'Rubocop Results'
2
-
3
- rubocop_fail_level: 'refactor'
4
-
5
- rubocop_excluded_cops:
6
- - 'Metrics'
7
-
8
- versions:
9
- - rubocop
10
- - rubocop-rails
11
- - rubocop-minitest
12
- - rubocop-performance