typingtutor 1.0.2 → 1.0.3
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 +4 -4
- data/.gitignore +50 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +21 -0
- data/LICENSE +21 -0
- data/README.md +20 -0
- data/Rakefile +2 -0
- data/exercises/fox.txt +1 -0
- data/exercises/haikurb.txt +3 -0
- data/exercises/lorem.txt +7 -0
- data/exercises/starwars.txt +17 -0
- data/lib/typingtutor.rb +1 -0
- data/lib/typingtutor/line.rb +1 -1
- data/lib/typingtutor/runner.rb +22 -18
- data/lib/typingtutor/version.rb +3 -0
- data/typingtutor.gemspec +20 -0
- metadata +31 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5696067963b2ee5de9aeeff804074fd4bebff0be
|
4
|
+
data.tar.gz: 89383a076e3b71244b0aa54b938ab576d3903047
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f57820a556542fcb36e2630ce28490df28941d3d1b0dccdb9eb4e81af18d84af4ae6cbcd24a949105575ace1775e7919f099c537b096d39eadccf5a719468e6f
|
7
|
+
data.tar.gz: 4bef0c9629250f12214c91dac86dcd13aa11ad355c893e3439adc1850072ade7743b8b7b4c76b79192c64b5e0d04d8e479b9123362e3af7b81b347a8baeecdd8
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
typingtutor (1.0.3)
|
5
|
+
highline (= 1.7.8)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
highline (1.7.8)
|
11
|
+
rake (11.2.2)
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
ruby
|
15
|
+
|
16
|
+
DEPENDENCIES
|
17
|
+
rake
|
18
|
+
typingtutor!
|
19
|
+
|
20
|
+
BUNDLED WITH
|
21
|
+
1.12.5
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 Paolo
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Typing Tutor
|
2
|
+
Minimalist command line typing tutor written in ruby
|
3
|
+
|
4
|
+
Installation:
|
5
|
+
|
6
|
+
```
|
7
|
+
$ gem install typingtutor
|
8
|
+
```
|
9
|
+
|
10
|
+
Show exercises available:
|
11
|
+
|
12
|
+
```
|
13
|
+
$ typingtutor
|
14
|
+
```
|
15
|
+
|
16
|
+
Play a specific exercise, eg:
|
17
|
+
|
18
|
+
```
|
19
|
+
$ typingtutor lorem
|
20
|
+
```
|
data/Rakefile
ADDED
data/exercises/fox.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
The quick brown fox jumps over the lazy dog
|
data/exercises/lorem.txt
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
2
|
+
Nam nulla lacus, pharetra nec sollicitudin nec, faucibus non est. Nunc a erat in ante aliquet dapibus.
|
3
|
+
Quisque congue libero vel mattis sodales.
|
4
|
+
Sed pellentesque, nunc nec gravida molestie, tellus mauris semper tellus, ac suscipit nisl est sit amet augue.
|
5
|
+
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
|
6
|
+
Sed vehicula risus risus, a lobortis velit ultricies ut. Nullam porttitor leo eu leo congue, id porta elit vestibulum.
|
7
|
+
Suspendisse facilisis ut diam nec molestie. Donec consequat elementum volutpat.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
A long time ago, in a galaxy far, far away...
|
2
|
+
It is a period of civil war. Rebel
|
3
|
+
spaceships, striking from a hidden
|
4
|
+
base, have won their first victory
|
5
|
+
against the evil Galactic Empire.
|
6
|
+
|
7
|
+
During the battle, Rebel spies managed
|
8
|
+
to steal secret plans to the Empire's
|
9
|
+
ultimate weapon, the Death Star, an
|
10
|
+
armored space station with enough
|
11
|
+
power to destroy an entire planet.
|
12
|
+
|
13
|
+
Pursued by the Empire's sinister agents,
|
14
|
+
Princess Leia races home aboard her
|
15
|
+
starship, custodian of the stolen plans
|
16
|
+
that can save her people and restore
|
17
|
+
freedom to the galaxy....
|
data/lib/typingtutor.rb
CHANGED
data/lib/typingtutor/line.rb
CHANGED
data/lib/typingtutor/runner.rb
CHANGED
@@ -3,7 +3,7 @@ module Typingtutor
|
|
3
3
|
include HighLine::SystemExtensions
|
4
4
|
|
5
5
|
def run(exercise_name)
|
6
|
-
exercise =
|
6
|
+
exercise = load_exercise(exercise_name)
|
7
7
|
if exercise
|
8
8
|
setup_color_scheme
|
9
9
|
play_intro
|
@@ -11,9 +11,10 @@ module Typingtutor
|
|
11
11
|
stats = exercise.map { |line| Line.new(line).play }
|
12
12
|
print_stats(stats)
|
13
13
|
else
|
14
|
+
puts "Typingtutor v#{Typingtutor::VERSION}"
|
14
15
|
puts "usage: typingtutor <exercise>"
|
15
16
|
puts "available:"
|
16
|
-
exercises.
|
17
|
+
exercises.each {|e| puts "- #{e}"}
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
@@ -34,23 +35,26 @@ module Typingtutor
|
|
34
35
|
HighLine.color_scheme = cs
|
35
36
|
end
|
36
37
|
|
38
|
+
def load_exercise(name)
|
39
|
+
file_name = File.join(File.dirname(__FILE__), '..', '..', "exercises", "#{name}.txt")
|
40
|
+
|
41
|
+
# load from exercise folder in the gem
|
42
|
+
lines = IO.read(file_name).lines if File.exists?(file_name)
|
43
|
+
return if lines.nil?
|
44
|
+
|
45
|
+
lines.each {|line| line.strip!} # remove extra spaces
|
46
|
+
lines.reject! {|line| line.strip.to_s == ""} # remove empty lines
|
47
|
+
return lines
|
48
|
+
end
|
49
|
+
|
37
50
|
def exercises
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
'paolo is a nice guy', 'but he cannot type fast', 'that is a shame.'
|
46
|
-
],
|
47
|
-
"fox" => ["The quick brown fox jumps over the lazy dog"],
|
48
|
-
"haikurb" => [
|
49
|
-
'"eyes".scan /the_darkness/',
|
50
|
-
'catch( :in_the_wind ) { ?a.round; "breath"',
|
51
|
-
'or "a".slice /of_moon/ }'
|
52
|
-
]
|
53
|
-
}
|
51
|
+
files = Dir[File.join(File.dirname(__FILE__), '..', '..', "exercises", "*.txt")]
|
52
|
+
files.map! do |name|
|
53
|
+
name = name.split(File::SEPARATOR).last
|
54
|
+
name = name.gsub /\.txt/, ''
|
55
|
+
name
|
56
|
+
end
|
57
|
+
files
|
54
58
|
end
|
55
59
|
|
56
60
|
def print_stats(stats)
|
data/typingtutor.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "typingtutor/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = 'typingtutor'
|
7
|
+
gem.version = Typingtutor::VERSION
|
8
|
+
gem.platform = Gem::Platform::RUBY
|
9
|
+
gem.summary = "Command line typing tutor"
|
10
|
+
gem.authors = ["Paolo Dona"]
|
11
|
+
gem.email = ['paolo.dona@gmail.com']
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.homepage = 'https://github.com/paolodona/typingtutor'
|
14
|
+
gem.license = 'MIT'
|
15
|
+
gem.executables = ['typingtutor']
|
16
|
+
gem.require_paths = ["lib"]
|
17
|
+
|
18
|
+
gem.add_runtime_dependency "highline", ['1.7.8']
|
19
|
+
gem.add_development_dependency 'rake'
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typingtutor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paolo Dona
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -24,17 +24,44 @@ dependencies:
|
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.7.8
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description:
|
28
|
-
email:
|
42
|
+
email:
|
43
|
+
- paolo.dona@gmail.com
|
29
44
|
executables:
|
30
45
|
- typingtutor
|
31
46
|
extensions: []
|
32
47
|
extra_rdoc_files: []
|
33
48
|
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- Gemfile.lock
|
52
|
+
- LICENSE
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
34
55
|
- bin/typingtutor
|
56
|
+
- exercises/fox.txt
|
57
|
+
- exercises/haikurb.txt
|
58
|
+
- exercises/lorem.txt
|
59
|
+
- exercises/starwars.txt
|
35
60
|
- lib/typingtutor.rb
|
36
61
|
- lib/typingtutor/line.rb
|
37
62
|
- lib/typingtutor/runner.rb
|
63
|
+
- lib/typingtutor/version.rb
|
64
|
+
- typingtutor.gemspec
|
38
65
|
homepage: https://github.com/paolodona/typingtutor
|
39
66
|
licenses:
|
40
67
|
- MIT
|
@@ -55,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
82
|
version: '0'
|
56
83
|
requirements: []
|
57
84
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
85
|
+
rubygems_version: 2.5.1
|
59
86
|
signing_key:
|
60
87
|
specification_version: 4
|
61
88
|
summary: Command line typing tutor
|