exercism_config 0.28.0 → 0.29.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: 913c636d3aa6d15b8e6747b9b0e3073fee09fad61f9a198ac64e1382a4ca2da5
4
- data.tar.gz: 83aac0ef0e856934a3dcf5e096b86beb2a79825493d60772ecdc6f29922995d3
3
+ metadata.gz: 1b04997a88ec2a910bbfd5bfc544a2283f3625303a7be4e095562c5d0426d344
4
+ data.tar.gz: 0b7e9976d8c8fcac075b63c19f30b7b4ff6ea1a85989b1df727cd3bac0f31a6a
5
5
  SHA512:
6
- metadata.gz: 7d328e8f2334c156a54b021386e3504dc9bd92fcf5a377cb0aa67b6ef961866920dfaa47e004fbd8fbec864b910aa92cd5f2ebd961219db7e345dbca9e275338
7
- data.tar.gz: '01970fc7b263be6503627d824184aaf76899efd7d1c7dfc1cbd298c5fbc638cc80ad8cdd22e2567f8486270fb890782a958ffd90a95e08de878832857a704c12'
6
+ metadata.gz: cc39469f3004690ae7f30069c1d31c7f9e5304774e23e7ef624da312c612a12b7e911bb43918c50b190060fea2cf3c9e002a2511d316aee2ac704e3888a8a9ed
7
+ data.tar.gz: 858ac021fefa6fef3fd830ebe0a2291cba521570253c45bcbdb7561cb6fa8deb3f2dcff1ec33f48610f1da08ecd0972f775a076e853b141d2a176d8e634b14df
@@ -0,0 +1,12 @@
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
@@ -0,0 +1,17 @@
1
+ name: Rubocop
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ rubocop:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Rubocop Linter Action
15
+ uses: andrewmcodes/rubocop-linter-action@v3.0.0
16
+ env:
17
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,81 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ services:
14
+ dynamodb:
15
+ image: "amazon/dynamodb-local"
16
+ ports:
17
+ - 8000
18
+
19
+ steps:
20
+ ###
21
+ # Checkout using GitHub's checkout action
22
+ - uses: actions/checkout@v2
23
+
24
+ ###
25
+ # Setup Ruby - this needs to match the version in the Gemfile
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
28
+ with:
29
+ ruby-version: 2.6.6
30
+
31
+ ###
32
+ # Caching using GitHub's caching action
33
+ - name: Cache Bundler
34
+ uses: actions/cache@v2
35
+ with:
36
+ path: vendor/bundle
37
+ key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
38
+ restore-keys: |
39
+ ${{ runner.os }}-gems-
40
+
41
+ ###
42
+ # Install bundler and yarn dependencies
43
+ - name: Install dependencies
44
+ env:
45
+ EXERCISM_ENV: test
46
+ EXERCISM_CI: true
47
+ DYNAMODB_PORT: ${{ job.services.dynamodb.ports['8000'] }}
48
+ run: |
49
+ bundle config path vendor/bundle # This is needed for the caching above
50
+ bundle install --jobs 4 --retry 3
51
+ bundle exec setup_exercism_config
52
+
53
+ ###
54
+ # Setup code climate
55
+ # - name: Setup Code Climate test-reporter
56
+ # run: |
57
+ # curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
58
+ # chmod +x ./cc-test-reporter
59
+ # ./cc-test-reporter before-build
60
+
61
+ ###
62
+ # Run the tests
63
+ - name: Run Ruby tests
64
+ env:
65
+ EXERCISM_ENV: test
66
+ EXERCISM_CI: true
67
+ DYNAMODB_PORT: ${{ job.services.dynamodb.ports['8000'] }}
68
+ CAPTURE_CODE_COVERAGE: true
69
+ run: |
70
+ bundle exec rake test
71
+ #./cc-test-reporter format-coverage -t simplecov -o codeclimate.backend.json coverage/backend/.resultset.json
72
+
73
+ ###
74
+ # Publish the coverage to CodeClimate
75
+ # - name: Publish code coverage
76
+ # env:
77
+ # GIT_BRANCH: ${GITHUB_REF/refs\/heads\//}
78
+ # CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
79
+ # run: |
80
+ # ./cc-test-reporter sum-coverage codeclimate.*.json -p 2 -o codeclimate.total.json
81
+ # ./cc-test-reporter upload-coverage -i codeclimate.total.json
data/.gitignore CHANGED
@@ -6,5 +6,6 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ node_modules/
9
10
 
