srv 0.0.1 → 1.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/lib/srv/version.rb +1 -1
 - data/lib/srv.rb +20 -1
 - data/srv.gemspec +1 -1
 - metadata +2 -3
 - data/lib/config.ru +0 -3
 
    
        data/lib/srv/version.rb
    CHANGED
    
    
    
        data/lib/srv.rb
    CHANGED
    
    | 
         @@ -5,7 +5,10 @@ module Srv 
     | 
|
| 
       5 
5 
     | 
    
         
             
                def initialize(args)
         
     | 
| 
       6 
6 
     | 
    
         
             
                  port = args[0] || 4000
         
     | 
| 
       7 
7 
     | 
    
         
             
                  puts ">>> srv will run on port: #{port}"
         
     | 
| 
       8 
     | 
    
         
            -
                   
     | 
| 
      
 8 
     | 
    
         
            +
                  root = Dir.pwd
         
     | 
| 
      
 9 
     | 
    
         
            +
                  puts ">>> serving contents of directory: #{root}"
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  @rack_server = Rack::Server.new(:app => DirectoryWithIndex.new(root),
         
     | 
| 
       9 
12 
     | 
    
         
             
                                                  :Port => port,
         
     | 
| 
       10 
13 
     | 
    
         
             
                                                  :AccessLog => [])
         
     | 
| 
       11 
14 
     | 
    
         
             
                end
         
     | 
| 
         @@ -14,4 +17,20 @@ module Srv 
     | 
|
| 
       14 
17 
     | 
    
         
             
                  @rack_server.start
         
     | 
| 
       15 
18 
     | 
    
         
             
                end
         
     | 
| 
       16 
19 
     | 
    
         
             
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              class DirectoryWithIndex < Rack::Directory
         
     | 
| 
      
 22 
     | 
    
         
            +
                def list_directory
         
     | 
| 
      
 23 
     | 
    
         
            +
                  index, = Dir.glob(File.join(@path, "index.htm*"))
         
     | 
| 
      
 24 
     | 
    
         
            +
                  if index
         
     | 
| 
      
 25 
     | 
    
         
            +
                    index_path_info = @path_info
         
     | 
| 
      
 26 
     | 
    
         
            +
                    index_path_info += "/" unless @path_info[-1] == "/"
         
     | 
| 
      
 27 
     | 
    
         
            +
                    index_path_info += File.basename index
         
     | 
| 
      
 28 
     | 
    
         
            +
                    altered_env = @env.dup
         
     | 
| 
      
 29 
     | 
    
         
            +
                    altered_env["PATH_INFO"] = index_path_info
         
     | 
| 
      
 30 
     | 
    
         
            +
                    @app.call(altered_env)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  else
         
     | 
| 
      
 32 
     | 
    
         
            +
                    super
         
     | 
| 
      
 33 
     | 
    
         
            +
                  end
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
       17 
36 
     | 
    
         
             
            end
         
     | 
    
        data/srv.gemspec
    CHANGED
    
    | 
         @@ -18,5 +18,5 @@ Gem::Specification.new do |s| 
     | 
|
| 
       18 
18 
     | 
    
         
             
              s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
         
     | 
| 
       19 
19 
     | 
    
         
             
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         
     | 
| 
       20 
20 
     | 
    
         
             
              s.require_paths = ["lib"]
         
     | 
| 
       21 
     | 
    
         
            -
              s.add_dependency 'rack', '>=1. 
     | 
| 
      
 21 
     | 
    
         
            +
              s.add_dependency 'rack', '>=1.3.0'
         
     | 
| 
       22 
22 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            name: srv
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
4 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       5 
     | 
    
         
            -
              version: 0.0 
     | 
| 
      
 5 
     | 
    
         
            +
              version: 1.0.0
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors: 
         
     | 
| 
       8 
8 
     | 
    
         
             
            - Hubert Lepicki
         
     | 
| 
         @@ -21,7 +21,7 @@ dependencies: 
     | 
|
| 
       21 
21 
     | 
    
         
             
                requirements: 
         
     | 
| 
       22 
22 
     | 
    
         
             
                - - ">="
         
     | 
| 
       23 
23 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       24 
     | 
    
         
            -
                    version: 1. 
     | 
| 
      
 24 
     | 
    
         
            +
                    version: 1.3.0
         
     | 
| 
       25 
25 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       26 
26 
     | 
    
         
             
              version_requirements: *id001
         
     | 
| 
       27 
27 
     | 
    
         
             
            description: fire up with 'srv' to serve current directory on port 4000 (default), 'srv 5000' on port 5000
         
     | 
| 
         @@ -40,7 +40,6 @@ files: 
     | 
|
| 
       40 
40 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       41 
41 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       42 
42 
     | 
    
         
             
            - bin/srv
         
     | 
| 
       43 
     | 
    
         
            -
            - lib/config.ru
         
     | 
| 
       44 
43 
     | 
    
         
             
            - lib/srv.rb
         
     | 
| 
       45 
44 
     | 
    
         
             
            - lib/srv/version.rb
         
     | 
| 
       46 
45 
     | 
    
         
             
            - srv.gemspec
         
     | 
    
        data/lib/config.ru
    DELETED