bivouac 0.2.1 → 0.2.2
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/README +12 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +22 -1
- data/lib/bivouac.rb +0 -0
- data/lib/bivouac/template.rb +4 -4
- data/lib/bivouac/template/application/postamble.rb +101 -43
- metadata +2 -2
    
        data/README
    CHANGED
    
    | @@ -20,6 +20,18 @@ Bivouac is a simple generator for camping[http://code.whytheluckystiff.net/campi | |
| 20 20 |  | 
| 21 21 | 
             
            == FEATURES/PROBLEMS:
         | 
| 22 22 |  | 
| 23 | 
            +
            === 0.2.2:
         | 
| 24 | 
            +
            * Postamble has been completely rewritten. So :
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              Usage: server [thin|mongrel|webrick] [option]
         | 
| 27 | 
            +
            	  -p port                : Runs Bivouac on the specified port (default 3301)
         | 
| 28 | 
            +
            	  -b ip                  : Binds Bivouac to the specified ip (default 0.0.0.0)
         | 
| 29 | 
            +
            	  -d start|stop|restart  : Make server run as a Daemon.
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            * Bivouac::Template#copyTemplate and Bivouac::Template#template have been modified to support backpack, the new plugin generator
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            	gem install backpack
         | 
| 34 | 
            +
             | 
| 23 35 | 
             
            === 0.2.1:
         | 
| 24 36 | 
             
            * Add addControllerHelperModule and controllerHelperModule
         | 
| 25 37 | 
             
            * iUI's Tent Plugin beta
         | 
    
        data/doc/rdoc/created.rid
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            Wed, 09 Apr 2008 20:08:28 +0200
         | 
    
        data/doc/rdoc/files/README.html
    CHANGED
    
    | @@ -87,7 +87,7 @@ end</strong> | |
| 87 87 | 
             
                <div id="README" class="page_shade">
         | 
| 88 88 | 
             
            <div class="page">
         | 
| 89 89 | 
             
            <div class="header">
         | 
| 90 | 
            -
              <div class="path">README /  | 
| 90 | 
            +
              <div class="path">README / Wed Apr 09 20:07:58 +0200 2008</div>
         | 
| 91 91 | 
             
            </div>
         | 
| 92 92 |  | 
| 93 93 | 
             
            <h1>Bivouac</h1>
         | 
| @@ -130,6 +130,27 @@ href="http://code.whytheluckystiff.net/camping">camping</a>. | |
| 130 130 | 
             
            </li>
         | 
| 131 131 | 
             
            </ul>
         | 
| 132 132 | 
             
            <h2>FEATURES/PROBLEMS:</h2>
         | 
| 133 | 
            +
            <h3>0.2.2:</h3>
         | 
| 134 | 
            +
            <ul>
         | 
| 135 | 
            +
            <li>Postamble has been completely rewritten. So :
         | 
| 136 | 
            +
             | 
| 137 | 
            +
            <p>
         | 
| 138 | 
            +
            Usage: server [thin|mongrel|webrick] [option]
         | 
| 139 | 
            +
            </p>
         | 
| 140 | 
            +
            <pre>
         | 
| 141 | 
            +
                    -p port                : Runs Bivouac on the specified port (default 3301)
         | 
| 142 | 
            +
                    -b ip                  : Binds Bivouac to the specified ip (default 0.0.0.0)
         | 
| 143 | 
            +
                    -d start|stop|restart  : Make server run as a Daemon.
         | 
| 144 | 
            +
            </pre>
         | 
| 145 | 
            +
            </li>
         | 
| 146 | 
            +
            <li>Bivouac::Template#copyTemplate and Bivouac::Template#template have been
         | 
| 147 | 
            +
            modified to support backpack, the new plugin generator
         | 
| 148 | 
            +
             | 
| 149 | 
            +
            <pre>
         | 
| 150 | 
            +
                  gem install backpack
         | 
| 151 | 
            +
            </pre>
         | 
| 152 | 
            +
            </li>
         | 
| 153 | 
            +
            </ul>
         | 
| 133 154 | 
             
            <h3>0.2.1:</h3>
         | 
| 134 155 | 
             
            <ul>
         | 
| 135 156 | 
             
            <li>Add addControllerHelperModule and controllerHelperModule
         | 
    
        data/lib/bivouac.rb
    CHANGED
    
    | 
            File without changes
         | 
    
        data/lib/bivouac/template.rb
    CHANGED
    
    | @@ -54,12 +54,12 @@ module Bivouac | |
| 54 54 | 
             
                  end
         | 
| 55 55 | 
             
                end
         | 
| 56 56 |  | 
| 57 | 
            -
                def copyTemplate( file, dest )
         | 
| 57 | 
            +
                def copyTemplate( file, dest, from = File.dirname(__FILE__) )
         | 
| 58 58 | 
             
                  if File.exist?( dest + "/" + File.basename( file ) )
         | 
| 59 59 | 
             
                    puts "\tskip #{File.expand_path( dest + "/" + File.basename( file ) )}: already exist"
         | 
| 60 60 | 
             
                  else
         | 
| 61 61 | 
             
                    puts "\tcreate #{File.expand_path( dest ) + "/" + File.basename( file )}"
         | 
| 62 | 
            -
                    src =  | 
| 62 | 
            +
                    src = from + "/template/" + file
         | 
| 63 63 | 
             
                    FileUtils::cp( src, dest )
         | 
| 64 64 | 
             
                  end
         | 
| 65 65 | 
             
                end
         | 
| @@ -73,8 +73,8 @@ module Bivouac | |
| 73 73 | 
             
                  return( result )
         | 
| 74 74 | 
             
                end
         | 
| 75 75 |  | 
| 76 | 
            -
                def template( template_name, b = nil )
         | 
| 77 | 
            -
                  template_file =  | 
| 76 | 
            +
                def template( template_name, b = nil, from = File.dirname(__FILE__) )
         | 
| 77 | 
            +
                  template_file = from + "/template/" + template_name + ".rb"
         | 
| 78 78 |  | 
| 79 79 | 
             
                  return plugin_template( template_file, b )
         | 
| 80 80 | 
             
                end
         | 
| @@ -7,6 +7,8 @@ | |
| 7 7 | 
             
            #  DO NOT EDIT THIS FILE OR YOU REALLY KNOW WHAT YOU ARE DOING
         | 
| 8 8 | 
             
            #  USE script/generate helper my_helper
         | 
| 9 9 | 
             
            #
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            ## If the app run on Windows, check if win32/process is installed
         | 
| 10 12 | 
             
            windows_process = false
         | 
| 11 13 | 
             
            if /Windows/.match( ENV['OS'] )
         | 
| 12 14 | 
             
              begin
         | 
| @@ -23,54 +25,103 @@ DIRNAME = File.expand_path( File.dirname(__FILE__) ) | |
| 23 25 | 
             
            SimpleDaemon::WORKING_DIRECTORY = DIRNAME + "/../log/"
         | 
| 24 26 |  | 
| 25 27 | 
             
            class <%= @conf.appname %>Daemon < SimpleDaemon::Base
         | 
| 28 | 
            +
              begin
         | 
| 29 | 
            +
                begin
         | 
| 30 | 
            +
                  require 'thin'
         | 
| 31 | 
            +
                  @@loaded_server = 'thin'
         | 
| 32 | 
            +
                rescue LoadError
         | 
| 33 | 
            +
                  require 'mongrel/camping'
         | 
| 34 | 
            +
                  @@loaded_server = 'mongrel'
         | 
| 35 | 
            +
                end
         | 
| 36 | 
            +
              rescue LoadError
         | 
| 37 | 
            +
                require 'webrick/httpserver'
         | 
| 38 | 
            +
                require 'camping/webrick'
         | 
| 39 | 
            +
                @@loaded_server = 'webrick'
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
              
         | 
| 26 42 | 
             
              @@server = nil
         | 
| 27 | 
            -
              @@ | 
| 43 | 
            +
              @@force_use = nil
         | 
| 44 | 
            +
              @@server_ip = nil
         | 
| 45 | 
            +
              @@server_port = nil
         | 
| 28 46 |  | 
| 29 47 | 
             
              def self.use=(x)
         | 
| 30 | 
            -
                @@ | 
| 48 | 
            +
                @@force_use=x
         | 
| 49 | 
            +
              end
         | 
| 50 | 
            +
              
         | 
| 51 | 
            +
              def self.ip=(x)
         | 
| 52 | 
            +
                @@server_ip=x
         | 
| 53 | 
            +
              end
         | 
| 54 | 
            +
              
         | 
| 55 | 
            +
              def self.port=(x)
         | 
| 56 | 
            +
                @@server_port=x
         | 
| 31 57 | 
             
              end
         | 
| 32 58 |  | 
| 33 59 | 
             
              def self.start
         | 
| 60 | 
            +
                ## Load configuration
         | 
| 34 61 | 
             
                config = Bivouac::Environment.new( )
         | 
| 35 62 |  | 
| 63 | 
            +
                ## Initialize database connection
         | 
| 36 64 | 
             
                database_connection = config.environment.db
         | 
| 37 65 | 
             
                if database_connection[:adapter] =~ /sqlite/
         | 
| 38 66 | 
             
                  database_connection[:database] = DIRNAME + "/../" + database_connection[:database]
         | 
| 39 67 | 
             
                end
         | 
| 40 68 | 
             
                <%= @conf.appname %>::Models::Base.establish_connection database_connection
         | 
| 69 | 
            +
                
         | 
| 70 | 
            +
                ## Define log
         | 
| 41 71 | 
             
                <%= @conf.appname %>::Models::Base.logger = Logger.new(DIRNAME + "/../log/<%= @conf.appname %>.log")
         | 
| 42 | 
            -
                 | 
| 72 | 
            +
                
         | 
| 73 | 
            +
                ## Migrate database if needed
         | 
| 43 74 | 
             
                <%= @conf.appname %>.create if <%= @conf.appname %>.respond_to? :create
         | 
| 44 75 |  | 
| 76 | 
            +
                ## Initialize trap
         | 
| 45 77 | 
             
                trap(:INT) do
         | 
| 46 78 | 
             
                  stop
         | 
| 47 79 | 
             
                end
         | 
| 48 80 |  | 
| 81 | 
            +
                ## Set server to use
         | 
| 82 | 
            +
                if @@force_use.nil?
         | 
| 83 | 
            +
                  @@use_server = @@loaded_server
         | 
| 84 | 
            +
                else
         | 
| 85 | 
            +
                  @@use_server = @@force_use
         | 
| 86 | 
            +
                end
         | 
| 87 | 
            +
                
         | 
| 88 | 
            +
                ## Set ip and port
         | 
| 89 | 
            +
                @@server_port = config.environment.port if @@server_port.nil?
         | 
| 90 | 
            +
                @@server_ip = config.environment.address if @@server_ip.nil?
         | 
| 91 | 
            +
                
         | 
| 49 92 | 
             
                begin
         | 
| 50 | 
            -
                   | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
                      
         | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
                     | 
| 93 | 
            +
                  case @@use_server
         | 
| 94 | 
            +
                  when 'thin'
         | 
| 95 | 
            +
                    if @@loaded_server != @@use_server
         | 
| 96 | 
            +
                      require 'thin'
         | 
| 97 | 
            +
                    end
         | 
| 98 | 
            +
                    
         | 
| 99 | 
            +
                    # Rack::Handler::Thin.run Rack::Adapter::Camping.new( <%= @conf.appname %> ), :Host => @@server_ip, :Port => @@server_port
         | 
| 100 | 
            +
                    @@server = Thin::Server.new( @@server_ip, @@server_port.to_i, Rack::Adapter::Camping.new( <%= @conf.appname %> ) )
         | 
| 101 | 
            +
                    puts "** <%= @conf.appname %> is running at http://#{@@server_ip}:#{@@server_port}"
         | 
| 102 | 
            +
                    @@server.start
         | 
| 103 | 
            +
                  when 'mongrel'
         | 
| 104 | 
            +
                    if @@loaded_server != @@use_server
         | 
| 57 105 | 
             
                      require 'mongrel/camping'
         | 
| 58 | 
            -
                  
         | 
| 59 | 
            -
                      @@server = Mongrel::Camping.start( config.environment.address, config.environment.port, "/", <%= @conf.appname %>)
         | 
| 60 | 
            -
                      puts "** <%= @conf.appname %> is running at http://#{config.environment.address}:#{config.environment.port}"
         | 
| 61 | 
            -
                      @@server.run.join
         | 
| 62 106 | 
             
                    end
         | 
| 107 | 
            +
                    
         | 
| 108 | 
            +
                    @@server = Mongrel::Camping.start( @@server_ip, @@server_port, "/", <%= @conf.appname %>)
         | 
| 109 | 
            +
                    puts "** <%= @conf.appname %> is running at http://#{@@server_ip}:#{@@server_port}"
         | 
| 110 | 
            +
                    @@server.run.join
         | 
| 111 | 
            +
                  when 'webrick'
         | 
| 112 | 
            +
                    if @@loaded_server != @@use_server
         | 
| 113 | 
            +
                      require 'webrick/httpserver'
         | 
| 114 | 
            +
                      require 'camping/webrick'
         | 
| 115 | 
            +
                    end
         | 
| 116 | 
            +
                    
         | 
| 117 | 
            +
                    @@server = WEBrick::HTTPServer.new :BindAddress => @@server_ip, :Port => @@server_port
         | 
| 118 | 
            +
                    puts "** <%= @conf.appname %> is running at http://#{@@server_ip}:#{@@server_port}"
         | 
| 119 | 
            +
                    @@server.mount "/", WEBrick::CampingHandler, <%= @conf.appname %>
         | 
| 120 | 
            +
                    @@server.start
         | 
| 63 121 | 
             
                  else
         | 
| 64 | 
            -
                     | 
| 122 | 
            +
                    puts "Don't know how to use server `#{@@use_server}'!"
         | 
| 123 | 
            +
                    exit 0
         | 
| 65 124 | 
             
                  end
         | 
| 66 | 
            -
                rescue LoadError => e
         | 
| 67 | 
            -
                  require 'webrick/httpserver'
         | 
| 68 | 
            -
                  require 'camping/webrick'
         | 
| 69 | 
            -
                  
         | 
| 70 | 
            -
                  @@server = WEBrick::HTTPServer.new :BindAddress => config.environment.address, :Port => config.environment.port
         | 
| 71 | 
            -
                  puts "** <%= @conf.appname %> is running at http://#{config.environment.address}:#{config.environment.port}"
         | 
| 72 | 
            -
                  @@server.mount "/", WEBrick::CampingHandler, <%= @conf.appname %>
         | 
| 73 | 
            -
                  @@server.start
         | 
| 74 125 | 
             
                end
         | 
| 75 126 | 
             
              end
         | 
| 76 127 |  | 
| @@ -82,16 +133,8 @@ class <%= @conf.appname %>Daemon < SimpleDaemon::Base | |
| 82 133 | 
             
                end
         | 
| 83 134 | 
             
                @@server = nil
         | 
| 84 135 | 
             
              end
         | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
            while ARGV.size > 0
         | 
| 88 | 
            -
              deamonize = ARGV.shift
         | 
| 89 | 
            -
              case deamonize
         | 
| 90 | 
            -
              when 'webrick'
         | 
| 91 | 
            -
                <%= @conf.appname %>Daemon.use='webrick'
         | 
| 92 | 
            -
              when '-c'
         | 
| 93 | 
            -
                ARGV.clear
         | 
| 94 | 
            -
                
         | 
| 136 | 
            +
              
         | 
| 137 | 
            +
              def self.console
         | 
| 95 138 | 
             
                include <%= @conf.appname %>::Models
         | 
| 96 139 |  | 
| 97 140 | 
             
                config = Bivouac::Environment.new( )
         | 
| @@ -108,24 +151,39 @@ while ARGV.size > 0 | |
| 108 151 | 
             
                  ENV['IRBRC'] = ".irbrc"
         | 
| 109 152 | 
             
                end
         | 
| 110 153 | 
             
                IRB.start
         | 
| 154 | 
            +
              end
         | 
| 155 | 
            +
            end
         | 
| 156 | 
            +
             | 
| 157 | 
            +
            while ARGV.size > 0
         | 
| 158 | 
            +
              deamonize = ARGV.shift
         | 
| 159 | 
            +
              case deamonize
         | 
| 160 | 
            +
              when 'webrick'
         | 
| 161 | 
            +
                <%= @conf.appname %>Daemon.use='webrick'
         | 
| 162 | 
            +
              when 'mongrel'
         | 
| 163 | 
            +
                <%= @conf.appname %>Daemon.use='mongrel'
         | 
| 164 | 
            +
              when 'thin'
         | 
| 165 | 
            +
                <%= @conf.appname %>Daemon.use='thin'
         | 
| 166 | 
            +
              when '-c'
         | 
| 167 | 
            +
                ARGV.clear
         | 
| 168 | 
            +
                <%= @conf.appname %>Daemon.console
         | 
| 169 | 
            +
                break
         | 
| 170 | 
            +
              when '-h'
         | 
| 171 | 
            +
                puts "Usage: server [thin|mongrel|webrick] [option]"
         | 
| 172 | 
            +
                puts "  -p port                : Runs Bivouac on the specified port (default 3301)"
         | 
| 173 | 
            +
                puts "  -b ip                  : Binds Bivouac to the specified ip (default 0.0.0.0)"
         | 
| 174 | 
            +
                puts "  -d start|stop|restart  : Make server run as a Daemon."
         | 
| 111 175 | 
             
                break
         | 
| 176 | 
            +
              when '-p'
         | 
| 177 | 
            +
                <%= @conf.appname %>Daemon.port=ARGV.shift
         | 
| 178 | 
            +
              when '-b'
         | 
| 179 | 
            +
                <%= @conf.appname %>Daemon.ip=ARGV.shift
         | 
| 112 180 | 
             
              when '-d'
         | 
| 113 181 | 
             
                if /Windows/.match( ENV['OS'] ) and windows_process == false
         | 
| 114 182 | 
             
                  warn "You must install `win32-process' to daemonize this app."
         | 
| 115 183 | 
             
                  exit 1
         | 
| 116 184 | 
             
                end
         | 
| 117 | 
            -
                
         | 
| 118 185 | 
             
                <%= @conf.appname %>Daemon.daemonize
         | 
| 119 186 | 
             
                break
         | 
| 120 | 
            -
              when '-h'
         | 
| 121 | 
            -
                begin
         | 
| 122 | 
            -
                  require 'mongrel/camping'
         | 
| 123 | 
            -
                  puts "=> Booting Mongrel (use 'script/server webrick [options]' to force WEBrick)"
         | 
| 124 | 
            -
                rescue LoadError => e
         | 
| 125 | 
            -
                  puts "=> Booting WEBrick"
         | 
| 126 | 
            -
                end
         | 
| 127 | 
            -
                puts "script/server [-d start|stop|restart] [-h]"
         | 
| 128 | 
            -
                exit
         | 
| 129 187 | 
             
              when '--'
         | 
| 130 188 | 
             
                <%= @conf.appname %>Daemon.start
         | 
| 131 189 | 
             
                break
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: bivouac
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - "Gr\xC3\xA9goire Lejeune"
         | 
| @@ -9,7 +9,7 @@ autorequire: | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 |  | 
| 12 | 
            -
            date: 2008-04- | 
| 12 | 
            +
            date: 2008-04-10 00:00:00 +02:00
         | 
| 13 13 | 
             
            default_executable: 
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency 
         |