webroar 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/CHANGELOG +48 -1
  2. data/README +11 -14
  3. data/Rakefile +1 -1
  4. data/conf/mime_type.yml +172 -166
  5. data/conf/server_internal_config.yml +30 -8
  6. data/doc/user-guide.html +294 -153
  7. data/doc/user-guide.txt +9 -13
  8. data/lib/command_runner.rb +1 -0
  9. data/lib/dependencies.rb +18 -15
  10. data/lib/installer.rb +115 -50
  11. data/src/admin_panel/app/controllers/admin_controller.rb +1 -15
  12. data/src/admin_panel/app/controllers/application_controller.rb +2 -2
  13. data/src/admin_panel/app/controllers/application_specification_controller.rb +2 -1
  14. data/src/admin_panel/app/controllers/headers_controller.rb +73 -0
  15. data/src/admin_panel/app/controllers/mail_specification_controller.rb +10 -0
  16. data/src/admin_panel/app/controllers/server_specification_controller.rb +14 -0
  17. data/src/admin_panel/app/helpers/admin_helper.rb +0 -85
  18. data/src/admin_panel/app/models/app.rb +1 -1
  19. data/src/admin_panel/app/models/application_specification.rb +33 -25
  20. data/src/admin_panel/app/models/headers.rb +116 -0
  21. data/src/admin_panel/app/models/mail_specification.rb +20 -5
  22. data/src/admin_panel/app/models/server_specification.rb +2 -7
  23. data/src/admin_panel/app/views/admin/configuration.html.erb +10 -5
  24. data/src/admin_panel/app/views/exceptions/_exception_list_partial.html.erb +4 -4
  25. data/src/admin_panel/app/views/graph/_graph_page.html.erb +3 -0
  26. data/src/admin_panel/app/views/headers/_add_expires_text_box.html.erb +35 -0
  27. data/src/admin_panel/app/views/headers/_expires_by_type_form.html.erb +65 -0
  28. data/src/admin_panel/app/views/headers/_headers_table.html.erb +113 -0
  29. data/src/admin_panel/app/views/mail_specification/_current_spec.html.erb +168 -0
  30. data/src/admin_panel/app/views/{admin → server_specification}/_add_div.html.erb +1 -1
  31. data/src/admin_panel/config/initializers/application_constants.rb +6 -0
  32. data/src/admin_panel/lib/control.rb +6 -3
  33. data/src/admin_panel/lib/scgi.rb +74 -21
  34. data/src/admin_panel/lib/yaml_writer.rb +51 -17
  35. data/src/admin_panel/public/javascripts/application.js +20 -1
  36. data/src/head/wr_access_log.c +2 -2
  37. data/src/head/wr_application.c +294 -236
  38. data/src/head/wr_application.h +8 -8
  39. data/src/head/wr_configurator.c +451 -517
  40. data/src/head/wr_configurator.h +10 -115
  41. data/src/head/wr_connection.c +26 -25
  42. data/src/head/wr_connection.h +2 -3
  43. data/src/head/wr_controller.c +110 -93
  44. data/src/head/wr_controller.h +6 -6
  45. data/src/head/wr_main.c +31 -24
  46. data/src/head/wr_request.c +70 -93
  47. data/src/head/wr_request.h +0 -4
  48. data/src/head/wr_resolver.c +21 -15
  49. data/src/head/wr_resolver.h +2 -2
  50. data/src/head/wr_server.c +36 -26
  51. data/src/head/wr_server.h +5 -5
  52. data/src/head/wr_worker.c +551 -512
  53. data/src/head/wr_worker.h +33 -20
  54. data/src/helper/wr_config.c +316 -0
  55. data/src/helper/wr_config.h +235 -0
  56. data/src/helper/wr_helper.h +1 -5
  57. data/src/helper/wr_logger.c +4 -4
  58. data/src/helper/wr_scgi.c +3 -4
  59. data/src/helper/wr_scgi.h +2 -0
  60. data/src/helper/wr_string.h +2 -2
  61. data/src/helper/wr_util.c +3 -1
  62. data/src/helper/wr_util.h +0 -0
  63. data/src/helper/wr_yaml_parser.c +30 -0
  64. data/src/helper/wr_yaml_parser.h +1 -0
  65. data/src/ruby_lib/exception_tracker/instrumentation/action_controller.rb +2 -1
  66. data/src/ruby_lib/mailer/smtpmail.rb +7 -4
  67. data/src/ruby_lib/profiler/instrumentation/action_controller.rb +2 -1
  68. data/src/ruby_lib/profiler/instrumentation/active_record.rb +3 -0
  69. data/src/ruby_lib/rack/adapter/rails.rb +14 -7
  70. data/src/ruby_lib/ruby_interface/client.rb +1 -1
  71. data/src/ruby_lib/ruby_interface/version.rb +2 -2
  72. data/src/ruby_lib/webroar_app_loader.rb +4 -2
  73. data/src/worker/wkr_controller.c +200 -140
  74. data/src/worker/wkr_http.c +14 -28
  75. data/src/worker/wkr_http.h +4 -4
  76. data/src/worker/wkr_http_request.c +12 -11
  77. data/src/worker/wkr_http_request.h +7 -8
  78. data/src/worker/wkr_http_response.c +10 -14
  79. data/src/worker/wkr_http_response.h +0 -1
  80. data/src/worker/wkr_main.c +74 -140
  81. data/src/worker/wkr_static.c +295 -108
  82. data/src/worker/wkr_static.h +20 -7
  83. data/src/worker/worker.c +245 -70
  84. data/src/worker/worker.h +46 -34
  85. data/tasks/compile.rake +128 -175
  86. data/tasks/test.rake +345 -469
  87. data/test/spec/webroar_command_spec.rb +23 -0
  88. metadata +173 -43
  89. data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/README +0 -34
  90. data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/Rakefile +0 -13
  91. data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/init.rb +0 -5
  92. data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/lib/action_mailer_tls.rb +0 -16
  93. data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/lib/smtp_tls.rb +0 -123
  94. data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/test/tls_test.rb +0 -42
  95. data/src/head/wr_config.h +0 -165
  96. data/src/ruby_lib/mailer/action_mailer_tls.rb +0 -16
  97. data/src/ruby_lib/mailer/smtp_tls.rb +0 -123
