geek_typist 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Gemfile.lock +20 -0
  2. data/VERSION +1 -1
  3. data/bin/geek_typist.rb +31 -3
  4. metadata +4 -3
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.5.2)
6
+ bundler (~> 1.0.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.9.2)
10
+ rcov (0.9.9)
11
+ shoulda (2.11.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.0.0)
18
+ jeweler (~> 1.5.2)
19
+ rcov
20
+ shoulda
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/bin/geek_typist.rb CHANGED
@@ -1,14 +1,42 @@
1
1
  #gem install highline
2
2
 
3
3
  require "rubygems"
4
+ require 'optparse'
4
5
  require "highline/system_extensions"
5
6
  include HighLine::SystemExtensions
6
7
 
7
- str_test = "{13-_87}"
8
+ options = {}
9
+ OptionParser.new do |opts|
10
+ opts.banner = "Usage: geek_typist [options]"
11
+
12
+ opts.on("-v", "--version", "Version") do |v|
13
+ options[:version] = 1
14
+ end
15
+
16
+ opts.on("-t text", "--text text", "launch the system with the given text ") do |v|
17
+ options[:use_text] = v
18
+ end
19
+
20
+ opts.on("-n NUM", "--n-times NUM", "repeat the text NUM times") do |v|
21
+ options[:repeat] = v
22
+ end
23
+
24
+ end.parse!
25
+
26
+ if options[:use_text]
27
+ str_test = options[:use_text]
28
+ else
29
+ str_test = "{13-_87}"
30
+ end
31
+
32
+ if options[:repeat]
33
+ n_times = options[:repeat].to_i
34
+ else
35
+ n_times = 1
36
+ end
8
37
 
9
- #debugger
10
38
  failures = 0
11
- str_test.split("").each do |s|
39
+ (str_test * n_times).split("").sort_by{ rand }.each do |s|
12
40
 
13
41
  c = 0
14
42
  while (c != s[0]) do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geek_typist
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Caccinolo Benoit
@@ -89,6 +89,7 @@ extra_rdoc_files:
89
89
  files:
90
90
  - .document
91
91
  - Gemfile
92
+ - Gemfile.lock
92
93
  - LICENSE.txt
93
94
  - README.rdoc
94
95
  - Rakefile