gitara 0.4.0 → 0.4.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.
Files changed (47) hide show
  1. data/CHANGELOG.markdown +5 -0
  2. data/examples/eraserheads-huling-el-bimbo/tab.ly +333 -0
  3. data/examples/eraserheads-huling-el-bimbo/tab.midi +0 -0
  4. data/examples/eraserheads-huling-el-bimbo/tab.pdf +0 -0
  5. data/examples/eraserheads-huling-el-bimbo/tab.rb +249 -0
  6. data/examples/tab.ly +11 -3
  7. data/gitara.gemspec +1 -0
  8. data/lib/gitara.rb +8 -5
  9. data/lib/gitara/is_node_version.rb +23 -0
  10. data/lib/gitara/node/bar.rb +12 -0
  11. data/lib/gitara/node/bar/{chorded_node.rb → chorded_version.rb} +1 -1
  12. data/lib/gitara/node/bar/stanza_version.rb +11 -0
  13. data/lib/gitara/node/bar/{voiced_node.rb → voiced_version.rb} +1 -1
  14. data/lib/gitara/node/base.rb +11 -2
  15. data/lib/gitara/node/base/chorded_version.rb +11 -0
  16. data/lib/gitara/node/base/stanza_version.rb +11 -0
  17. data/lib/gitara/node/base/{voiced_node.rb → voiced_version.rb} +5 -7
  18. data/lib/gitara/node/chord_set/{chorded_node.rb → chorded_version.rb} +1 -1
  19. data/lib/gitara/template/bar.erb +1 -0
  20. data/lib/gitara/template/line.erb +2 -1
  21. data/lib/gitara/template/score.erb +2 -1
  22. data/lib/gitara/template/stanza.erb +2 -1
  23. data/lib/gitara/template/tab.erb +1 -5
  24. data/lib/gitara/version.rb +1 -1
  25. data/spec/factories.rb +54 -0
  26. data/spec/lib/gitara/app_spec.rb +1 -1
  27. data/spec/lib/gitara/dsl_spec.rb +24 -24
  28. data/spec/lib/gitara/is_node_version_spec.rb +58 -0
  29. data/spec/lib/gitara/node/bar/chorded_version_spec.rb +20 -0
  30. data/spec/lib/gitara/node/bar/stanza_version_spec.rb +14 -0
  31. data/spec/lib/gitara/node/bar/voiced_version_spec.rb +16 -0
  32. data/spec/lib/gitara/node/bar_spec.rb +39 -7
  33. data/spec/lib/gitara/node/base/chorded_version_spec.rb +5 -0
  34. data/spec/lib/gitara/node/base/voiced_version_spec.rb +28 -0
  35. data/spec/lib/gitara/node/base_spec.rb +87 -79
  36. data/spec/lib/gitara/node/chord_set/chorded_version_spec.rb +11 -0
  37. data/spec/lib/gitara/node/stanza_spec.rb +4 -4
  38. data/spec/lib/gitara/node/tab_spec.rb +21 -32
  39. data/spec/lib/gitara/voice_spec.rb +21 -21
  40. data/spec/spec_helper.rb +2 -0
  41. metadata +141 -171
  42. data/lib/gitara/node/base/chorded_node.rb +0 -21
  43. data/spec/lib/gitara/node/bar/chorded_node_spec.rb +0 -20
  44. data/spec/lib/gitara/node/bar/voiced_node_spec.rb +0 -17
  45. data/spec/lib/gitara/node/base/chorded_node_spec.rb +0 -29
  46. data/spec/lib/gitara/node/base/voiced_node_spec.rb +0 -35
  47. data/spec/lib/gitara/node/chord_set/chorded_node_spec.rb +0 -11