data/doc/user-guide.txt CHANGED
@@ -24,13 +24,15 @@ Ruby on Rails applications.
24
24
  * Provides run time performance data for the deployed applications.
25
25
  * Generates notifications in case any exceptions occur in any of the deployed
26
26
  applications.
27
+ * Zero Downtime Application Upgrades.
28
+ * Static assets encoding.
27
29
  * SSL support.
28
30
 
29
31
  == Supported Operating Systems ==
30
32
 
31
- WebROaR has been tested on Ubuntu 8.10/9.04/9.10, Debian 5 (64 Bit), Mac OS X
32
- (v10.5 & v10.6), Arch Linux 2009.08 and Cent OS 5.2. Basically, it should be
33
- able to run on any *IX OS.
33
+ WebROaR has been tested on Ubuntu 8.10/9.04/9.10/10.04, Debian 5 (64 Bit),
34
+ Mac OS X (v10.5 & v10.6), Arch Linux 2009.08 and Cent OS 5.2. Basically, it
35
+ should be able to run on any *IX OS.
34
36
 
35
37
  Currently it does not support Microsoft(R) Windows.
36
38
 
@@ -51,16 +53,6 @@ Currently it does not support Microsoft(R) Windows.
51
53
  - gnutls 2.4.1 or later (Only necessary in case SSL support is required)
52
54
  - gnutls-dev 2.4.1 or later (Only necessary in case SSL support is required)
53
55
 
54
- [NOTE]
55
- .Ruby Shared Library
56
- ===============================
57
- The server needs the shared library - libruby.so to run the ruby web
58
- applications.
59
-
60
- If you are building ruby from source, please ensure you pass the flag
61
- *--enable-shared* while executing its ./configure script.
62
-
63
- ===============================
64
56
 
65
57
  === Procedure ===
66
58
 
