grade_runner 0.0.4.pre.19 → 0.0.4.pre.20
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/tasks/grade.rake +12 -2
- 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: '070915299f7c5c937ac216285f003f2a17a74a443421dd222bf7e92a2252e871'
|
4
|
+
data.tar.gz: 3291f47534deceaeaf0c0f8b159abf24d50f3cc11577f5d9c3d0dcf707567847
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ffd1185c5bb93da3e1cc062848ddb2f9c7b3703588efc3bd8cc4cb782c1642ceeada4ac8c5879ea8128439b6d0a2cb7123a6c791bac50c513a73b05bac91302
|
7
|
+
data.tar.gz: 0aa782b80664769e042092b399441107197cfcf31e1b2eac869a5d4c679776db479f594fcd0bbbeb84dea75f496101b404ab95a618bda4757df3318b793cd5ac
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.4.pre.
|
1
|
+
0.0.4.pre.20
|
data/lib/tasks/grade.rake
CHANGED
@@ -31,16 +31,21 @@ namespace :grade do
|
|
31
31
|
submission_url = "https://grades.firstdraft.com"
|
32
32
|
end
|
33
33
|
|
34
|
+
p "File found"#REMOVE
|
34
35
|
if !input_token.nil?
|
36
|
+
p "input token:"#REMOVE
|
37
|
+
p input_token#REMOVE
|
35
38
|
token = input_token
|
36
39
|
student_config["personal_access_token"] = input_token
|
37
40
|
update_config_file(config_file_name, student_config)
|
38
41
|
elsif input_token.nil? && !file_token.nil?
|
42
|
+
p "file token"
|
43
|
+
p file_token
|
39
44
|
token = file_token
|
40
45
|
elsif input_token.nil? && file_token.nil?
|
41
46
|
puts "Enter your access token for this project"
|
42
47
|
new_personal_access_token = ""
|
43
|
-
|
48
|
+
p "Entering new token" #REMOVE
|
44
49
|
while new_personal_access_token == "" do
|
45
50
|
print "> "
|
46
51
|
new_personal_access_token = $stdin.gets.chomp.strip
|
@@ -55,10 +60,12 @@ namespace :grade do
|
|
55
60
|
update_config_file(config_file_name, student_config)
|
56
61
|
token = new_personal_access_token
|
57
62
|
end
|
63
|
+
p "end of loop" #REMOVE
|
58
64
|
end
|
59
65
|
end
|
60
66
|
|
61
67
|
if !token.nil?
|
68
|
+
p "token not nil" #REMOVE
|
62
69
|
if is_valid_token?(submission_url, token) == false
|
63
70
|
student_config["personal_access_token"] = nil
|
64
71
|
update_config_file(config_file_name, student_config)
|
@@ -104,6 +111,7 @@ def update_config_file(config_file_name, config)
|
|
104
111
|
end
|
105
112
|
|
106
113
|
def is_valid_token?(root_url, token)
|
114
|
+
p "is valid" #REMOVE
|
107
115
|
return false unless token.is_a?(String) && token =~ /^[1-9A-Za-z][^OIl]{23}$/
|
108
116
|
url = "#{root_url}/submissions/validate_token?token=#{token}"
|
109
117
|
uri = URI.parse(url)
|
@@ -114,6 +122,8 @@ def is_valid_token?(root_url, token)
|
|
114
122
|
result = JSON.parse(res.body)
|
115
123
|
result["success"]
|
116
124
|
rescue => e
|
125
|
+
p "error" #REMOVE
|
126
|
+
p e #REMOVE
|
117
127
|
return false
|
118
128
|
end
|
119
129
|
|
@@ -125,6 +135,6 @@ def project_root
|
|
125
135
|
# if defined?(Bundler)
|
126
136
|
# return Bundler.root
|
127
137
|
# end
|
128
|
-
|
138
|
+
p "project root" #REMOVE
|
129
139
|
Dir.pwd
|
130
140
|
end
|