mongrel2 0.27.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,3 +1,22 @@
1
+ 2012-07-02 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * .hgtags:
4
+ Added tag v0.27.0 for changeset 8883019d3299
5
+ [b85c576e5fb1] [tip]
6
+
7
+ * .hgsigs:
8
+ Added signature for changeset 6de3cbe2409c
9
+ [8883019d3299] [v0.27.0]
10
+
11
+ * History.rdoc, lib/mongrel2.rb:
12
+ Bump the minor version, update history.
13
+ [6de3cbe2409c]
14
+
15
+ * README.rdoc, lib/mongrel2/config.rb, lib/mongrel2/connection.rb,
16
+ lib/mongrel2/control.rb, lib/mongrel2/testing.rb:
17
+ Updating API documentation.
18
+ [cfac9894f2ec]
19
+
1
20
  2012-06-30 Michael Granger <ged@FaerieMUD.org>
2
21
 
3
22
  * Manifest.txt, README.rdoc, bin/m2sh.rb, data/mongrel2/config.rb.in,
@@ -6,7 +25,7 @@
6
25
 
7
26
  Also adding documentation for them to the README, and moved the
8
27
  DATA_DIR constants into mongrel2/constants.
9
- [2f2b9b4bc86f] [tip]
28
+ [2f2b9b4bc86f]
10
29
 
11
30
  2012-06-27 Michael Granger <ged@FaerieMUD.org>
12
31
 