@@ -244,6 +236,10 @@ directory. This can be used to troubleshoot the issues, if any.
244
236
  in */var/log/webroar*. In the unfortunate event of the server crashing, a core
245
237
  dump file would be created in /tmp if 'gcore' is available on that machine.
246
238
 
239
+ === Know Issue ===
240
+
241
+ * WebROaR with SSL build crashes on Ubuntu 10.04 upon execution of
242
+ *gnutls_handshake* by secure connection.
247
243
 
248
244
  === Setting up database for server admin panel ===
249
245
 
@@ -283,6 +283,7 @@ class CommandRunner
283
283
 
284
284
  opts.on( '-D', '--path DIR', 'Path for the web application root directory') do |value|
285
285
  @options[:path] = value.lstrip.gsub(/^=/,"")
286
+ @options[:path] = File.expand_path(@options[:path])
286
287
  end
287
288
 
288
289
  opts.on( '-T', '--type APPTYPE', 'Type of the application either rack or rails') do |value|
data/lib/dependencies.rb CHANGED
@@ -34,10 +34,10 @@ module Webroar
34
34
  @options = options
35
35
  case (@name)
36
36
  when File.basename(Config::CONFIG['CC']), "make", Config::CONFIG['RUBY_INSTALL_NAME'], "starling"; flag = find_command
37
- when "libsqlite3.so"; flag = find_so
38
- when "sqlite3.h", "gnutls/gnutls.h"; flag = find_header_file
37
+ when "libsqlite3.so"; flag = find_lib
38
+ when "sqlite3.h", "gnutls/gnutls.h", "zlib.h", "regex.h"; flag = find_header_file
39
39
  when "ruby_headers"; flag = find_header_file("ruby.h")
40
- when Config::CONFIG['LIBRUBY_SO']; flag = find_shared_lib
40
+ when Config::CONFIG['LIBRUBY']; flag = find_ruby_lib
41
41
  when "rubygems"; flag = find_gem
42
42
  when "openssl-ruby"; flag = find_gem("openssl")
43
43
  when "zlib-ruby"; flag = find_gem("zlib")
@@ -49,15 +49,15 @@ module Webroar
49
49
 
50
50
  private
51
51
 
52
- def find_shared_lib
53
- if File.exist?(File.join(Config::CONFIG['libdir'],Config::CONFIG['LIBRUBY_SO']))
52
+ def find_ruby_lib
53
+ if File.exist?(File.join(Config::CONFIG['libdir'],Config::CONFIG['LIBRUBY']))
54
54
  flag = "\e[32mfound\e[0m at #{Config::CONFIG['libdir']}."
55
55
  elsif Config::CONFIG['ENABLE_SHARED'] == 'yes'
56
56
  flag = "\e[32mfound\e[0m."
57
57
  else
58
- flag = find_so(Config::CONFIG['LIBRUBY_SO'])
58
+ flag = find_lib(Config::CONFIG['LIBRUBY'])
59
59
  # else
60
- # flag="\e[31mnot found\e[0m.\nUnable to find #{Config::CONFIG['LIBRUBY_SO']} at #{Config::CONFIG['libdir']}."
60
+ # flag="\e[31mnot found\e[0m.\nUnable to find #{Config::CONFIG['LIBRUBY']} at #{Config::CONFIG['libdir']}."
61
61
  end
62
62
  return flag
63
63
  end
@@ -84,11 +84,11 @@ module Webroar
84
84
  check_file(arr, name)
85
85
  end
86
86
 
87
- def find_so(name = @name)
88
- arr = []
89
- arr += ENV['LD_LIBRARY_PATH'].split(File::PATH_SEPARATOR) if ENV['LD_LIBRARY_PATH']
90
- arr += ["/usr/lib"]
91
- arr += @options[:library_paths].gsub(' -L','').gsub("''",":").gsub("'",'').split(File::PATH_SEPARATOR) if @options[:library_paths]
87
+ def find_lib(name = @name)
88
+ arr = ["/usr/lib"]
89
+ arr << ENV['LD_LIBRARY_PATH'].split(File::PATH_SEPARATOR) if ENV['LD_LIBRARY_PATH']
90
+ arr << Config::CONFIG['libdir'] if Config::CONFIG['libdir']
91
+ arr << @options[:library_paths].gsub(' -L','').gsub("''",":").gsub("'",'').split(File::PATH_SEPARATOR) if @options[:library_paths]
92
92
  arr.delete("")
