msd-fretboard 0.0.5 → 0.0.6

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.
Files changed (3) hide show
  1. data/lib/fretboard.rb +7 -21
  2. metadata +12 -4
  3. data/lib/ansicolor.rb +0 -20
data/lib/fretboard.rb CHANGED
@@ -33,8 +33,6 @@
33
33
  # -d, --display [flat|sharp] Show fretboard
34
34
  # -l, --log LOGFILE Log session score to LOGFILE
35
35
  # -v, --version Show version
36
- # -c, --[no-]color Display ANSI color codes
37
- #
38
36
  #
39
37
  # == Author
40
38
  # Mark DeWandel
@@ -46,13 +44,16 @@
46
44
  require 'optparse'
47
45
  require 'timeout'
48
46
  require 'pp'
49
- require 'lib/ansicolor'
47
+
48
+ require 'rubygems'
49
+ require 'term/ansicolor'
50
+ include Term::ANSIColor
50
51
 
51
52
  # Fretboard class for learning the guitar fretboard.
52
53
  class Fretboard
53
54
  FRETS = 12
54
55
  STRINGS = 6
55
- VERSION = '0.0.5'
56
+ VERSION = '0.0.6'
56
57
 
57
58
  def self.display_version
58
59
  puts "#{File.basename(__FILE__)} version #{VERSION}"
@@ -90,10 +91,6 @@ class Fretboard
90
91
  options[:logfile] = opt
91
92
  end
92
93
 
93
- opts.on("-c", "--[no-]color", "Display ANSI color codes") do |opt|
94
- options[:color] = opt
95
- end
96
-
97
94
  opts.on("-v", "--version", "Show version") do
98
95
  display_version
99
96
  exit 0
@@ -112,17 +109,6 @@ class Fretboard
112
109
  def initialize(args)
113
110
  @timeout = args[:timeout] || 0
114
111
 
115
- # Default is to show ANSI color codes
116
- if args.has_key?(:color)
117
- if args[:color]
118
- @show_color = AnsiColor.new
119
- else
120
- @show_color = NoColor.new
121
- end
122
- else
123
- @show_color = AnsiColor.new
124
- end
125
-
126
112
  if args.has_key?(:fret)
127
113
  a = args[:fret]
128
114
  @first_fret = a[0].to_i
@@ -297,10 +283,10 @@ class Fretboard
297
283
  end
298
284
 
299
285
  if correct
300
- puts @show_color.green("Correct.")
286
+ puts green(bold("Correct."))
301
287
  else
302
288
  errors += 1
303
- puts @show_color.red("Incorrect.") + (timed_out ? " [Timeout]" : "")
289
+ puts red(bold("Incorrect.")) + (timed_out ? " [Timeout]" : "")
304
290
  if timed_out
305
291
  printf("\nContinue? ")
306
292
  $stdin.gets
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msd-fretboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark DeWandel
@@ -11,8 +11,17 @@ cert_chain: []
11
11
 
12
12
  date: 2009-02-13 00:00:00 -08:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: term-ansicolor
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
16
25
  description:
17
26
  email: mark.dewandel@gmail.com
18
27
  executables:
@@ -24,7 +33,6 @@ extra_rdoc_files: []
24
33
  files:
25
34
  - COPYING
26
35
  - bin/fb
27
- - lib/ansicolor.rb
28
36
  - lib/fretboard.rb
29
37
  has_rdoc: false
30
38
  homepage:
data/lib/ansicolor.rb DELETED
@@ -1,20 +0,0 @@
1
- class AnsiColor
2
- def green(s)
3
- "\e[32m#{s}\e[0m"
4
- end
5
-
6
- def red(s)
7
- "\e[31m#{s}\e[0m"
8
- end
9
- end
10
-
11
- class NoColor
12
- def green(s)
13
- s
14
- end
15
-
16
- def red(s)
17
- s
18
- end
19
- end
20
-