wtf_chord 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wtf_chord/cli.rb +3 -4
- data/lib/wtf_chord/fingerings_generator.rb +6 -8
- data/lib/wtf_chord/fretboard.rb +8 -0
- data/lib/wtf_chord/scale.rb +7 -1
- data/lib/wtf_chord/version.rb +1 -1
- data/wtf_chord.gemspec +2 -2
- metadata +7 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff26ad0548f061f6982cfa47df59f0ffff78b136
|
4
|
+
data.tar.gz: 073b2e5c14ac65a19c6aa806f97467c618f10145
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40326155782d5c90b1e99f6b1e0d117d06d6c6b10139636fe7d27bcc5a9207c72073a205298e870405fd5af1aee6865ffb8271d80c3e47b940d86a65d54ca74b
|
7
|
+
data.tar.gz: 33d25bb0f14caaa21278dfdce45ef553656c29a77eb29bab409c80910e3f7f5c2aeeb97e5b99f580c2f2949d4ca2c1359594ce80d0798bdc7fadde366ceac4ca
|
data/lib/wtf_chord/cli.rb
CHANGED
@@ -7,14 +7,13 @@ module WTFChord
|
|
7
7
|
include Methadone::CLILogging
|
8
8
|
|
9
9
|
main do |name|
|
10
|
-
chord
|
11
|
-
|
12
|
-
formatter = WTFChord::Formatter.new(options['output'], options['rates'])
|
10
|
+
chord = WTFChord.chord(name)
|
11
|
+
formatter = WTFChord::Formatter.new(options['output'], options['rates'])
|
13
12
|
|
14
13
|
debug { "Output using formatter: #{formatter.formatter.to_s}\n" }
|
15
14
|
|
16
15
|
puts chord.inspect, nil
|
17
|
-
puts formatter[*fingerings] * formatter.separator
|
16
|
+
puts formatter[*chord.fingerings(options['amount'])] * formatter.separator
|
18
17
|
end
|
19
18
|
|
20
19
|
version VERSION
|
@@ -26,18 +26,16 @@ module WTFChord
|
|
26
26
|
private
|
27
27
|
|
28
28
|
def generate(fret_range)
|
29
|
-
combinations =
|
30
|
-
fret_range.
|
31
|
-
pitch = s.original + dist
|
32
|
-
|
33
|
-
end.tap do |frets|
|
34
|
-
frets << nil if frets.size == 0
|
35
|
-
end
|
29
|
+
combinations = WTFChord.guitar.strings.map.with_index do |s, index|
|
30
|
+
fret_range.
|
31
|
+
select { |dist| pitch = s.original + dist; has_note?(pitch) }.
|
32
|
+
tap { |frets| frets << nil if frets.size == 0 }
|
36
33
|
end
|
37
34
|
|
38
35
|
combinations.inject(&:product).each do |fingers|
|
39
36
|
fingers.flatten!
|
40
|
-
|
37
|
+
|
38
|
+
Fingering.new(WTFChord.guitar, fingers) do |variant|
|
41
39
|
adjust(variant)
|
42
40
|
yield(variant)
|
43
41
|
end
|
data/lib/wtf_chord/fretboard.rb
CHANGED
data/lib/wtf_chord/scale.rb
CHANGED
@@ -63,5 +63,11 @@ module WTFChord
|
|
63
63
|
ScaleArray.build(*chromatic_scale).freeze
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
def self.guitar=(guitar)
|
67
|
+
Thread.current[:wtf_guitar] = guitar
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.guitar
|
71
|
+
Thread.current[:wtf_guitar] ||= Fretboard.new(*%w(E2 A2 D3 G3 B3 E4))
|
72
|
+
end
|
67
73
|
end
|
data/lib/wtf_chord/version.rb
CHANGED
data/wtf_chord.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_runtime_dependency "methadone"
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "bundler"
|
26
|
+
spec.add_development_dependency "rake"
|
27
27
|
spec.add_development_dependency "rspec", ">= 3.0", "< 4"
|
28
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wtf_chord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: methadone
|
@@ -30,40 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '2'
|
33
|
+
version: '0'
|
37
34
|
type: :development
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - ">="
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '2'
|
40
|
+
version: '0'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: rake
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
45
|
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
54
|
-
- - "<"
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '12'
|
47
|
+
version: '0'
|
57
48
|
type: :development
|
58
49
|
prerelease: false
|
59
50
|
version_requirements: !ruby/object:Gem::Requirement
|
60
51
|
requirements:
|
61
52
|
- - ">="
|
62
53
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
64
|
-
- - "<"
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: '12'
|
54
|
+
version: '0'
|
67
55
|
- !ruby/object:Gem::Dependency
|
68
56
|
name: rspec
|
69
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
128
|
version: '0'
|
141
129
|
requirements: []
|
142
130
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.6.
|
131
|
+
rubygems_version: 2.6.6
|
144
132
|
signing_key:
|
145
133
|
specification_version: 4
|
146
134
|
summary: "‘WTF Chord?’ is the Ruby guitar chords generator library."
|