@@ -1,3 +1,13 @@
1
+ == v0.28.0 [2012-07-12] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Add Mongrel2::Config::Server pathname methods for the path
4
+ attributes (#access_log, #pid_file, etc.).
5
+ - Show the server's URL at startup
6
+ - Finish Config::Server API docs and add a predicate method for
7
+ use_ssl
8
+ - Remove shell mode from m2sh.rb.
9
+
10
+
1
11
  == v0.27.0 [2012-07-02] Michael Granger <ged@FaerieMUD.org>
2
12
 
3
13
  - Adds support for websocket handshake in 'develop' branch.
@@ -14,7 +14,6 @@ data/mongrel2/css/master.css
14
14
  data/mongrel2/js/websock-test.js
15
15
  data/mongrel2/mimetypes.sql
16
16
  data/mongrel2/websock-test.html
17
- examples/.env
18
17
  examples/Procfile
19
18
  examples/README.txt
20
19
  examples/async-upload.rb
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'uri'
4
4
  require 'pathname'
5
- require 'shellwords'
6
5
  require 'fileutils'
7
6
  require 'tnetstring'
8
7
  require 'loggability'
@@ -23,7 +22,7 @@ require 'mongrel2/config'
23
22
  #
24
23
  # [√] load Load a config.
25
24
  # [√] config Alias for load.
26
- # [] shell Starts an interactive shell.
25
+ # [-] shell Starts an interactive shell.
27
26
  # [√] access Prints the access log.
28
27
  # [√] servers Lists the servers in a config database.
29
28
  # [√] hosts Lists the hosts in a server.
@@ -43,7 +42,8 @@ require 'mongrel2/config'
43
42
  # well), so I don't plan to implement that. The 'control' command is more-easily
44
43
  # accessed via pry+Mongrel2::Control, so I'm not going to implement that, either.
45
44
  # Everything else should be analagous to (or better than) the m2sh that comes with
46
- # mongrel2.
45
+ # mongrel2. I implemented the 'shell' mode, but I found I never used it, and it
46
+ # introduced a dependency on the Termios library, so I removed it.
47
47
  #
48
48
  class Mongrel2::M2SHCommand
49
49
  extend ::Sysexits,
@@ -67,15 +67,9 @@ class Mongrel2::M2SHCommand
67
67
  end
68
68
 
69
69
 
70
- # Path to the default history file for 'shell' mode
71
- HISTORY_FILE = Pathname( "~/.m2shrb.history" )
72
-
73
70
  # Number of items to store in history by default
74
71
  DEFAULT_HISTORY_SIZE = 100
75
72
 
76
- # The prompt the 'shell' mode should show
77
- PROMPT = 'mongrel2> '
78
-
79
73
 
80
74
  # Class instance variables
81
75
  @command_help = Hash.new {|h,k| h[k] = { :desc => nil, :usage => ''} }
@@ -213,7 +207,6 @@ class Mongrel2::M2SHCommand
213
207
  def initialize( options )
214
208
  Loggability.format_as( :color ) if $stderr.tty?
215
209
  @options = options
216
- @shellmode = false
217
210
 
218
211
  if @options.debug
219
212
  $DEBUG = true
@@ -234,9 +227,6 @@ class Mongrel2::M2SHCommand
234
227
  # The Trollop options hash the command will read its configuration from
235
228
  attr_reader :options
236
229
 
237
- # True if running in shell mode
238
- attr_reader :shellmode
239
-
240
230
 
241
231
  # Delegate the instance #prompt method to the class method instead
242
232
  define_method( :prompt, &self.method(:prompt) )
@@ -244,7 +234,7 @@ class Mongrel2::M2SHCommand
244
234
 
245
235
  ### Run the command with the specified +command+ and +args+.
246
236
  def run( command, *args )
247
- command ||= 'shell'
237
+ command ||= 'help'
248
238
  cmd_method = nil
249
239
 
250
240
  begin
@@ -330,71 +320,6 @@ class Mongrel2::M2SHCommand
330
320
  help :init, "Initialize a new empty config database."
331
321
 
332
322
 
333
- ### The 'shell' command.
334
- def shell_command( * )
335
- require 'readline'
336
- require 'termios'
337
- require 'shellwords'
338
-
339
- term = Termios.getattr( $stdin )
340
- @shellmode = true
341
-
342
- # Set up the completion callback
343
- # self.setup_completion
344
-
345
- # Load saved command-line history
346
- self.read_history
347
-
348
- # Run until something sets the quit flag
349
- quitting = false
350
- until quitting
351
- $stderr.puts
352
- input = Readline.readline( PROMPT, true )
353
- self.log.debug "Input is: %p" % [ input ]
354
-
355
- # EOL makes the shell quit
356
- if input.nil?
357
- self.log.debug "EOL: setting quit flag"
358
- quitting = true
359
-
360
- # Blank input -- just reprompt
361
- elsif input == ''
362
- self.log.debug "No command. Re-displaying the prompt."
363
-
364
- # Parse everything else into command + args
365
- else
366
- self.log.debug "Dispatching input: %p" % [ input ]
367
- command, *args = Shellwords.split( input )
368
-
369
- # Don't allow recursive shells
370
- if command == 'shell'
371
- error "Already in a shell."
372
- next
373
- end
374
-
375
- begin
376
- self.run( command, *args )
377
- rescue => err
378
- error "%p: %s" % [ err.class, err.message ]
379
- err.backtrace.each do |frame|
380
- self.log.debug " " + frame
381
- end
382
- end
383
- end
384
- end
385
-
386
- message "\nSaving history...\n"
387
- self.save_history
388
-
389
- message "done."
390
-
391
- ensure
392
- @shellmode = false
393
- Termios.tcsetattr( $stdin, Termios::TCSANOW, term )
394
- end
395
- help :shell, "Start the program in interactive mode."
396
-
397
-
398
323
  ### The 'access' command
399
324
  def access_command( logfile='logs/access.log', * )
400
325
  # 1$ 2$ 3$ 4$ 5$ 6$ 7$ 8$ 9$
@@ -511,16 +436,16 @@ class Mongrel2::M2SHCommand
511
436
  server.save
512
437
  end
513
438
 
514
- # Run the command, waiting for it to finish if invoked from shell mode, or
515
- # execing it if not.
516
439
  cmd = [ mongrel2, Mongrel2::Config.dbname.to_s, server.uuid ]
517
440
  cmd.unshift( 'sudo' ) if self.options.sudo
518
441
 
519
- if @shellmode
520
- system( *cmd )
521
- else
522
- exec( *cmd )
523
- end
442
+ url = "http%s://%s:%d" % [
443
+ server.use_ssl? ? 's' : '',
444
+ server.bind_addr,
445
+ server.port,
446
+ ]
447
+ header "Starting mongrel2 at: #{url}"
448
+ exec( *cmd )
524
449
  end
525
450
  help :start, "Starts a server."
526
451
  usage :start, <<-END_USAGE
@@ -20,10 +20,10 @@ module Mongrel2
20
20
  abort "\n\n>>> Mongrel2 requires Ruby 1.9.2 or later. <<<\n\n" if RUBY_VERSION < '1.9.2'
21
21
 
22
22
  # Library version constant
23
- VERSION = '0.27.0'
23
+ VERSION = '0.28.0'
24
24
 
25
25
  # Version-control revision constant
26
- REVISION = %q$Revision: 6de3cbe2409c $
26
+ REVISION = %q$Revision: 511f5e29f0a0 $
27
27
 
28
28
 
29
29
  require 'mongrel2/constants'
@@ -25,6 +25,95 @@ class Mongrel2::Config::Server < Mongrel2::Config( :server )
25
25
  # port INTEGER,
26
26
  # use_ssl INTEGER default 0);
27
27
 
28
+ ##
29
+ # :method: uuid
30
+ # Get the server identifier, which is typically a UUID, but can
31
+ # in reality be any string of alphanumeric characters and dashes.
32
+
33
+ ##
34
+ # :method: uuid=( newuuid )
35
+ # Set the server identifier.
36
+
37
+ ##
38
+ # :method: access_log
39
+ # Get the path to the server's access log as a String.
40
+
41
+ ### Get the path to the server's access log as a Pathname
42
+ def access_log_path
43
+ path = self.access_log or return nil
44
+ return Pathname( path )
45
+ end
46
+
47
+
48
+ ##
49
+ # :method: error_log
50
+ # Get the path tot he server's error log as a String.
51
+
52
+ ### Get the path to the server's error log as a Pathname
53
+ def error_log_path
54
+ path = self.error_log or return nil
55
+ return Pathname( path )
56
+ end
57
+
58
+
59
+ ##
60
+ # :method: chroot
61
+ # Get the name of the directory Mongrel2 will chroot to if run as root
62
+ # as a String.
63
+
64
+ ### Return a Pathname for the server's chroot directory.
65
+ def chroot_path
66
+ path = self.chroot or return nil
67
+ return Pathname( path )
68
+ end
69
+
70
+
71
+ ##
72
+ # :method: pid_file
73
+ # Get the path to the server's PID file as a String.
74
+
75
+ ### The path to the server's PID file as a Pathname.
76
+ def pid_file_path
77
+ path = self.pid_file or return nil
78
+ return Pathname( path )
79
+ end
80
+
81
+
82
+ ##
83
+ # :method: default_host
84
+ # Get the name of the default virtualhost for the server. If none
85
+ # of the hosts' names (or matching pattern) matches the request's Host:
86
+ # header, the default_host will be used.
87
+
88
+ ##
89
+ # :method: name
90
+ # The huamn-readable name of the server.
91
+
92
+ ##
93
+ # :method: bind_addr
94
+ # The address to bind to on startup.
95
+
96
+ ##
97
+ # :method: port
98
+ # The port to listen on.
99
+
100
+
101
+ ### Returns +true+ if the server uses SSL.
102
+ def use_ssl?
103
+ return self.use_ssl.nonzero?
104
+ end
105
+
106
+
107
+ ### If +enabled+, the server will use SSL.
108
+ def use_ssl=( enabled )
109
+ if !enabled || enabled == 0
110
+ super( 0 )
111
+ else
112
+ super( 1 )
113
+ end
114
+ end
115
+
116
+
28
117
  #
29
118
  # :section: Associations
30
119
  #
@@ -54,12 +143,6 @@ class Mongrel2::Config::Server < Mongrel2::Config( :server )
54
143
  # :section: Socket/Pathname Convenience Methods
55
144
  #
56
145
 
57
- ### Return a Pathname for the server's chroot directory.
58
- def chroot_path
59
- return Pathname( self.chroot )
60
- end
61
-
62
-
63
146
  ### Return the URI for its control socket.
64
147
  def control_socket_uri
65
148
  # Find the control socket relative to the server's chroot
@@ -84,15 +167,6 @@ class Mongrel2::Config::Server < Mongrel2::Config( :server )
84
167
  end
85
168
 
86
169
 
87
- ### Return a Pathname for the server's PID file with its chroot directory prepended.
88
- def pid_file_path
89
- pidfile = self.pid_file
90
- pidfile.slice!( 0, 1 ) if pidfile.start_with?( '/' )
91
-
92
- return self.chroot_path + pidfile
93
- end
94
-
95
-
96
170
  #
97
171
  # :section: Validation Callbacks
98
172
  #
@@ -102,7 +102,13 @@ describe Mongrel2::Config::Server do
102
102
  it "knows what the Pathname of its PID file is" do
103
103
  pidfile = @server.pid_file_path
104
104
  pidfile.should be_a( Pathname )
105
- pidfile.to_s.should == '/usr/local/www/run/mongrel2.pid'
105
+ pidfile.to_s.should == '/run/mongrel2.pid'
106
+ end
107
+
108
+ it "has a predicate that understands the use_ssl value" do
109
+ @server.use_ssl.should be_false()
110
+ @server.use_ssl = true
111
+ @server.use_ssl.should be_true()
106
112
  end
107
113
 
108
114
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongrel2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.28.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,7 +36,7 @@ cert_chain:
36
36
  YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
37
37
  Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
38
38
  cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
39
- date: 2012-07-02 00:00:00.000000000 Z
39
+ date: 2012-07-12 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: nokogiri
@@ -334,7 +334,6 @@ files:
334
334
  - data/mongrel2/js/websock-test.js
335
335
  - data/mongrel2/mimetypes.sql
336
336
  - data/mongrel2/websock-test.html
337
- - examples/.env
338
337
  - examples/Procfile
339
338
  - examples/README.txt
340
339
  - examples/async-upload.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,2 +0,0 @@
1
- RUBYOPT=-I../lib
2
- MONGREL2=/Users/mgranger/source/C/mongrel2/bin/mongrel2