et 0.7.2 → 0.7.3

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: 14c8827508f274f3055a4d79b2d65bbb3d530ab7e47b66a5f9bdf2ebc9eded23
4
- data.tar.gz: e26d93b96439f78c4c721a4a6a2193763575a71b6b2e28b4c412463760ae0461
3
+ metadata.gz: 331e5a91f8e482aa1fc11fdc252bb0fdb56e9f30a5e7540ab835eff988fe09fb
4
+ data.tar.gz: baae2e27d8c5535f80ce4ec00a4e8068ee94ddb35cda65351838871f32ff7335
5
5
  SHA512:
6
- metadata.gz: acebf4e72972c2ddf75bd184c152a86ad28caa8a8c4c91eeb27f08f1c3eb6227c87ef9c19f21f1505247d4843ceec7791485f11604205c55009afe128c8025ee
7
- data.tar.gz: 22da208518289aa04817da787607d32f80926859c7d8d8656f76013f9aa1b968194ad62180b474e3ea0e7e43010fd64233b8a6b8a0d12ea726cce166032a1269
6
+ metadata.gz: ecde7b950b03188702855221929ed4ff23e2e47578504123b9521ece21721e3d2d991942090544aac5b92d139b0a7563b351b9d5f2bd34cd938af9c82fb242a4
7
+ data.tar.gz: 67136c5f8a5a3ad58fce15cb0b23f3bf25c40b4e02e2df8e4c3a59a4b0dd0f4861242b0fe7dd501a78541f4e2903e955c5c9ee4c0be173868e7b79d9f7231b94
@@ -0,0 +1,30 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+
15
+ jobs:
16
+ test:
17
+
18
+ runs-on: macos-latest
19
+
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ - name: Set up Ruby
23
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
24
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
25
+ # uses: ruby/setup-ruby@v1
26
+ uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
27
+ - name: Install dependencies
28
+ run: bundle install
29
+ - name: Run tests
30
+ run: bundle exec rake
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- et (0.6.2)
4
+ et (0.7.2)
5
5
  faraday (~> 0.9)
6
6
  faraday_middleware (~> 0.10)
7
7
  gli (= 2.11.0)
data/lib/et.rb CHANGED
@@ -7,6 +7,4 @@ require_relative "et/submission_file_list"
7
7
  require_relative "et/config"
8
8
  require_relative "et/formatter"
9
9
  require_relative "et/lesson"
10
- require_relative "et/challenge"
11
- require_relative "et/exercise"
12
10
  require_relative "et/archive_manager"
@@ -53,18 +53,14 @@ module ET
53
53
 
54
54
  protected
55
55
 
56
- def config
57
- @config ||= YAML.load_file(File.join(dir, ".lesson.yml"))
58
- end
59
-
60
56
  def random_archive_path
61
57
  File.join(Dir.mktmpdir, "#{SecureRandom.hex}.tar.gz")
62
58
  end
63
59
 
64
60
  def find_lesson_dir(current_dir)
65
- path = File.join(current_dir, ".lesson.yml")
61
+ parent_directory = File.dirname(current_dir)
66
62
 
67
- if File.exists?(path)
63
+ if Config.new(parent_directory).exists?
68
64
  current_dir
69
65
  elsif current_dir == "." || Pathname.new(current_dir).root?
70
66
  nil
@@ -1,5 +1,4 @@
1
1
  require "gli"
2
- require "yaml"
3
2
 
4
3
  module ET
5
4
  class Runner
@@ -77,19 +76,6 @@ module ET
77
76
  end
78
77
  end
79
78
 
80
- desc "Run an exercise test suite."
81
- command :test do |c|
82
- c.action do |_global_options, _options, _cmdargs|
83
- exercise = Exercise.new(cwd)
84
-
85
- if exercise.exists?
86
- exercise.run_tests
87
- else
88
- raise StandardError.new("Not in an exercise directory.")
89
- end
90
- end
91
- end
92
-
93
79
  run(args)
94
80
  end
95
81
 
@@ -4,8 +4,9 @@ module ET
4
4
  class SubmissionFileList
5
5
  include Enumerable
6
6
  DEFAULT_IGNORE_GLOBS = [
7
- '.lesson.yml',
8
- 'node_modules/'
7
+ '.etignore',
8
+ 'node_modules/',
9
+ 'coverage/'
9
10
  ]
10
11
 
11
12
  def initialize(path)
@@ -1,3 +1,3 @@
1
1
  module ET
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
@@ -0,0 +1 @@
1
+ #required for et to do its thing
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe ET::Lesson do
4
4
  context "archive! method" do
5
5
  it "creates a tar.gz file" do
