grade_runner 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/tasks/grade.rake +22 -47
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f83e35368d549636de5841a719e1c81f211fedf13572bdd27a819b24b04ebbeb
|
4
|
+
data.tar.gz: 5f237a123364f57d1cb83ed9c98134391600fa57b020d7e2d05346a8676c4cc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 343919cd54317ce463d9fccbc4a3eca37d0faafe36c31fa294ed911e96aecdec637b6a4e728dde8f7fab3a945a86054bc02717ddc659e56f75bcfcea9661b280
|
7
|
+
data.tar.gz: 5f13ed69664ba6a817247be6933306aa610267b37f04f1bb259036fc64a4798006b74fad7ec42b250ddc6e9f2242e6a715738034aafddd7d2cab9c797d459c81
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/lib/tasks/grade.rake
CHANGED
@@ -3,13 +3,12 @@ require 'net/http'
|
|
3
3
|
require "json"
|
4
4
|
require_relative "../grade_runner/runner"
|
5
5
|
|
6
|
-
desc "Alias for \"grade:next\"."
|
7
|
-
task grade: "grade:all" do
|
8
|
-
end
|
6
|
+
# desc "Alias for \"grade:next\"."
|
7
|
+
# task grade: "grade:all" do
|
8
|
+
# end
|
9
9
|
|
10
|
-
namespace :grade do
|
11
10
|
desc "Run all tests and submit a build report."
|
12
|
-
task :
|
11
|
+
task :grade do
|
13
12
|
ARGV.each { |a| task a.to_sym do ; end }
|
14
13
|
input_token = ARGV[1]
|
15
14
|
file_token = nil
|
@@ -31,29 +30,15 @@ namespace :grade do
|
|
31
30
|
submission_url = "https://grades.firstdraft.com"
|
32
31
|
end
|
33
32
|
|
34
|
-
if input_token !=
|
35
|
-
input_token != "" &&
|
36
|
-
input_token != " " &&
|
37
|
-
!input_token.nil? &&
|
38
|
-
input_token != [] &&
|
39
|
-
input_token != {}
|
40
|
-
|
33
|
+
if !input_token.nil? && input_token != "" && input_token != " "
|
41
34
|
token = input_token
|
42
35
|
student_config["personal_access_token"] = input_token
|
43
36
|
update_config_file(config_file_name, student_config)
|
44
|
-
elsif input_token.nil? &&
|
45
|
-
file_token != false &&
|
46
|
-
file_token != "" &&
|
47
|
-
file_token != " " &&
|
48
|
-
!file_token.nil? &&
|
49
|
-
file_token != [] &&
|
50
|
-
file_token != {}
|
51
|
-
|
37
|
+
elsif input_token.nil? && !file_token.nil?
|
52
38
|
token = file_token
|
53
39
|
elsif input_token.nil? && file_token.nil?
|
54
40
|
puts "Enter your access token for this project"
|
55
41
|
new_personal_access_token = ""
|
56
|
-
|
57
42
|
while new_personal_access_token == "" do
|
58
43
|
print "> "
|
59
44
|
new_personal_access_token = $stdin.gets.chomp.strip
|
@@ -71,12 +56,7 @@ namespace :grade do
|
|
71
56
|
end
|
72
57
|
end
|
73
58
|
|
74
|
-
if token !=
|
75
|
-
token != "" &&
|
76
|
-
token != " " &&
|
77
|
-
!token.nil? &&
|
78
|
-
token != [] &&
|
79
|
-
token != {}
|
59
|
+
if !token.nil? && token != "" && token != " "
|
80
60
|
if is_valid_token?(submission_url, token) == false
|
81
61
|
student_config["personal_access_token"] = nil
|
82
62
|
update_config_file(config_file_name, student_config)
|
@@ -101,38 +81,33 @@ namespace :grade do
|
|
101
81
|
end
|
102
82
|
end
|
103
83
|
|
104
|
-
desc "Run only the next failing test."
|
105
|
-
task :next do
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
end
|
84
|
+
# desc "Run only the next failing test."
|
85
|
+
# task :next do
|
86
|
+
# path = File.join(__dir__, "examples.txt")
|
87
|
+
# if File.file?(path)
|
88
|
+
# # `bin/rails db:migrate RAILS_ENV=test`
|
89
|
+
# # puts `RAILS_ENV=test bundle exec rspec --next-failure --format HintFormatter`
|
90
|
+
# puts `bundle exec rspec --next-failure --format HintFormatter`
|
91
|
+
# else
|
92
|
+
# # puts `RAILS_ENV=test bundle exec rspec`
|
93
|
+
# puts `bundle exec rspec`
|
94
|
+
# puts "Please rerun rake grade:next to run the first failing spec"
|
95
|
+
# end
|
96
|
+
# end
|
117
97
|
|
118
|
-
end
|
119
98
|
|
120
99
|
def update_config_file(config_file_name, config)
|
121
100
|
File.write(config_file_name, YAML.dump(config))
|
122
101
|
end
|
123
102
|
|
124
103
|
def is_valid_token?(root_url, token)
|
125
|
-
return false unless token.is_a?(String) &&
|
126
|
-
|
104
|
+
return false unless token.is_a?(String) && token =~ /^[1-9A-Za-z][^OIl]{23}$/
|
127
105
|
url = "#{root_url}/submissions/validate_token?token=#{token}"
|
128
106
|
uri = URI.parse(url)
|
129
|
-
|
130
107
|
req = Net::HTTP::Get.new(uri, 'Content-Type' => 'application/json')
|
131
|
-
|
132
108
|
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
|
133
109
|
http.request(req)
|
134
110
|
end
|
135
|
-
|
136
111
|
result = JSON.parse(res.body)
|
137
112
|
result["success"]
|
138
113
|
rescue => e
|
@@ -147,6 +122,6 @@ def project_root
|
|
147
122
|
if defined?(Bundler)
|
148
123
|
return Bundler.root
|
149
124
|
end
|
150
|
-
|
125
|
+
p "project root" #REMOVE
|
151
126
|
Dir.pwd
|
152
127
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grade_runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raghu Betina
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|