gisikw-lilypad 0.0.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.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +30 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/generators/lilypad/lilypad_generator.rb +61 -0
- data/generators/lilypad/templates/lilypad.rb +106 -0
- data/generators/lilypad/templates/lilypad_staff.rb +15 -0
- data/generators/lilypad/templates/lilypads_controller.rb +55 -0
- data/generators/lilypad/templates/migration.rb +37 -0
- data/generators/lilypad/templates/mime_types.rb +11 -0
- data/generators/lilypad/templates/views/_form.html.erb +35 -0
- data/generators/lilypad/templates/views/edit.html.erb +5 -0
- data/generators/lilypad/templates/views/index.html.erb +7 -0
- data/generators/lilypad/templates/views/new.html.erb +5 -0
- data/generators/lilypad/templates/views/show.html.erb +31 -0
- data/lib/lilypad.rb +0 -0
- data/lilypad.gemspec +65 -0
- data/test/lilypad_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +85 -0
    
        data/.document
    ADDED
    
    
    
        data/LICENSE
    ADDED
    
    | @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            Copyright (c) 2009 
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining
         | 
| 4 | 
            +
            a copy of this software and associated documentation files (the
         | 
| 5 | 
            +
            "Software"), to deal in the Software without restriction, including
         | 
| 6 | 
            +
            without limitation the rights to use, copy, modify, merge, publish,
         | 
| 7 | 
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         | 
| 8 | 
            +
            permit persons to whom the Software is furnished to do so, subject to
         | 
| 9 | 
            +
            the following conditions:
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            The above copyright notice and this permission notice shall be
         | 
| 12 | 
            +
            included in all copies or substantial portions of the Software.
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         | 
| 15 | 
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         | 
| 16 | 
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         | 
| 17 | 
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         | 
| 18 | 
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         | 
| 19 | 
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         | 
| 20 | 
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
    
        data/README.rdoc
    ADDED
    
    | @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            = Lilypad
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Lilypad is a RubyGem that improves interaction with the Lilypond music scoring software. This is very much in its early stages.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            == script/generate lilypad model
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            Running
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              ruby script/generate lilypad model
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            will generate the migrations, models, and controllers for a Lilypad resource. A Lilypad is a Rails ActiveRecord object which can be interpreted by Lilypond to generate sheet music in PDF, PNG, or Midi form. This does require that you have the lilypond command-line utility installed.
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            == WAV and MP3 Generation
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            If you have timidity and lame installed, you can also generate wav and mp3 files from the generated Midi file. The generated Lilypad has optional methods to support this.
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            == Accessing the Lilypad resouce
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            The generated resource respond to the following method calls:
         | 
| 20 | 
            +
             
         | 
| 21 | 
            +
              to_ly # Lilypond file format
         | 
| 22 | 
            +
              to_png(page)
         | 
| 23 | 
            +
              to_pdf
         | 
| 24 | 
            +
              to_midi
         | 
| 25 | 
            +
              to_wav
         | 
| 26 | 
            +
              to_mp3
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            == Copyright
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            Copyright (c) 2009 Kevin W. Gisi. See LICENSE for details.
         | 
    
        data/Rakefile
    ADDED
    
    | @@ -0,0 +1,56 @@ | |
| 1 | 
            +
            require 'rubygems'
         | 
| 2 | 
            +
            require 'rake'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            begin
         | 
| 5 | 
            +
              require 'jeweler'
         | 
| 6 | 
            +
              Jeweler::Tasks.new do |gem|
         | 
| 7 | 
            +
                gem.name = "lilypad"
         | 
| 8 | 
            +
                gem.summary = %Q{TODO: one-line summary of your gem}
         | 
| 9 | 
            +
                gem.description = %Q{TODO: longer description of your gem}
         | 
| 10 | 
            +
                gem.email = "kevin.gisi@gmail.com"
         | 
| 11 | 
            +
                gem.homepage = "http://github.com/gisikw/lilypad"
         | 
| 12 | 
            +
                gem.authors = ["Kevin W. Gisi"]
         | 
| 13 | 
            +
                gem.add_development_dependency "thoughtbot-shoulda"
         | 
| 14 | 
            +
                # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
            rescue LoadError
         | 
| 17 | 
            +
              puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
         | 
| 18 | 
            +
            end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            require 'rake/testtask'
         | 
| 21 | 
            +
            Rake::TestTask.new(:test) do |test|
         | 
| 22 | 
            +
              test.libs << 'lib' << 'test'
         | 
| 23 | 
            +
              test.pattern = 'test/**/*_test.rb'
         | 