6
- path = '/tmp/et'
6
+ path = Dir.mktmpdir
7
7
  filename = 'fab'
8
8
 
9
9
  FileUtils.rm_rf(File.join(path, filename))
@@ -9,8 +9,8 @@ describe ET::SubmissionFileList do
9
9
  expect(file_list).to include('problem.rb')
10
10
  end
11
11
 
12
- it 'includes .etignore' do
13
- expect(file_list).to include('.etignore')
12
+ it 'does not include .etignore' do
13
+ expect(file_list).to_not include('.etignore')
14
14
  end
15
15
 
16
16
  it 'ignores a standard file' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: et
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Sheehan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-01 00:00:00.000000000 Z
11
+ date: 2020-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -131,6 +131,7 @@ executables:
131
131
  extensions: []
132
132
  extra_rdoc_files: []
133
133
  files:
134
+ - ".github/workflows/ruby.yml"
134
135
  - ".gitignore"
135
136
  - ".rspec"
136
137
  - ".rubocop.yml"
@@ -147,9 +148,7 @@ files:
147
148
  - lib/et.rb
148
149
  - lib/et/api.rb
149
150
  - lib/et/archive_manager.rb
150
- - lib/et/challenge.rb
151
151
  - lib/et/config.rb
152
- - lib/et/exercise.rb
153
152
  - lib/et/fallback_connection.rb
154
153
  - lib/et/formatter.rb
155
154
  - lib/et/lesson.rb
@@ -160,10 +159,9 @@ files:
160
159
  - spec/cli/get_lesson_spec.rb
161
160
  - spec/cli/init_spec.rb
162
161
  - spec/cli/list_lessons_spec.rb
163
- - spec/cli/run_exercise_test_suite_spec.rb
164
162
  - spec/cli/submit_lesson_spec.rb
163
+ - spec/data/.et
165
164
  - spec/data/bloated-challenge/.etignore
166
- - spec/data/bloated-challenge/.lesson.yml
167
165
  - spec/data/bloated-challenge/bloated-challenge.md
168
166
  - spec/data/bloated-challenge/node_modules/boo/somefile.js
169
167
  - spec/data/bloated-challenge/problem.rb
@@ -171,20 +169,16 @@ files:
171
169
  - spec/data/challenge.json
172
170
  - spec/data/lessons.json
173
171
  - spec/data/sample-challenge/.etignore
174
- - spec/data/sample-challenge/.lesson.yml
175
172
  - spec/data/sample-challenge/problem.rb
176
173
  - spec/data/sample-challenge/sample-challenge.md
177
174
  - spec/data/sample-exercise/.etignore
178
- - spec/data/sample-exercise/.lesson.yml
179
175
  - spec/data/sample-exercise/lib/sample_exercise.rb
180
176
  - spec/data/sample-exercise/sample-exercise.md
181
177
  - spec/data/sample-exercise/test/sample_exercise_test.rb
182
178
  - spec/data/some-challenge.tar.gz
183
179
  - spec/lib/api_spec.rb
184
180
  - spec/lib/archive_manager_spec.rb
185
- - spec/lib/challenge_spec.rb
186
181
  - spec/lib/config_spec.rb
187
- - spec/lib/exercise_spec.rb
188
182
  - spec/lib/fallback_connection_spec.rb
189
183
  - spec/lib/lesson_spec.rb
190
184
  - spec/lib/operating_system_spec.rb
