ruby_learner 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/contents/datas/emacs.d/black/init.el +8 -1
- data/contents/datas/emacs.d/white/init.el +8 -0
- data/contents/datas/sequential_mode.txt +1 -0
- data/contents/workshop/rubocop.yml +2 -0
- data/docs/{thesis/manual.org → manual.org} +0 -0
- data/docs/{todo → seminar}/9-27.org +0 -0
- data/docs/thesis/final_presentation/IMRD/ctrlZ_fg_method.org +7 -0
- data/docs/thesis/final_presentation/IMRD/why_not_web.org +9 -0
- data/docs/thesis/{mid_term.pptx → midterm_presentation/others/5464_takaki_midterm.pptx} +0 -0
- data/docs/thesis/midterm_presentation/others/mid_term.pptx +0 -0
- data/docs/thesis/midterm_presentation/ruby_learner_thesis/.ruby_learner.tex.swp +0 -0
- data/docs/thesis/midterm_presentation/ruby_learner_thesis/jlisting.sty +216 -0
- data/docs/thesis/midterm_presentation/ruby_learner_thesis/rspec_rubocop.png +0 -0
- data/docs/thesis/midterm_presentation/ruby_learner_thesis/ruby_learner.aux +22 -0
- data/docs/thesis/midterm_presentation/ruby_learner_thesis/ruby_learner.dvi +0 -0
- data/docs/thesis/midterm_presentation/ruby_learner_thesis/ruby_learner.log +152 -0
- data/docs/thesis/midterm_presentation/ruby_learner_thesis/ruby_learner.md +35 -0
- data/docs/thesis/midterm_presentation/ruby_learner_thesis/ruby_learner.pdf +0 -0
- data/docs/thesis/midterm_presentation/ruby_learner_thesis/ruby_learner.tex +79 -0
- data/docs/thesis/midterm_presentation/ruby_learner_thesis/test.md +39 -0
- data/docs/thesis/{competing_services.org → research/competing_services.org} +0 -0
- data/lib/ruby_learner/common.rb +0 -29
- data/lib/ruby_learner/copspec.rb +49 -0
- data/lib/ruby_learner/pair_timer.rb +9 -19
- data/lib/ruby_learner/restore.rb +81 -0
- data/lib/ruby_learner/{typing_practice.rb → rubocop_rspec_check.rb} +25 -24
- data/lib/ruby_learner/ruby_learner.rb +47 -56
- data/lib/ruby_learner/sequential_check.rb +110 -0
- data/lib/ruby_learner/sequential_check_real.rb +29 -0
- data/lib/ruby_learner/version.rb +1 -1
- metadata +25 -11
- data/docs/thesis/~$mid_term.pptx +0 -0
- data/lib/ruby_learner/popup_per_time_for_background.rb +0 -14
- data/lib/ruby_learner/practice_datas.txt +0 -0
- data/lib/ruby_learner/sequential_main.rb +0 -207
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'thor'
|
3
|
-
require 'ruby_learner/version.rb'
|
4
3
|
require 'open3'
|
5
|
-
require 'ruby_learner/
|
6
|
-
require 'ruby_learner/
|
7
|
-
require 'ruby_learner/
|
4
|
+
require 'ruby_learner/version'
|
5
|
+
require 'ruby_learner/common'
|
6
|
+
require 'ruby_learner/sequential_check'
|
7
|
+
require 'ruby_learner/sequential_check_real'
|
8
|
+
require 'ruby_learner/restore'
|
9
|
+
require 'ruby_learner/copspec'
|
8
10
|
|
9
11
|
module RubyLearner
|
10
12
|
# ruby_learner CLI main class
|
@@ -43,85 +45,74 @@ module RubyLearner
|
|
43
45
|
return
|
44
46
|
end
|
45
47
|
time = args[0].to_i
|
46
|
-
|
47
|
-
system("ruby #{
|
48
|
+
file = File.expand_path("../pair_timer.rb", __FILE__)
|
49
|
+
system("ruby #{file} #{time} &")
|
48
50
|
end
|
49
51
|
|
50
|
-
desc '
|
52
|
+
desc 'copspec [file_path]','check rspec and rubocop'
|
53
|
+
map "-c" => "copspec"
|
54
|
+
option :sequential_check, aliases: :s, type: :boolean
|
55
|
+
def copspec(*args)
|
56
|
+
begin
|
57
|
+
if options[:sequential_check]
|
58
|
+
CopSpec.copspec("#{@workshop_dir}/lib/workplace.rb")
|
59
|
+
else
|
60
|
+
CopSpec.copspec(args[0])
|
61
|
+
end
|
62
|
+
rescue => error
|
63
|
+
puts "Error.message: #{error.message}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
desc 'sequential_check [section:1~11] [part:1~3]','learning drill'
|
51
68
|
map "-s" => "sequential_check"
|
69
|
+
option :real, aliases: :r, type: :boolean
|
70
|
+
option :copspec, aliases: :c, type: :boolean
|
52
71
|
option :next, aliases: :n, type: :boolean
|
53
72
|
option :drill, aliases: :d, type: :boolean
|
54
73
|
option :last, aliases: :l, type: :boolean
|
55
74
|
def sequential_check(*args)
|
56
75
|
begin
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
76
|
+
mode = File.read("#{@datas_dir}/sequential_mode.txt").chomp
|
77
|
+
puts "active mode: #{mode}"
|
78
|
+
sequential_check = nil
|
79
|
+
if mode == 'nomal'
|
80
|
+
sequential_check = SequentialCheck.new(@gem_dir, @local_dir)
|
81
|
+
else
|
82
|
+
sequential_check = SequentialCheckReal.new(@gem_dir, @local_dir)
|
64
83
|
end
|
65
|
-
|
66
84
|
if options[:drill]
|
67
|
-
|
68
|
-
sequential_main.drill_contents
|
85
|
+
sequential_check.drill_contents
|
69
86
|
elsif options[:next]
|
70
|
-
|
71
|
-
next_sec, next_par = sequential_main.get_next_question(final_sec, final_par)
|
72
|
-
sequential_main.action(next_sec, next_par)
|
87
|
+
sequential_check.next_action
|
73
88
|
elsif options[:last]
|
74
|
-
|
89
|
+
sequential_check.last_re_action
|
90
|
+
elsif options[:real]
|
91
|
+
sequential_check.change_mode
|
92
|
+
elsif options[:copspec]
|
93
|
+
CopSpec.copspec("#{@workshop_dir}/lib/workplace.rb")
|
75
94
|
else
|
76
|
-
|
95
|
+
sequential_check.action(args[0], args[1])
|
77
96
|
end
|
78
|
-
Thread.kill(pair_timer) if pair_timer != nil
|
79
97
|
rescue => error
|
80
98
|
puts "Error.message: #{error.message}"
|
81
|
-
|
82
|
-
puts 'mode-1: $ sequential_check [section:1~11] [part:1~], ex) sequential_check 1 3'
|
83
|
-
puts 'mode-2: $ sequential_check -d, check drill contents'
|
84
|
-
puts 'mode-3: $ sequential_check -n, learn next to your last-question'
|
85
|
-
puts 'mode-4: $ sequential_check -l, learn your last-question'
|
86
|
-
puts 'mode-5: $ sequential_check -p [1 2, -d, -n, -l], learn with partner, change per 10 minutes.'
|
99
|
+
sequential_check.instruct_modes
|
87
100
|
end
|
88
101
|
end
|
89
102
|
|
90
103
|
desc 'restore','check your restore'
|
104
|
+
map "-r" => "restore"
|
91
105
|
option :refresh, aliases: :r, type: :boolean
|
106
|
+
option :copspec, aliases: :c, type: :boolean
|
92
107
|
def restore(*args)
|
93
|
-
|
94
|
-
dir = Dir.open(@restore_dir)
|
95
|
-
dir.each do |file|
|
96
|
-
if file != '.' && file != '..' && file != '.empty.rb'
|
97
|
-
restores << file.slice(1..file.length)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
sorted_restores = restores.sort_by{|item| item.to_i}
|
101
|
-
sorted_restores.each{|item| item.insert(0, "[")}
|
108
|
+
restore = Restore.new
|
102
109
|
if options[:refresh]
|
103
110
|
system("rm -rf #{@restore_dir}")
|
104
111
|
system("mkdir #{@restore_dir}")
|
105
112
|
elsif args.empty? == true
|
106
|
-
|
107
|
-
puts sorted_restores
|
108
|
-
else
|
109
|
-
system("ls #{@restore_dir}")
|
110
|
-
puts "\nlast 5 restore history."
|
111
|
-
puts sorted_restores[-5..-1], "\n"
|
112
|
-
end
|
113
|
-
puts "If you want to open a restore_file, you execute 'ruby_learner restore [number]'"
|
114
|
-
puts "ex) ruby_learner restore 3"
|
115
|
-
print "If you want to remove all restore_files, you execute 'ruby_learner restore -r'"
|
113
|
+
restore.output
|
116
114
|
else
|
117
|
-
|
118
|
-
when 0..sorted_restores.size-1
|
119
|
-
filename = sorted_restores[args[0].to_i]
|
120
|
-
system("emacs #{@restore_dir}/#{filename}")
|
121
|
-
else
|
122
|
-
puts "you have #{sorted_restores.size} restore_files."
|
123
|
-
puts "you must put 'ruby_learner restore 0~#{sorted_restores.size - 1}.'"
|
124
|
-
end
|
115
|
+
restore.open(args[0].to_i)
|
125
116
|
end
|
126
117
|
end
|
127
118
|
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'ruby_learner/rubocop_rspec_check'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
class SequentialCheck
|
5
|
+
|
6
|
+
def initialize(gem_dir, local_dir)
|
7
|
+
@gem_dir = gem_dir
|
8
|
+
@local_dir = local_dir
|
9
|
+
@workshop_dir = "#{local_dir}/workshop"
|
10
|
+
@restore_dir = "#{local_dir}/restore"
|
11
|
+
@datas_dir = "#{local_dir}/.datas"
|
12
|
+
end
|
13
|
+
|
14
|
+
# non opt, -next
|
15
|
+
def action(sec, par)
|
16
|
+
puts "section_#{sec}/part_#{par}"
|
17
|
+
seq_dir = "#{@gem_dir}/contents/questions/sequential_check/section_#{sec}/part_#{par}"
|
18
|
+
rubocop_rspec_check = RubocopRspecCheck.new(@local_dir, @gem_dir)
|
19
|
+
rubocop_rspec_check.action(mode_dir: seq_dir, is_copy: true)
|
20
|
+
write_final_history(sec, par)
|
21
|
+
end
|
22
|
+
|
23
|
+
# -next
|
24
|
+
def next_action
|
25
|
+
final_sec, final_par = get_final_history
|
26
|
+
next_sec, next_par = get_next_question(final_sec, final_par)
|
27
|
+
action(next_sec, next_par)
|
28
|
+
end
|
29
|
+
|
30
|
+
# -last
|
31
|
+
def last_re_action
|
32
|
+
final_sec, final_par = get_final_history
|
33
|
+
puts "section_#{final_sec}/part_#{final_par}"
|
34
|
+
rubocop_rspec_check = RubocopRspecCheck.new(@local_dir, @gem_dir)
|
35
|
+
rubocop_rspec_check.action(mode_dir: "#{@local_dir}/workshop", is_copy: false)
|
36
|
+
end
|
37
|
+
|
38
|
+
# -drill
|
39
|
+
def drill_contents
|
40
|
+
puts "section \t part\t contents"
|
41
|
+
puts "section_1\t 1~3\t standard_output"
|
42
|
+
puts "section_2\t 1~3\t standard_input"
|
43
|
+
puts "section_3\t 1~3\t standard_I/O summary"
|
44
|
+
puts "section_4\t 1~3\t comparisons & conditionals"
|
45
|
+
puts "section_5\t 1~3\t loop_methods"
|
46
|
+
puts "section_6\t 1~3\t array & hash & symbol"
|
47
|
+
puts "section_7\t 1~3\t function"
|
48
|
+
puts "section_8\t 1~3\t class"
|
49
|
+
puts "section_9\t 1~3\t regular_expression"
|
50
|
+
puts "section_10\t 1~3\t file_operation"
|
51
|
+
puts "section_11\t 1~3\t library"
|
52
|
+
end
|
53
|
+
|
54
|
+
# -ch_mode
|
55
|
+
def change_mode
|
56
|
+
mode_txt = "#{@datas_dir}/sequential_mode.txt"
|
57
|
+
case File.read(mode_txt).chomp
|
58
|
+
when 'nomal'
|
59
|
+
File.write(mode_txt, 'real')
|
60
|
+
else
|
61
|
+
File.write(mode_txt, 'nomal')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def instruct_modes
|
66
|
+
puts 'sequential_check has 5-modes'
|
67
|
+
puts 'mode-1: $ -s [section:1~11] [part:1~], ex) sequential_check 1 3'
|
68
|
+
puts 'mode-2: $ -s -d, check drill contents'
|
69
|
+
puts 'mode-3: $ -s -n, learn next to your last-question'
|
70
|
+
puts 'mode-4: $ -s -l, learn your last-question'
|
71
|
+
puts 'mode-5: $ -s -c, change behavior'
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def write_final_history(sec, par)
|
77
|
+
chmoded = 0
|
78
|
+
file_dir = "#{@datas_dir}/final_history_sequential.txt"
|
79
|
+
begin
|
80
|
+
File.write(file_dir, "#{sec}-#{par}")
|
81
|
+
rescue => error
|
82
|
+
system "sudo chmod go+w #{file_dir}"
|
83
|
+
chmoded += 1
|
84
|
+
retry if chmoded < 2
|
85
|
+
puts "FileWrite error #{error.message}"
|
86
|
+
puts "you should input $sudo chmod go+w #{file_dir}"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def get_final_history
|
91
|
+
final_history = ''
|
92
|
+
File.open("#{@datas_dir}/final_history_sequential.txt") do |f|
|
93
|
+
final_history = f.gets
|
94
|
+
end
|
95
|
+
final_sec = final_history.match(/(.*)\-/)[1].to_i
|
96
|
+
final_par = final_history.match(/\-(.*)/)[1].to_i
|
97
|
+
return final_sec, final_par
|
98
|
+
end
|
99
|
+
|
100
|
+
def get_next_question(final_sec, final_par)
|
101
|
+
if final_par == 3
|
102
|
+
next_sec = final_sec + 1
|
103
|
+
next_sec = 1 if next_sec >= 12
|
104
|
+
return next_sec, 1
|
105
|
+
else
|
106
|
+
return final_sec, final_par+1
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'ruby_learner/common'
|
2
|
+
require 'ruby_learner/sequential_check'
|
3
|
+
require 'ruby_learner/rubocop_rspec_check'
|
4
|
+
|
5
|
+
class SequentialCheckReal < SequentialCheck
|
6
|
+
def initialize(x, y)
|
7
|
+
super
|
8
|
+
@theme_color = File.read("#{@datas_dir}/theme_color.txt").chomp
|
9
|
+
end
|
10
|
+
|
11
|
+
def action(sec, par)
|
12
|
+
start_time = Time.now
|
13
|
+
puts "section_#{sec}/part_#{par}"
|
14
|
+
mode_dir = "#{@gem_dir}/contents/questions/sequential_check/section_#{sec}/part_#{par}"
|
15
|
+
%w{lib/workplace.rb lib/sentence.org lib/answer.rb spec/workplace_spec.rb}.each do |path|
|
16
|
+
FileUtils.cp("#{mode_dir}/#{path}", "#{@workshop_dir}/#{path}")
|
17
|
+
end
|
18
|
+
system "cd #{@workshop_dir}/lib && emacs -nw -q -l #{@datas_dir}/.emacs.d/#{@theme_color}/init.el sentence.org workplace.rb"
|
19
|
+
write_final_history(sec, par)
|
20
|
+
elapsed_time = Common.allocate.time_check(start_time: start_time)
|
21
|
+
p "#{elapsed_time} sec"
|
22
|
+
restore = Restore.new
|
23
|
+
restore.save(file: "#{@workshop_dir}/lib/workplace.rb", elapsed_time: elapsed_time)
|
24
|
+
end
|
25
|
+
|
26
|
+
def last_re_action
|
27
|
+
system "cd #{@workshop_dir}/lib && emacs -nw -q -l #{@datas_dir}/.emacs.d/#{@theme_color}/init.el sentence.org workplace.rb"
|
28
|
+
end
|
29
|
+
end
|
data/lib/ruby_learner/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_learner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takaki Otsu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- contents/datas/emacs_help.pdf
|
124
124
|
- contents/datas/final_history_sequential.txt
|
125
125
|
- contents/datas/install_emacs.sh
|
126
|
+
- contents/datas/sequential_mode.txt
|
126
127
|
- contents/datas/theme_color.txt
|
127
128
|
- contents/questions/random_check/.rspec
|
128
129
|
- contents/questions/random_check/random_h.rb
|
@@ -388,27 +389,40 @@ files:
|
|
388
389
|
- docs/happy_ruby/TanoshiiRuby_v5_c2-3.pdf
|
389
390
|
- docs/happy_ruby/c2.ipynb
|
390
391
|
- docs/happy_ruby/c3_4.ipynb
|
392
|
+
- docs/manual.org
|
391
393
|
- docs/seminar/10-18.org
|
392
394
|
- docs/seminar/10-18.rb
|
393
395
|
- docs/seminar/8-1.org
|
394
396
|
- docs/seminar/8-30.org
|
395
397
|
- docs/seminar/9-16.org
|
398
|
+
- docs/seminar/9-27.org
|
396
399
|
- docs/seminar/ruby_kansai_9-1.org
|
397
400
|
- docs/seminar/seminer_9_20.org
|
398
|
-
- docs/thesis/
|
399
|
-
- docs/thesis/
|
400
|
-
- docs/thesis/
|
401
|
-
- docs/thesis
|
402
|
-
- docs/
|
401
|
+
- docs/thesis/final_presentation/IMRD/ctrlZ_fg_method.org
|
402
|
+
- docs/thesis/final_presentation/IMRD/why_not_web.org
|
403
|
+
- docs/thesis/midterm_presentation/others/5464_takaki_midterm.pptx
|
404
|
+
- docs/thesis/midterm_presentation/others/mid_term.pptx
|
405
|
+
- docs/thesis/midterm_presentation/ruby_learner_thesis/.ruby_learner.tex.swp
|
406
|
+
- docs/thesis/midterm_presentation/ruby_learner_thesis/jlisting.sty
|
407
|
+
- docs/thesis/midterm_presentation/ruby_learner_thesis/rspec_rubocop.png
|
408
|
+
- docs/thesis/midterm_presentation/ruby_learner_thesis/ruby_learner.aux
|
409
|
+
- docs/thesis/midterm_presentation/ruby_learner_thesis/ruby_learner.dvi
|
410
|
+
- docs/thesis/midterm_presentation/ruby_learner_thesis/ruby_learner.log
|
411
|
+
- docs/thesis/midterm_presentation/ruby_learner_thesis/ruby_learner.md
|
412
|
+
- docs/thesis/midterm_presentation/ruby_learner_thesis/ruby_learner.pdf
|
413
|
+
- docs/thesis/midterm_presentation/ruby_learner_thesis/ruby_learner.tex
|
414
|
+
- docs/thesis/midterm_presentation/ruby_learner_thesis/test.md
|
415
|
+
- docs/thesis/research/competing_services.org
|
403
416
|
- exe/ruby_learner
|
404
417
|
- lib/ruby_learner/.ruby-version
|
405
418
|
- lib/ruby_learner/common.rb
|
419
|
+
- lib/ruby_learner/copspec.rb
|
406
420
|
- lib/ruby_learner/pair_timer.rb
|
407
|
-
- lib/ruby_learner/
|
408
|
-
- lib/ruby_learner/
|
421
|
+
- lib/ruby_learner/restore.rb
|
422
|
+
- lib/ruby_learner/rubocop_rspec_check.rb
|
409
423
|
- lib/ruby_learner/ruby_learner.rb
|
410
|
-
- lib/ruby_learner/
|
411
|
-
- lib/ruby_learner/
|
424
|
+
- lib/ruby_learner/sequential_check.rb
|
425
|
+
- lib/ruby_learner/sequential_check_real.rb
|
412
426
|
- lib/ruby_learner/version.rb
|
413
427
|
- ruby_learner.gemspec
|
414
428
|
homepage: ''
|
data/docs/thesis/~$mid_term.pptx
DELETED
Binary file
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'open3'
|
2
|
-
|
3
|
-
time = ARGV[0].to_i
|
4
|
-
|
5
|
-
loop do
|
6
|
-
sleep time
|
7
|
-
system('afplay /System/Library/Sounds/Submarine.aiff')
|
8
|
-
o, e, s = Open3.capture3("osascript -e 'tell app \"System Events\" to display dialog \"#{time}s passed.\nPut cancel to stop pair-mode.\nPut OK to continue pair-mode.\"'")
|
9
|
-
|
10
|
-
if o != "button returned:OK\n"
|
11
|
-
Open3.capture3("osascript -e 'tell app \"System Events\" to display dialog \"pair_popup_mode is stopped.\"'")
|
12
|
-
break
|
13
|
-
end
|
14
|
-
end
|
File without changes
|
@@ -1,207 +0,0 @@
|
|
1
|
-
require 'ruby_learner/typing_practice'
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
class SequentialMain
|
5
|
-
|
6
|
-
def initialize(gem_dir, local_dir)
|
7
|
-
@gem_dir = gem_dir
|
8
|
-
@local_dir = local_dir
|
9
|
-
@workshop_dir = "#{local_dir}/workshop"
|
10
|
-
@restore_dir = "#{local_dir}/restore"
|
11
|
-
@datas_dir = "#{local_dir}/.datas"
|
12
|
-
end
|
13
|
-
|
14
|
-
def action(sec, par)
|
15
|
-
puts "section_#{sec}/part_#{par}"
|
16
|
-
seq_dir = "#{@gem_dir}/contents/questions/sequential_check/section_#{sec}/part_#{par}"
|
17
|
-
typing_prac_class = TypingPractice.new(@local_dir, @gem_dir)
|
18
|
-
typing_prac_class.prac_sequence(mode_dir: seq_dir)
|
19
|
-
write_final_history(sec, par)
|
20
|
-
end
|
21
|
-
|
22
|
-
def last_re_action()
|
23
|
-
final_sec, final_par = get_final_history()
|
24
|
-
puts "section_#{final_sec}/part_#{final_par}"
|
25
|
-
theme_color = ""
|
26
|
-
File.open("#{@datas_dir}/theme_color.txt") do |f|
|
27
|
-
theme_color = f.gets.chomp
|
28
|
-
end
|
29
|
-
emacs_dir = "#{@datas_dir}/.emacs.d/#{theme_color}"
|
30
|
-
system "cd #{@workshop_dir}/lib && emacs -nw -q -l #{emacs_dir}/init.el sentence.org workplace.rb"
|
31
|
-
start_time = Time.now
|
32
|
-
typing_prac_class = TypingPractice.new(@local_dir, @gem_dir)
|
33
|
-
typing_prac_class.typing_discriminant
|
34
|
-
elapsed_time = Common.allocate.time_check(start_time: start_time)
|
35
|
-
p "#{elapsed_time} sec"
|
36
|
-
end
|
37
|
-
|
38
|
-
def write_final_history(sec, par)
|
39
|
-
chmoded = 0
|
40
|
-
file_dir = "#{@datas_dir}/final_history_sequential.txt"
|
41
|
-
begin
|
42
|
-
File.write(file_dir, "#{sec}-#{par}")
|
43
|
-
rescue => error
|
44
|
-
system "sudo chmod go+w #{file_dir}"
|
45
|
-
chmoded += 1
|
46
|
-
retry if chmoded < 2
|
47
|
-
puts "FileWrite error #{error.message}"
|
48
|
-
puts "you should input $sudo chmod go+w #{file_dir}"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def drill_contents
|
53
|
-
puts "section \t part\t contents"
|
54
|
-
puts "section_1\t 1~3\t standard_output"
|
55
|
-
puts "section_2\t 1~3\t standard_input"
|
56
|
-
puts "section_3\t 1~3\t standard_I/O summary"
|
57
|
-
puts "section_4\t 1~3\t comparisons & conditionals"
|
58
|
-
puts "section_5\t 1~3\t loop_methods"
|
59
|
-
puts "section_6\t 1~3\t array & hash & symbol"
|
60
|
-
puts "section_7\t 1~3\t function"
|
61
|
-
puts "section_8\t 1~3\t class"
|
62
|
-
puts "section_9\t 1~3\t regular_expression"
|
63
|
-
puts "section_10\t 1~3\t file_operation"
|
64
|
-
puts "section_11\t 1~3\t library"
|
65
|
-
end
|
66
|
-
|
67
|
-
def get_final_history()
|
68
|
-
final_history = ''
|
69
|
-
final_sec = 0
|
70
|
-
final_par = 0
|
71
|
-
Dir::chdir(@datas_dir){
|
72
|
-
File.open("final_history_sequential.txt") do |f|
|
73
|
-
final_history = f.gets
|
74
|
-
end
|
75
|
-
final_sec = final_history.match(/(.*)\-/)[1].to_i
|
76
|
-
final_par = final_history.match(/\-(.*)/)[1].to_i
|
77
|
-
}
|
78
|
-
return final_sec, final_par
|
79
|
-
end
|
80
|
-
|
81
|
-
def get_next_question(final_sec, final_par)
|
82
|
-
if final_sec == 1
|
83
|
-
if final_par == 1
|
84
|
-
next_sec = 1
|
85
|
-
next_par = 2
|
86
|
-
elsif final_par == 2
|
87
|
-
next_sec = 1
|
88
|
-
next_par = 3
|
89
|
-
else
|
90
|
-
next_sec = 2
|
91
|
-
next_par = 1
|
92
|
-
end
|
93
|
-
elsif final_sec == 2
|
94
|
-
if final_par == 1
|
95
|
-
next_sec = 2
|
96
|
-
next_par = 2
|
97
|
-
elsif final_par == 2
|
98
|
-
next_sec = 2
|
99
|
-
next_par = 3
|
100
|
-
else
|
101
|
-
next_sec = 3
|
102
|
-
next_par = 1
|
103
|
-
end
|
104
|
-
elsif final_sec == 3
|
105
|
-
if final_par == 1
|
106
|
-
next_sec = 3
|
107
|
-
next_par = 2
|
108
|
-
elsif final_par == 2
|
109
|
-
next_sec = 3
|
110
|
-
next_par = 3
|
111
|
-
else
|
112
|
-
next_sec = 4
|
113
|
-
next_par = 1
|
114
|
-
end
|
115
|
-
elsif final_sec == 4
|
116
|
-
if final_par == 1
|
117
|
-
next_sec = 4
|
118
|
-
next_par = 2
|
119
|
-
elsif final_par == 2
|
120
|
-
next_sec = 4
|
121
|
-
next_par = 3
|
122
|
-
else
|
123
|
-
next_sec = 5
|
124
|
-
next_par = 1
|
125
|
-
end
|
126
|
-
elsif final_sec == 5
|
127
|
-
if final_par == 1
|
128
|
-
next_sec = 5
|
129
|
-
next_par = 2
|
130
|
-
elsif final_par == 2
|
131
|
-
next_sec = 5
|
132
|
-
next_par = 3
|
133
|
-
else
|
134
|
-
next_sec = 6
|
135
|
-
next_par = 1
|
136
|
-
end
|
137
|
-
elsif final_sec == 6
|
138
|
-
if final_par == 1
|
139
|
-
next_sec = 6
|
140
|
-
next_par = 2
|
141
|
-
elsif final_par == 2
|
142
|
-
next_sec = 6
|
143
|
-
next_par = 3
|
144
|
-
else
|
145
|
-
next_sec = 7
|
146
|
-
next_par = 1
|
147
|
-
end
|
148
|
-
elsif final_sec == 7
|
149
|
-
if final_par == 1
|
150
|
-
next_sec = 7
|
151
|
-
next_par = 2
|
152
|
-
elsif final_par == 2
|
153
|
-
next_sec = 7
|
154
|
-
next_par = 3
|
155
|
-
else
|
156
|
-
next_sec = 8
|
157
|
-
next_par = 1
|
158
|
-
end
|
159
|
-
elsif final_sec == 8
|
160
|
-
if final_par == 1
|
161
|
-
next_sec = 8
|
162
|
-
next_par = 2
|
163
|
-
elsif final_par == 2
|
164
|
-
next_sec = 8
|
165
|
-
next_par = 3
|
166
|
-
else
|
167
|
-
next_sec = 9
|
168
|
-
next_par = 1
|
169
|
-
end
|
170
|
-
elsif final_sec == 9
|
171
|
-
if final_par == 1
|
172
|
-
next_sec = 9
|
173
|
-
next_par = 2
|
174
|
-
elsif final_par == 2
|
175
|
-
next_sec = 9
|
176
|
-
next_par = 3
|
177
|
-
else
|
178
|
-
next_sec = 10
|
179
|
-
next_par = 1
|
180
|
-
end
|
181
|
-
elsif final_sec == 10
|
182
|
-
if final_par == 1
|
183
|
-
next_sec = 10
|
184
|
-
next_par = 2
|
185
|
-
elsif final_par == 2
|
186
|
-
next_sec = 10
|
187
|
-
next_par = 3
|
188
|
-
else
|
189
|
-
next_sec = 11
|
190
|
-
next_par = 1
|
191
|
-
end
|
192
|
-
else
|
193
|
-
if final_par == 1
|
194
|
-
next_sec = 11
|
195
|
-
next_par = 2
|
196
|
-
elsif final_par == 2
|
197
|
-
next_sec = 11
|
198
|
-
next_par = 3
|
199
|
-
else
|
200
|
-
next_sec = 1
|
201
|
-
next_par = 1
|
202
|
-
end
|
203
|
-
end
|
204
|
-
return next_sec, next_par
|
205
|
-
end
|
206
|
-
|
207
|
-
end
|