grade_runner 0.0.4.pre.12 → 0.0.4.pre.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/tasks/grade.rake +5 -9
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f485807c9d31e3a97493072fce193e6f495642747e9d17746a230c9c3def17b0
4
- data.tar.gz: 4bfec642d85e98e8acc0ab5466d733fdd53d0bd7f61dd4a5aeec8f8e0921fc87
3
+ metadata.gz: c14ad48e3941fb2f67a4cdc3a9a40873f33dae886041c12cd53e207db97c204b
4
+ data.tar.gz: 8ea949a5f26b06abeeec984bcc9dcbb49075fedc07557259b6c4111faa727e5a
5
5
  SHA512:
6
- metadata.gz: 167d51eb229c890e0a2422237ceb944a14580339b081a2632c05dd319856c5eec6e8de0be014bbf8847f78adee747083a7f3fba704c954547e3062fcf3166d25
7
- data.tar.gz: 49de51e9b026dc1a7b69a3a92e4b997df4879faa80ab74722b2efd35a59c1869767f42a63bf73a967a10374e6aa05b887709d5470a745247f07b0c185042939c
6
+ metadata.gz: 2f07ec5bf001e927d41abf788c81def9cc61156d8a7af88ee9d332f23cef826ed3fa6095cc46bfa9790a0fd20d1096e623d7b1ca5cf71d290f5f2fbc8dbe1bea
7
+ data.tar.gz: 4fd170f15efe7c178dd99e48cc1ae51c76444e45a9a264709c37a10de465f9e0e4e4f53440d2a4edfcd06ad9347dc8a3f3f7ce9bc3ebc3ab08782b80a5477102
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4.pre.12
1
+ 0.0.4.pre.13
data/lib/tasks/grade.rake CHANGED
@@ -31,12 +31,12 @@ namespace :grade do
31
31
  submission_url = "https://grades.firstdraft.com"
32
32
  end
33
33
 
34
- if (input_token != false && input_token != "" && input_token != " " && !input_token.nil? && input_token != [] && input_token != {})
34
+ if input_token != false && input_token != "" && input_token != " " && !input_token.nil?
35
35
 
36
36
  token = input_token
37
37
  student_config["personal_access_token"] = input_token
38
38
  update_config_file(config_file_name, student_config)
39
- elsif input_token.nil? && file_token != false && file_token != "" && file_token != " " && !file_token.nil? && file_token != [] && file_token != {}
39
+ elsif input_token.nil? && file_token != false && file_token != "" && file_token != " " && !file_token.nil?
40
40
 
41
41
  token = file_token
42
42
  elsif input_token.nil? && file_token.nil?
@@ -47,7 +47,7 @@ namespace :grade do
47
47
  print "> "
48
48
  new_personal_access_token = $stdin.gets.chomp.strip
49
49
 
50
- if ((new_personal_access_token!= "") && (is_valid_token?(submission_url, new_personal_access_token) == false))
50
+ if new_personal_access_token!= "" && is_valid_token?(submission_url, new_personal_access_token == false
51
51
  puts "Please enter valid token"
52
52
  new_personal_access_token = ""
53
53
  end
@@ -60,7 +60,7 @@ namespace :grade do
60
60
  end
61
61
  end
62
62
 
63
- if (token != false && token != "" && token != " " && !token.nil? && token != [] && token != {})
63
+ if token != false && token != "" && token != " " && !token.nil?
64
64
  if is_valid_token?(submission_url, token) == false
65
65
  student_config["personal_access_token"] = nil
66
66
  update_config_file(config_file_name, student_config)
@@ -106,17 +106,13 @@ def update_config_file(config_file_name, config)
106
106
  end
107
107
 
108
108
  def is_valid_token?(root_url, token)
109
- return false unless token.is_a?(String) && !(token =~ /^[1-9A-Za-z][^OIl]{23}$/).nil?
110
-
109
+ return false unless token.is_a?(String) && token =~ /^[1-9A-Za-z][^OIl]{23}$/
111
110
  url = "#{root_url}/submissions/validate_token?token=#{token}"
112
111
  uri = URI.parse(url)
113
-
114
112
  req = Net::HTTP::Get.new(uri, 'Content-Type' => 'application/json')
115
-
116
113
  res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
117
114
  http.request(req)
118
115
  end
119
-
120
116
  result = JSON.parse(res.body)
121
117
  result["success"]
122
118
  rescue => e
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grade_runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.pre.12
4
+ version: 0.0.4.pre.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raghu Betina