10
11
  exercism_config-*.gem
@@ -0,0 +1,81 @@
1
+ require:
2
+ - rubocop-minitest
3
+ - rubocop-performance
4
+
5
+ AllCops:
6
+ NewCops: disable
7
+ Exclude:
8
+ - "bin/**/*"
9
+
10
+ Bundler/OrderedGems:
11
+ Enabled: false
12
+
13
+ Layout/DotPosition:
14
+ EnforcedStyle: trailing
15
+
16
+ Layout/EndOfLine:
17
+ EnforcedStyle: lf
18
+
19
+ Layout/MultilineMethodCallIndentation:
20
+ EnforcedStyle: indented
21
+
22
+ Layout/EmptyLinesAroundAccessModifier:
23
+ EnforcedStyle: only_before
24
+
25
+ #Layout/LineLength:
26
+ #Exclude:
27
+
28
+ Lint/SuppressedException:
29
+ Exclude:
30
+ - "test/**/*"
31
+ - "lib/tooling_invoker/runc_wrapper.rb"
32
+ - "lib/tooling_invoker/external_command.rb"
33
+
34
+ Metrics/BlockLength:
35
+ Exclude:
36
+ - "test/**/*"
37
+
38
+ Metrics/MethodLength:
39
+ # We probably want to bring this down but let's start here for now
40
+ Max: 20
41
+ Exclude:
42
+ - "test/**/*"
43
+
44
+ Naming/PredicateName:
45
+ Enabled: false
46
+
47
+ Style/StringLiterals:
48
+ Enabled: false
49
+
50
+ Style/FrozenStringLiteralComment:
51
+ Enabled: false
52
+
53
+ Style/Documentation:
54
+ Enabled: false
55
+
56
+ Style/DocumentationMethod:
57
+ Enabled: false
58
+
59
+ Style/IfUnlessModifier:
60
+ Exclude:
61
+ - "lib/exercism_config/setup_dynamodb_client.rb"
62
+
63
+ Style/NumericPredicate:
64
+ Enabled: false
65
+
66
+ Style/RedundantSelf:
67
+ Enabled: false
68
+
69
+ Style/ZeroLengthPredicate:
70
+ Enabled: false
71
+
72
+ # I don't mind this being enabled if
73
+ # someone fixes all the fails.
74
+ Style/ClassAndModuleChildren:
75
+ Enabled: false
76
+
77
+ Naming/VariableNumber:
78
+ EnforcedStyle: snake_case
79
+
80
+ Style/LambdaCall:
81
+ EnforcedStyle: braces
@@ -0,0 +1 @@
1
+ ruby-2.6.6
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in exercism_config.gemspec
4
4
  gemspec
5
5
 
6
- gem "rake", "~> 12.0"
6
+ gem 'rake', '~> 12.0'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exercism_config (0.21.0)
4
+ exercism_config (0.29.0)
5
5
  aws-sdk-dynamodb (~> 1.0)
6
6
  mandate
7
7
  zeitwerk
@@ -9,8 +9,9 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
+ ast (2.4.1)
12
13
  aws-eventstream (1.1.0)
13
- aws-partitions (1.346.0)
14
+ aws-partitions (1.350.0)
14
15
  aws-sdk-core (3.104.3)
15
16
  aws-eventstream (~> 1, >= 1.0.2)
16
17
  aws-partitions (~> 1, >= 1.239.0)
@@ -19,24 +20,58 @@ GEM
19
20
  aws-sdk-dynamodb (1.51.0)
20
21
  aws-sdk-core (~> 3, >= 3.99.0)
21
22
  aws-sigv4 (~> 1.1)
