ruby_learner 1.2.4 → 1.2.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: 462ae1a2641d2df7efabc463dd9a7f7e22d3bea5
4
- data.tar.gz: 531e93f06a095a816a4711d5b2651d819b9261fc
3
+ metadata.gz: 59dea657d06e5d0cf4e3f5445618514293cbb1ea
4
+ data.tar.gz: 34945031cda007634d0c9c62c77a533f54b26a7a
5
5
  SHA512:
6
- metadata.gz: 0b53d42427668ca43106eb5165de175a7ded277abb5687616901aecf9f4dcdc9195392c03670cb2b7c9c6f799bf4732d2b4936503925fd4347582e7261a87839
7
- data.tar.gz: acb35ff93a23c16f2cef2cb5e8342415cfd38cd16894f12e95f5670b3fa8542dad98cc13af56b04778ba31697157d4a56ead91b1d0b0b00ee2cf6b4b7386a934
6
+ metadata.gz: d7134b49fd61a50ecba118f5ba9c74d12d4ca6fc9872efc210f80de5a5ee0107b684b9b9abec73695e28308b601d28b1447da3486d737d652f26640ba0e3720d
7
+ data.tar.gz: 36ed23cefde9a178b572a2068334ec0c47279fdf06157481bf14f588ccbca746c81756615876ae99901997713e9731a60294412bb63d3b6bc0bfe9bcd66b5c23
@@ -1,8 +1,8 @@
1
1
  require 'open3'
2
2
 
3
3
  class PairTimer < Thread
4
- def popup_per_time(time)
5
- loop do
4
+ def popup_per_time_for_exe(time)
5
+ loop do
6
6
  sleep time
7
7
  system('afplay /System/Library/Sounds/Submarine.aiff')
8
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.\"'")
@@ -13,4 +13,11 @@ class PairTimer < Thread
13
13
  end
14
14
  end
15
15
  end
16
+
17
+ def popup_per_time_for_non_exe(time)
18
+ popup_file = File.expand_path("popup_per_time_for_background.rb", __FILE__)
19
+ p popup_file
20
+ system("ruby #{popup_file} #{time} &")
21
+ end
22
+
16
23
  end
@@ -0,0 +1,14 @@
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
@@ -4,6 +4,7 @@ require 'ruby_learner/version.rb'
4
4
  require 'open3'
5
5
  require 'ruby_learner/common.rb'
6
6
  require 'ruby_learner/sequential_main'
7
+ require 'ruby_learner/pair_timer.rb'
7
8
 
8
9
  module RubyLearner
9
10
  # ruby_learner CLI main class
@@ -34,6 +35,18 @@ module RubyLearner
34
35
  end
35
36
  end
36
37
 
38
+ desc 'pair_popup [time]','popup_per_time'
39
+ map "-p" => "pair_popup"
40
+ def pair_popup(*args)
41
+ if args[0].to_i == nil || args[0].to_i == 0
42
+ puts "your input is #{args[0]}. not exchange time."
43
+ return
44
+ end
45
+ time = args[0].to_i
46
+ popup_file = File.expand_path("../popup_per_time_for_background.rb", __FILE__)
47
+ system("ruby #{popup_file} #{time} &")
48
+ end
49
+
37
50
  desc 'sequential_check [section:1~11] [part:1~]','learning drill'
38
51
  map "-s" => "sequential_check"
39
52
  option :next, aliases: :n, type: :boolean
@@ -44,7 +57,7 @@ module RubyLearner
44
57
  sequential_main = SequentialMain.new(@gem_dir, @local_dir)
45
58
  if args[0] == '-p'
46
59
  pair_timer = PairTimer.new do
47
- pair_timer.popup_per_time(600)
60
+ pair_timer.popup_per_time_for_exe(600)
48
61
  end
49
62
  args[0] = args[1]
50
63
  args[1] = args[2]
@@ -70,7 +83,7 @@ module RubyLearner
70
83
  puts 'mode-2: $ sequential_check -d, check drill contents'
71
84
  puts 'mode-3: $ sequential_check -n, learn next to your last-question'
72
85
  puts 'mode-4: $ sequential_check -l, learn your last-question'
73
- puts 'mode-5: $ sequential_check -p [1 2, -d, -n, -l], learn with partner'
86
+ puts 'mode-5: $ sequential_check -p [1 2, -d, -n, -l], learn with partner, change per 10 minutes.'
74
87
  end
75
88
  end
76
89
 
@@ -1,3 +1,3 @@
1
1
  module RubyLearner
2
- VERSION = "1.2.4"
2
+ VERSION = "1.2.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_learner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takaki Otsu
@@ -404,6 +404,7 @@ files:
404
404
  - lib/ruby_learner/.ruby-version
405
405
  - lib/ruby_learner/common.rb
406
406
  - lib/ruby_learner/pair_timer.rb
407
+ - lib/ruby_learner/popup_per_time_for_background.rb
407
408
  - lib/ruby_learner/ruby_learner.rb
408
409
  - lib/ruby_learner/sequential_main.rb
409
410
  - lib/ruby_learner/typing_practice.rb