webink 1.1.5 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/bin/rfcgi CHANGED
@@ -1,5 +1,5 @@
1
1
  require "fcgi"
2
- require "mmap"
2
+ require "simple_mmap"
3
3
  require "webink/beauty"
4
4
 
5
5
  def getBinding(cgi,env,params)
@@ -17,10 +17,10 @@ pram = nil
17
17
  is_production = nil
18
18
  use_errors = nil
19
19
  FCGI.each_cgi do |cgi|
20
- puts cgi.header
21
- cgi.env_table.each do |k,v|
22
- puts "#{k}=#{v}<br>"
23
- end
20
+ #puts cgi.header
21
+ #cgi.env_table.each do |k,v|
22
+ # puts "#{k}=#{v}<br>"
23
+ #end
24
24
  is_production = ((cgi.env_table["INK_PRODUCTION"] and eval cgi.env_table["INK_PRODUCTION"]) or (ENV["INK_PRODUCTION"] and eval ENV["INK_PRODUCTION"])) ? true : false
25
25
  use_errors = ((cgi.env_table["INK_ERRORS"] and eval cgi.env_table["INK_ERRORS"]) or (ENV["INK_ERRORS"] and eval ENV["INK_ERRORS"])) ? true : false
26
26
  time = Time.now
@@ -29,10 +29,10 @@ FCGI.each_cgi do |cgi|
29
29
  pram = CGI::parse(cgi.env_table['QUERY_STRING'].gsub(/\?/, "&"))
30
30
  control = pram['controller'][0]
31
31
  routes = Ink::Beauty.load_routes script
32
- fhandle = Mmap.new(routes, "r")
32
+ fhandle = SimpleMmap::MappedFile.new(routes)
33
33
  Dir.chdir( File.dirname(routes) )
34
- control = eval fhandle, getBinding(cgi,cgi.env_table,control) if fhandle
35
- fhandle.munmap
34
+ control = eval fhandle.read_window_data(0,fhandle.size), getBinding(cgi,cgi.env_table,control) if fhandle
35
+ fhandle.close
36
36
  raise StandardError.new("Routes not matched.") if control.keys.length <= 1
37
37
 
38
38
  control[:get] = pram
@@ -47,7 +47,7 @@ FCGI.each_cgi do |cgi|
47
47
  v.each do |a|
48
48
  control[:post][k].push((control[:config]["escape_post_data"]) ? CGI::escapeHTML(a) : a)
49
49
  end
50
- control[:post][k] = control[:post][k].to_s
50
+ control[:post][k] = control[:post][k][0] if control[:post][k].length <= 1
51
51
  else
52
52
  control[:post][k] = (control[:config]["escape_post_data"]) ? CGI::escapeHTML(v) : v
53
53
  end
@@ -60,11 +60,10 @@ FCGI.each_cgi do |cgi|
60
60
  end
61
61
 
62
62
  script = Ink::Beauty.load_init script
63
- fhandle = Mmap.new(script, "r")
63
+ fhandle = SimpleMmap::MappedFile.new(script)
64
64
  Dir.chdir( File.dirname(script) )
65
- eval fhandle, getBinding(cgi,cgi.env_table,control) if fhandle
66
- fhandle.munmap
67
-
65
+ eval fhandle.read_window_data(0,fhandle.size), getBinding(cgi,cgi.env_table,control) if fhandle
66
+ fhandle.close
68
67
 
69
68
  rescue LoadError => bang
70
69
  if not is_production
data/bin/webink_database CHANGED
@@ -1,4 +1,4 @@
1
- require 'mmap'
1
+ require 'simple_mmap'
2
2
  require 'webink/beauty'
3
3
 
4
4
  config = nil
data/lib/webink/beauty.rb CHANGED
@@ -33,9 +33,9 @@ module Ink
33
33
  config = "#{File.dirname(script)}/config"
34
34
  config = "#{config}.rb" if not File.exist? config
35
35
  raise LoadError.new("Config not found.") if not File.exist? config
