femtows 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/bin/femtows.bat +0 -0
  2. data/bin/femtows.sh +2 -1
  3. data/lib/femtows.rb +13 -6
  4. metadata +9 -10
  5. data/gitc.bat +0 -20
File without changes
@@ -1 +1,2 @@
1
- ruby -rfemtows -e "cliweb()" &
1
+ require 'femtows'
2
+ cliweb((ARGV[1]||"./"),(ARGV[0]||"8080").to_i)
@@ -52,6 +52,7 @@ class WebserverAbstract
52
52
  @redirect={}
53
53
  info(" serveur http #{port} on #{@rootd} ready!")
54
54
  observe(cadence,timeout*2)
55
+ pool_create
55
56
  @thm=Thread.new {
56
57
  loop {
57
58
  nbError=0
@@ -73,17 +74,23 @@ class WebserverAbstract
73
74
  }
74
75
  }
75
76
  end
77
+ def pool_create
78
+ @queue=Queue.new
79
+ ici=self
80
+ 100.times { Thread.new { loop {
81
+ param,bloc=@queue.pop
82
+ bloc.call(param) rescue p $!
83
+ } } }
84
+ end
85
+ def pool_get(param,&block)
86
+ @queue.push([param,block])
87
+ end
76
88
  def run(session)
77
- if ! File.exists?(@root)
78
- sendError(session,500,txt="root directory unknown: #{@root}") rescue nil
79
- session.close rescue nil
80
- else
81
- Thread.new(session) do |sess|
89
+ pool_get(session) do |sess|
82
90
  @th[Thread.current]=[Time.now,sess]
83
91
  request(sess)
84
92
  @th.delete(Thread.current)
85
93
  end
86
- end
87
94
  end
88
95
  def serve(uri,&blk)
89
96
  @cb[uri] = blk
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: femtows
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Regis d'Aubarede
8
+ - Glurp man
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-27 00:00:00.000000000 Z
12
+ date: 2014-07-17 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: ! "a tiny web server, for local file transfert, \nembededded, http experimentations\n"
14
+ description: ! "a tiny web server, for local file transfert, \nembedded, http experimentations\n"
15
15
  email: regis.aubarede@gmail.com
16
16
  executables:
17
17
  - femtows.bat
@@ -20,14 +20,14 @@ extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
22
  - demo.rb
23
- - guidemo.rb
24
23
  - lib/femtows.rb
24
+ - guidemo.rb
25
25
  - bin/femtows.sh
26
26
  - bin/femtows.bat
27
- - gitc.bat
28
- homepage: http://github.com/raubarede/femtows
27
+ homepage: http://github.com/glurp/femtows
29
28
  licenses: []
30
- post_install_message:
29
+ post_install_message: ! "-------------------------------------------------------------------------------\nHello,
30
+ welcome to Femto Web Server....\n\n$ femtows [port,[root-directory] \n\n-------------------------------------------------------------------------------\n"
31
31
  rdoc_options: []
32
32
  require_paths:
33
33
  - lib
@@ -45,9 +45,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
45
  version: '0'
46
46
  requirements: []
47
47
  rubyforge_project:
48
- rubygems_version: 1.8.24
48
+ rubygems_version: 1.8.23
49
49
  signing_key:
50
50
  specification_version: 3
51
51
  summary: a tiny webserver
52
52
  test_files: []
53
- has_rdoc:
data/gitc.bat DELETED
@@ -1,20 +0,0 @@
1
- @echo off
2
- IF DEFINED %1=="" (
3
- call giti
4
- ruby -e "a=File.read('VERSION').split('.') ; a[-1]=(a.last.to_i+1).to_s; puts r=a.join('.'); File.open('VERSION','w') {|f| f.write(r)}"
5
- echo %1 %2 %3 %4 %5 %6 %7 %8 %9 >> CHANGELOG.txt
6
- git commit -a -m "%1 %2 %3 %4 %5 %6 %7 %8 %9"
7
- git push
8
- echo
9
- echo call gitc.bat without args for make/post rubygem
10
- goto :eof
11
- )
12
- :gem
13
- rem ==== no args, generate gem and push it to rubygems.org
14
-
15
- ruby -e "a=File.read('VERSION').split('.');a.pop ; a[-1]=(a.last.to_i+1).to_s; puts r=(a+[0]).join('.'); File.open('VERSION','w') {|f| f.puts(r)}"
16
- cat VERSION >> CHANGELOG.txt
17
-
18
- ruby -e "Dir.glob('femtows*.gem').each {|f| File.delete(f) }"
19
- call gem build femtows.gemspec
20
- call gem push femtows*.gem