| 24 | 
            +
              test.verbose = true
         | 
| 25 | 
            +
            end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            begin
         | 
| 28 | 
            +
              require 'rcov/rcovtask'
         | 
| 29 | 
            +
              Rcov::RcovTask.new do |test|
         | 
| 30 | 
            +
                test.libs << 'test'
         | 
| 31 | 
            +
                test.pattern = 'test/**/*_test.rb'
         | 
| 32 | 
            +
                test.verbose = true
         | 
| 33 | 
            +
              end
         | 
| 34 | 
            +
            rescue LoadError
         | 
| 35 | 
            +
              task :rcov do
         | 
| 36 | 
            +
                abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
         | 
| 37 | 
            +
              end
         | 
| 38 | 
            +
            end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            task :test => :check_dependencies
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            task :default => :test
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            require 'rake/rdoctask'
         | 
| 45 | 
            +
            Rake::RDocTask.new do |rdoc|
         | 
| 46 | 
            +
              if File.exist?('VERSION')
         | 
| 47 | 
            +
                version = File.read('VERSION')
         | 
| 48 | 
            +
              else
         | 
| 49 | 
            +
                version = ""
         | 
| 50 | 
            +
              end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
              rdoc.rdoc_dir = 'rdoc'
         | 
| 53 | 
            +
              rdoc.title = "lilypad #{version}"
         | 
| 54 | 
            +
              rdoc.rdoc_files.include('README*')
         | 
| 55 | 
            +
              rdoc.rdoc_files.include('lib/**/*.rb')
         | 
| 56 | 
            +
            end
         | 
    
        data/VERSION
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            0.1.0
         | 
| @@ -0,0 +1,61 @@ | |
| 1 | 
            +
            class LilypadGenerator < Rails::Generator::NamedBase
         | 
| 2 | 
            +
             | 
| 3 | 
            +
              attr_reader       :object_name,
         | 
| 4 | 
            +
                                :table_name,
         | 
| 5 | 
            +
                                :model_file_name,
         | 
| 6 | 
            +
                                :controller_name,
         | 
| 7 | 
            +
                                :controller_file_name,
         | 
| 8 | 
            +
                                :staff_class_name,
         | 
| 9 | 
            +
                                :staff_table_name,
         | 
| 10 | 
            +
                                :staff_model_file_name,
         | 
| 11 | 
            +
                                :staff_controller_name,
         | 
| 12 | 
            +
                                :staff_controller_file_name
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              def initialize(runtime_args, runtime_options = {})
         | 
| 15 | 
            +
                super
         | 
| 16 | 
            +
                @class_name = @class_name.singularize
         | 
| 17 | 
            +
                @object_name = @class_name.downcase
         | 
| 18 | 
            +
                @table_name = @class_name.tableize
         | 
| 19 | 
            +
                @model_file_name = "#{@table_name.singularize}.rb"
         | 
| 20 | 
            +
                @controller_name = "#{@class_name.pluralize}Controller"
         | 
| 21 | 
            +
                @controller_file_name = "#{@controller_name.tableize.singularize}.rb"
         | 
| 22 | 
            +
                @staff_class_name = "#{@class_name}Staff"
         | 
| 23 | 
            +
                @staff_table_name = @staff_class_name.tableize
         | 
| 24 | 
            +
                @staff_model_file_name = "#{@staff_table_name.singularize}.rb"
         | 
| 25 | 
            +
                @staff_controller_name = "#{@staff_class_name.pluralize}Controller"
         | 
| 26 | 
            +
                @staff_controller_file_name = "#{@staff_controller_name.tableize}.rb"
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              def manifest
         | 
| 30 | 
            +
                record do |m|
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  puts "Generating Lilypad named #{@class_name}"
         | 
| 33 | 
            +
                  m.migration_template 'migration.rb', 'db/migrate', :assigns => {:migration_name => "Create#{@class_name.pluralize}"}, 
         | 
| 34 | 
            +
                    :migration_file_name => "create_#{@table_name}"
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  m.directory "app/models"
         | 
| 37 | 
            +
                  m.template "lilypad.rb", "app/models/#{@model_file_name}"
         | 
| 38 | 
            +
                  m.template "lilypad_staff.rb", "app/models/#{@staff_model_file_name}"
         | 
| 39 | 
            +
                  m.directory "app/controllers"
         | 
| 40 | 
            +
                  m.template "lilypads_controller.rb", "app/controllers/#{@controller_file_name}"
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                  m.directory "app/views/#{@table_name}"
         | 