93
93
 
94
94
  check_file(arr, name)
@@ -100,7 +100,8 @@ module Webroar
100
100
  begin
101
101
  require 'rbconfig'
102
102
  require 'mkmf'
103
- arr += [Config::CONFIG['archdir'], Config::CONFIG['sitearchdir']]
103
+ arr += [Config::CONFIG['includedir'], Config::CONFIG['archdir'], Config::CONFIG['sitearchdir']]
104
+ arr << Config::CONFIG['rubyhdrdir'] if Config::CONFIG['rubyhdrdir']
104
105
  end
105
106
 
106
107
  arr += ["/usr/include"]
@@ -125,7 +126,7 @@ module Webroar
125
126
  GCC = Dependency.new(File.basename(Config::CONFIG['CC']))
126
127
  Gnutls = Dependency.new('gnutls/gnutls.h')
127
128
  Make = Dependency.new('make')
128
- LibRuby = Dependency.new(Config::CONFIG['LIBRUBY_SO'])
129
+ LibRuby = Dependency.new(Config::CONFIG['LIBRUBY'])
129
130
  LibSqlite = Dependency.new('libsqlite3.so')
130
131
  Ruby_OpenSSL = Dependency.new('openssl-ruby')
131
132
  Ruby = Dependency.new(Config::CONFIG['RUBY_INSTALL_NAME'])
@@ -134,6 +135,8 @@ module Webroar
134
135
  Sqlite_DevHeaders = Dependency.new('sqlite3.h')
135
136
  Starling = Dependency.new('starling')
136
137
  Xcode = Dependency.new('Xcode.app')
137
- Zlib = Dependency.new('zlib-ruby')
138
+ RubyZlib = Dependency.new('zlib-ruby')
139
+ Zlib = Dependency.new('zlib.h')
140
+ Regex = Dependency.new('regex.h')
138
141
  end
139
142
  end # module Webroar
data/lib/installer.rb CHANGED
@@ -73,6 +73,9 @@ class Installer
73
73
  # 9) Logging level(optional)(default is 'Server Specification/log_level')
74
74
  # 10) Run as user (mandatory)
75
75
  # 11) Hostnames(optional)
76
+ # 12) Environment Variable(optional)
77
+ # It defines environment variables which can be used in the deployed application. It take following parameter.
78
+ # I) set_env(optional)(Value is key-value pair separated by equal sign('=') e.g. LOG_DIR=/var/log/webroar)
76
79
  # Order of the above elements does not matter.
77
80
  # Base-uri 'admin-panel' is reserved for 'Admin Panel'.
78
81
  # Either host_names or baseuri(not both) must present to resolve HTTP request.
@@ -91,6 +94,9 @@ class Installer
91
94
  # min_worker: 2
92
95
  # max_worker: 5
93
96
  # log_level: SEVERE
97
+ # environment_variables:
98
+ # - set_env: LOG_DIR=/var/log/webroar
99
+ # - set_env: TMP_DIR=/tmp
94
100
  # Example with host_names:
95
101
  # Application Specification:
96
102
  # - name: Mephisto
@@ -103,21 +109,42 @@ class Installer
103
109
  # min_worker: 2
104
110
  # max_worker: 5
105
111
  # log_level: SEVERE
