cw 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +3 -3
- data/VERSION +1 -1
- data/cw.gemspec +15 -15
- data/lib/cw.rb +9 -9
- data/lib/cw/alphabet.rb +1 -1
- data/lib/cw/audio_player.rb +3 -3
- data/lib/cw/book.rb +1 -1
- data/lib/cw/book_details.rb +2 -2
- data/lib/cw/callsign.rb +1 -2
- data/lib/cw/cl.rb +2 -2
- data/lib/cw/common_words.rb +2 -2
- data/lib/cw/config.rb +2 -2
- data/lib/cw/coreaudio.rb +2 -2
- data/lib/cw/current_word.rb +1 -1
- data/lib/cw/{cw_dsl.rb → dsl.rb} +8 -8
- data/lib/cw/element.rb +1 -2
- data/lib/cw/{cw_encoding.rb → encoding.rb} +2 -3
- data/lib/cw/file_details.rb +1 -2
- data/lib/cw/key_input.rb +1 -2
- data/lib/cw/numbers.rb +1 -1
- data/lib/cw/os.rb +1 -1
- data/lib/cw/play.rb +1 -2
- data/lib/cw/print.rb +1 -2
- data/lib/cw/progress.rb +1 -4
- data/lib/cw/randomize.rb +1 -3
- data/lib/cw/read.rb +2 -2
- data/lib/cw/repeat_word.rb +2 -3
- data/lib/cw/reveal.rb +1 -4
- data/lib/cw/rss.rb +3 -3
- data/lib/cw/rss_clean.rb +1 -1
- data/lib/cw/sentence.rb +2 -3
- data/lib/cw/speak.rb +1 -3
- data/lib/cw/spoken.rb +1 -3
- data/lib/cw/str.rb +1 -3
- data/lib/cw/{cw_stream.rb → stream.rb} +2 -5
- data/lib/cw/test_letters.rb +1 -2
- data/lib/cw/test_words.rb +1 -4
- data/lib/cw/tester.rb +3 -4
- data/lib/cw/text_helpers.rb +3 -6
- data/lib/cw/{cw_threads.rb → threads.rb} +2 -5
- data/lib/cw/timing.rb +2 -5
- data/lib/cw/tone_generator.rb +2 -3
- data/lib/cw/tone_helpers.rb +1 -2
- data/lib/cw/tx.rb +3 -3
- data/lib/cw/voice.rb +1 -3
- data/lib/cw/winkey.rb +1 -2
- data/lib/cw/words.rb +3 -6
- data/run_script_tests.rb +5 -5
- data/test/test_common_words.rb +1 -1
- data/test/test_config.rb +19 -19
- data/test/test_current_word.rb +1 -1
- data/test/test_cw.rb +13 -13
- data/test/test_cw_threads.rb +16 -16
- data/test/test_dsl.rb +106 -0
- data/test/test_filtering.rb +2 -2
- data/test/test_numbers.rb +24 -0
- data/test/test_params.rb +2 -2
- data/test/test_play.rb +4 -4
- data/test/test_stream.rb +3 -3
- data/test/test_tester.rb +4 -5
- data/test/test_timing.rb +3 -3
- data/test/test_tone_generator.rb +13 -13
- metadata +51 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2607a56ec12dd2d8582bdf6848e6d43fca1559aab5b903a5ba7eddc716f8f164
|
4
|
+
data.tar.gz: 2420c8070826ac4d596885155c27b74f7bcf0e014f755ec270d0e02f91acc39b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6081dd5de93a4706294f5fb09cbe2dc4ae2384e3ab3daebcfc26ed7de560e803b5bace946209aac1c47dd347887416e6c0c14e943064c0a3d0f98818523add2f
|
7
|
+
data.tar.gz: 658106773af6d4f17e73174f625cdbec1839d5b09bf5c1f88f455f42f83818f51f0cfefbd4cd6afcfe7a21a1a8a3b3d9d3010456a690ddd7b75ea778689232e3
|
data/.travis.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/cw.gemspec
CHANGED
@@ -18,23 +18,23 @@ Gem::Specification.new do |spec|
|
|
18
18
|
|
19
19
|
spec.require_paths = ["lib", "audio", "data/text", "test"]
|
20
20
|
|
21
|
-
spec.required_ruby_version = '>= 2.
|
22
|
-
spec.add_runtime_dependency 'oga', '~> 2.
|
23
|
-
spec.add_runtime_dependency 'httpclient'
|
24
|
-
spec.add_runtime_dependency 'htmlentities', '
|
25
|
-
spec.add_runtime_dependency 'paint', '
|
26
|
-
spec.add_runtime_dependency 'rake', '
|
27
|
-
spec.add_runtime_dependency 'ruby-progressbar'
|
28
|
-
spec.add_runtime_dependency 'wavefile', '
|
21
|
+
spec.required_ruby_version = '>= 2.2.8'
|
22
|
+
spec.add_runtime_dependency 'oga', '~> 2.11'
|
23
|
+
spec.add_runtime_dependency 'httpclient', '~> 2.8.3'
|
24
|
+
spec.add_runtime_dependency 'htmlentities', '~> 4.3.4'
|
25
|
+
spec.add_runtime_dependency 'paint', '~> 2.0.1'
|
26
|
+
spec.add_runtime_dependency 'rake', '~> 12.3.0'
|
27
|
+
spec.add_runtime_dependency 'ruby-progressbar'
|
28
|
+
spec.add_runtime_dependency 'wavefile', '~> 0.8.1'
|
29
29
|
spec.add_runtime_dependency 'parseconfig', '~> 1.0.8'
|
30
30
|
spec.add_runtime_dependency 'rubyserial', '~> 0.4.0'
|
31
31
|
|
32
|
-
spec.add_dependency 'os', '~> 0.
|
32
|
+
spec.add_dependency 'os', '~> 1.0.0'
|
33
33
|
|
34
|
-
spec.add_development_dependency 'version', '
|
35
|
-
spec.add_development_dependency 'minitest', '
|
36
|
-
spec.add_development_dependency 'simplecov', '
|
37
|
-
spec.add_development_dependency 'yard', '~> 0.9.
|
38
|
-
spec.add_development_dependency 'sequel', '~>
|
39
|
-
spec.add_development_dependency 'sqlite3',
|
34
|
+
spec.add_development_dependency 'version', '~> 1.1.1'
|
35
|
+
spec.add_development_dependency 'minitest', '~> 5.10.3'
|
36
|
+
spec.add_development_dependency 'simplecov', '~> 0.15.1'
|
37
|
+
spec.add_development_dependency 'yard', '~> 0.9.11'
|
38
|
+
spec.add_development_dependency 'sequel', '~> 5.2.0'
|
39
|
+
spec.add_development_dependency 'sqlite3', '~> 1.3.13'
|
40
40
|
end
|
data/lib/cw.rb
CHANGED
@@ -8,8 +8,8 @@ require_relative 'cw/text_helpers'
|
|
8
8
|
require_relative 'cw/tone_helpers'
|
9
9
|
require_relative 'cw/element'
|
10
10
|
require_relative 'cw/current_word'
|
11
|
-
require_relative 'cw/
|
12
|
-
require_relative 'cw/
|
11
|
+
require_relative 'cw/encoding'
|
12
|
+
require_relative 'cw/dsl'
|
13
13
|
require_relative 'cw/randomize'
|
14
14
|
require_relative 'cw/sentence'
|
15
15
|
require_relative 'cw/alphabet'
|
@@ -20,11 +20,11 @@ require_relative 'cw/rss_clean'
|
|
20
20
|
require_relative 'cw/words'
|
21
21
|
require_relative 'cw/cl'
|
22
22
|
require_relative 'cw/key_input'
|
23
|
-
require_relative 'cw/
|
23
|
+
require_relative 'cw/stream'
|
24
24
|
require_relative 'cw/timing'
|
25
25
|
require_relative 'cw/print'
|
26
26
|
require_relative 'cw/audio_player'
|
27
|
-
require_relative 'cw/
|
27
|
+
require_relative 'cw/threads'
|
28
28
|
require_relative 'cw/book_details'
|
29
29
|
require_relative 'cw/tester'
|
30
30
|
require_relative 'cw/play'
|
@@ -48,17 +48,17 @@ if RbConfig::CONFIG['target_os'].include?('darwin')
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def cw &block
|
51
|
-
|
51
|
+
Core.new do
|
52
52
|
instance_eval(&block)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
#
|
57
|
-
# Inherits
|
56
|
+
# Core provides Morse code generation functionality
|
57
|
+
# Inherits Dsl
|
58
58
|
|
59
|
-
class
|
59
|
+
class Core < CW::Dsl
|
60
60
|
|
61
|
-
# Initialize
|
61
|
+
# Initialize Core class. Eval block if passed in.
|
62
62
|
|
63
63
|
def initialize(&block)
|
64
64
|
super
|
data/lib/cw/alphabet.rb
CHANGED
data/lib/cw/audio_player.rb
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
require 'timeout'
|
4
4
|
require 'os'
|
5
5
|
|
6
|
-
module
|
6
|
+
module CW
|
7
7
|
|
8
8
|
class AudioPlayer
|
9
9
|
|
10
10
|
include FileDetails
|
11
|
-
include
|
11
|
+
include CW::OStest
|
12
12
|
|
13
13
|
def tone
|
14
14
|
@tone ||= ToneGenerator.new
|
@@ -75,7 +75,7 @@ module CWG
|
|
75
75
|
cmd = play_command + ' ' + play_filename
|
76
76
|
@pid = ! @dry_run ? Process.spawn(cmd) : cmd
|
77
77
|
begin
|
78
|
-
Process.waitpid(@pid) if @pid.is_a?(
|
78
|
+
Process.waitpid(@pid) if @pid.is_a?(1.class)
|
79
79
|
rescue Errno::ECHILD
|
80
80
|
end
|
81
81
|
end
|
data/lib/cw/book.rb
CHANGED
data/lib/cw/book_details.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module CW
|
4
4
|
|
5
5
|
class BookDetails
|
6
6
|
|
@@ -49,7 +49,7 @@ module CWG
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def sentences_complete?
|
52
|
-
if @args.has_key?(:sentences) && @args[:sentences].is_a?(
|
52
|
+
if @args.has_key?(:sentences) && @args[:sentences].is_a?(1.class)
|
53
53
|
if @sentence_count_source
|
54
54
|
@sentence_count_source = nil
|
55
55
|
else
|
data/lib/cw/callsign.rb
CHANGED
data/lib/cw/cl.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module CW
|
4
4
|
|
5
5
|
#class Cl performs command-line processing
|
6
6
|
|
@@ -82,7 +82,7 @@ module CWG
|
|
82
82
|
|
83
83
|
def cl_quality
|
84
84
|
quality = Cfg.config["quality"]
|
85
|
-
if quality && quality.class ==
|
85
|
+
if quality && quality.class == 1.class
|
86
86
|
"-q #{quality} "
|
87
87
|
else
|
88
88
|
coarse_quality quality
|
data/lib/cw/common_words.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module CW
|
2
2
|
|
3
3
|
class CommonWords
|
4
4
|
|
@@ -66,7 +66,7 @@ module CWG
|
|
66
66
|
def parse_quantity(quantity = :default)
|
67
67
|
if quantity == :default
|
68
68
|
return [0, 999]
|
69
|
-
elsif quantity.class ==
|
69
|
+
elsif quantity.class == 1.class
|
70
70
|
[0, quantity - 1]
|
71
71
|
(0...quantity).collect {|q| q}
|
72
72
|
elsif quantity.class == Range
|
data/lib/cw/config.rb
CHANGED
data/lib/cw/coreaudio.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'coreaudio'
|
2
2
|
|
3
|
-
module
|
3
|
+
module CW
|
4
4
|
|
5
5
|
class Coreaudio
|
6
6
|
|
@@ -131,7 +131,7 @@ module CWG
|
|
131
131
|
# # play_tone
|
132
132
|
# # # @words = words
|
133
133
|
# # # p @words
|
134
|
-
# # # @cw_threads =
|
134
|
+
# # # @cw_threads = Threads.new(self, thread_processes)
|
135
135
|
# # # @cw_threads.run
|
136
136
|
# # # reset_stdin
|
137
137
|
# # # print.newline
|
data/lib/cw/current_word.rb
CHANGED
data/lib/cw/{cw_dsl.rb → dsl.rb}
RENAMED
@@ -1,13 +1,13 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
# class
|
3
|
+
# class Dsl provides CW's commands
|
4
4
|
|
5
|
-
module
|
5
|
+
module CW
|
6
6
|
|
7
|
-
class
|
7
|
+
class Dsl
|
8
8
|
|
9
|
-
include
|
10
|
-
include
|
9
|
+
include CW::Cfg
|
10
|
+
include CW::FileDetails
|
11
11
|
[:wpm, :effective_wpm, :frequency, :audio_filename,:audio_dir,
|
12
12
|
:book_name, :book_dir, :play_command, :run_default, :command_line,
|
13
13
|
:author, :title, :quality, :ebook2cw_path, :list_colour, :list_colour,
|
@@ -208,7 +208,7 @@ module CWG
|
|
208
208
|
end
|
209
209
|
|
210
210
|
def cw_element_match arg
|
211
|
-
encs =
|
211
|
+
encs = CW::Encoding.new
|
212
212
|
encs.match_elements arg
|
213
213
|
end
|
214
214
|
|
@@ -286,7 +286,7 @@ module CWG
|
|
286
286
|
def load_abbreviations ; load_text ABBREVIATIONS ; end
|
287
287
|
def reverse ; @words.reverse ; end
|
288
288
|
def double_words ; @words.double_words ; end
|
289
|
-
def letters_numbers ;
|
289
|
+
def letters_numbers ; @words.letters_numbers ; end
|
290
290
|
def load_codes ; load_text Q_CODES ; end
|
291
291
|
def alpha ; 'a'.upto('z').collect{|ch| ch} ; end
|
292
292
|
def vowels ; %w(a e i o u) ; end
|
@@ -294,7 +294,7 @@ module CWG
|
|
294
294
|
def dash_letters ; %w(t m o) ; end
|
295
295
|
def load_vowels ; @words.assign vowels ; end
|
296
296
|
def load_consonants ; @words.assign alpha - vowels ; end
|
297
|
-
def numbers ;
|
297
|
+
def numbers ; %w(0 1 2 3 4 5 6 7 8 9) ; end
|
298
298
|
def load_numbers ; @words.assign numbers ; end
|
299
299
|
def load_dots ; load_letters(dot_letters) ; end
|
300
300
|
def load_dashes ; load_letters(dash_letters) ; end
|
data/lib/cw/element.rb
CHANGED
data/lib/cw/file_details.rb
CHANGED
data/lib/cw/key_input.rb
CHANGED
data/lib/cw/numbers.rb
CHANGED
data/lib/cw/os.rb
CHANGED
data/lib/cw/play.rb
CHANGED
data/lib/cw/print.rb
CHANGED
data/lib/cw/progress.rb
CHANGED
data/lib/cw/randomize.rb
CHANGED
data/lib/cw/read.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#require 'wavefile'
|
4
4
|
require 'coreaudio'
|
5
5
|
|
6
|
-
module
|
6
|
+
module CW
|
7
7
|
|
8
8
|
SAMPLE_RATE = 44100
|
9
9
|
MAGNITUDE_CUTOFF = 50000 # 200000
|
@@ -47,7 +47,7 @@ module CWG
|
|
47
47
|
@high = Array.new(3)
|
48
48
|
@low = Array.new(2)
|
49
49
|
@queue = Queue.new
|
50
|
-
@cw_encoding =
|
50
|
+
@cw_encoding = Encoding.new
|
51
51
|
@print = Print.new
|
52
52
|
@state[START] = 0
|
53
53
|
@state[VALUE] = :low
|
data/lib/cw/repeat_word.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
module
|
4
|
-
|
3
|
+
module CW
|
5
4
|
class RepeatWord < Tester
|
6
5
|
|
7
6
|
#overloaded #todo
|
@@ -59,7 +58,7 @@ module CWG
|
|
59
58
|
end
|
60
59
|
|
61
60
|
def threads
|
62
|
-
threads ||=
|
61
|
+
threads ||= Threads.new(self, thread_processes)
|
63
62
|
end
|
64
63
|
|
65
64
|
def run words
|