| 43 | 
            +
                  m.template "views/index.html.erb","app/views/#{@table_name}/index.html.erb"
         | 
| 44 | 
            +
                  m.template "views/_form.html.erb","app/views/#{@table_name}/_form.html.erb"
         | 
| 45 | 
            +
                  m.template "views/edit.html.erb","app/views/#{@table_name}/edit.html.erb"
         | 
| 46 | 
            +
                  m.template "views/new.html.erb","app/views/#{@table_name}/new.html.erb"
         | 
| 47 | 
            +
                  m.template "views/show.html.erb","app/views/#{@table_name}/show.html.erb"
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                  m.route_resources @table_name
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                  File.open("config/initializers/mime_types.rb","a"){|f|f.write(%Q{
         | 
| 52 | 
            +
            Mime::Type.register "audio/midi", :midi
         | 
| 53 | 
            +
            Mime::Type.register "application/pdf", :pdf
         | 
| 54 | 
            +
            Mime::Type.register "image/png", :png
         | 
| 55 | 
            +
            Mime::Type.register "audio/wav", :wav
         | 
| 56 | 
            +
            Mime::Type.register "audio/mpeg", :mp3
         | 
| 57 | 
            +
            Mime::Type.register "text/x-lilypond", :ly})}
         | 
| 58 | 
            +
                end
         | 
| 59 | 
            +
              end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
            end
         | 
| @@ -0,0 +1,106 @@ | |
| 1 | 
            +
            class <%= class_name %> < ActiveRecord::Base
         | 
| 2 | 
            +
             | 
| 3 | 
            +
              HEADER_PARAMS = ["title","subtitle","subsubtitle","dedication","poet","instrument","composer","meter","arranger","piece","opus","breakbefore","copyright","tagline"]
         | 
| 4 | 
            +
              DEFAULT_VERSION = "2.12.1"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              has_many :staves, :class_name => "<%= staff_class_name %>"
         | 
| 7 | 
            +
              accepts_nested_attributes_for :staves
         | 
| 8 | 
            +
              validates_presence_of :version, :title
         | 
| 9 | 
            +
              before_validation :set_version
         | 
| 10 | 
            +
              after_save :clear_cache
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              def ly_notation
         | 
| 13 | 
            +
            %Q{
         | 
| 14 | 
            +
            \\version "#{self.version}"
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            \\header {
         | 
| 17 | 
            +
              #{HEADER_PARAMS.collect{|x|[x,self.send(x)]}.reject{|x|x[1].blank?}.collect{|x|"#{x[0]} = \"#{x[1]}\""}.join("\r\n  ")}
         | 
| 18 | 
            +
            }
         | 
| 19 | 
            +
            #{self.staves.collect{|x|x.to_ly}.join("\r\n")}
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            \\score {
         | 
| 22 | 
            +
              \\new PianoStaff <<
         | 
| 23 | 
            +
                \\set PianoStaff.instrumentName = #"Piano"
         | 
| 24 | 
            +
                #{self.staves.collect{|x|"\\new Staff = \"#{x.title}\" \\#{x.title}"}.join("\r\n    ")}
         | 
| 25 | 
            +
              >>
         | 
| 26 | 
            +
              \\layout { }
         | 
| 27 | 
            +
              \\midi { }
         | 
| 28 | 
            +
            }}
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
              def to_ly
         | 
| 32 | 
            +
                file = File.join(self.directory,self.filename)
         | 
| 33 | 
            +
                write_ly unless File.exist?(file)
         | 
| 34 | 
            +
                file
         | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
              def to_png(page=1)
         | 
| 38 | 
            +
                single_file = File.join(self.directory,self.filename(:png))
         | 
| 39 | 
            +
                multiple_file = File.join(self.directory,self.filename("-page#{page}.png"))
         | 
| 40 | 
            +
                process_ly unless File.exist?(multiple_file) || (page == 1 && File.exist?(single_file))
         | 
| 41 | 
            +
                File.exist?(single_file) ? single_file : multiple_file
         | 
| 42 | 
            +
              end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
              def to_pdf
         | 
| 45 | 
            +
                file = File.join(self.directory,self.filename(:pdf))
         | 
| 46 | 
            +
                self.process_ly unless File.exist?(file)
         | 
| 47 | 
            +
                file
         | 
| 48 | 
            +
              end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
              def to_midi
         | 
| 51 | 
            +
                file = File.join(self.directory,self.filename(:midi))
         | 
| 52 | 
            +
                self.process_ly unless File.exist?(file)
         | 
| 53 | 
            +
                file
         | 
| 54 | 
            +
              end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
              def to_wav
         | 
| 57 | 
            +
                file = File.join(self.directory,self.filename(:wav))
         | 
| 58 | 
            +
                self.build_wav unless File.exist?(file)
         | 
| 59 | 
            +
                file
         | 
| 60 | 
            +
              end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
              def to_mp3
         | 
| 63 | 
            +
                file = File.join(self.directory,self.filename(:mp3))
         | 
| 64 | 
            +
                self.build_mp3 unless File.exist?(file)
         | 
| 65 | 
            +
                file
         | 
| 66 | 
            +
              end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
              def write_ly
         | 
| 69 | 
            +
                FileUtils.mkdir_p self.directory
         | 
| 70 | 
            +
                File.open(File.join(self.directory,self.filename),"w"){|f|f.write(self.ly_notation)}
         | 
| 71 | 
            +
              end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
              def process_ly(use_cached=false)
         | 
| 74 | 
            +
                write_ly unless use_cached && File.exist?(File.join(self.directory,self.filename))
         | 
| 75 | 
            +
                `cd #{self.directory} && lilypond --formats=pdf,png #{self.filename}`
         | 
| 76 | 
            +
              end
         | 
| 77 | 
            +
             | 
| 78 | 
            +
              def build_wav(use_cached=false)
         | 
| 79 | 
            +
                self.process_ly unless use_cached && File.exist?(File.join(self.directory,self.filename(:midi)))
         | 
| 80 | 
            +
                `cd #{self.directory} && timidity -Ow #{self.filename(:midi)}`
         | 
| 81 | 
            +
              end
         | 
| 82 | 
            +
             | 
| 83 | 
            +
              def build_mp3(use_cached=false)
         | 
| 84 | 
            +
                self.build_wav unless use_cached && File.exist?(File.join(self.directory,self.filename(:wav)))
         | 
| 85 | 
            +
                `cd #{self.directory} && lame #{self.filename(:wav)} #{self.filename(:mp3)}`
         | 
| 86 | 
            +
              end
         | 
| 87 | 
            +
             | 
| 88 | 
            +
              protected
         | 
| 89 | 
            +
             | 
| 90 | 
            +
              def filename(extension=".ly")
         | 
| 91 | 
            +
                (self.title.gsub(/[^a-zA-Z0-9]/,"")+(extension.class == Symbol ? ".#{extension.to_s}" : extension)).downcase
         | 
| 92 | 
            +
              end
         | 
| 93 | 
            +
             | 
| 94 | 
            +
              def directory
         | 
| 95 | 
            +
                "lilypond_files/#{self.id}"
         | 
| 96 | 
            +
              end
         | 
| 97 | 
            +
             | 
| 98 | 
            +
              def clear_cache
         | 
| 99 | 
            +
                FileUtils.rm_rf(self.directory)
         | 
| 100 | 
            +
              end
         | 
| 101 | 
            +
             | 
| 102 | 
            +
              def set_version
         | 
| 103 | 
            +
                self.version = <%= class_name %>::DEFAULT_VERSION if self.version.blank?
         | 
| 104 | 
            +
              end
         | 
| 105 | 
            +
             | 
| 106 | 
            +
            end
         | 
| @@ -0,0 +1,55 @@ | |
| 1 | 
            +
            class <%= controller_name %> < ApplicationController
         | 
| 2 | 
            +
             | 
| 3 | 
            +
              before_filter :find_<%= object_name %>, :only => [:show,:edit,:update,:destroy]
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              def index
         | 
| 6 | 
            +
                @<%= table_name %> = <%= class_name %>.all
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              def new
         | 
| 10 | 
            +
                @<%= object_name %> = <%= class_name %>.new
         | 
| 11 | 
            +
                @<%= object_name %>.staves << <%= staff_class_name %>.new(:title => "upper")
         | 
| 12 | 
            +
                @<%= object_name %>.staves << <%= staff_class_name %>.new(:title => "lower")
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              def create
         | 
| 16 | 
            +
                @<%= object_name %> = <%= class_name %>.new(params[:<%= object_name %>])
         | 
| 17 | 
            +
                if @<%= object_name %>.save
         | 
| 18 | 
            +
                  redirect_to <%= table_name %>_url
         | 
| 19 | 
            +
                else
         | 
| 20 | 
            +
                  render :action => "new"
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              def update
         | 
| 25 | 
            +
                if @<%= object_name %>.update_attributes(params[:<%= object_name %>])
         | 
| 26 | 
            +
                  redirect_to <%= table_name %>_url(@<%= object_name %>)
         | 
| 27 | 
            +
                else
         | 
| 28 | 
            +
                  render :action => "edit"
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
              def destroy
         | 
| 33 | 
            +
                @<%= object_name %>.destroy
         | 
| 34 | 
            +
                redirect_to <%= table_name %>_url
         | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
              def show
         | 
| 38 | 
            +
                respond_to do |format|
         | 
| 39 | 
            +
                  format.html
         | 
| 40 | 
            +
                  format.png { render :file => @<%= object_name %>.to_png(params[:page]||1) }
         | 
| 41 | 
            +
                  format.pdf { render :file => @<%= object_name %>.to_pdf }
         | 
| 42 | 
            +
                  format.ly {send_file(@<%= object_name %>.to_ly)}
         | 
| 43 | 
            +
                  format.midi {send_file(@<%= object_name %>.to_midi)}
         | 
| 44 | 
            +
                  format.wav {send_file(@<%= object_name %>.to_wav)}
         | 
| 45 | 
            +
                  format.mp3 {send_file(@<%= object_name %>.to_mp3)}
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
              protected
         | 
| 50 | 
            +
             | 
| 51 | 
            +
              def find_<%= object_name %>
         | 
| 52 | 
            +
                @<%= object_name %> = <%= class_name %>.find(params[:id])
         | 
| 53 | 
            +
              end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            end
         | 
| @@ -0,0 +1,37 @@ | |
| 1 | 
            +
            class <%= migration_name %> < ActiveRecord::Migration
         | 
| 2 | 
            +
              def self.up
         | 
| 3 | 
            +
                create_table "<%= table_name %>", :force => true do |t|
         | 
| 4 | 
            +
                  t.column :version,      :string
         | 
| 5 | 
            +
                  t.column :dedication,   :string
         | 
| 6 | 
            +
                  t.column :title,        :string
         | 
| 7 | 
            +
                  t.column :subtitle,     :string
         | 
| 8 | 
            +
                  t.column :subsubtitle,  :string
         | 
| 9 | 
            +
                  t.column :poet,         :string
         | 
| 10 | 
            +
                  t.column :instrument,   :string
         | 
| 11 | 
            +
                  t.column :composer,     :string
         | 
| 12 | 
            +
                  t.column :meter,        :string
         | 
| 13 | 
            +
                  t.column :arranger,     :string
         | 
| 14 | 
            +
                  t.column :piece,        :string
         | 
| 15 | 
            +
                  t.column :opus,         :string
         | 
| 16 | 
            +
                  t.column :breakbefore,  :string
         | 
| 17 | 
            +
                  t.column :copyright,    :string
         | 
| 18 | 
            +
                  t.column :tagline,      :string
         | 
| 19 | 
            +
                  t.column :pdf_file,     :string
         | 
| 20 | 
            +
                  t.timestamps
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
                create_table "<%= staff_table_name %>", :force => true do |t|
         | 
| 23 | 
            +
                  t.column :title,        :string
         | 
| 24 | 
            +
                  t.column :<%= object_name %>_id,    :integer
         | 
| 25 | 
            +
                  t.column :clef,         :string
         | 
| 26 | 
            +
                  t.column :key,          :string
         | 
| 27 | 
            +
                  t.column :time,         :string
         | 
| 28 | 
            +
                  t.column :content,      :text
         | 
| 29 | 
            +
                  t.timestamps
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
              def self.down
         | 
| 34 | 
            +
                drop_table "<%= table_name %>"
         | 
| 35 | 
            +
                drop_table "<%= staff_table_name %>"
         | 
| 36 | 
            +
              end
         | 
| 37 | 
            +
            end
         | 
| @@ -0,0 +1,11 @@ | |
| 1 | 
            +
            # Be sure to restart your server when you modify this file.
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Add new mime types for use in respond_to blocks:
         | 
| 4 | 
            +
            # Mime::Type.register "text/richtext", :rtf
         | 
| 5 | 
            +
            # Mime::Type.register_alias "text/html", :iphone
         | 
| 6 | 
            +
            Mime::Type.register "audio/midi", :midi
         | 
| 7 | 
            +
            Mime::Type.register "application/pdf", :pdf
         | 
| 8 | 
            +
            Mime::Type.register "image/png", :png
         | 
| 9 | 
            +
            Mime::Type.register "audio/wav", :wav
         | 
| 10 | 
            +
            Mime::Type.register "audio/mpeg", :mp3
         | 
| 11 | 
            +
            Mime::Type.register "text/x-lilypond", :ly
         | 