@@ -1,7 +0,0 @@
1
- module ET
2
- class Challenge < Lesson
3
- def exists?
4
- !dir.nil? && config["type"] == "challenge"
5
- end
6
- end
7
- end
@@ -1,15 +0,0 @@
1
- module ET
2
- class Exercise < Lesson
3
- def run_tests
4
- system("rspec", "--color", "--fail-fast", spec_file)
5
- end
6
-
7
- def exists?
8
- !dir.nil? && config["type"] == "exercise"
9
- end
10
-
11
- def spec_file
12
- File.join(dir, "test", "#{slug.gsub("-", "_")}_test.rb")
13
- end
14
- end
15
- end
@@ -1,31 +0,0 @@
1
- describe "run exercise test suite" do
2
- context "when in an exercise directory" do
3
- it "runs the test suite" do
4
- Dir.mktmpdir("test") do |tmpdir|
5
- write_sample_config_to(tmpdir)
6
- exercise_dir = add_sample_exercise(tmpdir)
7
-
8
- expect_any_instance_of(ET::Exercise).to receive(:run_tests).and_return(true)
9
-
10
- runner = ET::Runner.new(exercise_dir)
11
- _, _ = capture_output do
12
- expect(runner.go(["test"])).to eq(0)
13
- end
14
- end
15
- end
16
- end
17
-
18
- context "when not in an exercise directory" do
19
- it "fails to run the test suite" do
20
- Dir.mktmpdir("test") do |tmpdir|
21
- write_sample_config_to(tmpdir)
22
- expect_any_instance_of(ET::Exercise).to_not receive(:run_tests)
23
-
24
- runner = ET::Runner.new(tmpdir)
25
- _, _ = capture_output do
26
- expect(runner.go(["test"])).to eq(1)
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,3 +0,0 @@
1
- title: "Bloated Challenge"
2
- type: "challenge"
3
- description: "Some description."
@@ -1,4 +0,0 @@
1
- ---
2
- title: "Sample Challenge"
3
- type: "challenge"
4
- description: "Some description."
@@ -1,4 +0,0 @@
1
- ---
2
- title: "Sample Exercise"
3
- type: "exercise"
4
- description: "Some description here."
@@ -1,78 +0,0 @@
1
- require "yaml"
2
-
3
- describe ET::Challenge do
4
- describe "#dir" do
5
- it "selects the directory containing the challenge file" do
6
- Dir.mktmpdir do |tmpdir|
7
- challenge_dir = add_sample_challenge(tmpdir)
8
-
9
- challenge = ET::Challenge.new(challenge_dir)
10
- expect(challenge.dir).to eq(challenge_dir)
11
- end
12
- end
13
-
14
- it "checks parent directories for the challenge file" do
15
- Dir.mktmpdir do |tmpdir|
16
- challenge_dir = add_sample_challenge(tmpdir)
17
-
18
- child_dir = File.join(challenge_dir, "child")
19
- Dir.mkdir(child_dir)
20
-
21
- challenge = ET::Challenge.new(child_dir)
22
- expect(challenge.dir).to eq(challenge_dir)
23
- end
24
- end
25
-
26
- it "returns nil if no challenge file found" do
27
- Dir.mktmpdir do |tmpdir|
28
- challenge = ET::Challenge.new(tmpdir)
29
- expect(challenge.dir).to eq(nil)
30
- end
31
- end
32
- end
33
-
34
- describe "#archive" do
35
- it "packages up files in the given directory" do
36
- archive_path = nil
37
-
38
- begin
39
- Dir.mktmpdir do |tmpdir|
40
- challenge_dir = add_sample_challenge(tmpdir)
41
-
42
- challenge = ET::Challenge.new(challenge_dir)
43
- archive_path = challenge.archive!
44
-
45
- contents = read_file_from_gzipped_archive(archive_path, "./problem.rb")
46
- expect(contents).to eq("# YOUR CODE GOES HERE\n")
47
- end
48
- ensure
49
- if archive_path && File.exist?(archive_path)
50
- FileUtils.rm(archive_path)
51
- end
52
- end
53
- end
54
-
55
- it "excludes files in the ignore array" do
56
- archive_path = nil
57
-
58
- begin
59
- Dir.mktmpdir do |tmpdir|
60
- challenge_dir = add_sample_challenge(tmpdir)
61
-
62
- challenge = ET::Challenge.new(challenge_dir)
63
- archive_path = challenge.archive!
64
-
65
- files = list_files_in_gzipped_archive(archive_path)
66
-
67
- expect(files).to include("./problem.rb")
68
- expect(files).to_not include("./sample-challenge.md")
69
- expect(files).to_not include("./.lesson.yml")
70
- end
71
- ensure
72
- if archive_path && File.exist?(archive_path)
73
- FileUtils.rm(archive_path)
74
- end
75
- end
76
- end
77
- end
78
- end
@@ -1,28 +0,0 @@
1
- describe ET::Exercise do
2
- describe "#exists?" do
3
- it "is true if within an exercise directory" do
4
- Dir.mktmpdir do |tmpdir|
5
- exercise_dir = add_sample_exercise(tmpdir)
6
- exercise = ET::Exercise.new(exercise_dir)
7
-
8
- expect(exercise.exists?).to eq(true)
9
- end
10
- end
11
-
12
- it "is false when in a challenge directory" do
13
- Dir.mktmpdir do |tmpdir|
14
- challenge_dir = add_sample_challenge(tmpdir)
15
- exercise = ET::Exercise.new(challenge_dir)
16
-
17
- expect(exercise.exists?).to eq(false)
18
- end
19
- end
20
-
21
- it "is false when not in a lesson dir" do
22
- Dir.mktmpdir do |tmpdir|
23
- exercise = ET::Exercise.new(tmpdir)
24
- expect(exercise.exists?).to eq(false)
25
- end
26
- end
27
- end
28
- end