choan-lilypond_generators 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +37 -0
- data/app_generators/lilypond_score/USAGE +0 -0
- data/app_generators/lilypond_score/lilypond_score_generator.rb +61 -0
- data/app_generators/lilypond_score/templates/defs.lyi +28 -0
- data/app_generators/lilypond_score/templates/header.lyi +15 -0
- data/app_generators/lilypond_score/templates/instrument.ly +13 -0
- data/app_generators/lilypond_score/templates/instrument.lyi +11 -0
- data/app_generators/lilypond_score/templates/part.lyi +24 -0
- data/app_generators/lilypond_score/templates/score_mvt.ly +39 -0
- data/bin/newly +13 -0
- data/lib/lilypond_generators.rb +5 -0
- data/tasks/templates/gemspec.erb +23 -0
- metadata +81 -0
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require "rake/clean"
|
2
|
+
require "lib/lilypond_generators.rb"
|
3
|
+
|
4
|
+
PROJECT_NAME = "lilypond_generators"
|
5
|
+
PROJECT_VERSION = LilypondGenerators::VERSION
|
6
|
+
PROJECT_DESCRIPTION = "Rubigen based generators for lilypond projects"
|
7
|
+
PROJECT_SUMMARY = "Rubigen based generators for lilypond projects"
|
8
|
+
PROJECT_HAS_RDOC = false
|
9
|
+
PROJECT_AUTHORS = [ "Choan Gálvez" ]
|
10
|
+
PROJECT_EMAIL = "choan.galvez@gmail.com"
|
11
|
+
PROJECT_HOMEPAGE = "http://github.com/choan/#{PROJECT_NAME}"
|
12
|
+
PROJECT_EXECUTABLES = %w[newly]
|
13
|
+
|
14
|
+
|
15
|
+
CLEAN.include("*.gem")
|
16
|
+
|
17
|
+
task :default
|
18
|
+
|
19
|
+
task :gemspec do
|
20
|
+
require "erb"
|
21
|
+
PROJECT_FILES_STR = FileList['**/**'].exclude(*%w[*.gemspec]).join(' ')
|
22
|
+
File.open("#{PROJECT_NAME}.gemspec", "w") do |f|
|
23
|
+
f.puts ERB.new(File.read("tasks/templates/gemspec.erb")).result
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
task :install => [ :uninstall, :build ] do
|
28
|
+
sh "sudo gem install #{PROJECT_NAME}-#{PROJECT_VERSION}.gem"
|
29
|
+
end
|
30
|
+
|
31
|
+
task :build => [ :gemspec ] do
|
32
|
+
sh "gem build #{PROJECT_NAME}.gemspec"
|
33
|
+
end
|
34
|
+
|
35
|
+
task :uninstall do
|
36
|
+
sh "sudo gem uninstall #{PROJECT_NAME}"
|
37
|
+
end
|
File without changes
|
@@ -0,0 +1,61 @@
|
|
1
|
+
class LilypondScoreGenerator < RubiGen::Base
|
2
|
+
|
3
|
+
attr_accessor :score_dirname
|
4
|
+
attr_accessor :score_title
|
5
|
+
attr_accessor :instruments
|
6
|
+
attr_accessor :composer
|
7
|
+
attr_accessor :movements
|
8
|
+
attr_accessor :version_str
|
9
|
+
|
10
|
+
def initialize(runtime_args, runtime_options = {})
|
11
|
+
self.instruments = []
|
12
|
+
self.movements = 1
|
13
|
+
super
|
14
|
+
usage if args.empty?
|
15
|
+
@destination_root = args.shift
|
16
|
+
self.score_dirname = File.basename(File.expand_path(@destination_root))
|
17
|
+
self.score_title = score_dirname.camelize
|
18
|
+
end
|
19
|
+
|
20
|
+
def manifest
|
21
|
+
|
22
|
+
self.instruments = ['instrument'] if self.instruments.empty?
|
23
|
+
|
24
|
+
record do |m|
|
25
|
+
|
26
|
+
m.directory ''
|
27
|
+
m.template 'header.lyi', 'header.lyi'
|
28
|
+
m.template 'defs.lyi', 'defs.lyi'
|
29
|
+
m.template 'part.lyi', 'part.lyi'
|
30
|
+
|
31
|
+
instruments.each do |instrument|
|
32
|
+
m.template 'instrument.ly', "#{instrument}.ly", :assigns => { :instrument => instrument }
|
33
|
+
m.template 'instrument.lyi', "#{instrument}.lyi", :assigns => { :instrument => instrument }
|
34
|
+
end
|
35
|
+
|
36
|
+
(0...movements).each do |movement|
|
37
|
+
mvt = "Mvt" + roman(movement)
|
38
|
+
m.template 'score_mvt.ly', "score_mvt_#{roman(movement).downcase }.ly", :assigns => { :mvt => mvt }
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
def roman n
|
46
|
+
%w[I II III IV V VI][n]
|
47
|
+
end
|
48
|
+
|
49
|
+
def version_str
|
50
|
+
'\version "2.12.2"'
|
51
|
+
end
|
52
|
+
|
53
|
+
protected
|
54
|
+
|
55
|
+
def add_options!(opts)
|
56
|
+
opts.on("-a", "--composer=COMPOSER", String) { |v| self.composer = v }
|
57
|
+
opts.on("-i", "--instrument=INSTRUMENT", String) { |v| self.instruments.push(v) }
|
58
|
+
opts.on("-m", "--movements=MOVEMENTS", Integer) { |v| self.movements = v }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<%= version_str %>
|
2
|
+
|
3
|
+
rMark = #(define-music-function (parser location markp) (string?)
|
4
|
+
#{
|
5
|
+
\mark \markup { \box \bold $markp }
|
6
|
+
#})
|
7
|
+
|
8
|
+
<% (0...movements).each do |movement| -%>
|
9
|
+
<% mvt = "Mvt" + roman(movement) -%>
|
10
|
+
<%= mvt %> = ""
|
11
|
+
|
12
|
+
rehearsalMarks<%= mvt %> = {
|
13
|
+
|
14
|
+
}
|
15
|
+
|
16
|
+
outline<%= mvt %> = {
|
17
|
+
<<
|
18
|
+
\rehearsalMarks<%= mvt %>
|
19
|
+
{
|
20
|
+
\time 4/4
|
21
|
+
\tempo 4 = 120
|
22
|
+
|
23
|
+
\bar "|."
|
24
|
+
}
|
25
|
+
>>
|
26
|
+
|
27
|
+
}
|
28
|
+
<% end -%>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= version_str %>
|
2
|
+
|
3
|
+
\header
|
4
|
+
{
|
5
|
+
title = \markup{ <%= score_title %> }
|
6
|
+
composer = "<%= composer %>"
|
7
|
+
instrument = \instrument
|
8
|
+
% subtitle = ""
|
9
|
+
% opus = ""
|
10
|
+
% copyright = ""
|
11
|
+
% date = ""
|
12
|
+
% source = ""
|
13
|
+
% footer = ""
|
14
|
+
% tagline = ""
|
15
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= version_str %>
|
2
|
+
|
3
|
+
\include "<%= instrument %>.lyi"
|
4
|
+
|
5
|
+
instrument = "<%= instrument.capitalize %>"
|
6
|
+
|
7
|
+
<% (0...movements).each do |movement| -%>
|
8
|
+
<% mvt = "Mvt" + roman(movement) -%>
|
9
|
+
notes<%= mvt %> = \<%= instrument %><%= mvt %>
|
10
|
+
|
11
|
+
<% end -%>
|
12
|
+
|
13
|
+
\include "part.lyi"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= version_str %>
|
2
|
+
|
3
|
+
\include "defs.lyi"
|
4
|
+
|
5
|
+
\book
|
6
|
+
{
|
7
|
+
\include "header.lyi"
|
8
|
+
|
9
|
+
<% (0...movements).each do |movement| -%>
|
10
|
+
<% mvt = "Mvt" + roman(movement) %>
|
11
|
+
\score
|
12
|
+
{
|
13
|
+
\new Staff
|
14
|
+
{
|
15
|
+
<< \keepWithTag #'part \notes<%= mvt %> \outline<%= mvt %> >>
|
16
|
+
}
|
17
|
+
\header { piece = \<%= mvt %> }
|
18
|
+
\layout {
|
19
|
+
|
20
|
+
}
|
21
|
+
}
|
22
|
+
<% end %>
|
23
|
+
}
|
24
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<%= version_str %>
|
2
|
+
|
3
|
+
\version "2.12.2"
|
4
|
+
|
5
|
+
\include "defs.lyi"
|
6
|
+
<% instruments.each do |ins| -%>
|
7
|
+
\include "<%= ins %>.lyi"
|
8
|
+
<% end -%>
|
9
|
+
|
10
|
+
instrument = ""
|
11
|
+
|
12
|
+
\book {
|
13
|
+
|
14
|
+
\include "header.lyi"
|
15
|
+
|
16
|
+
\score {
|
17
|
+
<<
|
18
|
+
<% instruments.each do |instrument| %>
|
19
|
+
\new Staff {
|
20
|
+
\set Staff.instrumentName = "<%= instrument.capitalize %>"
|
21
|
+
% \set Staff.shortInstrumentName = ""
|
22
|
+
% \set Staff.midiInstrument = ""
|
23
|
+
<%- if instrument == instruments.last -%>
|
24
|
+
<< \<%= instrument %><%= mvt %> \keepWithTag #'score \outline<%= mvt %> >>
|
25
|
+
<%- else -%>
|
26
|
+
\<%= instrument %><%= mvt %> \keepWithTag #'score
|
27
|
+
<%- end -%>
|
28
|
+
}
|
29
|
+
<% end %>
|
30
|
+
>>
|
31
|
+
|
32
|
+
\header { piece = \<%= mvt %> }
|
33
|
+
|
34
|
+
\layout {
|
35
|
+
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
}
|
data/bin/newly
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubigen'
|
4
|
+
|
5
|
+
# if %w(-v --version).include? ARGV.first
|
6
|
+
# require 'newgem/version'
|
7
|
+
# puts "#{File.basename($0)} #{Newgem::VERSION}"
|
8
|
+
# exit(0)
|
9
|
+
# end
|
10
|
+
|
11
|
+
require 'rubigen/scripts/generate'
|
12
|
+
RubiGen::Base.use_application_sources!
|
13
|
+
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'lilypond_score')
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{<%= PROJECT_NAME %>}
|
5
|
+
s.version = "<%= PROJECT_VERSION %>"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Choan Gálvez"]
|
9
|
+
s.date = %q{2009-03-31}
|
10
|
+
s.description = %q{<%= PROJECT_DESCRIPTION %>}
|
11
|
+
s.email = %q{<%= PROJECT_EMAIL %>}
|
12
|
+
s.files = %w[<%= PROJECT_FILES_STR %>]
|
13
|
+
s.executables = %w[<%= PROJECT_EXECUTABLES.join(' ') %> ]
|
14
|
+
s.has_rdoc = <%= PROJECT_HAS_RDOC %>
|
15
|
+
s.homepage = %q{<%= PROJECT_HOMEPAGE %>}
|
16
|
+
s.bindir = "bin"
|
17
|
+
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
# s.rubyforge_project = %q{lilypond_generators}
|
20
|
+
s.rubygems_version = %q{1.3.0}
|
21
|
+
s.summary = %q{<%= PROJECT_SUMMARY %>}
|
22
|
+
s.add_dependency("rubigen")
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: choan-lilypond_generators
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "Choan G\xC3\xA1lvez"
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-03-31 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rubigen
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description: Rubigen based generators for lilypond projects
|
26
|
+
email: choan.galvez@gmail.com
|
27
|
+
executables:
|
28
|
+
- newly
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files: []
|
32
|
+
|
33
|
+
files:
|
34
|
+
- app_generators
|
35
|
+
- app_generators/lilypond_score
|
36
|
+
- app_generators/lilypond_score/lilypond_score_generator.rb
|
37
|
+
- app_generators/lilypond_score/templates
|
38
|
+
- app_generators/lilypond_score/templates/defs.lyi
|
39
|
+
- app_generators/lilypond_score/templates/header.lyi
|
40
|
+
- app_generators/lilypond_score/templates/instrument.ly
|
41
|
+
- app_generators/lilypond_score/templates/instrument.lyi
|
42
|
+
- app_generators/lilypond_score/templates/part.lyi
|
43
|
+
- app_generators/lilypond_score/templates/score_mvt.ly
|
44
|
+
- app_generators/lilypond_score/USAGE
|
45
|
+
- bin
|
46
|
+
- bin/newly
|
47
|
+
- lib
|
48
|
+
- lib/lilypond_generators.rb
|
49
|
+
- Rakefile
|
50
|
+
- tasks
|
51
|
+
- tasks/templates
|
52
|
+
- tasks/templates/gemspec.erb
|
53
|
+
has_rdoc: false
|
54
|
+
homepage: http://github.com/choan/lilypond_generators
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options:
|
57
|
+
- --inline-source
|
58
|
+
- --charset=UTF-8
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.2.0
|
77
|
+
signing_key:
|
78
|
+
specification_version: 2
|
79
|
+
summary: Rubigen based generators for lilypond projects
|
80
|
+
test_files: []
|
81
|
+
|