gitara 1.0.1 → 1.2.0
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.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/CHANGELOG.markdown +6 -0
- data/README.markdown +1 -1
- data/examples/aimee-man-wise-up.ly +1 -1
- data/gitara.gemspec +3 -4
- data/lib/gitara/app.rb +3 -3
- data/lib/gitara/node/base.rb +1 -4
- data/lib/gitara/template/tab.erb +1 -1
- data/lib/gitara/utilities.rb +7 -4
- data/lib/gitara/version.rb +1 -1
- data/lib/gitara.rb +2 -2
- data/spec/factories.rb +7 -7
- data/spec/lib/gitara/app_spec.rb +4 -4
- data/spec/lib/gitara/dsl_spec.rb +112 -112
- data/spec/lib/gitara/node/alternative_spec.rb +4 -4
- data/spec/lib/gitara/node/bar/chorded_version_spec.rb +6 -6
- data/spec/lib/gitara/node/bar/stanza_version_spec.rb +5 -5
- data/spec/lib/gitara/node/bar/voiced_version_spec.rb +5 -5
- data/spec/lib/gitara/node/bar_spec.rb +20 -20
- data/spec/lib/gitara/node/base/node_version_spec.rb +19 -19
- data/spec/lib/gitara/node/base/voiced_version_spec.rb +9 -9
- data/spec/lib/gitara/node/base_spec.rb +113 -106
- data/spec/lib/gitara/node/chord_set/chorded_version_spec.rb +2 -2
- data/spec/lib/gitara/node/line_spec.rb +2 -2
- data/spec/lib/gitara/node/repeat_spec.rb +3 -3
- data/spec/lib/gitara/node/stanza_spec.rb +14 -14
- data/spec/lib/gitara/node/tab_spec.rb +25 -25
- data/spec/lib/gitara/time_signature_spec.rb +6 -6
- data/spec/lib/gitara/voice_spec.rb +33 -33
- data/spec/lib/gitara_spec.rb +4 -4
- data/spec/spec_helper.rb +6 -4
- data/spec/support/app_tester.rb +5 -5
- metadata +68 -118
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2e2826f811fba5feb695cbc7031ede9780218536fe398cd8e97bf644b4cb4da4
|
4
|
+
data.tar.gz: 074d686d39fe120c15259f1d6b58333201d49c22ef7eec7471715cbff7181474
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f9516849fe5f9d5e48f44ecaa47ec88da8e80bcd9c2524dd15157751495723ae0c37e44ab9c31d4edc094f0f13f2928ea699e4d9149de149f61ad55b011b1f3e
|
7
|
+
data.tar.gz: 8498c45c544ade9df131ae16ff9e0f9edce49b9fdfd70002678539846c4a810203fce74a4544ac84d9b8eb79685143db93da7a79b3780050992fd10cc7159713
|
data/.gitignore
CHANGED
data/CHANGELOG.markdown
CHANGED
data/README.markdown
CHANGED
@@ -10,7 +10,7 @@ To install,
|
|
10
10
|
|
11
11
|
You need [lilypond](http://lilypond.org) in order to generate pdfs and midis.
|
12
12
|
|
13
|
-
Gitara is tested on Ruby
|
13
|
+
Gitara is tested on Ruby 3.3.3 and Lilypond 2.22. Patches are welcome.
|
14
14
|
|
15
15
|
To run,
|
16
16
|
|
data/gitara.gemspec
CHANGED
@@ -18,19 +18,18 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
s.add_runtime_dependency "
|
21
|
+
s.add_runtime_dependency "activesupport"
|
22
22
|
s.add_runtime_dependency "erubis"
|
23
23
|
s.add_runtime_dependency "linguistics"
|
24
24
|
s.add_runtime_dependency "loggability"
|
25
|
-
s.add_runtime_dependency "pow"
|
26
25
|
s.add_runtime_dependency "redwood"
|
27
26
|
s.add_runtime_dependency "thor"
|
28
27
|
s.add_runtime_dependency "valuable"
|
29
28
|
|
30
|
-
s.add_development_dependency "
|
29
|
+
s.add_development_dependency "factory_bot"
|
31
30
|
s.add_development_dependency "guard"
|
32
31
|
s.add_development_dependency "guard-rspec"
|
33
|
-
s.add_development_dependency "
|
32
|
+
s.add_development_dependency "byebug"
|
34
33
|
s.add_development_dependency "rb-inotify"
|
35
34
|
s.add_development_dependency "rspec"
|
36
35
|
s.add_development_dependency "yard"
|
data/lib/gitara/app.rb
CHANGED
@@ -17,12 +17,12 @@ module Gitara
|
|
17
17
|
def export(source_path)
|
18
18
|
load source_path
|
19
19
|
tab = Gitara.tab
|
20
|
-
lilypond_name =
|
21
|
-
lilypond_path =
|
20
|
+
lilypond_name = Pathname.new(source_path).sub_ext('.ly')
|
21
|
+
lilypond_path = Pathname.new(options['target-directory']) / lilypond_name
|
22
22
|
lilypond_path.write(Gitara.render('tab', tab))
|
23
23
|
|
24
24
|
if options['run-lilypond']
|
25
|
-
`lilypond -o #{lilypond_path.parent / lilypond_path.
|
25
|
+
`lilypond -o #{lilypond_path.parent / lilypond_path.basename.sub_ext('') } #{lilypond_path}`
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
data/lib/gitara/node/base.rb
CHANGED
@@ -55,10 +55,7 @@ module Gitara
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def definition_name
|
58
|
-
name.to_s.
|
59
|
-
gsub(/\W/, '_').
|
60
|
-
gsub(/\d+/){|s| Utilities.id_as_word(s)}.
|
61
|
-
camelize
|
58
|
+
name.to_s.gsub(/\d+/){ |s| Utilities.id_as_word(s) }.split(/\W/).map(&:camelize).join
|
62
59
|
end
|
63
60
|
|
64
61
|
def definition_of?(target)
|
data/lib/gitara/template/tab.erb
CHANGED
data/lib/gitara/utilities.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
module Gitara
|
2
2
|
module Utilities
|
3
|
+
class PathnameDoesNotExist < StandardError
|
4
|
+
end
|
5
|
+
|
3
6
|
def self.id_as_word(id)
|
4
7
|
id.en.numwords.gsub('-', '_').camelize
|
5
8
|
end
|
@@ -8,11 +11,11 @@ module Gitara
|
|
8
11
|
"#{object.class}(" + attributes.collect{|a| "#{a}=#{object.send(a).inspect}"}.join(', ') + ")"
|
9
12
|
end
|
10
13
|
|
11
|
-
def self.read!(
|
12
|
-
if
|
13
|
-
|
14
|
+
def self.read!(pathname)
|
15
|
+
if pathname.exist?
|
16
|
+
pathname.read
|
14
17
|
else
|
15
|
-
raise
|
18
|
+
raise PathnameDoesNotExist, "#{pathname} does not exist"
|
16
19
|
end
|
17
20
|
end
|
18
21
|
end
|
data/lib/gitara/version.rb
CHANGED
data/lib/gitara.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "active_support/inflector"
|
2
2
|
require "erubis"
|
3
3
|
require "linguistics"
|
4
|
-
require "
|
4
|
+
require "pathname"
|
5
5
|
require "redwood"
|
6
6
|
require "thor"
|
7
7
|
require "valuable"
|
@@ -41,7 +41,7 @@ module Gitara
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.render(path, object)
|
44
|
-
template = (
|
44
|
+
template = Pathname.new(__FILE__).parent / "gitara/template/#{path}.erb"
|
45
45
|
erb = Erubis::Eruby.new(Utilities.read!(template))
|
46
46
|
erb.evaluate(object)
|
47
47
|
end
|
data/spec/factories.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :note_set, :class => Node::NoteSet do
|
3
3
|
end
|
4
4
|
|
@@ -9,7 +9,7 @@ FactoryGirl.define do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
factory :bar, :class => Node::Bar do
|
12
|
-
children [
|
12
|
+
children { [FactoryBot.build(:note_set)] }
|
13
13
|
end
|
14
14
|
|
15
15
|
factory :base, :class => Node::Base do
|
@@ -28,25 +28,25 @@ FactoryGirl.define do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
factory :line, :class => Node::Line do
|
31
|
-
children [
|
31
|
+
children { [FactoryBot.build(:bar)] }
|
32
32
|
end
|
33
33
|
|
34
34
|
factory :repeat, :class => Node::Repeat do
|
35
35
|
end
|
36
36
|
|
37
37
|
factory :stanza, :class => Node::Stanza do
|
38
|
-
children [
|
38
|
+
children { [FactoryBot.build(:line)] }
|
39
39
|
end
|
40
40
|
|
41
41
|
factory :stanza_version_bar, :class => Node::Bar::StanzaVersion do
|
42
42
|
end
|
43
43
|
|
44
44
|
factory :score, :class => Node::Score do
|
45
|
-
children [
|
45
|
+
children { [FactoryBot.build(:stanza)] }
|
46
46
|
end
|
47
47
|
|
48
48
|
factory :tab, :class => Node::Tab do
|
49
|
-
children [
|
49
|
+
children { [FactoryBot.build(:score)] }
|
50
50
|
end
|
51
51
|
|
52
52
|
factory :time_signature, :class => TimeSignature do
|
@@ -60,4 +60,4 @@ FactoryGirl.define do
|
|
60
60
|
|
61
61
|
factory :voiced_version, :class => Node::Base::VoicedVersion do
|
62
62
|
end
|
63
|
-
end
|
63
|
+
end
|
data/spec/lib/gitara/app_spec.rb
CHANGED
@@ -4,18 +4,18 @@ describe Gitara::App do
|
|
4
4
|
describe "#export" do
|
5
5
|
let(:app_test){AppTester.new(:run_lilypond => run_lilypond?)}
|
6
6
|
|
7
|
-
|
7
|
+
Pathname.new('examples').glob('/*.rb').each do |path|
|
8
8
|
it "can convert #{path.name(false)} to lilypond" do
|
9
9
|
app_test.name = path.name(false)
|
10
10
|
app_test.run
|
11
|
-
app_test.actual.
|
11
|
+
expect(app_test.actual).to eq(app_test.expected)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
after do
|
16
16
|
if run_lilypond?
|
17
|
-
app_test.
|
18
|
-
app_test.
|
17
|
+
expect(app_test).to be_midi_generated
|
18
|
+
expect(app_test).to be_pdf_generated
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|