106
- # (c) Headers (optional)
107
- # It allows adding or changing the Expires and Cache-Control in the response headers for static assets (e.g. *.js, *.gif etc).
108
- # Elements:
109
- # 1) Expires header for all static assets (optional) (default is 'off')
110
- # 2) Specific expires header for specific file types (optional)
111
- # Elements:
112
- # I) File Extensions(mandatory)
113
- # II) Expires value(mandatory) (No of seconds)
114
- # Possible value for expires is off or no. of seconds.
115
- # Example:
116
- # Headers:
117
- # expires: 3600
118
- # expires_by_type:
119
- # - ext: png, jpg, gif
120
- # expires: 31536000
112
+ # environment_variables:
113
+ # - set_env: LOG_DIR=/var/log/webroar
114
+ # - set_env: TMP_DIR=/tmp
115
+ #
116
+ # (c) Headers (optional)
117
+ # It allows adding or changing the Expires and Cache-Control in the response headers for static assets (e.g. *.js, *.gif etc).
118
+ # Elements:
119
+ # 1) Expires header for all static assets (optional) (default is 'off')
120
+ # 2) Specific expires header for specific file types (optional)
121
+ # Elements:
122
+ # I) File Extensions(mandatory)
123
+ # II) Expires value(mandatory) (No of seconds)
124
+ # Possible value for expires is off or no. of seconds.
125
+ # Example:
126
+ # Headers:
127
+ # expires: 3600
128
+ # expires_by_type:
129
+ # - ext: png, jpg, gif
130
+ # expires: 31536000
131
+ #
132
+ # (d) Encoding (optional)
133
+ # It allows (deflate) encoding of static assets.
134
+ # Elements:
135
+ # 1) Regex value for supported Content-Type (optional) (default is 'text|xml')
136
+ # 2) Regex value for supported Used-Agent (optional) (default is '.*')
137
+ # 3) Range of Content-Length (optional)
138
+ # Elements:
139
+ # I) Lower limit of Content-Length (optional) (default is 1024 i.e. 1KB)
140
+ # II) Upper limit of Content-Length (optional) (default is 12328960 i.e. 10MB)
141
+ # Example:
142
+ # Encoding:
143
+ # Content-Type: text|xml|javascript
144
+ # User-Agent: .*
145
+ # Size Limit:
146
+ # lower_limit: 2094
147
+ # upper_limit: 12328960
121
148
  #
122
149
  ######################################################################################
123
150
  }
@@ -130,7 +157,7 @@ class Installer
130
157
  Dependencies::Ruby,
131
158
  Dependencies::LibRuby,
132
159
  Dependencies::Ruby_OpenSSL,
133
- Dependencies::Zlib,
160
+ Dependencies::RubyZlib,
134
161
  Dependencies::Ruby_DevHeaders,
135
162
  Dependencies::RubyGems,
136
163
  Dependencies::GCC,
@@ -138,7 +165,9 @@ class Installer
138
165
  Dependencies::LibSqlite,
139
166
  Dependencies::Sqlite_DevHeaders,
140
167
  Dependencies::Starling,
141
- Dependencies::Gnutls
168
+ Dependencies::Gnutls,
169
+ Dependencies::Zlib,
170
+ Dependencies::Regex
142
171
  ]
143
172
  end
144
173
 
@@ -147,14 +176,16 @@ class Installer
147
176
  Dependencies::Ruby,
148
177
  Dependencies::LibRuby,
149
178
  Dependencies::Ruby_OpenSSL,
150
- Dependencies::Zlib,
179
+ Dependencies::RubyZlib,
151
180
  Dependencies::Ruby_DevHeaders,
152
181
  Dependencies::RubyGems,
153
182
  Dependencies::GCC,
154
183
  Dependencies::Make,
155
184
  Dependencies::Starling,
156
185
  Dependencies::Xcode,
157
- Dependencies::Gnutls
186
+ Dependencies::Gnutls,
187
+ Dependencies::Zlib,
188
+ Dependencies::Regex
158
189
  ]
159
190
  end
160
191
 
@@ -164,36 +195,48 @@ class Installer
164
195
  @import = false
165
196
  @port = 0
166
197
  @err_msg = nil
198
+ @zlib = true
199
+ @regex = true
167
200
  end
168
201
 
169
202
  # Install the server
170
203
  def install(options)
171
- return -1 unless CheckUser.check
172
- @options = options
173
-
174
- str = set_install_options
175
-
176
204
 
177
- check_dependencies || exit(1)
205
+ begin
206
+ return -1 unless CheckUser.check
207
+ @options = options
178
208
 
