music 0.5.0 → 0.5.1
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.
- data/Gemfile.lock +14 -14
- data/lib/music/chord.rb +10 -0
- data/lib/music/version.rb +1 -1
- data/spec/classes/chord_spec.rb +18 -8
- metadata +4 -6
- data/test/helper.rb +0 -18
- data/test/test_music.rb +0 -7
data/Gemfile.lock
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
music
|
|
4
|
+
music (0.5.0)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: http://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
activemodel (3.2.
|
|
10
|
-
activesupport (= 3.2.
|
|
9
|
+
activemodel (3.2.3)
|
|
10
|
+
activesupport (= 3.2.3)
|
|
11
11
|
builder (~> 3.0.0)
|
|
12
|
-
activesupport (3.2.
|
|
12
|
+
activesupport (3.2.3)
|
|
13
13
|
i18n (~> 0.6)
|
|
14
14
|
multi_json (~> 1.0)
|
|
15
15
|
builder (3.0.0)
|
|
16
16
|
diff-lcs (1.1.3)
|
|
17
17
|
i18n (0.6.0)
|
|
18
|
-
multi_json (1.
|
|
18
|
+
multi_json (1.3.5)
|
|
19
19
|
rake (0.9.2.2)
|
|
20
|
-
rspec (2.
|
|
21
|
-
rspec-core (~> 2.
|
|
22
|
-
rspec-expectations (~> 2.
|
|
23
|
-
rspec-mocks (~> 2.
|
|
24
|
-
rspec-core (2.
|
|
25
|
-
rspec-expectations (2.
|
|
20
|
+
rspec (2.10.0)
|
|
21
|
+
rspec-core (~> 2.10.0)
|
|
22
|
+
rspec-expectations (~> 2.10.0)
|
|
23
|
+
rspec-mocks (~> 2.10.0)
|
|
24
|
+
rspec-core (2.10.0)
|
|
25
|
+
rspec-expectations (2.10.0)
|
|
26
26
|
diff-lcs (~> 1.1.3)
|
|
27
|
-
rspec-mocks (2.
|
|
27
|
+
rspec-mocks (2.10.1)
|
|
28
28
|
|
|
29
29
|
PLATFORMS
|
|
30
30
|
ruby
|
|
31
31
|
|
|
32
32
|
DEPENDENCIES
|
|
33
|
-
activemodel (>= 3.0)
|
|
33
|
+
activemodel (>= 3.2.0)
|
|
34
34
|
bundler (>= 1.1.3)
|
|
35
|
-
music
|
|
35
|
+
music!
|
|
36
36
|
rake (>= 0.9)
|
|
37
37
|
rspec
|
data/lib/music/chord.rb
CHANGED
|
@@ -28,6 +28,16 @@ module Music
|
|
|
28
28
|
:diminished
|
|
29
29
|
when [4, 8]
|
|
30
30
|
:augmented
|
|
31
|
+
when [4, 7, 11]
|
|
32
|
+
:major_7
|
|
33
|
+
when [3, 7, 10]
|
|
34
|
+
:minor_7
|
|
35
|
+
when [3, 6, 9]
|
|
36
|
+
:diminished_7
|
|
37
|
+
when [3, 6, 10]
|
|
38
|
+
:half_diminished_7
|
|
39
|
+
when [4, 8, 10]
|
|
40
|
+
:augmented_7
|
|
31
41
|
end
|
|
32
42
|
|
|
33
43
|
[@notes.first.letter, quality]
|
data/lib/music/version.rb
CHANGED
data/spec/classes/chord_spec.rb
CHANGED
|
@@ -28,28 +28,38 @@ describe Music::Chord do
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
describe '#describe' do
|
|
31
|
-
describe
|
|
31
|
+
describe "triads" do
|
|
32
32
|
it 'should recognize C major' do
|
|
33
33
|
Chord.new(['C4', 'E4', 'G4']).describe.should == ['C', :major]
|
|
34
34
|
end
|
|
35
|
-
end
|
|
36
35
|
|
|
37
|
-
describe 'minor chords' do
|
|
38
36
|
it 'should recognize C minor' do
|
|
39
37
|
Chord.new(['C4', 'Eb4', 'G4']).describe.should == ['C', :minor]
|
|
40
38
|
end
|
|
41
|
-
end
|
|
42
39
|
|
|
43
|
-
describe 'diminished chords' do
|
|
44
40
|
it 'should recognize C diminished' do
|
|
45
41
|
Chord.new(['C4', 'Eb4', 'Gb4']).describe.should == ['C', :diminished]
|
|
46
42
|
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
describe 'augmented chords' do
|
|
50
43
|
it 'should recognize C augmented' do
|
|
51
44
|
Chord.new(['C4', 'E4', 'G#4']).describe.should == ['C', :augmented]
|
|
52
45
|
end
|
|
53
46
|
end
|
|
47
|
+
describe "seven chords" do
|
|
48
|
+
it 'should recognize Cmaj7' do
|
|
49
|
+
Chord.new(['C4', 'E4', 'G4', 'B4']).describe.should == ['C', :major_7]
|
|
50
|
+
end
|
|
51
|
+
it 'should recognize Cmin7' do
|
|
52
|
+
Chord.new(['C4', 'Eb4', 'G4', 'Bb4']).describe.should == ['C', :minor_7]
|
|
53
|
+
end
|
|
54
|
+
it 'should recognize Cdim7' do
|
|
55
|
+
Chord.new(['C4', 'Eb4', 'Gb4', 'A4']).describe.should == ['C', :diminished_7]
|
|
56
|
+
end
|
|
57
|
+
it 'should recognize Cmin7b5' do
|
|
58
|
+
Chord.new(['C4', 'Eb4', 'Gb4', 'Bb4']).describe.should == ['C', :half_diminished_7]
|
|
59
|
+
end
|
|
60
|
+
it 'should recognize Caug7' do
|
|
61
|
+
Chord.new(['C4', 'E4', 'G#4', 'Bb4']).describe.should == ['C', :augmented_7]
|
|
62
|
+
end
|
|
63
|
+
end
|
|
54
64
|
end
|
|
55
65
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: music
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 9
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 5
|
|
9
|
-
-
|
|
10
|
-
version: 0.5.
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.5.1
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Brian Underwood
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2012-
|
|
18
|
+
date: 2012-05-15 00:00:00 Z
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
21
21
|
name: rake
|
|
@@ -106,8 +106,6 @@ files:
|
|
|
106
106
|
- spec/classes/hash_spec.rb
|
|
107
107
|
- spec/classes/note_spec.rb
|
|
108
108
|
- spec/spec_helper.rb
|
|
109
|
-
- test/helper.rb
|
|
110
|
-
- test/test_music.rb
|
|
111
109
|
homepage: http://github.com/cheerfulstoic/music
|
|
112
110
|
licenses:
|
|
113
111
|
- MIT
|
data/test/helper.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'bundler'
|
|
3
|
-
begin
|
|
4
|
-
Bundler.setup(:default, :development)
|
|
5
|
-
rescue Bundler::BundlerError => e
|
|
6
|
-
$stderr.puts e.message
|
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
|
8
|
-
exit e.status_code
|
|
9
|
-
end
|
|
10
|
-
require 'test/unit'
|
|
11
|
-
require 'shoulda'
|
|
12
|
-
|
|
13
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
14
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
15
|
-
require 'music'
|
|
16
|
-
|
|
17
|
-
class Test::Unit::TestCase
|
|
18
|
-
end
|