@@ -1,21 +0,0 @@
1
- module Gitara
2
- module Node
3
- class Base
4
- class ChordedNode < Valuable
5
- has_value :node
6
-
7
- def call_name
8
- "\\#{definition_name}"
9
- end
10
-
11
- def definition_name
12
- "c#{node.class.to_s.split('::').last}#{node.definition_name}"
13
- end
14
-
15
- def value
16
- node.children.map(&:chorded).map(&:call_name).join(' ')
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,20 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'ChordedNode' do
4
- describe "value" do
5
- it "should be the call names of the chord sets in the bar, if available" do
6
- bar = Node::Bar.new(:children => [Node::ChordSet.new(:name => :Am, :value => 'r-"Am"')])
7
-
8
- chorded_bar = Node::Bar::ChordedNode.new(:node => bar)
9
- chorded_bar.value.should == '\cChordSetAm'
10
- end
11
-
12
- it "should be blank, if the bar does not have any chord sets" do
13
- bar = Node::Bar.new(:children => [Node::NoteSet.new(:value => 'c')])
14
-
15
- chorded_bar = Node::Bar::ChordedNode.new(:node => bar)
16
- chorded_bar.value.should == ""
17
- end
18
- end
19
- end
20
-
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Bar::VoicedNode' do
4
- describe "matching_note_set" do
5
- it "should be the note_set matching this voiced bar" do
6
- note_set = Node::NoteSet.new
7
-
8
- bar = Node::Bar.new
9
- bar.add note_set
10
-
11
- voice = Voice.new(:id => 1)
12
-
13
- voiced_bar = Node::Bar::VoicedNode.new(:node => bar, :voice => voice)
14
- voiced_bar.matching_note_set.should == note_set
15
- end
16
- end
17
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'ChordedNode' do
4
- describe "definition_name" do
5
- it "should include the node's class and the node's name" do
6
- chorded_node = Node::Base::ChordedNode.new(:node => Node::Base.new(:name => :Am))
7
- chorded_node.definition_name.should == 'cBaseAm'
8
- end
9
- end
10
-
11
- describe "value" do
12
- it "should be the call names of its children" do
13
- node = Node::Base.new(:children => [
14
- Node::Base.new(:name => :First),
15
- Node::Base.new(:name => :Second)
16
- ])
17
- chorded_node = Node::Base::ChordedNode.new(:node => node)
18
- chorded_node.value.should == '\cBaseFirst \cBaseSecond'
19
- end
20
- end
21
-
22
- describe "call_name" do
23
- it "should be the call name of the voiced node's definition name" do
24
- chorded_node = Node::Base::ChordedNode.new(:node => Node::Base.new(:name => :Am))
25
- chorded_node.call_name.should == '\cBaseAm'
26
- end
27
- end
28
- end
29
-
@@ -1,35 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'VoicedNode' do
4
- describe "call_name" do
5
- it "should be the call name of the voiced node's definition name" do
6
- voiced_node = Node::Base::VoicedNode.new(:node => Node::Base.new(:name => 'Intro'), :voice => Voice.new(:id => 1))
7
- voiced_node.call_name.should == '\vOneBaseIntro'
8
- end
9
- end
10
-
11
- describe "definition_name" do
12
- it "should include the voice's id, the node's class, and the node's name" do
13
- voiced_node = Node::Base::VoicedNode.new(:node => Node::Base.new(:name => 'Intro'), :voice => Voice.new(:id => 1))
14
- voiced_node.definition_name.should == 'vOneBaseIntro'
15
- end
16
- end
17
-
18
- describe "children" do
19
- it "should be voiced versions of the node's children" do
20
- parent = Node::Base.new(:name => 'parent')
21
- child = Node::Base.new(:name => 'child')
22
- parent.add child
23
-
24
- voice = Voice.new(:id => 1)
25
-
26
- voiced_node = Node::Base::VoicedNode.new(:node => parent, :voice => voice)
27
-
28
- children = voiced_node.children
29
- children.should have(1).voiced_node
30
- children[0].node.should == child
31
- children[0].voice.should == voice
32
- end
33
- end
34
- end
35
-
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'ChordSet::ChordedNode' do
4
- describe "value" do
5
- it "should be the chord set's value" do
6
- chorded_node = Node::ChordSet::ChordedNode.new(:node => Node::ChordSet.new(:name => :Am, :value => '4r-"Am" r r r'))
7
- chorded_node.value.should == '4r-"Am" r r r'
8
- end
9
- end
10
- end
11
-