arb-xmu-course 2.5.4 → 2.5.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2d9749a7ca5b3de907847ce8b2e51137ab9b84f
4
- data.tar.gz: 81fce379eb920807337b6afd4149a56857e75e60
3
+ metadata.gz: a8449dc7e0973933485064102644ea365626ce3b
4
+ data.tar.gz: 2e84d30861491cce5f727a0ba1244bd5605a5d18
5
5
  SHA512:
6
- metadata.gz: af256a6e2b86a1793897591bace50c8aee2e683dc18f49e0773f3d71dd9a26d9b1e494bb44bb2a0d32219347acda87bf550ac8a00c33714e9b27c9fd9d849184
7
- data.tar.gz: 76e683228d86d17d698e4e64ce8ab7f4f24ed6abee8fd1f4c9231eccd2ae9ecdb7d8d7888bbab6a72946cbe696c61c205f0290a3f71289327b58de26af2c3bd7
6
+ metadata.gz: 6d80799b51ae6d567851d277e5a963bf760a6c6c5adb6dd2bb65bb05cffe3dafa094179bb18cf8f3389c2237ebff83218779ab56c67da0d6f5f1647560773973
7
+ data.tar.gz: 43d4be9ff5d45ab468bd86694b42398a9a8e0f58f7ab6bd28c1e04b3df74309a7fe0293eaea0d5f2c4b76ffa29c716c1817c5579a8960bce05b58e1f19c2fa44
data/bin/arb-xmu-course CHANGED
@@ -44,6 +44,8 @@ def select_course_common(client, url, xxlx)
44
44
  end
45
45
  rescue Timeout::Error, HTTPClient::TimeoutError
46
46
  exit_with_error "服务器无响应,程序结束运行。"
47
+ rescue Exception => e
48
+ exit_with_error "因未知错误,程序结束运行。(#{e})"
47
49
  end
48
50
 
49
51
  def set_up_account
@@ -136,7 +138,7 @@ def create_attempt_thread(max_interval, client, course, xxlx, lcid, retry_count,
136
138
  global_puts "《#{course.name}》(#{course.class_name}班)第#{count}次尝试选课失败,#{interval}秒后将重试。(#{filter_text(res['message'])})"
137
139
  end
138
140
  sleep interval
139
- rescue Timeout::Error, HTTPClient::TimeoutError
141
+ rescue
140
142
  retry if retry_count!=0 and retry_count-=1 and global_puts('网络超时,重新连接中……')
141
143
  exit_with_error('超时次数耗尽,程序结束运行。') if retry_count==0
142
144
  end
@@ -144,9 +146,8 @@ def create_attempt_thread(max_interval, client, course, xxlx, lcid, retry_count,
144
146
  opened_thread_count=block.binding.local_variable_get(:opened_thread_count)
145
147
  exit unless opened_thread_count > 0
146
148
  block.binding.local_variable_set :opened_thread_count, opened_thread_count-1
147
- rescue Interrupt
148
149
  rescue Exception=>e
149
- exit_with_error("未知原因导致程序运行出错,请联系作者。(#{e}")
150
+ exit_with_error "因未知错误,程序结束运行。(#{e})"
150
151
  end
151
152
  end
152
153
  end
@@ -249,13 +250,14 @@ def global_gets(*args)
249
250
  tmp = $stdin.gets.chomp
250
251
  exit if quit_flags.include? tmp
251
252
  tmp
253
+ rescue Interrupt
254
+ exit_with_error "因手动退出,程序结束运行。"
252
255
  end
253
256
 
254
257
  def exit_with_error(*args)
255
258
  global_puts(*args) and exit
256
259
  end
257
260
 
258
-
259
261
  TOKEN_FILE_NAME = 'encrypted_token'
260
262
  TOKEN_SEPARATOR = ':'
261
263
  CLIENT = HTTPClient.new
@@ -1,7 +1,7 @@
1
1
  module Arb
2
2
  module Xmu
3
3
  module Course
4
- VERSION = '2.5.4'
4
+ VERSION = '2.5.5'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arb-xmu-course
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.4
4
+ version: 2.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - arybin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-15 00:00:00.000000000 Z
11
+ date: 2016-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler