sinatra-gen 0.3.0 → 0.4.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/History.txt +9 -0
- data/Manifest.txt +2 -2
- data/README.rdoc +27 -4
- data/Rakefile +9 -5
- data/app_generators/sinatra_app/sinatra_app_generator.rb +20 -4
- data/app_generators/sinatra_app/templates/bin/app.erb +6 -0
- data/app_generators/sinatra_app/templates/config.ru.erb +3 -3
- data/app_generators/sinatra_app/templates/lib/app.rb.erb +57 -0
- data/app_generators/sinatra_app/templates/test/test_helper.rb.erb +2 -2
- data/lib/sinatra-gen.rb +1 -1
- data/sinatra-gen.gemspec +22 -25
- data/test/test_sinatra_app_generator.rb +35 -9
- metadata +15 -14
- data/app_generators/sinatra_app/templates/app.rb.erb +0 -25
- data/app_generators/sinatra_app/templates/lib/module.rb.erb +0 -3
    
        data/History.txt
    CHANGED
    
    | @@ -1,3 +1,12 @@ | |
| 1 | 
            +
            == 0.4.0 2009-08-13
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            * Unless --tiny is specified generate an app that < Sinatra::Application
         | 
| 4 | 
            +
            * Added --vegas/--bin option for generating an executable using Vegas
         | 
| 5 | 
            +
            * Add --middleware option. e.g --middleware rack/flash,Rack::Cache
         | 
| 6 | 
            +
            * Fix deprecations:
         | 
| 7 | 
            +
              * Require the view framework as that isn't explicit in sinatra anymore
         | 
| 8 | 
            +
              * Fix config.ru deprecations
         | 
| 9 | 
            +
             | 
| 1 10 | 
             
            == 0.3.0 2009-04-29
         | 
| 2 11 |  | 
| 3 12 | 
             
            * No longer use deprecated Sinatra::Test - depend on Rack::Test and simple helper
         | 
    
        data/Manifest.txt
    CHANGED
    
    | @@ -7,11 +7,11 @@ app_generators/sinatra_app/USAGE | |
| 7 7 | 
             
            app_generators/sinatra_app/sinatra_app_generator.rb
         | 
| 8 8 | 
             
            app_generators/sinatra_app/templates/Capfile
         | 
| 9 9 | 
             
            app_generators/sinatra_app/templates/Rakefile.erb
         | 
| 10 | 
            -
            app_generators/sinatra_app/templates/app.rb.erb
         | 
| 11 10 | 
             
            app_generators/sinatra_app/templates/config.ru.erb
         | 
| 11 | 
            +
            app_generators/sinatra_app/templates/bin/app.erb
         | 
| 12 12 | 
             
            app_generators/sinatra_app/templates/config.yml
         | 
| 13 13 | 
             
            app_generators/sinatra_app/templates/config/deploy.rb.erb
         | 
| 14 | 
            -
            app_generators/sinatra_app/templates/lib/ | 
| 14 | 
            +
            app_generators/sinatra_app/templates/lib/app.rb.erb
         | 
| 15 15 | 
             
            app_generators/sinatra_app/templates/test/test_app_bacon.rb.erb
         | 
| 16 16 | 
             
            app_generators/sinatra_app/templates/test/test_app_rspec.rb.erb
         | 
| 17 17 | 
             
            app_generators/sinatra_app/templates/test/test_app_shoulda.rb.erb
         | 
    
        data/README.rdoc
    CHANGED
    
    | @@ -9,7 +9,7 @@ For more information on sinatra, check out http://sinatrarb.com | |
| 9 9 |  | 
| 10 10 | 
             
            == SYNOPSIS:
         | 