179
- @port, @import, gem_name = UserInteraction.new(@options).user_input
180
- @port = import_files(gem_name) if @import
181
- write_server_port if !@import
209
+ str = set_install_options
210
+
211
+ check_dependencies || exit(1)
182
212
 
183
- create_dirs
184
- return -1 unless compile_code(str)
185
- return -1 unless install_server
186
-
187
-
188
- # Stop WebROaR if already running.
189
- WebroarCommand.new.operation(nil, "stop") if File.exist?(PIDFILE)
190
-
191
- # Start WebROaR
192
- puts"Starting WebROaR ... "
193
- WebroarCommand.new.operation(nil, "start")
194
-
195
- install_msg(false)
196
- puts "Warning: " + @err_msg if @err_msg
213
+ str << " zlib=yes" if @zlib
214
+ str << " regex=yes" if(@zlib and @regex)
215
+
216
+ @port, @import, gem_name = UserInteraction.new(@options).user_input
217
+ @port = import_files(gem_name) if @import
218
+ write_server_port if !@import
219
+
220
+ create_dirs
221
+ return -1 unless compile_code(str)
222
+ return -1 unless install_server
223
+
224
+
225
+ # Stop WebROaR if already running.
226
+ WebroarCommand.new.operation(nil, "stop") if File.exist?(PIDFILE)
227
+
228
+ # Start WebROaR
229
+ puts"Starting WebROaR ... "
230
+ WebroarCommand.new.operation(nil, "start")
231
+
232
+ install_msg(false)
233
+ puts "Warning: " + @err_msg if @err_msg
234
+ rescue Exception=>e
235
+ File.open(File.join(WEBROAR_ROOT, "install.log"), "a+") do |f|
236
+ f.puts e.class.name
237
+ f.puts e.backtrace
238
+ end
239
+ end
197
240
  end
198
241
 
199
242
  # Start test cases
@@ -391,8 +434,8 @@ class Installer
391
434
  # Check the dependency
392
435
  def check_dependencies
393
436
  puts "Checking for the dependencies ..."
394
- failed_dependencies =[]
395
-
437
+ failed_dependencies = []
438
+
396
439
  REQUIRED_DEPENDENCIES.each do |dep|
397
440
  if (dep.name=="gnutls/gnutls.h" and @ssl) or dep.name != "gnutls/gnutls.h"
398
441
  print "Checking for #{dep.name}........"
@@ -407,6 +450,12 @@ class Installer
407
450
  end
408
451
  end
409
452
  end
453
+
454
+ @zlib = false if failed_dependencies.include?(Dependencies::Zlib.name)
455
+ failed_dependencies.delete(Dependencies::Zlib.name)
456
+
457
+ @regex = false if failed_dependencies.include?(Dependencies::Regex.name)
458
+ failed_dependencies.delete(Dependencies::Regex.name)
410
459
 
411
460
  if( failed_dependencies.size > 0)
412
461
  puts "The following dependencies required for installation could not be found:"
@@ -414,13 +463,24 @@ class Installer
414
463
  failed_dependencies.each do |dependency|
415
464
  puts dependency
416
465
  end
466
+
417
467
  puts "\e[0mPlease refer the user guide for the list of prerequisites."
418
468
  puts "Sorry, WebROaR could not be installed on this machine."
419
469
  return false
420
470
  end
471
+
472
+ unless @zlib
473
+ puts "\n\e[31mThe installation continue without supporting static assets encoding.\e[0m"
474
+ puts ""
475
+ else
476
+ unless @regex
477
+ puts "\n\e[31mThe static asstes endcoding supported without Regex validations.\e[0m"
478
+ puts ""
479
+ end
480
+ end
421
481
 
422
482
  return true
423
- end
483
+ end
424
484
 
425
485
  def check_exe_file(file)
426
486
  paths = ENV['PATH'].split(":")
@@ -434,7 +494,6 @@ class Installer
434
494
  return flag
435
495
  end
436
496
 
437
-
438
497
  def create_service_links(script_file)
439
498
  create_service_link("0", 'K15webroar', script_file)
