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.
- data/CHANGELOG.markdown +5 -0
- data/examples/eraserheads-huling-el-bimbo/tab.ly +333 -0
- data/examples/eraserheads-huling-el-bimbo/tab.midi +0 -0
- data/examples/eraserheads-huling-el-bimbo/tab.pdf +0 -0
- data/examples/eraserheads-huling-el-bimbo/tab.rb +249 -0
- data/examples/tab.ly +11 -3
- data/gitara.gemspec +1 -0
- data/lib/gitara.rb +8 -5
- data/lib/gitara/is_node_version.rb +23 -0
- data/lib/gitara/node/bar.rb +12 -0
- data/lib/gitara/node/bar/{chorded_node.rb → chorded_version.rb} +1 -1
- data/lib/gitara/node/bar/stanza_version.rb +11 -0
- data/lib/gitara/node/bar/{voiced_node.rb → voiced_version.rb} +1 -1
- data/lib/gitara/node/base.rb +11 -2
- data/lib/gitara/node/base/chorded_version.rb +11 -0
- data/lib/gitara/node/base/stanza_version.rb +11 -0
- data/lib/gitara/node/base/{voiced_node.rb → voiced_version.rb} +5 -7
- data/lib/gitara/node/chord_set/{chorded_node.rb → chorded_version.rb} +1 -1
- data/lib/gitara/template/bar.erb +1 -0
- data/lib/gitara/template/line.erb +2 -1
- data/lib/gitara/template/score.erb +2 -1
- data/lib/gitara/template/stanza.erb +2 -1
- data/lib/gitara/template/tab.erb +1 -5
- data/lib/gitara/version.rb +1 -1
- data/spec/factories.rb +54 -0
- data/spec/lib/gitara/app_spec.rb +1 -1
- data/spec/lib/gitara/dsl_spec.rb +24 -24
- data/spec/lib/gitara/is_node_version_spec.rb +58 -0
- data/spec/lib/gitara/node/bar/chorded_version_spec.rb +20 -0
- data/spec/lib/gitara/node/bar/stanza_version_spec.rb +14 -0
- data/spec/lib/gitara/node/bar/voiced_version_spec.rb +16 -0
- data/spec/lib/gitara/node/bar_spec.rb +39 -7
- data/spec/lib/gitara/node/base/chorded_version_spec.rb +5 -0
- data/spec/lib/gitara/node/base/voiced_version_spec.rb +28 -0
- data/spec/lib/gitara/node/base_spec.rb +87 -79
- data/spec/lib/gitara/node/chord_set/chorded_version_spec.rb +11 -0
- data/spec/lib/gitara/node/stanza_spec.rb +4 -4
- data/spec/lib/gitara/node/tab_spec.rb +21 -32
- data/spec/lib/gitara/voice_spec.rb +21 -21
- data/spec/spec_helper.rb +2 -0
- metadata +141 -171
- data/lib/gitara/node/base/chorded_node.rb +0 -21
- data/spec/lib/gitara/node/bar/chorded_node_spec.rb +0 -20
- data/spec/lib/gitara/node/bar/voiced_node_spec.rb +0 -17
- data/spec/lib/gitara/node/base/chorded_node_spec.rb +0 -29
- data/spec/lib/gitara/node/base/voiced_node_spec.rb +0 -35
- data/spec/lib/gitara/node/chord_set/chorded_node_spec.rb +0 -11
data/examples/tab.ly
CHANGED
@@ -29,26 +29,32 @@ cChordSetFD = { r4-"F" r r-"D" r }
|
|
29
29
|
vOneBarBeganIt = { \skip 4 <a\3 c'\2 >8 <g\3>8 \skip 4 <g\3 c'\2 >8 <g\3>8 }
|
30
30
|
vTwoBarBeganIt = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
|
31
31
|
cBarBeganIt = { \cChordSetFC }
|
32
|
+
sBarBeganIt = { r1 }
|
32
33
|
|
33
34
|
vOneBarItsNot = { r8 <g'\1>4 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>16( <a\3>16) }
|
34
35
|
vTwoBarItsNot = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
|
35
36
|
cBarItsNot = { \cChordSetFC }
|
37
|
+
sBarItsNot = { r1 }
|
36
38
|
|
37
39
|
vOneBarItThough = { r8 <d'\2>16( <c'\2>16) r8 <a\3>16 <c'\2>16 r8 <d'\2>16( <c'\2>16) r8 <a\3>8 }
|
38
40
|
vTwoBarItThough = { <f\4>4 <f\4>4 <d\4>4 <d\4>4 }
|
39
41
|
cBarItThough = { \cChordSetFD }
|
42
|
+
sBarItThough = { r1 }
|
40
43
|
|
41
44
|
vOneBarWhatYouThought = { r8 <g'\1>4 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>8 }
|
42
45
|
vTwoBarWhatYouThought = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
|
43
46
|
cBarWhatYouThought = { \cChordSetFC }
|
47
|
+
sBarWhatYouThought = { r1 }
|
44
48
|
|
45
49
|
vOneBarWhenYouFirst = { <e'\1>8 <d'\2>16( <c'\2>8) <a\3>8. <c'\2>4 <a\3>8 <c'\2>8 }
|
46
50
|
vTwoBarWhenYouFirst = { <a,\5>4 <a,\5>8 <e\4>4 <a,\5>4 \skip 8 }
|
47
51
|
cBarWhenYouFirst = { \cChordSetAm }
|
52
|
+
sBarWhenYouFirst = { r1 }
|
48
53
|
|
49
54
|
vOneBarYouGot = { <g'\1>8 <a\3>8 <g'\1>8 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>16( <a\3>16) }
|
50
55
|
vTwoBarYouGot = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
|
51
56
|
cBarYouGot = { \cChordSetFC }
|
57
|
+
sBarYouGot = { r1 }
|
52
58
|
|
53
59
|
|
54
60
|
%-----------------------------------------------------------------------
|
@@ -57,10 +63,12 @@ cBarYouGot = { \cChordSetFC }
|
|
57
63
|
vOneLineVerseOneLineTwo = { \vOneBarYouGot \vOneBarWhatYouThought \vOneBarWhenYouFirst \vOneBarItThough \break }
|
58
64
|
vTwoLineVerseOneLineTwo = { \vTwoBarYouGot \vTwoBarWhatYouThought \vTwoBarWhenYouFirst \vTwoBarItThough \break }
|
59
65
|
cLineVerseOneLineTwo = { \cBarYouGot \cBarWhatYouThought \cBarWhenYouFirst \cBarItThough }
|
66
|
+
sLineVerseOneLineTwo = { \sBarYouGot \sBarWhatYouThought \sBarWhenYouFirst \sBarItThough }
|
60
67
|
|
61
68
|
vOneLineVerseOneLineOne = { \vOneBarItsNot \vOneBarWhatYouThought \vOneBarWhenYouFirst \vOneBarBeganIt \break }
|
62
69
|
vTwoLineVerseOneLineOne = { \vTwoBarItsNot \vTwoBarWhatYouThought \vTwoBarWhenYouFirst \vTwoBarBeganIt \break }
|
63
70
|
cLineVerseOneLineOne = { \cBarItsNot \cBarWhatYouThought \cBarWhenYouFirst \cBarBeganIt }
|
71
|
+
sLineVerseOneLineOne = { \sBarItsNot \sBarWhatYouThought \sBarWhenYouFirst \sBarBeganIt }
|
64
72
|
|
65
73
|
|
66
74
|
%-----------------------------------------------------------------------
|
@@ -69,6 +77,7 @@ cLineVerseOneLineOne = { \cBarItsNot \cBarWhatYouThought \cBarWhenYouFirst \cBar
|
|
69
77
|
vOneStanzaVerseOne = { \vOneLineVerseOneLineOne \vOneLineVerseOneLineTwo }
|
70
78
|
vTwoStanzaVerseOne = { \vTwoLineVerseOneLineOne \vTwoLineVerseOneLineTwo }
|
71
79
|
cStanzaVerseOne = { \cLineVerseOneLineOne \cLineVerseOneLineTwo }
|
80
|
+
sStanzaVerseOne = { \sLineVerseOneLineOne \sLineVerseOneLineTwo }
|
72
81
|
|
73
82
|
|
74
83
|
%-----------------------------------------------------------------------
|
@@ -77,6 +86,7 @@ cStanzaVerseOne = { \cLineVerseOneLineOne \cLineVerseOneLineTwo }
|
|
77
86
|
vOneScoreTabOneScoreOne = { \vOneStanzaVerseOne }
|
78
87
|
vTwoScoreTabOneScoreOne = { \vTwoStanzaVerseOne }
|
79
88
|
cScoreTabOneScoreOne = { \cStanzaVerseOne }
|
89
|
+
sScoreTabOneScoreOne = { \sStanzaVerseOne }
|
80
90
|
|
81
91
|
|
82
92
|
%-----------------------------------------------------------------------
|
@@ -96,9 +106,7 @@ vTwo = {
|
|
96
106
|
%-----------------------------------------------------------------------
|
97
107
|
% Stanza Headings
|
98
108
|
|
99
|
-
stanzaHeadings = {
|
100
|
-
r1^"Verse 1" r r r r r r r
|
101
|
-
}
|
109
|
+
stanzaHeadings = { \sScoreTabOneScoreOne }
|
102
110
|
|
103
111
|
%-----------------------------------------------------------------------
|
104
112
|
% Chord Headings
|
data/gitara.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_runtime_dependency "thor"
|
26
26
|
s.add_runtime_dependency "valuable"
|
27
27
|
|
28
|
+
s.add_development_dependency "factory_girl"
|
28
29
|
s.add_development_dependency "guard"
|
29
30
|
s.add_development_dependency "guard-rspec"
|
30
31
|
s.add_development_dependency "pry"
|
data/lib/gitara.rb
CHANGED
@@ -7,14 +7,17 @@ require "valuable"
|
|
7
7
|
|
8
8
|
require "gitara/app"
|
9
9
|
require "gitara/dsl"
|
10
|
+
require "gitara/is_node_version"
|
10
11
|
require "gitara/node/base"
|
11
|
-
require "gitara/node/base/
|
12
|
-
require "gitara/node/base/
|
12
|
+
require "gitara/node/base/chorded_version"
|
13
|
+
require "gitara/node/base/stanza_version"
|
14
|
+
require "gitara/node/base/voiced_version"
|
13
15
|
require "gitara/node/bar"
|
14
|
-
require "gitara/node/bar/
|
15
|
-
require "gitara/node/bar/
|
16
|
+
require "gitara/node/bar/chorded_version"
|
17
|
+
require "gitara/node/bar/stanza_version"
|
18
|
+
require "gitara/node/bar/voiced_version"
|
16
19
|
require "gitara/node/chord_set"
|
17
|
-
require "gitara/node/chord_set/
|
20
|
+
require "gitara/node/chord_set/chorded_version"
|
18
21
|
require "gitara/node/line"
|
19
22
|
require "gitara/node/note_set"
|
20
23
|
require "gitara/node/score"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Gitara
|
2
|
+
module IsNodeVersion
|
3
|
+
def call_name
|
4
|
+
"\\#{definition_name}"
|
5
|
+
end
|
6
|
+
|
7
|
+
def children
|
8
|
+
node.children.map{|child| self.class.new(:node => child)}
|
9
|
+
end
|
10
|
+
|
11
|
+
def definition_name
|
12
|
+
"#{prefix}#{node.class.to_s.split('::').last}#{node.definition_name}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def prefix
|
16
|
+
self.class.to_s.split('::').last[0].downcase
|
17
|
+
end
|
18
|
+
|
19
|
+
def value
|
20
|
+
children.map(&:call_name).join(' ')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/gitara/node/bar.rb
CHANGED
@@ -1,9 +1,21 @@
|
|
1
1
|
module Gitara
|
2
2
|
module Node
|
3
3
|
class Bar < Base
|
4
|
+
def first_bar_of_stanza?
|
5
|
+
stanza && stanza.descendants(Node::Bar)[0] == self
|
6
|
+
end
|
7
|
+
|
4
8
|
def note_sets
|
5
9
|
children.select{|child| child.is_a?(Node::NoteSet)}
|
6
10
|
end
|
11
|
+
|
12
|
+
def stanza
|
13
|
+
self.ancestor(Node::Stanza)
|
14
|
+
end
|
15
|
+
|
16
|
+
def stanza_heading
|
17
|
+
first_bar_of_stanza? ? %Q|r1^"#{ancestor(Node::Stanza).name}"| : "r1"
|
18
|
+
end
|
7
19
|
end
|
8
20
|
end
|
9
21
|
end
|
data/lib/gitara/node/base.rb
CHANGED
@@ -12,6 +12,10 @@ module Gitara
|
|
12
12
|
child.parent = self
|
13
13
|
end
|
14
14
|
|
15
|
+
def ancestor(node_class)
|
16
|
+
self.is_a?(node_class) ? self : self.parent && self.parent.ancestor(node_class)
|
17
|
+
end
|
18
|
+
|
15
19
|
def children
|
16
20
|
if own_children.empty?
|
17
21
|
definition ? definition.own_children : []
|
@@ -21,13 +25,14 @@ module Gitara
|
|
21
25
|
end
|
22
26
|
|
23
27
|
def children=(values)
|
28
|
+
own_children.clear
|
24
29
|
values.each do |child|
|
25
30
|
add child
|
26
31
|
end
|
27
32
|
end
|
28
33
|
|
29
34
|
def chorded
|
30
|
-
self.class::
|
35
|
+
self.class::ChordedVersion.new(:node => self)
|
31
36
|
end
|
32
37
|
|
33
38
|
def definition(target = self)
|
@@ -82,13 +87,17 @@ module Gitara
|
|
82
87
|
parent.nil? ? self : parent.root
|
83
88
|
end
|
84
89
|
|
90
|
+
def stanza_version
|
91
|
+
self.class::StanzaVersion.new(:node => self)
|
92
|
+
end
|
93
|
+
|
85
94
|
def value
|
86
95
|
attributes[:value] ? attributes[:value].gsub('/', "\\") : nil
|
87
96
|
end
|
88
97
|
|
89
98
|
def voiced_as(arg)
|
90
99
|
if arg.is_a?(Voice)
|
91
|
-
self.class::
|
100
|
+
self.class::VoicedVersion.new(:node => self, :voice => arg)
|
92
101
|
elsif arg.is_a?(Array)
|
93
102
|
arg.map{|voice| self.voiced_as(voice) }
|
94
103
|
else
|
@@ -1,20 +1,18 @@
|
|
1
1
|
module Gitara
|
2
2
|
module Node
|
3
3
|
class Base
|
4
|
-
class
|
4
|
+
class VoicedVersion < Valuable
|
5
|
+
include IsNodeVersion
|
6
|
+
|
5
7
|
has_value :node
|
6
8
|
has_value :voice
|
7
9
|
|
8
|
-
def call_name
|
9
|
-
"\\#{definition_name}"
|
10
|
-
end
|
11
|
-
|
12
10
|
def children
|
13
11
|
node.children.map{|child| child.voiced_as(voice) }
|
14
12
|
end
|
15
13
|
|
16
|
-
def
|
17
|
-
|
14
|
+
def prefix
|
15
|
+
voice.definition_name
|
18
16
|
end
|
19
17
|
end
|
20
18
|
end
|
data/lib/gitara/template/bar.erb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
<% self.voiced_as(self.root.voices).each do |voiced_line| %>
|
2
|
-
<%= voiced_line.definition_name %> = { <%= voiced_line.
|
2
|
+
<%= voiced_line.definition_name %> = { <%= voiced_line.value %> \break }
|
3
3
|
<% end %>
|
4
4
|
<%= self.chorded.definition_name %> = { <%= self.chorded.value %> }
|
5
|
+
<%= self.stanza_version.definition_name %> = { <%= self.stanza_version.value %> }
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<% self.voiced_as(self.root.voices).each do |voiced_score| %>
|
2
|
-
<%= voiced_score.definition_name %> = { <%= voiced_score.
|
2
|
+
<%= voiced_score.definition_name %> = { <%= voiced_score.value %> }
|
3
3
|
<% end %>
|
4
4
|
<%= self.chorded.definition_name %> = { <%= self.chorded.value %> }
|
5
|
+
<%= self.stanza_version.definition_name %> = { <%= self.stanza_version.value %> }
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<% self.voiced_as(self.root.voices).each do |voiced_stanza| %>
|
2
|
-
<%= voiced_stanza.definition_name %> = { <%= voiced_stanza.
|
2
|
+
<%= voiced_stanza.definition_name %> = { <%= voiced_stanza.value %> }
|
3
3
|
<% end %>
|
4
4
|
<%= self.chorded.definition_name %> = { <%= self.chorded.value %> }
|
5
|
+
<%= self.stanza_version.definition_name %> = { <%= self.stanza_version.value %> }
|
data/lib/gitara/template/tab.erb
CHANGED
@@ -57,11 +57,7 @@
|
|
57
57
|
%-----------------------------------------------------------------------
|
58
58
|
% Stanza Headings
|
59
59
|
|
60
|
-
stanzaHeadings = {
|
61
|
-
<% definitions(Gitara::Node::Stanza).each do |stanza| %>
|
62
|
-
<%= stanza.heading_in_lilypond %>
|
63
|
-
<% end %>
|
64
|
-
}
|
60
|
+
stanzaHeadings = { <%= playable_child.stanza_version.call_name %> }
|
65
61
|
|
66
62
|
%-----------------------------------------------------------------------
|
67
63
|
% Chord Headings
|
data/lib/gitara/version.rb
CHANGED
data/spec/factories.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :note_set, :class => Node::NoteSet do
|
3
|
+
end
|
4
|
+
|
5
|
+
factory :app, :class => App do
|
6
|
+
end
|
7
|
+
|
8
|
+
factory :bar, :class => Node::Bar do
|
9
|
+
children [FactoryGirl.build(:note_set)]
|
10
|
+
end
|
11
|
+
|
12
|
+
factory :base, :class => Node::Base do
|
13
|
+
end
|
14
|
+
|
15
|
+
factory :chord_set, :class => Node::ChordSet do
|
16
|
+
end
|
17
|
+
|
18
|
+
factory :chorded_bar, :class => Node::Bar::ChordedVersion do
|
19
|
+
end
|
20
|
+
|
21
|
+
factory :chorded_chord_set, :class => Node::ChordSet::ChordedVersion do
|
22
|
+
end
|
23
|
+
|
24
|
+
factory :dsl, :class => Dsl do
|
25
|
+
end
|
26
|
+
|
27
|
+
factory :line, :class => Node::Line do
|
28
|
+
children [FactoryGirl.build(:bar)]
|
29
|
+
end
|
30
|
+
|
31
|
+
factory :stanza, :class => Node::Stanza do
|
32
|
+
children [FactoryGirl.build(:line)]
|
33
|
+
end
|
34
|
+
|
35
|
+
factory :stanza_version_bar, :class => Node::Bar::StanzaVersion do
|
36
|
+
end
|
37
|
+
|
38
|
+
factory :score, :class => Node::Score do
|
39
|
+
children [FactoryGirl.build(:stanza)]
|
40
|
+
end
|
41
|
+
|
42
|
+
factory :tab, :class => Node::Tab do
|
43
|
+
children [FactoryGirl.build(:score)]
|
44
|
+
end
|
45
|
+
|
46
|
+
factory :voice, :class => Voice do
|
47
|
+
end
|
48
|
+
|
49
|
+
factory :voiced_bar, :class => Node::Bar::VoicedVersion do
|
50
|
+
end
|
51
|
+
|
52
|
+
factory :voiced_version, :class => Node::Base::VoicedVersion do
|
53
|
+
end
|
54
|
+
end
|
data/spec/lib/gitara/app_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe App do
|
4
4
|
describe "export" do
|
5
5
|
it "can convert a tab without a reused bar to lilypond" do
|
6
|
-
app =
|
6
|
+
app = FactoryGirl.build(:app)
|
7
7
|
app.invoke :export, ['examples/tab.rb'], "target-directory" => test_tmp_dir.path, "run-lilypond" => false
|
8
8
|
|
9
9
|
example = Pow('examples/tab.ly').read
|
data/spec/lib/gitara/dsl_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe Gitara do
|
|
4
4
|
describe Dsl do
|
5
5
|
describe "bar(name, &block)" do
|
6
6
|
it "should add a bar with the name" do
|
7
|
-
dsl =
|
7
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
8
8
|
dsl.node.own_children.should be_empty
|
9
9
|
|
10
10
|
dsl.bar 'Intro'
|
@@ -17,10 +17,10 @@ describe Gitara do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should add the children declared in the block to the bar" do
|
20
|
-
dsl =
|
20
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
21
21
|
dsl.node.own_children.should be_empty
|
22
22
|
|
23
|
-
note_set =
|
23
|
+
note_set = FactoryGirl.build(:note_set)
|
24
24
|
|
25
25
|
dsl.bar 'Intro' do
|
26
26
|
add note_set
|
@@ -37,10 +37,10 @@ describe Gitara do
|
|
37
37
|
|
38
38
|
describe "add(child, &block)" do
|
39
39
|
it "should add the child to the dsl's node" do
|
40
|
-
dsl =
|
40
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
41
41
|
dsl.node.own_children.should be_empty
|
42
42
|
|
43
|
-
bar =
|
43
|
+
bar = FactoryGirl.build(:bar, :name => 'Intro')
|
44
44
|
|
45
45
|
dsl.add bar
|
46
46
|
|
@@ -49,11 +49,11 @@ describe Gitara do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should add the children in the block to the child" do
|
52
|
-
dsl =
|
52
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
53
53
|
dsl.node.own_children.should be_empty
|
54
54
|
|
55
|
-
bar =
|
56
|
-
note_set =
|
55
|
+
bar = FactoryGirl.build(:bar, :children => [])
|
56
|
+
note_set = FactoryGirl.build(:note_set)
|
57
57
|
|
58
58
|
dsl.add bar do
|
59
59
|
add note_set
|
@@ -69,7 +69,7 @@ describe Gitara do
|
|
69
69
|
|
70
70
|
describe "notes(value)" do
|
71
71
|
it "should add a note set with the value" do
|
72
|
-
dsl =
|
72
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:bar, :children => []))
|
73
73
|
dsl.node.own_children.should be_empty
|
74
74
|
|
75
75
|
dsl.notes 'test'
|
@@ -81,7 +81,7 @@ describe Gitara do
|
|
81
81
|
|
82
82
|
describe "line(name, &block)" do
|
83
83
|
it "should add a line with the name" do
|
84
|
-
dsl =
|
84
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
85
85
|
dsl.node.own_children.should be_empty
|
86
86
|
|
87
87
|
dsl.line 'Intro'
|
@@ -94,10 +94,10 @@ describe Gitara do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should add the children declared in the block to the line" do
|
97
|
-
dsl =
|
97
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
98
98
|
dsl.node.own_children.should be_empty
|
99
99
|
|
100
|
-
bar =
|
100
|
+
bar = FactoryGirl.build(:bar)
|
101
101
|
|
102
102
|
dsl.line 'Intro' do
|
103
103
|
add bar
|
@@ -114,7 +114,7 @@ describe Gitara do
|
|
114
114
|
|
115
115
|
describe "add_names(o)" do
|
116
116
|
it "should add a node with o[:name] of o[:node_class] to the node" do
|
117
|
-
dsl =
|
117
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
118
118
|
dsl.node.own_children.should be_empty
|
119
119
|
|
120
120
|
dsl.add_names :names => [:Intro, :Intro], :node_class => Node::Bar
|
@@ -127,7 +127,7 @@ describe Gitara do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should add a node with nil name if the o[:names] is blank" do
|
130
|
-
dsl =
|
130
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
131
131
|
dsl.node.own_children.should be_empty
|
132
132
|
|
133
133
|
dsl.add_names :names => [], :node_class => Node::Bar
|
@@ -140,7 +140,7 @@ describe Gitara do
|
|
140
140
|
|
141
141
|
describe "score(name, &block)" do
|
142
142
|
it "should add a score with the name" do
|
143
|
-
dsl =
|
143
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
144
144
|
dsl.node.own_children.should be_empty
|
145
145
|
|
146
146
|
dsl.score
|
@@ -153,10 +153,10 @@ describe Gitara do
|
|
153
153
|
end
|
154
154
|
|
155
155
|
it "should add the children declared in the block to the score" do
|
156
|
-
dsl =
|
156
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
157
157
|
dsl.node.own_children.should be_empty
|
158
158
|
|
159
|
-
note_set =
|
159
|
+
note_set = FactoryGirl.build(:note_set)
|
160
160
|
|
161
161
|
dsl.score do
|
162
162
|
add note_set
|
@@ -172,7 +172,7 @@ describe Gitara do
|
|
172
172
|
|
173
173
|
describe "stanza(name, &block)" do
|
174
174
|
it "should add a stanza with the name" do
|
175
|
-
dsl =
|
175
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
176
176
|
dsl.node.own_children.should be_empty
|
177
177
|
|
178
178
|
dsl.stanza 'Intro'
|
@@ -185,10 +185,10 @@ describe Gitara do
|
|
185
185
|
end
|
186
186
|
|
187
187
|
it "should add the children declared in the block to the stanza" do
|
188
|
-
dsl =
|
188
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
189
189
|
dsl.node.own_children.should be_empty
|
190
190
|
|
191
|
-
line =
|
191
|
+
line = FactoryGirl.build(:line)
|
192
192
|
|
193
193
|
dsl.stanza 'Intro' do
|
194
194
|
add line
|
@@ -206,9 +206,9 @@ describe Gitara do
|
|
206
206
|
[:title, :composer, :arranger, :instrument, :midi_instrument, :tempo, :transposition].each do |property|
|
207
207
|
describe "#{property}(value)" do
|
208
208
|
it "should set the #{property} of the tab to value" do
|
209
|
-
tab =
|
209
|
+
tab = FactoryGirl.build(:tab)
|
210
210
|
|
211
|
-
dsl =
|
211
|
+
dsl = FactoryGirl.build(:dsl, :node => tab)
|
212
212
|
dsl.send property, "test"
|
213
213
|
|
214
214
|
tab.send(property).should == "test"
|
@@ -218,7 +218,7 @@ describe Gitara do
|
|
218
218
|
|
219
219
|
describe "chords(name, value)" do
|
220
220
|
it "should add a chord set with the name" do
|
221
|
-
dsl =
|
221
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
222
222
|
dsl.node.own_children.should be_empty
|
223
223
|
|
224
224
|
dsl.chords :Am, 'r4-"Am" r r r'
|
@@ -233,7 +233,7 @@ describe Gitara do
|
|
233
233
|
|
234
234
|
describe "chords(name)" do
|
235
235
|
it "should add a bar with the name" do
|
236
|
-
dsl =
|
236
|
+
dsl = FactoryGirl.build(:dsl, :node => FactoryGirl.build(:tab, :children => []))
|
237
237
|
dsl.node.own_children.should be_empty
|
238
238
|
|
239
239
|
dsl.chords :Am
|