23
+ aws-sdk-kms (1.36.0)
24
+ aws-sdk-core (~> 3, >= 3.99.0)
25
+ aws-sigv4 (~> 1.1)
26
+ aws-sdk-s3 (1.75.0)
27
+ aws-sdk-core (~> 3, >= 3.104.1)
28
+ aws-sdk-kms (~> 1)
29
+ aws-sigv4 (~> 1.1)
22
30
  aws-sigv4 (1.2.1)
23
31
  aws-eventstream (~> 1, >= 1.0.2)
24
32
  jmespath (1.4.0)
25
33
  mandate (0.3.0)
26
34
  minitest (5.14.1)
27
35
  mocha (1.11.2)
36
+ parallel (1.19.2)
37
+ parser (2.7.1.4)
38
+ ast (~> 2.4.1)
39
+ rainbow (3.0.0)
28
40
  rake (12.3.3)
41
+ regexp_parser (1.7.1)
42
+ rexml (3.2.4)
43
+ rubocop (0.88.0)
44
+ parallel (~> 1.10)
45
+ parser (>= 2.7.1.1)
46
+ rainbow (>= 2.2.2, < 4.0)
47
+ regexp_parser (>= 1.7)
48
+ rexml
49
+ rubocop-ast (>= 0.1.0, < 1.0)
50
+ ruby-progressbar (~> 1.7)
51
+ unicode-display_width (>= 1.4.0, < 2.0)
52
+ rubocop-ast (0.3.0)
53
+ parser (>= 2.7.1.4)
54
+ rubocop-minitest (0.10.1)
55
+ rubocop (>= 0.87)
56
+ rubocop-performance (1.7.1)
57
+ rubocop (>= 0.82.0)
58
+ ruby-progressbar (1.10.1)
59
+ unicode-display_width (1.7.0)
29
60
  zeitwerk (2.4.0)
30
61
 
31
62
  PLATFORMS
32
63
  ruby
33
64
 
34
65
  DEPENDENCIES
66
+ aws-sdk-s3
35
67
  bundler (~> 2.1)
36
68
  exercism_config!
37
69
  minitest (~> 5.0)
38
70
  mocha
39
71
  rake (~> 12.0)
72
+ rubocop
73
+ rubocop-minitest
74
+ rubocop-performance
40
75
 
41
76
  BUNDLED WITH
42
77
  2.1.4
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
3
 
4
4
  Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
8
  end
9
9
 
10
- task :default => :test
10
+ task default: :test
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "exercism_config"
3
+ require 'bundler/setup'
4
+ require 'exercism_config'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "exercism_config"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "exercism_config"
3
+ require 'bundler/setup'
4
+ require 'exercism_config'
5
5
  require 'erb'
6
6
  require 'yaml'
7
7
 
8
- env = ExercismConfig::DetermineEnvironment.()
8
+ env = ExercismConfig::DetermineEnvironment.call
9
9
  if env == :production
10
- puts "Aborted! This script should not be run in production."
11
- exit
10
+ puts 'Aborted! This script should not be run in production.'
11
+ exit
12
12
  end
13
13
 
14
14
  def create_table(client)
@@ -16,26 +16,26 @@ def create_table(client)
16
16
  table_name: :config,
17
17
  attribute_definitions: [
18
18
  {
19
- attribute_name: "id",
20
- attribute_type: "S",
21
- },
19
+ attribute_name: 'id',
20
+ attribute_type: 'S'
21
+ }
22
22
  ],
23
23
  key_schema: [
24
24
  {
25
- attribute_name: "id",
26
- key_type: "HASH",
25
+ attribute_name: 'id',
26
+ key_type: 'HASH'
27
27
  }
28
28
  ],
29
29
  provisioned_throughput: {
30
- read_capacity_units: 1,
31
- write_capacity_units: 1,
30
+ read_capacity_units: 1,
31
+ write_capacity_units: 1
32
32
  }
33
33
  )
34
34
  end
35
35
 
36
36
  def delete_table(client)
37
37
  client.delete_table(
38
- table_name: :config,
38
+ table_name: :config
39
39
  )
40
40
  end
41
41
 
@@ -49,31 +49,31 @@ def set_config_value(client, id, value)
49
49
  )
50
50
  end
51
51
 