| @@ -0,0 +1,35 @@ | |
| 1 | 
            +
            <%%= error_messages_for '<%= object_name %>' %>
         | 
| 2 | 
            +
            <table>
         | 
| 3 | 
            +
            <%% for header_param in <%= class_name %>::HEADER_PARAMS %>
         | 
| 4 | 
            +
              <tr>
         | 
| 5 | 
            +
                <td>
         | 
| 6 | 
            +
                  <%%= f.label header_param %>
         | 
| 7 | 
            +
                </td>
         | 
| 8 | 
            +
                <td>
         | 
| 9 | 
            +
                  <%%= f.text_field header_param %>
         | 
| 10 | 
            +
                </td>
         | 
| 11 | 
            +
              </tr>
         | 
| 12 | 
            +
            <%% end %>
         | 
| 13 | 
            +
            </table>
         | 
| 14 | 
            +
            <%% f.fields_for :staves do |s| %>
         | 
| 15 | 
            +
              <%%= s.hidden_field :title %>
         | 
| 16 | 
            +
              <h2>Part</h2>
         | 
| 17 | 
            +
              <p>
         | 
| 18 | 
            +
                <%%= s.label :clef %>
         | 
| 19 | 
            +
                <%%= s.select :clef, ["treble","bass"] %>
         | 
| 20 | 
            +
              </p>
         | 
| 21 | 
            +
              <p>
         | 
| 22 | 
            +
                <%%= s.label :key %>
         | 
| 23 | 
            +
                <%%= s.text_field :key %>
         | 
| 24 | 
            +
              </p>
         | 
| 25 | 
            +
              <p>
         | 
| 26 | 
            +
                <%%= s.label :time, "Time Signature" %>
         | 
| 27 | 
            +
                <%%= s.text_field :time %>
         | 
| 28 | 
            +
              </p>
         | 
| 29 | 
            +
              <p>
         | 
| 30 | 
            +
                <%%= s.label :content %>
         | 
| 31 | 
            +
              </p>
         | 
| 32 | 
            +
              <p>
         | 
| 33 | 
            +
                <%%= s.text_area :content %>
         | 
| 34 | 
            +
              </p>
         | 
| 35 | 
            +
            <%% end %>
         | 
| @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            <h1><%= class_name.pluralize %></h1>
         | 
| 2 | 
            +
            <ul>
         | 
| 3 | 
            +
            <%% for <%= object_name %> in @<%= table_name %> %>
         | 
| 4 | 
            +
              <li><%%= link_to "<%= class_name %> #{<%= object_name %>.id}", <%= object_name %>_url(<%= object_name %>) %></li>
         | 
| 5 | 
            +
            <%% end %>
         | 
| 6 | 
            +
            </ul>
         | 
| 7 | 
            +
            <%%= link_to "Create a new <%= class_name %>", new_<%= object_name %>_url %>
         | 
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            <h1><%= class_name %> <%%= @<%= object_name %>.id %> — <%%= @<%= object_name %>.title %></h1>
         | 
| 2 | 
            +
            <p>
         | 
| 3 | 
            +
              <%%= link_to "Edit this file", edit_<%= object_name %>_url(@<%= object_name %>) %>
         | 
| 4 | 
            +
              <%%= link_to "Delete this file", <%= object_name %>_url(@<%= object_name %>),:method=>:delete %>
         | 
| 5 | 
            +
            </p>
         | 
| 6 | 
            +
            <p>
         | 
| 7 | 
            +
              View this file file as:
         | 
| 8 | 
            +
            </p>
         | 
| 9 | 
            +
            <ul>
         | 
| 10 | 
            +
              <li>
         | 
| 11 | 
            +
                <%%= link_to "A .ly (Lilypond) file", <%= object_name %>_url(@<%= object_name %>,:format=>"ly") %>
         | 
| 12 | 
            +
              </li>
         | 
| 13 | 
            +
              <li>
         | 
| 14 | 
            +
                <%%= link_to "A PNG image", <%= object_name %>_url(@<%= object_name %>,:format=>"png") %>
         | 
| 15 | 
            +
              </li>
         | 
| 16 | 
            +
              <li>
         | 
| 17 | 
            +
                <%%= link_to "A PDF", <%= object_name %>_url(@<%= object_name %>,:format=>"pdf") %>
         | 
| 18 | 
            +
              </li>
         | 
| 19 | 
            +
              <li>
         | 
| 20 | 
            +
                <%%= link_to "A .midi file", <%= object_name %>_url(@<%= object_name %>,:format=>"midi") %>
         | 
| 21 | 
            +
              </li>
         | 