| 11 11 |  | 
| 12 | 
            -
            sinatra-gen has a bunch of different options (based  | 
| 12 | 
            +
            sinatra-gen has a bunch of different options (based looseley on merb-gen) to try to not lock the 
         | 
| 13 13 | 
             
            user into any specific frameworks/dev practices.
         | 
| 14 14 |  | 
| 15 15 | 
             
            Run:
         | 
| @@ -20,6 +20,8 @@ e.g. | |
| 20 20 |  | 
| 21 21 | 
             
              sinatra-gen mysinatrapp --vendor --init --test=shoulda --views=haml get:/ post:/:id
         | 
| 22 22 |  | 
| 23 | 
            +
            ! Note: As of version 0.4.0 by default the sinatra app is placed in lib/appname.rb and is a subclass of Sinatra::Application. If you want 'classic' style apps (no class/module) use the --tiny option.
         | 
| 24 | 
            +
             | 
| 23 25 | 
             
            === Actions
         | 
| 24 26 |  | 
| 25 27 | 
             
            For even faster app development you specify actions to include in your app when generating.
         | 
| @@ -27,7 +29,7 @@ Actions are written out as | |
| 27 29 |  | 
| 28 30 | 
             
              http_method:path
         | 
| 29 31 |  | 
| 30 | 
            -
            And are  | 
| 32 | 
            +
            And are separated by spaces. For example:
         | 
| 31 33 |  | 
| 32 34 | 
             
              get:/ post:/:id put:/update/*
         | 
| 33 35 |  | 
| @@ -44,6 +46,22 @@ Will be added you your app as: | |
| 44 46 |  | 
| 45 47 | 
             
            It will also generate test skeletons in the test framework of your choosing.
         | 
| 46 48 |  | 
| 49 | 
            +
            === Middleware
         | 
| 50 | 
            +
             | 
| 51 | 
            +
            You can specify middleware to include by passing the filename(s) or class name(s), seperated by commas.
         | 
| 52 | 
            +
              
         | 
| 53 | 
            +
              sinatra-gen myapp --middleware=rack/flash,Rack::Cache
         | 
| 54 | 
            +
              
         | 
| 55 | 
            +
            Will place both the 'require' and 'use' statements in your app.
         | 
| 56 | 
            +
             | 
| 57 | 
            +
              require 'rack/flash'
         | 
| 58 | 
            +
              require 'rack/cache'
         | 
| 59 | 
            +
              
         | 
| 60 | 
            +
              #...
         | 
| 61 | 
            +
              
         | 
| 62 | 
            +
              use Rack::Flash
         | 
| 63 | 
            +
              use Rack::Cache
         | 
| 64 | 
            +
             | 
| 47 65 | 
             
            === Options 
         | 
| 48 66 |  | 
| 49 67 | 
             
            (can also be obtained by running sinatra-gen with no arguments):
         | 
| @@ -58,6 +76,8 @@ It will also generate test skeletons in the test framework of your choosing. | |
| 58 76 | 
             
                    --scripts                    Install the rubigen scripts (script/generate, script/destroy)
         | 
| 59 77 | 
             
                    --test=test_framework        Specify your testing framework (bacon (default)/rspec/spec/shoulda/test)
         | 
| 60 78 | 
             
                    --views=view_framework       Specify your view framework (haml (default)/erb/builder)
         | 
| 79 | 
            +
                    --middleware=rack-middleware Specify Rack Middleware to be required and included (comma delimited)
         | 
| 80 | 
            +
                    --vegas, --bin=[bin_name]    Create an executable bin using Vegas. Pass an optional bin_name
         | 
| 61 81 | 
             
            General Options:
         | 
| 62 82 | 
             
                -h, --help                       Show this help message and quit.
         | 
| 63 83 | 
             
                -p, --pretend                    Run but do not make any changes.
         | 
| @@ -78,12 +98,15 @@ Also, thanks to Dr. Nic (http://github.com/drnic) for the Rubigen and Newgem lib | |
| 78 98 |  | 
| 79 99 | 
             
            == REQUIREMENTS:
         | 
| 80 100 |  | 
| 81 | 
            -
            To use the --vendor option, git must be installed.
         | 
| 101 | 
            +
            To use the --vendor option, git must be installed. 
         | 
| 102 | 
            +
            To use the --bin/vegas option Vegas is required (sudo gem install vegas). 
         | 
| 103 | 
            +
            To use the --heroku option, a Heroku account and the heroku gem is required (sudo gem install heroku).
         | 
| 104 | 
            +
             | 
| 82 105 | 
             
            To run the app without using the vendor option, the sinatra gem must be installed.
         | 
| 83 106 |  | 
| 84 107 | 
             
            == INSTALL:
         | 
| 85 108 |  | 
| 86 | 
            -
              sudo gem install  | 
| 109 | 
            +
              sudo gem install sinatra-gen
         | 
| 87 110 |  | 
| 88 111 | 
             
            You can also install directly from github:
         | 
| 89 112 |  | 
    
        data/Rakefile
    CHANGED
    
    | @@ -1,16 +1,20 @@ | |
| 1 | 
            -
            %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
         | 
| 1 | 
            +
            %w[rubygems rake rake/clean hoe fileutils newgem rubigen].each { |f| require f }
         | 
| 2 2 | 
             
            require File.dirname(__FILE__) + '/lib/sinatra-gen'
         | 
| 3 3 |  | 
| 4 4 | 
             
            # Generate all the Rake tasks
         | 
| 5 5 | 
             
            # Run 'rake -T' to see list of generated tasks (from gem root directory)
         | 
| 6 | 
            -
            $hoe = Hoe. | 
| 6 | 
            +
            $hoe = Hoe.spec('sinatra-gen') do |p|
         | 
| 7 7 | 
             
              p.developer('Aaron Quint', 'aaron@quirkey.com')
         | 
| 8 8 | 
             
              p.changes              = p.paragraphs_of("History.txt", 0..1).join("\n\n")
         | 
| 9 9 | 
             
              p.rubyforge_name       = 'quirkey'
         | 
| 10 | 
            +
              p.summary = %q{sinatra-gen generates a common file structure and basic app files for a web app utilizing the sinatra framework}
         | 
| 11 | 
            +
              p.description = %q{sinatra-gen generates a common file structure and basic app files for a web app utilizing the sinatra framework. For more information on sinatra, check out http://sinatrarb.com}
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              p.version              = SinatraGen::VERSION
         | 
| 10 14 | 
             
              p.extra_deps         = [
         | 
| 11 | 
            -
                ['rubigen',' | 
| 12 | 
            -
                ['sinatra', '>= 0.9. | 
| 13 | 
            -
                ['rack-test', '>= 0.1 | 
| 15 | 
            +
                ['rubigen','=1.5.2'],
         | 
| 16 | 
            +
                ['sinatra', '>= 0.9.4'],
         | 
| 17 | 
            +
                ['rack-test', '>= 0.4.1']
         | 
| 14 18 | 
             
              ]
         | 
| 15 19 | 
             
              p.extra_dev_deps = [
         | 
| 16 20 | 
             
                ['newgem', ">= #{::Newgem::VERSION}"]
         | 
| @@ -28,7 +28,9 @@ class SinatraAppGenerator < RubiGen::Base | |
| 28 28 | 
             
                            :view_framework, 
         | 
| 29 29 | 
             
                            :install_scripts, 
         | 
| 30 30 | 
             
                            :cap, 
         | 
| 31 | 
            -
                            :actions
         | 
| 31 | 
            +
                            :actions,
         | 
| 32 | 
            +
                            :middleware,
         | 
| 33 | 
            +
                            :bin_name
         | 
| 32 34 |  | 
| 33 35 | 
             
              def initialize(runtime_args, runtime_options = {})
         | 
| 34 36 | 
             
                super
         | 
| @@ -49,7 +51,6 @@ class SinatraAppGenerator < RubiGen::Base | |
| 49 51 | 
             
                  end      
         | 
| 50 52 |  | 
| 51 53 | 
             
                  m.template 'config.ru.erb', 'config.ru'
         | 
| 52 | 
            -
                  m.template 'app.rb.erb'   , "#{app_name}.rb"
         | 
| 53 54 | 
             
                  m.template 'Rakefile.erb' , 'Rakefile'
         | 
| 54 55 |  | 
| 55 56 | 
             
                  test_dir = (tests_are_specs? ? 'spec' : 'test')
         | 
| @@ -58,12 +59,19 @@ class SinatraAppGenerator < RubiGen::Base | |
| 58 59 | 
             
                    BASEDIRS.each { |path| m.directory path }
         | 
| 59 60 | 
             
                    m.directory test_dir
         | 
| 60 61 | 
             
                    m.file     'config.yml', 'config.yml'
         | 
| 61 | 
            -
                    m.template 'lib/ | 
| 62 | 
            +
                    m.template 'lib/app.rb.erb', "lib/#{app_name}.rb"
         | 
| 62 63 | 
             
                    m.template 'test/test_helper.rb.erb', "#{test_dir}/#{test_dir}_helper.rb"
         | 
| 63 64 | 
             
                    m.template "test/test_app_#{test_framework}.rb.erb", 
         | 
| 64 65 | 
             
                               "#{test_dir}/#{(tests_are_specs? ? "#{app_name}_spec" : "test_#{app_name}")}.rb"
         | 
| 65 66 | 
             
                    m.template "views/#{view_framework}_index.erb", "views/index.#{view_framework}"
         | 
| 66 67 | 
             
                    m.template "views/#{view_framework}_layout.erb", "views/layout.#{view_framework}" unless view_framework == 'builder'
         | 
| 68 | 
            +
                  else
         | 
| 69 | 
            +
                    m.template "lib/app.rb.erb", "#{app_name}.rb"
         | 
| 70 | 
            +
                  end
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                  if options[:bin]
         | 
| 73 | 
            +
                    m.directory "bin"
         | 
| 74 | 
            +
                    m.template "bin/app.erb", "bin/#{bin_name}", {:chmod => 0755}
         | 
| 67 75 | 
             
                  end
         | 
| 68 76 |  | 
| 69 77 | 
             
                  if vendor
         | 
| @@ -98,7 +106,7 @@ class SinatraAppGenerator < RubiGen::Base | |
| 98 106 | 
             
                <<-EOS
         | 
| 99 107 | 
             
                Creates the skeleton for a new sinatra app
         | 
| 100 108 |  | 
| 101 | 
            -
                USAGE:  | 
| 109 | 
            +
                USAGE: sinatra-gen app_name [options] [paths]
         | 
| 102 110 | 
             
                EOS
         | 
| 103 111 | 
             
              end
         | 
| 104 112 |  | 
| @@ -116,6 +124,8 @@ class SinatraAppGenerator < RubiGen::Base | |
| 116 124 | 
             
                opts.on("--git /path/to/git", "Specify a different path for 'git'") {|o| options[:git] = o }
         | 
| 117 125 | 
             
                opts.on("--test=test_framework", String, "Specify your testing framework (bacon (default)/rspec/spec/shoulda/test)") {|o| options[:test_framework] = o }
         | 
| 118 126 | 
             
                opts.on("--views=view_framework", "Specify your view framework (haml (default)/erb/builder)")  {|o| options[:view_framework] = o }
         | 
| 127 | 
            +
                opts.on("--middleware=rack-middleware", Array, "Specify Rack Middleware to be required and included (comma delimited)") {|o| options[:middleware] = o }
         | 
| 128 | 
            +
                opts.on("--vegas=[bin_name]", "--bin=[bin_name]", "Create an executable bin using Vegas. Pass an optional bin_name") {|o| options[:bin] = true; options[:bin_name] = o }
         | 
| 119 129 | 
             
              end
         | 
| 120 130 |  | 
| 121 131 | 
             
              def extract_options
         | 
| @@ -131,12 +141,18 @@ class SinatraAppGenerator < RubiGen::Base | |
| 131 141 | 
             
                self.test_framework  = options[:test_framework] || 'bacon'
         | 
| 132 142 | 
             
                self.view_framework  = options[:view_framework] || 'haml'
         | 
| 133 143 | 
             
                self.install_scripts = options[:scripts] || false
         | 
| 144 | 
            +
                self.middleware      = options[:middleware] ? options[:middleware].reject {|m| m.blank? } : []
         | 
| 145 | 
            +
                self.bin_name        = options[:bin_name] || app_name
         | 
| 134 146 | 
             
              end
         | 
| 135 147 |  | 
| 136 148 | 
             
              def klass_name
         | 
| 137 149 | 
             
                app_name.classify
         | 
| 138 150 | 
             
              end
         | 
| 139 151 |  | 
| 152 | 
            +
              def app_klass
         | 
| 153 | 
            +
                tiny ? "Sinatra::Application" : klass_name
         | 
| 154 | 
            +
              end
         | 
| 155 | 
            +
             | 
| 140 156 | 
             
              def parse_actions(*action_args)
         | 
| 141 157 | 
             
                @actions = action_args.flatten.collect { |a| a.split(':', 2) }
         | 
| 142 158 | 
             
              end
         | 
| @@ -1,8 +1,8 @@ | |
| 1 1 | 
             
            # To use with thin 
         | 
| 2 2 | 
             
            #  thin start -p PORT -R config.ru
         | 
| 3 3 |  | 
| 4 | 
            -
            require File.join(File.dirname(__FILE__), '<%= app_name %>.rb')
         | 
| 4 | 
            +
            require File.join(File.dirname(__FILE__), <%- unless tiny -%>'lib', <%- end -%>'<%= app_name %>.rb')
         | 
| 5 5 |  | 
| 6 6 | 
             
            disable :run
         | 
| 7 | 
            -
            set : | 
| 8 | 
            -
            run  | 
| 7 | 
            +
            set :environment, :production
         | 
| 8 | 
            +
            run <%= app_klass -%>
         | 
| @@ -0,0 +1,57 @@ | |
| 1 | 
            +
            <%- if tiny -%>
         | 
| 2 | 
            +
            APP_ROOT = File.expand_path(File.dirname(__FILE__))
         | 
| 3 | 
            +
            <%- else -%>
         | 
| 4 | 
            +
            APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
         | 
| 5 | 
            +
            <%- end -%>
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            require 'rubygems'
         | 
| 8 | 
            +
            <%- if vendor -%>
         | 
| 9 | 
            +
            $:.unshift File.join(APP_ROOT, 'vendor', 'sinatra', 'lib')
         | 
| 10 | 
            +
            require 'sinatra'
         | 
| 11 | 
            +
            <%- else -%>
         | 
| 12 | 
            +
            require 'sinatra'
         | 
| 13 | 
            +
            <%- end -%>
         | 
| 14 | 
            +
            require '<%= view_framework %>'
         | 
| 15 | 
            +
            <%- middleware.each do |m| -%>
         | 
| 16 | 
            +
            require '<%= m.to_s.underscore %>'
         | 
| 17 | 
            +
            <%- end -%>
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            <%- if tiny -%>
         | 
| 20 | 
            +
            set :root, APP_ROOT
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            <%- unless actions.empty? -%>
         | 
| 23 | 
            +
            <%- actions.each do |meth, path| -%>
         | 
| 24 | 
            +
            <%= meth %> '<%= path %>' do
         | 
| 25 | 
            +
            end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            <%- end -%>
         | 
| 28 | 
            +
            <%- else -%>
         | 
| 29 | 
            +
            get '/' do
         | 
| 30 | 
            +
              <%= view_framework -%> :index
         | 
| 31 | 
            +
            end
         | 
| 32 | 
            +
            <%- end -%>
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            <%- else -%>
         | 
| 35 | 
            +
            class <%= klass_name -%> < Sinatra::Application
         | 
| 36 | 
            +
              
         | 
| 37 | 
            +
              set :root, APP_ROOT  
         | 
| 38 | 
            +
              <%- middleware.each do |m| -%>
         | 
| 39 | 
            +
              use <%= m.to_s.classify %>
         | 
| 40 | 
            +
              <%- end -%>
         | 
| 41 | 
            +
             | 
| 42 | 
            +
              <%- unless actions.empty? -%>
         | 
| 43 | 
            +
              <%- actions.each do |meth, path| -%>
         | 
| 44 | 
            +
              <%= meth %> '<%= path %>' do
         | 
| 45 | 
            +
                <%= view_framework -%> :<%= path %>
         | 
| 46 | 
            +
              end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
              <%- end -%>
         | 
| 49 | 
            +
              <%- else -%>
         | 
| 50 | 
            +
              get '/' do
         | 
| 51 | 
            +
                <%= view_framework -%> :index
         | 
| 52 | 
            +
              end
         | 
| 53 | 
            +
              <%- end -%>
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            end
         | 
| 56 | 
            +
            <%- end -%>
         | 
| 57 | 
            +
             | 
| @@ -4,14 +4,14 @@ $:.unshift File.join(File.dirname(__FILE__), '..', 'vendor', 'sinatra', 'lib') | |
| 4 4 | 
             
            require 'sinatra'
         | 
| 5 5 | 
             
            require 'rack/test'
         | 
| 6 6 |  | 
| 7 | 
            -
             | 
| 7 | 
            +
            <%= app_klass -%>.set(
         | 
| 8 8 | 
             
              :environment => :test,
         | 
| 9 9 | 
             
              :run => false,
         | 
| 10 10 | 
             
              :raise_errors => true,
         | 
| 11 11 | 
             
              :logging => false
         | 
| 12 12 | 
             
            )
         | 
| 13 13 |  | 
| 14 | 
            -
            require File.join(File.dirname(__FILE__), '..', '<%= app_name %>.rb')
         | 
| 14 | 
            +
            require File.join(File.dirname(__FILE__), '..', <%- unless tiny -%>'lib', <%- end -%>'<%= app_name %>.rb')
         | 
| 15 15 |  | 
| 16 16 | 
             
            module TestHelper
         | 
| 17 17 |  | 
    
        data/lib/sinatra-gen.rb
    CHANGED
    
    
    
        data/sinatra-gen.gemspec
    CHANGED
    
    | @@ -2,49 +2,46 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            Gem::Specification.new do |s|
         | 
| 4 4 | 
             
              s.name = %q{sinatra-gen}
         | 
| 5 | 
            -
              s.version = "0. | 
| 5 | 
            +
              s.version = "0.4.0"
         | 
| 6 6 |  | 
| 7 7 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 8 8 | 
             
              s.authors = ["Aaron Quint"]
         | 
| 9 | 
            -
              s.date = %q{2009- | 
| 9 | 
            +
              s.date = %q{2009-08-13}
         | 
| 10 10 | 
             
              s.default_executable = %q{sinatra-gen}
         | 
| 11 11 | 
             
              s.description = %q{sinatra-gen generates a common file structure and basic app files for a web app utilizing the sinatra framework. For more information on sinatra, check out http://sinatrarb.com}
         | 
| 12 12 | 
             
              s.email = ["aaron@quirkey.com"]
         | 
| 13 13 | 
             
              s.executables = ["sinatra-gen"]
         | 
| 14 | 
            -
              s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt" | 
| 15 | 
            -
              s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "app_generators/sinatra_app/USAGE", "app_generators/sinatra_app/sinatra_app_generator.rb", "app_generators/sinatra_app/templates/Capfile", "app_generators/sinatra_app/templates/Rakefile.erb", "app_generators/sinatra_app/templates/ | 
| 16 | 
            -
              s. | 
| 17 | 
            -
              s.homepage = %q{http://github.com/quirkey/sinatra-gen}
         | 
| 18 | 
            -
              s.post_install_message = %q{PostInstall.txt}
         | 
| 19 | 
            -
              s.rdoc_options = ["--main", "README.rdoc"]
         | 
| 14 | 
            +
              s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt"]
         | 
| 15 | 
            +
              s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "app_generators/sinatra_app/USAGE", "app_generators/sinatra_app/sinatra_app_generator.rb", "app_generators/sinatra_app/templates/Capfile", "app_generators/sinatra_app/templates/Rakefile.erb", "app_generators/sinatra_app/templates/config.ru.erb", "app_generators/sinatra_app/templates/bin/app.erb", "app_generators/sinatra_app/templates/config.yml", "app_generators/sinatra_app/templates/config/deploy.rb.erb", "app_generators/sinatra_app/templates/lib/app.rb.erb", "app_generators/sinatra_app/templates/test/test_app_bacon.rb.erb", "app_generators/sinatra_app/templates/test/test_app_rspec.rb.erb", "app_generators/sinatra_app/templates/test/test_app_shoulda.rb.erb", "app_generators/sinatra_app/templates/test/test_app_spec.rb.erb", "app_generators/sinatra_app/templates/test/test_app_unit.rb.erb", "app_generators/sinatra_app/templates/test/test_helper.rb.erb", "app_generators/sinatra_app/templates/views/builder_index.erb", "app_generators/sinatra_app/templates/views/erb_index.erb", "app_generators/sinatra_app/templates/views/erb_layout.erb", "app_generators/sinatra_app/templates/views/haml_index.erb", "app_generators/sinatra_app/templates/views/haml_layout.erb", "bin/sinatra-gen", "lib/sinatra-gen.rb", "sinatra-gen.gemspec", "test/test_generator_helper.rb", "test/test_helper.rb", "test/test_sinatra_app_generator.rb"]
         | 
| 16 | 
            +
              s.rdoc_options = ["--main", "README.txt"]
         | 
| 20 17 | 
             
              s.require_paths = ["lib"]
         | 
| 21 18 | 
             
              s.rubyforge_project = %q{quirkey}
         | 
| 22 | 
            -
              s.rubygems_version = %q{1.3. | 
| 19 | 
            +
              s.rubygems_version = %q{1.3.5}
         | 
| 23 20 | 
             
              s.summary = %q{sinatra-gen generates a common file structure and basic app files for a web app utilizing the sinatra framework}
         | 
| 24 21 | 
             
              s.test_files = ["test/test_generator_helper.rb", "test/test_helper.rb", "test/test_sinatra_app_generator.rb"]
         | 
| 25 22 |  | 
| 26 23 | 
             
              if s.respond_to? :specification_version then
         | 
| 27 24 | 
             
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| 28 | 
            -
                s.specification_version =  | 
| 25 | 
            +
                s.specification_version = 3
         | 
| 29 26 |  | 
| 30 27 | 
             
                if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
         | 
| 31 | 
            -
                  s.add_runtime_dependency(%q<rubigen>, [" | 
| 32 | 
            -
                  s.add_runtime_dependency(%q<sinatra>, [">= 0.9. | 
| 33 | 
            -
                  s.add_runtime_dependency(%q<rack-test>, [">= 0.1 | 
| 34 | 
            -
                  s.add_development_dependency(%q<newgem>, [">= 1.2 | 
| 35 | 
            -
                  s.add_development_dependency(%q<hoe>, [">=  | 
| 28 | 
            +
                  s.add_runtime_dependency(%q<rubigen>, ["= 1.5.2"])
         | 
| 29 | 
            +
                  s.add_runtime_dependency(%q<sinatra>, [">= 0.9.4"])
         | 
| 30 | 
            +
                  s.add_runtime_dependency(%q<rack-test>, [">= 0.4.1"])
         | 
| 31 | 
            +
                  s.add_development_dependency(%q<newgem>, [">= 1.5.2"])
         | 
| 32 | 
            +
                  s.add_development_dependency(%q<hoe>, [">= 2.3.3"])
         | 
| 36 33 | 
             
                else
         | 
| 37 | 
            -
                  s.add_dependency(%q<rubigen>, [" | 
| 38 | 
            -
                  s.add_dependency(%q<sinatra>, [">= 0.9. | 
| 39 | 
            -
                  s.add_dependency(%q<rack-test>, [">= 0.1 | 
| 40 | 
            -
                  s.add_dependency(%q<newgem>, [">= 1.2 | 
| 41 | 
            -
                  s.add_dependency(%q<hoe>, [">=  | 
| 34 | 
            +
                  s.add_dependency(%q<rubigen>, ["= 1.5.2"])
         | 
| 35 | 
            +
                  s.add_dependency(%q<sinatra>, [">= 0.9.4"])
         | 
| 36 | 
            +
                  s.add_dependency(%q<rack-test>, [">= 0.4.1"])
         | 
| 37 | 
            +
                  s.add_dependency(%q<newgem>, [">= 1.5.2"])
         | 
| 38 | 
            +
                  s.add_dependency(%q<hoe>, [">= 2.3.3"])
         | 
| 42 39 | 
             
                end
         | 
| 43 40 | 
             
              else
         | 
| 44 | 
            -
                s.add_dependency(%q<rubigen>, [" | 
| 45 | 
            -
                s.add_dependency(%q<sinatra>, [">= 0.9. | 
| 46 | 
            -
                s.add_dependency(%q<rack-test>, [">= 0.1 | 
| 47 | 
            -
                s.add_dependency(%q<newgem>, [">= 1.2 | 
| 48 | 
            -
                s.add_dependency(%q<hoe>, [">=  | 
| 41 | 
            +
                s.add_dependency(%q<rubigen>, ["= 1.5.2"])
         | 
| 42 | 
            +
                s.add_dependency(%q<sinatra>, [">= 0.9.4"])
         | 
| 43 | 
            +
                s.add_dependency(%q<rack-test>, [">= 0.4.1"])
         | 
| 44 | 
            +
                s.add_dependency(%q<newgem>, [">= 1.5.2"])
         | 
| 45 | 
            +
                s.add_dependency(%q<hoe>, [">= 2.3.3"])
         | 
| 49 46 | 
             
              end
         | 
| 50 47 | 
             
            end
         | 
| @@ -59,7 +59,7 @@ class TestSinatraAppGenerator < Test::Unit::TestCase | |
| 59 59 | 
             
                end
         | 
| 60 60 | 
             
              end
         | 
| 61 61 |  | 
| 62 | 
            -
              def  | 
| 62 | 
            +
              def test_generate_app_with_rspec_test_option
         | 
| 63 63 | 
             
                run_generator('sinatra_app', [APP_ROOT, '--test=rspec'], sources)
         | 
| 64 64 | 
             
                assert_basic_paths_and_files('spec')
         | 
| 65 65 | 
             
                assert_generated_file 'spec/spec_helper.rb' do |helper_contents|
         | 
| @@ -115,10 +115,10 @@ class TestSinatraAppGenerator < Test::Unit::TestCase | |
| 115 115 | 
             
                end
         | 
| 116 116 | 
             
              end
         | 
| 117 117 |  | 
| 118 | 
            -
              def  | 
| 118 | 
            +
              def test_generate_app_with_views_erb_option
         | 
| 119 119 | 
             
                run_generator('sinatra_app', [APP_ROOT, '--views=erb'], sources)
         | 
| 120 120 | 
             
                assert_basic_paths_and_files('spec')
         | 
| 121 | 
            -
                assert_generated_file " | 
| 121 | 
            +
                assert_generated_file "lib/#{app_name}.rb" do |app_contents|
         | 
| 122 122 | 
             
                  assert_match(/erb \:index/, app_contents)
         | 
| 123 123 | 
             
                end
         | 
| 124 124 | 
             
                assert_generated_file 'views/layout.erb'
         | 
| @@ -128,7 +128,7 @@ class TestSinatraAppGenerator < Test::Unit::TestCase | |
| 128 128 | 
             
              def test_generate_app_with_views_haml_option
         | 
| 129 129 | 
             
                run_generator('sinatra_app', [APP_ROOT, '--views=haml'], sources)
         | 
| 130 130 | 
             
                assert_basic_paths_and_files('spec')
         | 
| 131 | 
            -
                assert_generated_file " | 
| 131 | 
            +
                assert_generated_file "lib/#{app_name}.rb" do |app_contents|
         | 
| 132 132 | 
             
                  assert_match(/haml \:index/, app_contents)
         | 
| 133 133 | 
             
                end
         | 
| 134 134 | 
             
                assert_generated_file 'views/layout.haml'
         | 
| @@ -138,7 +138,7 @@ class TestSinatraAppGenerator < Test::Unit::TestCase | |
| 138 138 | 
             
              def test_generate_app_with_views_builder_option
         | 
| 139 139 | 
             
                run_generator('sinatra_app', [APP_ROOT, '--views=builder'], sources)
         | 
| 140 140 | 
             
                assert_basic_paths_and_files('spec')
         | 
| 141 | 
            -
                assert_generated_file " | 
| 141 | 
            +
                assert_generated_file "lib/#{app_name}.rb" do |app_contents|
         | 
| 142 142 | 
             
                  assert_match(/builder \:index/, app_contents)
         | 
| 143 143 | 
             
                end
         | 
| 144 144 | 
             
                assert_generated_file 'views/index.builder'
         | 
| @@ -155,7 +155,7 @@ class TestSinatraAppGenerator < Test::Unit::TestCase | |
| 155 155 | 
             
              def test_generate_app_with_actions_and_no_options
         | 
| 156 156 | 
             
                run_generator('sinatra_app', [APP_ROOT, 'get:/', 'post:/users/:id', 'put:/users/*'], sources)
         | 
| 157 157 | 
             
                assert_basic_paths_and_files('spec')
         | 
| 158 | 
            -
                assert_generated_file " | 
| 158 | 
            +
                assert_generated_file "lib/#{app_name}.rb" do |app_contents|
         | 
| 159 159 | 
             
                  assert_match(/get '\/' do/, app_contents)
         | 
| 160 160 | 
             
                  assert_match(/post '\/users\/\:id' do/, app_contents)
         | 
| 161 161 | 
             
                  assert_match(/put '\/users\/\*' do/, app_contents)
         | 
| @@ -165,7 +165,6 @@ class TestSinatraAppGenerator < Test::Unit::TestCase | |
| 165 165 | 
             
              def test_generate_app_with_actions_and_options
         | 
| 166 166 | 
             
                run_generator('sinatra_app', [APP_ROOT, 'get:/', 'post:/users/:id', '--tiny', 'put:/users/*'], sources)
         | 
| 167 167 | 
             
                assert_generated_file   'config.ru'
         | 
| 168 | 
            -
                assert_generated_file   "#{app_name}.rb"
         | 
| 169 168 | 
             
                assert_generated_file   'Rakefile'
         | 
| 170 169 | 
             
                assert_generated_file "#{app_name}.rb" do |app_contents|
         | 
| 171 170 | 
             
                  assert_match(/get '\/' do/, app_contents)
         | 
| @@ -174,6 +173,34 @@ class TestSinatraAppGenerator < Test::Unit::TestCase | |
| 174 173 | 
             
                end
         | 
| 175 174 | 
             
              end
         | 
| 176 175 |  | 
| 176 | 
            +
              def test_generate_app_with_middleware
         | 
| 177 | 
            +
                run_generator('sinatra_app', [APP_ROOT, "--middleware", "rack/flash,Rack::Cache"], sources)
         | 
| 178 | 
            +
                assert_generated_file   'config.ru'
         | 
| 179 | 
            +
                assert_generated_file   'Rakefile'
         | 
| 180 | 
            +
                assert_generated_file "lib/#{app_name}.rb" do |app_contents|
         | 
| 181 | 
            +
                  assert_match(/require \'rack\/flash\'/, app_contents)
         | 
| 182 | 
            +
                  assert_match(/require \'rack\/cache\'/, app_contents)
         | 
| 183 | 
            +
                  assert_match(/use Rack::Flash/, app_contents)
         | 
| 184 | 
            +
                  assert_match(/use Rack::Cache/, app_contents)
         | 
| 185 | 
            +
                end
         | 
| 186 | 
            +
              end
         | 
| 187 | 
            +
              
         | 
| 188 | 
            +
              def test_generate_app_with_vegas_and_default_bin
         | 
| 189 | 
            +
                run_generator('sinatra_app', [APP_ROOT, '--vegas'], sources)
         | 
| 190 | 
            +
                assert_basic_paths_and_files('spec')
         | 
| 191 | 
            +
                assert_generated_file "bin/#{app_name}" do |app_contents|
         | 
| 192 | 
            +
                  assert_match("Vegas::Runner.new(#{app_name.classify}, '#{app_name}')", app_contents)
         | 
| 193 | 
            +
                end
         | 
| 194 | 
            +
              end
         | 
| 195 | 
            +
              
         | 
| 196 | 
            +
              def test_generate_app_with_vegas_and_different_bin_name
         | 
| 197 | 
            +
                run_generator('sinatra_app', [APP_ROOT, '--vegas=other_bin'], sources)
         | 
| 198 | 
            +
                assert_basic_paths_and_files('spec')
         | 
| 199 | 
            +
                assert_generated_file "bin/other_bin" do |app_contents|
         | 
| 200 | 
            +
                  assert_match("Vegas::Runner.new(#{app_name.classify}, 'other_bin')", app_contents)
         | 
| 201 | 
            +
                end
         | 
| 202 | 
            +
              end
         | 
| 203 | 
            +
              
         | 
| 177 204 | 
             
              private
         | 
| 178 205 | 
             
              def assert_basic_paths_and_files(spec_or_test = 'spec')
         | 
| 179 206 | 
             
                assert_directory_exists 'lib'
         | 
| @@ -181,10 +208,9 @@ class TestSinatraAppGenerator < Test::Unit::TestCase | |
| 181 208 | 
             
                assert_directory_exists 'public'
         | 
| 182 209 | 
             
                assert_directory_exists 'views'
         | 
| 183 210 | 
             
                assert_generated_file   'config.ru'
         | 
| 184 | 
            -
                assert_generated_file   "#{app_name}.rb"
         | 
| 185 211 | 
             
                assert_generated_file   'Rakefile'
         | 
| 186 212 | 
             
                assert_generated_file   'config.yml'
         | 
| 187 | 
            -
                 | 
| 213 | 
            +
                assert_generated_class  "lib/#{app_name}"
         | 
| 188 214 | 
             
              end
         | 
| 189 215 |  | 
| 190 216 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: sinatra-gen
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.4.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - Aaron Quint
         | 
| @@ -9,7 +9,7 @@ autorequire: | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 |  | 
| 12 | 
            -
            date: 2009- | 
| 12 | 
            +
            date: 2009-08-13 00:00:00 -04:00
         | 
| 13 13 | 
             
            default_executable: 
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -18,7 +18,7 @@ dependencies: | |
| 18 18 | 
             
              version_requirement: 
         | 
| 19 19 | 
             
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 20 20 | 
             
                requirements: 
         | 
| 21 | 
            -
                - - " | 
| 21 | 
            +
                - - "="
         | 
| 22 22 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 23 23 | 
             
                    version: 1.5.2
         | 
| 24 24 | 
             
                version: 
         | 
| @@ -30,7 +30,7 @@ dependencies: | |
| 30 30 | 
             
                requirements: 
         | 
| 31 31 | 
             
                - - ">="
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 33 | 
            -
                    version: 0.9. | 
| 33 | 
            +
                    version: 0.9.4
         | 
| 34 34 | 
             
                version: 
         | 
| 35 35 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 36 36 | 
             
              name: rack-test
         | 
| @@ -40,7 +40,7 @@ dependencies: | |
| 40 40 | 
             
                requirements: 
         | 
| 41 41 | 
             
                - - ">="
         | 
| 42 42 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 43 | 
            -
                    version: 0.1 | 
| 43 | 
            +
                    version: 0.4.1
         | 
| 44 44 | 
             
                version: 
         | 
| 45 45 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 46 46 | 
             
              name: newgem
         | 
| @@ -50,7 +50,7 @@ dependencies: | |
| 50 50 | 
             
                requirements: 
         | 
| 51 51 | 
             
                - - ">="
         | 
| 52 52 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 53 | 
            -
                    version: 1.2 | 
| 53 | 
            +
                    version: 1.5.2
         | 
| 54 54 | 
             
                version: 
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 56 56 | 
             
              name: hoe
         | 
| @@ -60,7 +60,7 @@ dependencies: | |
| 60 60 | 
             
                requirements: 
         | 
| 61 61 | 
             
                - - ">="
         | 
| 62 62 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 63 | 
            -
                    version:  | 
| 63 | 
            +
                    version: 2.3.3
         | 
| 64 64 | 
             
                version: 
         | 
| 65 65 | 
             
            description: sinatra-gen generates a common file structure and basic app files for a web app utilizing the sinatra framework. For more information on sinatra, check out http://sinatrarb.com
         | 
| 66 66 | 
             
            email: 
         | 
| @@ -73,7 +73,6 @@ extra_rdoc_files: | |
| 73 73 | 
             
            - History.txt
         | 
| 74 74 | 
             
            - Manifest.txt
         | 
| 75 75 | 
             
            - PostInstall.txt
         | 
| 76 | 
            -
            - README.rdoc
         | 
| 77 76 | 
             
            files: 
         | 
| 78 77 | 
             
            - History.txt
         | 
| 79 78 | 
             
            - Manifest.txt
         | 
| @@ -84,11 +83,11 @@ files: | |
| 84 83 | 
             
            - app_generators/sinatra_app/sinatra_app_generator.rb
         | 
| 85 84 | 
             
            - app_generators/sinatra_app/templates/Capfile
         | 
| 86 85 | 
             
            - app_generators/sinatra_app/templates/Rakefile.erb
         | 
| 87 | 
            -
            - app_generators/sinatra_app/templates/app.rb.erb
         | 
| 88 86 | 
             
            - app_generators/sinatra_app/templates/config.ru.erb
         | 
| 87 | 
            +
            - app_generators/sinatra_app/templates/bin/app.erb
         | 
| 89 88 | 
             
            - app_generators/sinatra_app/templates/config.yml
         | 
| 90 89 | 
             
            - app_generators/sinatra_app/templates/config/deploy.rb.erb
         | 
| 91 | 
            -
            - app_generators/sinatra_app/templates/lib/ | 
| 90 | 
            +
            - app_generators/sinatra_app/templates/lib/app.rb.erb
         | 
| 92 91 | 
             
            - app_generators/sinatra_app/templates/test/test_app_bacon.rb.erb
         | 
| 93 92 | 
             
            - app_generators/sinatra_app/templates/test/test_app_rspec.rb.erb
         | 
| 94 93 | 
             
            - app_generators/sinatra_app/templates/test/test_app_shoulda.rb.erb
         | 
| @@ -104,11 +103,13 @@ files: | |
| 104 103 | 
             
            - lib/sinatra-gen.rb
         | 
| 105 104 | 
             
            - sinatra-gen.gemspec
         | 
| 106 105 | 
             
            has_rdoc: true
         | 
| 107 | 
            -
            homepage:  | 
| 106 | 
            +
            homepage: 
         | 
| 107 | 
            +
            licenses: []
         | 
| 108 | 
            +
             | 
| 108 109 | 
             
            post_install_message: 
         | 
| 109 110 | 
             
            rdoc_options: 
         | 
| 110 111 | 
             
            - --main
         | 
| 111 | 
            -
            - README. | 
| 112 | 
            +
            - README.txt
         | 
| 112 113 | 
             
            require_paths: 
         | 
| 113 114 | 
             
            - lib
         | 
| 114 115 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| @@ -126,9 +127,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 126 127 | 
             
            requirements: []
         | 
| 127 128 |  | 
| 128 129 | 
             
            rubyforge_project: quirkey
         | 
| 129 | 
            -
            rubygems_version: 1.3. | 
| 130 | 
            +
            rubygems_version: 1.3.5
         | 
| 130 131 | 
             
            signing_key: 
         | 
| 131 | 
            -
            specification_version:  | 
| 132 | 
            +
            specification_version: 3
         | 
| 132 133 | 
             
            summary: sinatra-gen generates a common file structure and basic app files for a web app utilizing the sinatra framework
         | 
| 133 134 | 
             
            test_files: 
         | 
| 134 135 | 
             
            - test/test_generator_helper.rb
         | 
| @@ -1,25 +0,0 @@ | |
| 1 | 
            -
            require 'rubygems'
         | 
| 2 | 
            -
            <%- if vendor -%>
         | 
| 3 | 
            -
            $:.unshift File.join(File.dirname(__FILE__), 'vendor', 'sinatra', 'lib')
         | 
| 4 | 
            -
            require 'sinatra'
         | 
| 5 | 
            -
            <%- else -%>
         | 
| 6 | 
            -
            require 'sinatra'
         | 
| 7 | 
            -
            <%- end -%>
         | 
| 8 | 
            -
            <%- unless tiny -%>
         | 
| 9 | 
            -
            require File.join(File.dirname(__FILE__), 'lib', '<%= app_name %>')
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            set :public, 'public'
         | 
| 12 | 
            -
            set :views,  'views'
         | 
| 13 | 
            -
            <%- end -%>
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            <%- unless actions.empty? -%>
         | 
| 16 | 
            -
            <%- actions.each do |meth, path| -%>
         | 
| 17 | 
            -
            <%= meth %> '<%= path %>' do
         | 
| 18 | 
            -
            end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            <%- end -%>
         | 
| 21 | 
            -
            <%- else -%>
         | 
| 22 | 
            -
            get '/' do
         | 
| 23 | 
            -
              <%= view_framework -%> :index
         | 
| 24 | 
            -
            end
         | 
| 25 | 
            -
            <%- end -%>
         |