440
499
  create_service_link("1", 'K15webroar', script_file)
@@ -581,6 +640,12 @@ exit 0"
581
640
  end
582
641
 
583
642
  def import_server_configuration(import_dir)
643
+ unless File.exist?(File.join(import_dir,"conf","config.yml"))
644
+ @port = 3000
645
+ write_server_port
646
+ return
647
+ end
648
+
584
649
  info = YAML.load(File.open(File.join(import_dir,"conf","config.yml")))
585
650
  ssl = info['Server Specification']['SSL Specification'] if info and info['Server Specification'] and info['Server Specification']['SSL Specification']
586
651
 
@@ -626,11 +691,11 @@ exit 0"
626
691
 
627
692
  if @options[:ssl]
628
693
  @ssl = true
629
- str = "ssl=yes "
694
+ str << "ssl=yes "
630
695
  end
631
696
 
632
- str += " include_flags=\"#{@options[:include_paths]}\"" if @options[:include_paths].length > 0
633
- str += " library_flags=\"#{@options[:library_paths]}\"" if @options[:library_paths].length > 0
697
+ str << " include_flags=\"#{@options[:include_paths]}\"" if @options[:include_paths].length > 0
698
+ str << " library_flags=\"#{@options[:library_paths]}\"" if @options[:library_paths].length > 0
634
699
  str
635
700
  end
636
701
 
@@ -702,7 +767,7 @@ exit 0"
702
767
  def create_dirs
703
768
  print 'Creating directory structure ...'
704
769
  Dir.chdir(WEBROAR_ROOT)
705
- system("ln -s #{ADMIN_PANEL_DIR} #{File.join(WEBROAR_ROOT)}>install.log 2>>install.log")
770
+ system("ln -s #{ADMIN_PANEL_DIR} #{WEBROAR_ROOT}>install.log 2>>install.log")
706
771
  system("chmod ugo+x #{File.join(WEBROAR_BIN_DIR,'webroar-analyzer')}")
707
772
  puts " done."
708
773
  end
@@ -138,7 +138,7 @@ class AdminController < ApplicationController
138
138
  end
139
139
  if password_changed
140
140
  flash[:notice] = PASSWORD_CHANGED
141
- YAMLWriter.write(users,USERS_FILE_PATH,"user")
141
+ YAMLWriter.write(users, USERS_FILE_PATH, YAMLConfig::USER)
142
142
  else
143
143
  if params[:password][:new].length < 6
144
144
  flash[:notice] = WRONG_PASSWORD2
@@ -155,20 +155,6 @@ class AdminController < ApplicationController
155
155
  set_application_name
156
156
  end
157
157
 
158
- #This method is to add div for changing the server specifications.
159
- #This action is called as a ajax call when user click on the edit button of the server specification block in the configuration page.
160
- def add_text_box
161
- @path = CONFIG_FILE_PATH
162
- render :partial => 'add_div'
163
- end
164
-
165
- #This method is to close the edit box for the server specification.
166
- #This is called if user doesnot wants to made the changes in the server specification.
167
- def cancel_edit
168
- text = params[:old_value].to_s
169
- render :text => text
170
- end
171
-
172
158
  #This method is to return the server time.
173
159
  #The method refreshes the time after every minute.
174
160
  def get_latest_time
@@ -95,9 +95,9 @@ private
95
95
  info = YAML::load_file(CONFIG_FILE_PATH) rescue nil
96
96
  if info and info['Application Specification']
97
97
  while(info['Application Specification'][i])
98
- if info['Application Specification'][i]['analytics'].downcase == "enabled".downcase
98
+ #if info['Application Specification'][i]['analytics'].downcase == "enabled".downcase
99
99
  apps << info['Application Specification'][i]['name'].gsub("<","&lt;").gsub(">","&gt;")
100
- end
100
+ #end
101
101
  i += 1
102
102
  end
103
103
  end
@@ -121,8 +121,9 @@ class ApplicationSpecificationController < ApplicationController
121
121
  end
122
122
 
123
123
  def set_error(reply, err_log)