| 22 | 
            +
              <li>
         | 
| 23 | 
            +
                <%%= link_to "A .wav file", <%= object_name %>_url(@<%= object_name %>,:format=>"wav") %>
         | 
| 24 | 
            +
              </li>
         | 
| 25 | 
            +
              <li>
         | 
| 26 | 
            +
                <%%= link_to "A .mp3 file", <%= object_name %>_url(@<%= object_name %>,:format=>"mp3") %>
         | 
| 27 | 
            +
              </li>
         | 
| 28 | 
            +
            </ul>
         | 
| 29 | 
            +
            <p>
         | 
| 30 | 
            +
              <%%= link_to "Show all Lilypads", <%= table_name %>_url %>
         | 
| 31 | 
            +
            </p>
         | 
    
        data/lib/lilypad.rb
    ADDED
    
    | 
            File without changes
         | 
    
        data/lilypad.gemspec
    ADDED
    
    | @@ -0,0 +1,65 @@ | |
| 1 | 
            +
            # Generated by jeweler
         | 
| 2 | 
            +
            # DO NOT EDIT THIS FILE
         | 
| 3 | 
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
         | 
| 4 | 
            +
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |s|
         | 
| 7 | 
            +
              s.name = %q{lilypad}
         | 
| 8 | 
            +
              s.version = "0.0.0"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 | 
            +
              s.authors = ["Kevin W. Gisi"]
         | 
| 12 | 
            +
              s.date = %q{2009-08-09}
         | 
| 13 | 
            +
              s.description = %q{TODO: longer description of your gem}
         | 
| 14 | 
            +
              s.email = %q{kevin.gisi@gmail.com}
         | 
| 15 | 
            +
              s.extra_rdoc_files = [
         | 
| 16 | 
            +
                "LICENSE",
         | 
| 17 | 
            +
                 "README.rdoc"
         | 
| 18 | 
            +
              ]
         | 
| 19 | 
            +
              s.files = [
         | 
| 20 | 
            +
                ".document",
         | 
| 21 | 
            +
                 ".gitignore",
         | 
| 22 | 
            +
                 "LICENSE",
         | 
| 23 | 
            +
                 "README.rdoc",
         | 
| 24 | 
            +
                 "Rakefile",
         | 
| 25 | 
            +
                 "VERSION",
         | 
| 26 | 
            +
                 "generators/lilypad/lilypad_generator.rb",
         | 
| 27 | 
            +
                 "generators/lilypad/templates/lilypad.rb",
         | 
| 28 | 
            +
                 "generators/lilypad/templates/lilypad_staff.rb",
         | 
| 29 | 
            +
                 "generators/lilypad/templates/lilypads_controller.rb",
         | 
| 30 | 
            +
                 "generators/lilypad/templates/migration.rb",
         | 
| 31 | 
            +
                 "generators/lilypad/templates/mime_types.rb",
         | 
| 32 | 
            +
                 "generators/lilypad/templates/views/_form.html.erb",
         | 
| 33 | 
            +
                 "generators/lilypad/templates/views/edit.html.erb",
         | 
| 34 | 
            +
                 "generators/lilypad/templates/views/index.html.erb",
         | 
| 35 | 
            +
                 "generators/lilypad/templates/views/new.html.erb",
         | 
| 36 | 
            +
                 "generators/lilypad/templates/views/show.html.erb",
         | 
| 37 | 
            +
                 "lib/lilypad.rb",
         | 
| 38 | 
            +
                 "lilypad.gemspec",
         | 
| 39 | 
            +
                 "test/lilypad_test.rb",
         | 
| 40 | 
            +
                 "test/test_helper.rb"
         | 
| 41 | 
            +
              ]
         | 
| 42 | 
            +
              s.has_rdoc = true
         | 
