grade_runner 0.0.4.pre.21 → 0.0.4
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 +35 -25
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78a54cd4e7ced9a406a055e1ad20b9fc78d295d3cf08bed661610a7f086b5467
|
4
|
+
data.tar.gz: 2792f96fbb55fc9ea3e913b484705332852c1c1e0a59fcc000f05c88c4dd24c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 280ffec77f82bef4e684790982b2b522ab3411b225c29dbf974e04dac9ee89b7cd36927856742667fd9c3d7d2c757ac665e89e2626053a09693e3e2e0fb6bc4c
|
7
|
+
data.tar.gz: 11c6c01972f6b645a7fcc3f5315713140faa7da10e929af9d4d55c4bfb28e717cfe54f77b7f932983f3bc10f1009a3dcec06d25146bdeca7df05300a972a3c22
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.4
|
1
|
+
0.0.4
|
data/lib/tasks/grade.rake
CHANGED
@@ -11,8 +11,6 @@ namespace :grade do
|
|
11
11
|
desc "Run all tests and submit a build report."
|
12
12
|
task :all do
|
13
13
|
ARGV.each { |a| task a.to_sym do ; end }
|
14
|
-
p "START OF FILE" #REMOVE
|
15
|
-
p ARGV.count
|
16
14
|
input_token = ARGV[1]
|
17
15
|
file_token = nil
|
18
16
|
|
@@ -33,21 +31,29 @@ namespace :grade do
|
|
33
31
|
submission_url = "https://grades.firstdraft.com"
|
34
32
|
end
|
35
33
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
if input_token != false &&
|
35
|
+
input_token != "" &&
|
36
|
+
input_token != " " &&
|
37
|
+
!input_token.nil? &&
|
38
|
+
input_token != [] &&
|
39
|
+
input_token != {}
|
40
|
+
|
40
41
|
token = input_token
|
41
42
|
student_config["personal_access_token"] = input_token
|
42
43
|
update_config_file(config_file_name, student_config)
|
43
|
-
elsif input_token.nil? &&
|
44
|
-
|
45
|
-
|
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
|
+
|
46
52
|
token = file_token
|
47
53
|
elsif input_token.nil? && file_token.nil?
|
48
54
|
puts "Enter your access token for this project"
|
49
55
|
new_personal_access_token = ""
|
50
|
-
|
56
|
+
|
51
57
|
while new_personal_access_token == "" do
|
52
58
|
print "> "
|
53
59
|
new_personal_access_token = $stdin.gets.chomp.strip
|
@@ -62,12 +68,15 @@ namespace :grade do
|
|
62
68
|
update_config_file(config_file_name, student_config)
|
63
69
|
token = new_personal_access_token
|
64
70
|
end
|
65
|
-
p "end of loop" #REMOVE
|
66
71
|
end
|
67
72
|
end
|
68
73
|
|
69
|
-
if
|
70
|
-
|
74
|
+
if token != false &&
|
75
|
+
token != "" &&
|
76
|
+
token != " " &&
|
77
|
+
!token.nil? &&
|
78
|
+
token != [] &&
|
79
|
+
token != {}
|
71
80
|
if is_valid_token?(submission_url, token) == false
|
72
81
|
student_config["personal_access_token"] = nil
|
73
82
|
update_config_file(config_file_name, student_config)
|
@@ -113,30 +122,31 @@ def update_config_file(config_file_name, config)
|
|
113
122
|
end
|
114
123
|
|
115
124
|
def is_valid_token?(root_url, token)
|
116
|
-
|
117
|
-
|
125
|
+
return false unless token.is_a?(String) && !(token =~ /^[1-9A-Za-z][^OIl]{23}$/).nil?
|
126
|
+
|
118
127
|
url = "#{root_url}/submissions/validate_token?token=#{token}"
|
119
128
|
uri = URI.parse(url)
|
129
|
+
|
120
130
|
req = Net::HTTP::Get.new(uri, 'Content-Type' => 'application/json')
|
131
|
+
|
121
132
|
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
|
122
133
|
http.request(req)
|
123
134
|
end
|
135
|
+
|
124
136
|
result = JSON.parse(res.body)
|
125
137
|
result["success"]
|
126
138
|
rescue => e
|
127
|
-
p "error" #REMOVE
|
128
|
-
p e #REMOVE
|
129
139
|
return false
|
130
140
|
end
|
131
141
|
|
132
142
|
def project_root
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
143
|
+
if defined?(Rails)
|
144
|
+
return Rails.root
|
145
|
+
end
|
146
|
+
|
147
|
+
if defined?(Bundler)
|
148
|
+
return Bundler.root
|
149
|
+
end
|
150
|
+
|
141
151
|
Dir.pwd
|
142
152
|
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
|
4
|
+
version: 0.0.4
|
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-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -202,9 +202,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
202
202
|
version: '0'
|
203
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
204
|
requirements:
|
205
|
-
- - "
|
205
|
+
- - ">="
|
206
206
|
- !ruby/object:Gem::Version
|
207
|
-
version:
|
207
|
+
version: '0'
|
208
208
|
requirements: []
|
209
209
|
rubyforge_project:
|
210
210
|
rubygems_version: 2.7.8
|