124
+ # flash data is being stored in Session, and causing cookie overflow error when total session data exceeds 4K
124
125
  flash[:error] = reply if reply
125
- flash[:error] += "<br/><br/><div align='left'><font color='red'" + err_log.gsub("\n","<br/>") + "</font></div>" if err_log
126
+ flash[:error] += "<br/><br/><div align='left'><font color='red'>" + err_log.gsub("\n","<br/>") + "</font></div>" if err_log
126
127
  end
127
128
 
128
129
  end
@@ -0,0 +1,73 @@
1
+ #--
2
+ # WebROaR - Ruby Application Server - http://webroar.in/
3
+ # Copyright (C) 2009 Goonj LLC
4
+ #
5
+ # This file is part of WebROaR.
6
+ #
7
+ # WebROaR is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # WebROaR is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with WebROaR. If not, see <http://www.gnu.org/licenses/>.
19
+ #++
20
+
21
+ class HeadersController < ApplicationController
22
+ before_filter :login_required
23
+ before_filter :check_session_timeout
24
+
25
+ def add_expires_text_box
26
+ render :partial => 'add_expires_text_box'
27
+ end
28
+
29
+ def cancel_expires_value_edit
30
+ text = params[:old_value].to_s
31
+ render :text => text
32
+ end
33
+
34
+ def save_expires_value
35
+ text = params[:old_value].to_s
36
+ if params[:data][:value]
37
+ text, error_message = Headers.validate_and_write_expires_value(text, params[:data][:value])
38
+ if error_message.length > 0
39
+ render :text => text.to_s + " <span id='error_div'>#{error_message}</span>"
40
+ else
41
+ render :text => text.to_s + " <span id='error_div'>#{RESTART_SERVER_MESSAGE}</span>"
42
+ end
43
+ end
44
+ end
45
+
46
+ def add_expires_by_type_form
47
+ render :partial => 'expires_by_type_form'
48
+ end
49
+
50
+ def save_expires_by_type_value
51
+ @error_message = Headers.validate_and_write_expires_by_type(params[:data][:ext], params[:data][:expires])
52
+ if @error_message.length > 0
53
+ update_div = 'expires_by_type_form'
54
+ partial_name = 'expires_by_type_form'
55
+ else
56
+ update_div = 'headers_div'
57
+ partial_name = 'headers_table'
58
+ @restart_server_message = RESTART_SERVER_MESSAGE
59
+ end
60
+ render :update do |page|
61
+ page.replace_html update_div, :partial => partial_name
62
+ end
63
+ end
64
+
65
+ def delete_expires_by_type
66
+ Headers.delete_expires_by_type(params[:id].to_i) if params[:id]
67
+ render :partial => 'headers_table'
68
+ end
69
+
70
+ def cancel_expires_by_type_value
71
+ render :text => ''
72
+ end
73
+ end
@@ -70,4 +70,14 @@ class MailSpecificationController < ApplicationController
70
70
  redirect_to :controller => 'admin', :action => 'configuration', :smtp => smtp
71
71
  end
72
72
 
73
+ def enable_notification
74
+ MailSpecification.update_notification_status(:enable)
75
+ render :partial => 'current_spec'
76
+ end
77
+
78
+ def disable_notification
79
+ MailSpecification.update_notification_status(:disable)
80
+ render :partial => 'current_spec'
81
+ end
82
+
73
83
  end
@@ -83,6 +83,20 @@ class ServerSpecificationController < ApplicationController
83
83
  end
84
84
  end
85
85
 
86
+ #This method is to add div for changing the server specifications.
87
+ #This action is called as a ajax call when user click on the edit button of the server specification block in the configuration page.
88
+ def add_text_box
89
+ @path = CONFIG_FILE_PATH
90
+ render :partial => 'add_div'
91
+ end
92
+
93
+ #This method is to close the edit box for the server specification.
94
+ #This is called if user doesnot wants to made the changes in the server specification.
95
+ def cancel_edit
96
+ text = params[:old_value].to_s
97
+ render :text => text
98
+ end
99
+
86
100
  private
87
101
 
88
102
  #Method is to check for the various constarins for ssl supports