| 43 | 
            +
              s.homepage = %q{http://github.com/gisikw/lilypad}
         | 
| 44 | 
            +
              s.rdoc_options = ["--charset=UTF-8"]
         | 
| 45 | 
            +
              s.require_paths = ["lib"]
         | 
| 46 | 
            +
              s.rubygems_version = %q{1.3.1}
         | 
| 47 | 
            +
              s.summary = %q{TODO: one-line summary of your gem}
         | 
| 48 | 
            +
              s.test_files = [
         | 
| 49 | 
            +
                "test/test_helper.rb",
         | 
| 50 | 
            +
                 "test/lilypad_test.rb"
         | 
| 51 | 
            +
              ]
         | 
| 52 | 
            +
             | 
| 53 | 
            +
              if s.respond_to? :specification_version then
         | 
| 54 | 
            +
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| 55 | 
            +
                s.specification_version = 2
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
         | 
| 58 | 
            +
                  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
         | 
| 59 | 
            +
                else
         | 
| 60 | 
            +
                  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
         | 
| 61 | 
            +
                end
         | 
| 62 | 
            +
              else
         | 
| 63 | 
            +
                s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
         | 
| 64 | 
            +
              end
         | 
| 65 | 
            +
            end
         | 
    
        data/test/test_helper.rb
    ADDED
    
    
    
        metadata
    ADDED
    
    | @@ -0,0 +1,85 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification 
         | 
| 2 | 
            +
            name: gisikw-lilypad
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              version: 0.0.0
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors: 
         | 
| 7 | 
            +
            - Kevin W. Gisi
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: bin
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            date: 2009-08-09 00:00:00 -07:00
         | 
| 13 | 
            +
            default_executable: 
         | 
| 14 | 
            +
            dependencies: 
         | 
| 15 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 16 | 
            +
              name: thoughtbot-shoulda
         | 
| 17 | 
            +
              type: :development
         | 
| 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: "TODO: longer description of your gem"
         | 
| 26 | 
            +
            email: kevin.gisi@gmail.com
         | 
| 27 | 
            +
            executables: []
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            extensions: []
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            extra_rdoc_files: 
         | 
| 32 | 
            +
            - LICENSE
         | 
| 33 | 
            +
            - README.rdoc
         | 
| 34 | 
            +
            files: 
         | 
| 35 | 
            +
            - .document
         | 
| 36 | 
            +
            - .gitignore
         | 
| 37 | 
            +
            - LICENSE
         | 
| 38 | 
            +
            - README.rdoc
         | 
| 39 | 
            +
            - Rakefile
         | 
| 40 | 
            +
            - VERSION
         | 
| 41 | 
            +
            - generators/lilypad/lilypad_generator.rb
         | 
| 42 | 
            +
            - generators/lilypad/templates/lilypad.rb
         | 
| 43 | 
            +
            - generators/lilypad/templates/lilypad_staff.rb
         | 
| 44 | 
            +
            - generators/lilypad/templates/lilypads_controller.rb
         | 
| 45 | 
            +
            - generators/lilypad/templates/migration.rb
         | 
| 46 | 
            +
            - generators/lilypad/templates/mime_types.rb
         | 
| 47 | 
            +
            - generators/lilypad/templates/views/_form.html.erb
         | 
| 48 | 
            +
            - generators/lilypad/templates/views/edit.html.erb
         | 
| 49 | 
            +
            - generators/lilypad/templates/views/index.html.erb
         | 
| 50 | 
            +
            - generators/lilypad/templates/views/new.html.erb
         | 
| 51 | 
            +
            - generators/lilypad/templates/views/show.html.erb
         | 
| 52 | 
            +
            - lib/lilypad.rb
         | 
| 53 | 
            +
            - lilypad.gemspec
         | 
| 54 | 
            +
            - test/lilypad_test.rb
         | 
| 55 | 
            +
            - test/test_helper.rb
         | 
| 56 | 
            +
            has_rdoc: true
         | 
| 57 | 
            +
            homepage: http://github.com/gisikw/lilypad
         | 
| 58 | 
            +
            licenses: 
         | 
| 59 | 
            +
            post_install_message: 
         | 
| 60 | 
            +
            rdoc_options: 
         | 
| 61 | 
            +
            - --charset=UTF-8
         | 
| 62 | 
            +
            require_paths: 
         | 
| 63 | 
            +
            - lib
         | 
| 64 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 65 | 
            +
              requirements: 
         | 
| 66 | 
            +
              - - ">="
         | 
| 67 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 68 | 
            +
                  version: "0"
         | 
| 69 | 
            +
              version: 
         | 
| 70 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 71 | 
            +
              requirements: 
         | 
| 72 | 
            +
              - - ">="
         | 
| 73 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 74 | 
            +
                  version: "0"
         | 
| 75 | 
            +
              version: 
         | 
| 76 | 
            +
            requirements: []
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            rubyforge_project: 
         | 
| 79 | 
            +
            rubygems_version: 1.3.5
         | 
| 80 | 
            +
            signing_key: 
         | 
| 81 | 
            +
            specification_version: 2
         | 
| 82 | 
            +
            summary: "TODO: one-line summary of your gem"
         | 
| 83 | 
            +
            test_files: 
         | 
| 84 | 
            +
            - test/test_helper.rb
         | 
| 85 | 
            +
            - test/lilypad_test.rb
         |