52
- client = ExercismConfig::SetupDynamoDBClient.()
52
+ client = ExercismConfig::SetupDynamoDBClient.call
53
53
 
54
54
  begin
55
55
  create_table(client)
56
56
  rescue Aws::DynamoDB::Errors::ResourceInUseException => e
57
- if ARGV.include?("--force")
58
- puts "Table exists. Recreating..."
57
+ if ARGV.include?('--force')
58
+ puts 'Table exists. Recreating...'
59
59
  delete_table(client)
60
60
  create_table(client)
61
- puts "Table recreated."
61
+ puts 'Table recreated.'
62
62
  else
63
- puts "Table exists. Not recreating."
63
+ puts 'Table exists. Not recreating.'
64
64
  end
65
65
  end
66
66
 
67
- settings_file_arg = ARGV.select{|arg|arg.start_with?("--settings-file=")}.first
68
- settings_file =
67
+ settings_file_arg = ARGV.select { |arg| arg.start_with?('--settings-file=') }.first
68
+ settings_file =
69
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__)
70
+ settings_file_arg.split('=').last
71
+ elsif ENV['EXERCISM_DOCKER']
72
+ File.expand_path('../settings/docker.yml', __dir__)
73
+ elsif ENV['EXERCISM_CI']
74
+ File.expand_path('../settings/ci.yml', __dir__)
75
75
  else
76
- File.expand_path("../../settings/development.yml", __FILE__)
76
+ File.expand_path('../settings/development.yml', __dir__)
77
77
  end
78
78
 
79
79
  puts "Using settings file: #{settings_file}"
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env ruby
2
+ require "bundler/setup"
3
+ require "exercism_config"
4
+
5
+ # Only allow this to run in development
6
+ return unless Exercism.environment == :development
7
+
8
+ puts "Create AWS/DynamoDB tables..."
9
+
10
+ Exercism.config.dynamodb_client = ExercismConfig::SetupDynamoDBClient.()
11
+
12
+ ##################
13
+ # Setup local s3 #
14
+ ##################
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"]
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
25
+ end
26
+ end
27
+
28
+ ########################
29
+ # Setup local dynamodb #
30
+ ########################
31
+ %w[tooling_jobs tooling_jobs-test].each do |table_name|
32
+ begin
33
+ Exercism.config.dynamodb_client.delete_table(
34
+ table_name: table_name
35
+ )
36
+ rescue Aws::DynamoDB::Errors::ResourceNotFoundException
37
+ end
38
+ puts "[x] #{table_name}"
39
+
40
+ Exercism.config.dynamodb_client.create_table(
41
+ table_name: table_name,
42
+ attribute_definitions: [
43
+ {
44
+ attribute_name: "id",
45
+ attribute_type: "S"
46
+ }
47
+ ],
48
+ key_schema: [
49
+ {
50
+ attribute_name: "id",
51
+ key_type: "HASH"
52
+ }
53
+ ],
54
+ provisioned_throughput: {
55
+ read_capacity_units: 1,
56
+ write_capacity_units: 1
57
+ }
58
+ )
59
+
60
+ Exercism.config.dynamodb_client.update_table(
61
+ table_name: table_name,
62
+ attribute_definitions: [
63
+ {
64
+ attribute_name: "job_status",
65
+ attribute_type: "S"
66
+ },
67
+ {
68
+ attribute_name: "created_at",
69
+ attribute_type: "N"
70
+ }
71
+ ],
72
+ global_secondary_index_updates: [
73
+ {
74
+ create: {
75
+ index_name: "job_status", # required
76
+ key_schema: [ # required
77
+ {
78
+ attribute_name: "job_status", # required
79
+ key_type: "HASH" # required, accepts HASH, RANGE
80
+ },
81
+ {
82
+ attribute_name: "created_at", # required
83
+ key_type: "RANGE" # required, accepts HASH, RANGE
84
+ }
85
+ ],
86
+ projection: { # required
87
+ projection_type: "KEYS_ONLY"
88
+ },
89
+ provisioned_throughput: {
90
+ read_capacity_units: 1, # required
91
+ write_capacity_units: 1 # required
92
+ }
93
+ }
94
+ }
95
+ ]
96
+ )
97
+ end