grade_runner 0.0.3.pre.3 → 0.0.3.pre.4
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 +4 -4
- data/VERSION +1 -1
- data/lib/grade_runner/railtie.rb +7 -7
- data/lib/tasks/grade.rake +16 -12
- data/lib/tasks/grade_runner.rake +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78d36c19cabfff00aa753ae3971b98ee8b322706920fdb2615502afe9db192e2
|
4
|
+
data.tar.gz: bcee602c1f6a1dbf4579c74a71643ed1f4984bcad6af35afdab3e2088fa92999
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c98546b7953efd45a09b14b8357cc4bb2c69bc74d81962596496c9099e6956b3c81626320db5ae40a67cee742fe372a9ff8d664af72c8ae73f3f4e2adbd45fc
|
7
|
+
data.tar.gz: b839f46883a83fd28fe957ff5b2be8fecd2250f1567c4502d0fc377d9f16a59d34025f020fd09f5abe166637a75b0acd010732262e38b32f1f45c2ce5a3c52f9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.3.pre.
|
1
|
+
0.0.3.pre.4
|
data/lib/grade_runner/railtie.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require 'rails'
|
1
|
+
# require 'rails'
|
2
2
|
|
3
3
|
module GradeRunner
|
4
|
-
class Railtie < ::Rails::Railtie
|
4
|
+
# class Railtie < ::Rails::Railtie
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
6
|
+
# rake_tasks do
|
7
|
+
# load "tasks/grade_runner.rake"
|
8
|
+
# load "tasks/grade.rake"
|
9
|
+
# end
|
10
|
+
# end
|
11
11
|
end
|
data/lib/tasks/grade.rake
CHANGED
@@ -9,7 +9,7 @@ namespace :grade do
|
|
9
9
|
input_token = ARGV[1]
|
10
10
|
file_token = nil
|
11
11
|
|
12
|
-
config_file_name =
|
12
|
+
config_file_name = File.join(__dir__, "grades.yml")
|
13
13
|
student_config = {}
|
14
14
|
student_config["submission_url"] = "https://grades.firstdraft.com"
|
15
15
|
|
@@ -17,7 +17,7 @@ namespace :grade do
|
|
17
17
|
begin
|
18
18
|
config = YAML.load_file(config_file_name)
|
19
19
|
rescue
|
20
|
-
abort "It looks like there's something wrong with your token in `/grades.yml`. Please delete that file and try `
|
20
|
+
abort "It looks like there's something wrong with your token in `/grades.yml`. Please delete that file and try `rake grade:all` again, and be sure to provide the access token for THIS project.".red
|
21
21
|
end
|
22
22
|
submission_url = config["submission_url"]
|
23
23
|
file_token = config["personal_access_token"]
|
@@ -57,11 +57,13 @@ namespace :grade do
|
|
57
57
|
if is_valid_token?(submission_url, token) == false
|
58
58
|
student_config["personal_access_token"] = nil
|
59
59
|
update_config_file(config_file_name, student_config)
|
60
|
-
puts "Your access token looked invalid, so we've reset it to be blank. Please re-run
|
60
|
+
puts "Your access token looked invalid, so we've reset it to be blank. Please re-run rake grade and, when asked, copy-paste your token carefully from the assignment page."
|
61
61
|
else
|
62
|
-
path =
|
63
|
-
`bin/rails db:migrate RAILS_ENV=test`
|
64
|
-
`
|
62
|
+
path = File.join(__dir__, "/tmp/output/#{Time.now.to_i}.json")
|
63
|
+
# `bin/rails db:migrate RAILS_ENV=test`
|
64
|
+
`bin/rake db:migrate`
|
65
|
+
# `RAILS_ENV=test bundle exec rspec --order default --format JsonOutputFormatter --out #{path}`
|
66
|
+
`bundle exec rspec --order default --format JsonOutputFormatter --out #{path}`
|
65
67
|
rspec_output_json = JSON.parse(File.read(path))
|
66
68
|
username = ""
|
67
69
|
reponame = ""
|
@@ -70,19 +72,21 @@ namespace :grade do
|
|
70
72
|
GradeRunner::Runner.new(submission_url, token, rspec_output_json, username, reponame, sha, "manual").process
|
71
73
|
end
|
72
74
|
else
|
73
|
-
puts "We couldn't find your access token, so we couldn't record your grade. Please click on the assignment link again and run the
|
75
|
+
puts "We couldn't find your access token, so we couldn't record your grade. Please click on the assignment link again and run the rake grade ... command shown there."
|
74
76
|
end
|
75
77
|
end
|
76
78
|
|
77
79
|
desc "Run only the next failing test."
|
78
80
|
task :next do
|
79
|
-
path =
|
81
|
+
path = File.join(__dir__, "examples.txt")
|
80
82
|
if File.exist?(path)
|
81
|
-
`bin/rails db:migrate RAILS_ENV=test`
|
82
|
-
puts `RAILS_ENV=test bundle exec rspec --next-failure --format HintFormatter`
|
83
|
+
# `bin/rails db:migrate RAILS_ENV=test`
|
84
|
+
# puts `RAILS_ENV=test bundle exec rspec --next-failure --format HintFormatter`
|
85
|
+
puts `bundle exec rspec --next-failure --format HintFormatter`
|
83
86
|
else
|
84
|
-
puts `RAILS_ENV=test bundle exec rspec`
|
85
|
-
puts
|
87
|
+
# puts `RAILS_ENV=test bundle exec rspec`
|
88
|
+
puts `bundle exec rspec`
|
89
|
+
puts "Please rerun rake grade:next to run the first failing spec"
|
86
90
|
end
|
87
91
|
end
|
88
92
|
|
data/lib/tasks/grade_runner.rake
CHANGED
@@ -3,12 +3,12 @@ namespace :grade_runner do
|
|
3
3
|
task :runner do
|
4
4
|
default_submission_url = "https://grades.firstdraft.com"
|
5
5
|
config = {}
|
6
|
-
path =
|
6
|
+
path = File.join(__dir__,"grades.yml")
|
7
7
|
if File.exist?(path)
|
8
8
|
begin
|
9
9
|
config = YAML.load_file(path)
|
10
10
|
rescue
|
11
|
-
abort "It looks like there's something wrong with your token in `/grades.yml`. Please delete that file and try `
|
11
|
+
abort "It looks like there's something wrong with your token in `/grades.yml`. Please delete that file and try `rake grade:all` again, and be sure to provide the access token for THIS project.".red
|
12
12
|
end
|
13
13
|
end
|
14
14
|
rspec_output_json = JSON.parse(File.read("#{ENV['CIRCLE_ARTIFACTS']}/output/rspec_output.json"))
|
@@ -19,7 +19,7 @@ namespace :grade_runner do
|
|
19
19
|
if token.present?
|
20
20
|
GradeRunner::Runner.new('', config['submission_url'] || default_submission_url, token, rspec_output_json, username, reponame, sha, 'circle_ci').process
|
21
21
|
else
|
22
|
-
puts "We couldn't find your access token, so we couldn't record your grade. Please click on the assignment link again and run the
|
22
|
+
puts "We couldn't find your access token, so we couldn't record your grade. Please click on the assignment link again and run the rake grade ... command shown there."
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|