36
- fhandle = Mmap.new(config, "r")
37
- config = eval fhandle
38
- fhandle.munmap
36
+ fhandle = SimpleMmap::MappedFile.new(config)
37
+ config = eval fhandle.read_window_data(0,fhandle.size)
38
+ fhandle.close
39
39
  raise RuntimeError.new("Config error.") if not config.instance_of? Hash
40
40
  config
41
41
  end
@@ -160,11 +160,13 @@ module Ink
160
160
  if args[:template]
161
161
  template = File.open "./views/#{args[:template]}.html.erb", "r"
162
162
  erb = ERB.new template.readlines * "\n"
163
+ template.close
163
164
  puts @params[:cgi].header
164
165
  erb.run self.getBinding(args[:locals])
165
166
  elsif args[:partial]
166
167
  template = File.open "./views/#{(File.dirname(args[:partial]) != ".") ? "#{File.dirname(args[:partial])}/" : ""}_#{File.basename(args[:partial])}.html.erb", "r"
167
168
  erb = ERB.new template.readlines * "\n"
169
+ template.close
168
170
  if not args[:standalone]
169
171
  erb.result self.getBinding(args[:locals])
170
172
  else
@@ -256,7 +258,7 @@ module Ink
256
258
  # Retrieve the current binding of the instance.
257
259
  # [param locals:] an Array of data for the template
258
260
  # [returns:] current binding
259
- def getBinding(*locals)
261
+ def getBinding(locals)
260
262
  binding
261
263
  end
262
264
 
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webink
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 1
9
- - 5
10
- version: 1.1.5
4
+ prerelease:
5
+ version: 1.2.5
11
6
  platform: ruby
12
7
  authors:
13
8
  - Matthias Geier
@@ -15,8 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2010-10-08 00:00:00 +02:00
19
- default_executable:
13
+ date: 2012-07-21 00:00:00 Z
20
14
  dependencies:
21
15
  - !ruby/object:Gem::Dependency
22
16
  name: fcgi
@@ -26,28 +20,18 @@ dependencies:
26
20
  requirements:
27
21
  - - ">="
28
22
  - !ruby/object:Gem::Version
29
- hash: 47
30
- segments:
31
- - 0
32
- - 8
33
- - 8
34
23
  version: 0.8.8
35
24
  type: :runtime
36
25
  version_requirements: *id001
37
26
  - !ruby/object:Gem::Dependency
38
- name: mmap
27
+ name: simple-mmap
39
28
  prerelease: false
40
29
  requirement: &id002 !ruby/object:Gem::Requirement
41
30
  none: false
42
31
  requirements:
43
32
  - - ">="
44
33
  - !ruby/object:Gem::Version
45
- hash: 27
46
- segments:
47
- - 0
48
- - 2
49
- - 6
50
- version: 0.2.6
34
+ version: 1.1.4
51
35
  type: :runtime
52
36
  version_requirements: *id002
53
37
  description:
@@ -63,11 +47,10 @@ files:
63
47
  - lib/webink.rb
64
48
  - lib/webink/model.rb
65
49
  - lib/webink/database.rb
66
- - lib/webink/controller.rb
67
50
  - lib/webink/beauty.rb
68
- - bin/rfcgi
51
+ - lib/webink/controller.rb
69
52
  - bin/webink_database
70
- has_rdoc: true
53
+ - bin/rfcgi
71
54
  homepage: http://powerpuff.net/
72
55
  licenses: []
73
56
 
@@ -81,25 +64,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
64
  requirements:
82
65
  - - ">="
83
66
  - !ruby/object:Gem::Version
84
- hash: 53
85
- segments:
86
- - 1
87
- - 8
88
- - 1
89
- version: 1.8.1
67
+ version: 1.9.3
90
68
  required_rubygems_version: !ruby/object:Gem::Requirement
91
69
  none: false
92
70
  requirements:
93
71
  - - ">="
94
72
  - !ruby/object:Gem::Version
95
- hash: 3
96
- segments:
97
- - 0
98
73
  version: "0"
99
74
  requirements: []
100
75
 
101
76
  rubyforge_project:
102
- rubygems_version: 1.3.7
77
+ rubygems_version: 1.8.23
103
78
  signing_key:
104
79
  specification_version: 3
105
80
  summary: A minimal web framework.