mongrel2 0.9.2 → 0.10.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,8 +1,159 @@
1
+ 2012-02-06 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * .hgtags:
4
+ Added tag v0.10.0 for changeset 1e9885cbcafd
5
+ [d3f06f6344ad] [tip]
6
+
7
+ * .hgsigs:
8
+ Added signature for changeset 948877fd6c9d
9
+ [1e9885cbcafd] [v0.10.0]
10
+
11
+ * Manifest.txt:
12
+ Updating the manifest
13
+ [948877fd6c9d]
14
+
15
+ * .hgsigs:
16
+ Added signature for changeset 2fcffa9c789b
17
+ [457375acdf50]
18
+
19
+ * History.rdoc:
20
+ Updated the date in the History file
21
+ [2fcffa9c789b]
22
+
23
+ 2012-01-25 Michael Granger <ged@FaerieMUD.org>
24
+
25
+ * .tm_properties, History.rdoc, data/mongrel2/config.sql,
26
+ examples/config.rb, lib/mongrel2/config.rb,
27
+ lib/mongrel2/config/dsl.rb, lib/mongrel2/config/filter.rb,
28
+ lib/mongrel2/config/server.rb, spec/mongrel2/config/dsl_spec.rb,
29
+ spec/mongrel2/config/filter_spec.rb,
30
+ spec/mongrel2/config/route_spec.rb:
31
+ Updating config database schema/classes for Mongrel 1.8.
32
+ [6d2608b23873] [github/master]
33
+
34
+ * examples/config.rb:
35
+ Move the example server back to port 8113
36
+ [05d301010931]
37
+
38
+ * History.rdoc, lib/mongrel2.rb:
39
+ Bumped minor version, updated history.
40
+ [b3ed6f931afa]
41
+
42
+ * .rvm.gems, .rvmrc, Rakefile, bin/m2sh.rb, lib/mongrel2/config.rb,
43
+ lib/mongrel2/config/server.rb, lib/mongrel2/constants.rb,
44
+ spec/mongrel2/config/server_spec.rb, spec/mongrel2/config_spec.rb:
45
+ Adding the rest of the m2sh commands to the ruby analog
46
+ [23ec891231d3]
47
+
48
+ 2012-01-11 Michael Granger <ged@FaerieMUD.org>
49
+
50
+ * .pryrc:
51
+ Adding a .pryrc
52
+ [08d0aad8c902]
53
+
54
+ 2012-01-09 Michael Granger <ged@FaerieMUD.org>
55
+
56
+ * History.rdoc, lib/mongrel2.rb:
57
+ Bumped patch version; updated history file
58
+ [e05d8ed6d64b]
59
+
60
+ * bin/m2sh.rb:
61
+ Adding a "sudo" option to m2sh.rb to start the server as root
62
+ [a03146c94124]
63
+
64
+ 2012-01-05 Michael Granger <ged@FaerieMUD.org>
65
+
66
+ * .rvm.gems, Rakefile:
67
+ Add rvm gemset, update dependencies.
68
+ [492faafc9c10]
69
+
70
+ 2011-12-29 Michael Granger <ged@FaerieMUD.org>
71
+
72
+ * examples/config.rb:
73
+ Modified values to be a bit more like the Mongrel2 example
74
+ [12866b0f1910]
75
+
76
+ * .tm_properties:
77
+ Adding my TextMate2 properties file
78
+ [7ad85509639e]
79
+
80
+ 2011-12-07 Michael Granger <ged@FaerieMUD.org>
81
+
82
+ * .rvmrc:
83
+ Use a gemset in the .rvmrc.
84
+ [0faddd8ecca1]
85
+
86
+ 2011-11-21 Michael Granger <ged@FaerieMUD.org>
87
+
88
+ * lib/mongrel2/config.rb:
89
+ Enable the json_serializer plugin for the config ORM classes
90
+ [95702dafbe39]
91
+
92
+ 2011-10-17 Michael Granger <ged@FaerieMUD.org>
93
+
94
+ * README.rdoc, lib/mongrel2/httpresponse.rb, lib/mongrel2/response.rb,
95
+ lib/mongrel2/table.rb:
96
+ Backing out the change to HTTPResponse to use the @body ivar:
97
+ changed the negotiation plugin to use the #to_s method instead.
98
+ [989199eb3731]
99
+
1
100
  2011-10-12 Michael Granger <ged@FaerieMUD.org>
2
101
 
102
+ * .hgtags:
103
+ Added tag v0.9.2 for changeset 4b86af172b1c
104
+ [cb02d92719e6]
105
+
106
+ * .hgsigs:
107
+ Added signature for changeset c0a5ad8a50f7
108
+ [4b86af172b1c] [v0.9.2]
109
+
110
+ * History.rdoc, lib/mongrel2.rb:
111
+ Bump the patch version, update history.
112
+ [c0a5ad8a50f7]
113
+
114
+ * lib/mongrel2/httpresponse.rb:
115
+ Bugfix: dup instead of clone to get rid of frozen status.
116
+ [d721f3550aa6]
117
+
118
+ * .hgtags:
119
+ Added tag v0.9.1 for changeset c4bcdadb0ea8
120
+ [a0fde2550745]
121
+
122
+ * .hgsigs:
123
+ Added signature for changeset f8aa9d64dbd4
124
+ [c4bcdadb0ea8] [v0.9.1]
125
+
126
+ * History.rdoc, lib/mongrel2.rb:
127
+ Bump the patch version, update history.
128
+ [f8aa9d64dbd4]
129
+
130
+ * lib/mongrel2/httpresponse.rb:
131
+ Bugfix: don't use the default content type string constant directly.
132
+ [d82673c8c1ae]
133
+
134
+ * .hgtags:
135
+ Added tag v0.9.0 for changeset 990255c9d9b2
136
+ [ef6f05d42f79]
137
+
138
+ * .hgsigs:
139
+ Added signature for changeset 180ebbaeb4a0
140
+ [990255c9d9b2] [v0.9.0]
141
+
142
+ * History.rdoc, lib/mongrel2.rb:
143
+ Bumped minor version, updated history.
144
+ [180ebbaeb4a0]
145
+
146
+ * lib/mongrel2/table.rb, spec/mongrel2/table_spec.rb:
147
+ Fix Mongrel2::Table not duping/cloning its internal values.
148
+ [34cb2a0bfee6]
149
+
150
+ * lib/mongrel2/httpresponse.rb, spec/mongrel2/httpresponse_spec.rb:
151
+ Set a default Content-type header in HTTP responses
152
+ [a9914061817c]
153
+
3
154
  * .hgtags:
4
155
  Added tag v0.8.0 for changeset 27d84902263b
5
- [51ad37ddc1cd] [tip]
156
+ [51ad37ddc1cd]
6
157
 
7
158
  * .hgsigs:
8
159
  Added signature for changeset 986182bd469e
@@ -109,7 +260,7 @@
109
260
 
110
261
  * .hgtags:
111
262
  Added tag v0.4.0 for changeset 25f2272fc9f8
112
- [0b4e011b72b4] [github/master]
263
+ [0b4e011b72b4]
113
264
 
114
265
  * .hgsigs:
115
266
  Added signature for changeset 3fb74e2ce308
@@ -357,6 +508,10 @@
357
508
  * Automated merge with ssh://deveiate.org/Ruby-Mongrel2
358
509
  [2da76acfb8db]
359
510
 
511
+ * History.rdoc:
512
+ Updating History
513
+ [3b013d4918c6]
514
+
360
515
  * Rakefile:
361
516
  Automated merge with ssh://deveiate.org/Ruby-Mongrel2
362
517
  [e3908fd8e744]
@@ -365,10 +520,6 @@
365
520
  Remove ChangeLog task, since hoe-deveiate already does it
366
521
  [5f4982a32949]
367
522
 
368
- * History.rdoc:
369
- Updating History
370
- [3b013d4918c6]
371
-
372
523
  * .hgtags:
373
524
  Added tag v0.1.1 for changeset 42da048fe158
374
525
  [2489be2693d5]
@@ -538,18 +689,6 @@
538
689
  * Merged with 6ea60b67e106
539
690
  [6d5341f30cc4]
540
691
 
541
- * Manifest.txt:
542
- Updating the manifest for the first release
543
- [916a79570cdc]
544
-
545
- * examples/helloworld-handler.rb, lib/mongrel2/handler.rb:
546
- More Handler API docs.
547
- [47427db9b4fb]
548
-
549
- * lib/mongrel2/handler.rb:
550
- Adding some Mongrel2::Handler API docs.
551
- [da95bfdf83da]
552
-
553
692
  * lib/mongrel2/config/host.rb:
554
693
  Adding a many_to_one association for the server belonging to a
555
694
  Mongrel2::Config::Host
@@ -569,6 +708,18 @@
569
708
  Adding a proftools dump of the requestdumper app
570
709
  [00cbc1b89a61]
571
710
 
711
+ * Manifest.txt:
712
+ Updating the manifest for the first release
713
+ [916a79570cdc]
714
+
715
+ * examples/helloworld-handler.rb, lib/mongrel2/handler.rb:
716
+ More Handler API docs.
717
+ [47427db9b4fb]
718
+
719
+ * lib/mongrel2/handler.rb:
720
+ Adding some Mongrel2::Handler API docs.
721
+ [da95bfdf83da]
722
+
572
723
  2011-09-08 Michael Granger <ged@FaerieMUD.org>
573
724
 
574
725
  * README.rdoc, lib/mongrel2.rb, lib/mongrel2/config.rb,
data/History.rdoc CHANGED
@@ -1,3 +1,24 @@
1
+ == v0.10.0 [2012-02-06] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ This release includes updates for Mongrel 1.8 and finishes up the m2sh.rb tool.
4
+
5
+ - New config class: Mongrel2::Config::Filter
6
+ - New DSL directive inside a 'server' section: 'filter'
7
+ - New methods:
8
+ * Mongrel2::Config.settings
9
+ * Mongrel2::Server
10
+ - #control_socket_uri
11
+ - #control_socket
12
+ - #pid_file_path
13
+ - Added a new Mongrel2::Constants::DEFAULT_CONTROL_SOCKET constant
14
+ - Finished implementation of the rest of the m2sh commands in the ruby
15
+ analog
16
+ - Adding a "sudo" option to m2sh.rb to start the server as root
17
+ - Enable the json_serializer plugin for the config ORM classes
18
+ - Backing out the change to HTTPResponse to use the @body ivar: changed
19
+ the negotiation
20
+
21
+
1
22
  == v0.9.2 [2011-10-12] Michael Granger <ged@FaerieMUD.org>
2
23
 
3
24
  Bugfix: dup instead of clone to get rid of frozen status.
data/Manifest.txt CHANGED
@@ -20,6 +20,7 @@ lib/mongrel2.rb
20
20
  lib/mongrel2/config.rb
21
21
  lib/mongrel2/config/directory.rb
22
22
  lib/mongrel2/config/dsl.rb
23
+ lib/mongrel2/config/filter.rb
23
24
  lib/mongrel2/config/handler.rb
24
25
  lib/mongrel2/config/host.rb
25
26
  lib/mongrel2/config/log.rb
@@ -49,6 +50,7 @@ spec/lib/helpers.rb
49
50
  spec/lib/matchers.rb
50
51
  spec/mongrel2/config/directory_spec.rb
51
52
  spec/mongrel2/config/dsl_spec.rb
53
+ spec/mongrel2/config/filter_spec.rb
52
54
  spec/mongrel2/config/handler_spec.rb
53
55
  spec/mongrel2/config/host_spec.rb
54
56
  spec/mongrel2/config/log_spec.rb
data/README.rdoc CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  = Ruby-Mongrel2
3
2
 
4
3
  * http://deveiate.org/projects/Ruby-Mongrel2/
data/Rakefile CHANGED
@@ -26,14 +26,16 @@ hoespec = Hoe.spec 'mongrel2' do
26
26
  self.developer 'Michael Granger', 'ged@FaerieMUD.org'
27
27
 
28
28
  self.dependency 'nokogiri', '~> 1.5'
29
- self.dependency 'sequel', '~> 3.26'
29
+ self.dependency 'sequel', '~> 3.31'
30
30
  self.dependency 'amalgalite', '~> 1.1'
31
31
  self.dependency 'tnetstring', '~> 0.3'
32
- self.dependency 'yajl-ruby', '~> 0.8'
32
+ self.dependency 'yajl-ruby', '~> 1.0'
33
+ self.dependency 'trollop', '~> 1.16'
34
+ self.dependency 'sysexits', '~> 1.0'
33
35
  self.dependency 'zmq', '~> 2.1.4'
34
36
 
35
37
  self.dependency 'configurability', '~> 1.0', :developer
36
- self.dependency 'rspec', '~> 2.4', :developer
38
+ self.dependency 'rspec', '~> 2.8', :developer
37
39
 
38
40
  self.spec_extras[:licenses] = ["BSD"]
39
41
  self.require_ruby_version( '>= 1.9.2' )
@@ -47,12 +49,13 @@ end
47
49
  ENV['VERSION'] ||= hoespec.spec.version.to_s
48
50
 
49
51
  # Ensure the specs pass before checking in
50
- task 'hg:precheckin' => [ :check_manifest, :check_history, :spec ]
51
-
52
+ task 'hg:precheckin' => [:check_manifest, :check_history, :spec]
52
53
 
53
54
  # Rebuild the ChangeLog immediately before release
54
55
  task :prerelease => [:check_manifest, :check_history, 'ChangeLog']
55
56
 
57
+ task :check_manifest => 'ChangeLog'
58
+
56
59
 
57
60
  desc "Build a coverage report"
58
61
  task :coverage do
data/bin/m2sh.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'pp'
3
+ require 'uri'
4
+ require 'pathname'
4
5
  require 'shellwords'
5
6
  require 'fileutils'
6
7
  require 'tnetstring'
@@ -29,18 +30,20 @@ require 'mongrel2/config'
29
30
  # [√] commit Adds a message to the log.
30
31
  # [√] log Prints the commit log.
31
32
  # [√] start Starts a server.
32
- # [ ] stop Stops a server.
33
- # [ ] reload Reloads a server.
34
- # [ ] running Tells you what's running.
35
- # [ ] control Connects to the control port.
33
+ # [] stop Stops a server.
34
+ # [] reload Reloads a server.
35
+ # [] running Tells you what's running.
36
+ # [-] control Connects to the control port.
36
37
  # [√] version Prints the Mongrel2 and m2sh version.
37
38
  # [√] help Get help, lists commands.
38
39
  # [-] uuid Prints out a randomly generated UUID.
39
40
  #
40
41
  # I just use 'uuidgen' to generate uuids (which is all m2sh does, as
41
- # well), so I don't plan to implement that. Everything else should
42
- # be pretty easy.
43
- #
42
+ # well), so I don't plan to implement that. The 'control' command is more-easily
43
+ # accessed via pry+Mongrel2::Control, so I'm not going to implement that, either.
44
+ # Everything else should be analagous to (or better than) the m2sh that comes with
45
+ # mongrel2.
46
+ #
44
47
  class Mongrel2::M2SHCommand
45
48
  extend ::Sysexits
46
49
  include Sysexits,
@@ -49,11 +52,11 @@ class Mongrel2::M2SHCommand
49
52
 
50
53
  # Make a HighLine color scheme
51
54
  COLOR_SCHEME = HighLine::ColorScheme.new do |scheme|
52
- scheme[:header] = [ :bold, :yellow ]
55
+ scheme[:header] = [ :bold, :yellow ]
53
56
  scheme[:subheader] = [ :bold, :white ]
54
- scheme[:key] = [ :white ]
55
- scheme[:value] = [ :bold, :white ]
56
- scheme[:error] = [ :red ]
57
+ scheme[:key] = [ :white ]
58
+ scheme[:value] = [ :bold, :white ]
59
+ scheme[:error] = [ :red ]
57
60
  scheme[:warning] = [ :yellow ]
58
61
  scheme[:message] = [ :reset ]
59
62
  end
@@ -101,7 +104,7 @@ class Mongrel2::M2SHCommand
101
104
  def self::prompt
102
105
  unless @prompt
103
106
  @prompt = HighLine.new
104
- @prompt.wrap_at = @prompt.output_cols - 10
107
+ # @prompt.wrap_at = @prompt.output_cols - 3
105
108
  end
106
109
 
107
110
  return @prompt
@@ -180,6 +183,7 @@ class Mongrel2::M2SHCommand
180
183
  text 'Global Options'
181
184
  opt :config, "Specify the configfile to use.",
182
185
  :default => DEFAULT_CONFIG_URI
186
+ opt :sudo, "Use 'sudo' to run the mongrel2 server."
183
187
  text ''
184
188
 
185
189
  text 'Other Options:'
@@ -491,33 +495,14 @@ class Mongrel2::M2SHCommand
491
495
 
492
496
  ### The 'start' command
493
497
  def start_command( *args )
494
- serverspec = args.shift
495
- servers = Mongrel2::Config.servers
496
-
497
- raise "No servers are configured." if servers.empty?
498
- server = nil
499
-
500
- # If there's only one configured server, just make sure if a serverspec was given
501
- # that it would have matched.
502
- if servers.length == 1
503
- server = servers.first if !serverspec ||
504
- servers.first.values_at( :uuid, :default_host, :name ).include?( serverspec )
505
-
506
- # Otherwise, require an argument and search for the desired server if there is one
507
- else
508
- raise "You must specify a server uuid/hostname/name when more " +
509
- "than one server is configured." if servers.length > 1 && !serverspec
510
-
511
- server = servers.find {|s| s.uuid == serverspec } ||
512
- servers.find {|s| s.default_host == serverspec } ||
513
- servers.find {|s| s.name == serverspec }
514
- end
515
-
516
- raise "No servers match '#{serverspec}'" unless server
498
+ server = find_server( args.shift )
499
+ mongrel2 = ENV['MONGREL2'] || 'mongrel2'
517
500
 
518
501
  # Run the command, waiting for it to finish if invoked from shell mode, or
519
502
  # execing it if not.
520
- cmd = [ 'mongrel2', Mongrel2::Config.pathname.to_s, server.uuid ]
503
+ cmd = [ mongrel2, Mongrel2::Config.pathname.to_s, server.uuid ]
504
+ cmd.unshift( 'sudo' ) if self.options.sudo
505
+
521
506
  if @shellmode
522
507
  system( *cmd )
523
508
  else
@@ -529,12 +514,65 @@ class Mongrel2::M2SHCommand
529
514
  [SERVER]
530
515
  If not specified, SERVER is assumed to be the only server entry in the
531
516
  current config. If there are more than one, you must specify a SERVER.
532
-
517
+
533
518
  The SERVER can be a uuid, hostname, or server name, and are searched for
534
519
  in that order.
535
520
  END_USAGE
536
521
 
537
522
 
523
+ ### The 'reload' command
524
+ def reload_command( *args )
525
+ server = find_server( args.shift )
526
+ control = server.control_socket
527
+
528
+ header "Reloading '%s'" % [ server.name ]
529
+ control.reload
530
+ message "done."
531
+ end
532
+ help :reload, "Reload the specified server's configuration"
533
+ usage :reload, "[server]"
534
+
535
+
536
+ ### The 'stop' command
537
+ def stop_command( *args )
538
+ server = find_server( args.shift )
539
+ control = server.control_socket
540
+
541
+ header "Stopping '%s' gracefully." % [ server.name ]
542
+ control.stop
543
+ message "done."
544
+ end
545
+ help :stop, "Stop the specified server gracefully"
546
+ usage :stop, "[server]"
547
+
548
+
549
+ ### The 'running' command
550
+ def running_command( *args )
551
+ server = find_server( args.shift )
552
+ pidfile = server.pid_file_path
553
+
554
+ header "Checking the status of the '%s' server." % [ server.name ]
555
+ unless pidfile.exist?
556
+ message "Not running: PID file (%s) doesn't exist." % [ pidfile ]
557
+ exit :noinput
558
+ end
559
+
560
+ pid = Integer( pidfile.read )
561
+ begin
562
+ Process.kill( 0, pid )
563
+ rescue Errno::ESRCH
564
+ message " mongrel2 at PID %d is NOT running" % [ pid ]
565
+ exit :unavailable
566
+ rescue => err
567
+ error " %p while signalling PID %d: %s" % [ err.class, pid, err.message ]
568
+ end
569
+
570
+ message " mongrel2 at PID %d is running." % [ pid ]
571
+ end
572
+ help :running, "Show the status of a server."
573
+ usage :running, "[server]"
574
+
575
+
538
576
  ### The 'version' command
539
577
  def version_command( *args )
540
578
  message( "<%= color 'Version:', :header %> " + Mongrel2.version_string(true) )
@@ -594,6 +632,35 @@ class Mongrel2::M2SHCommand
594
632
  end
595
633
 
596
634
 
635
+ ### Search the current mongrel2 config for a server matching +serverspec+ and
636
+ ### return it as a Mongrel2::Config::Server object.
637
+ def find_server( serverspec=nil )
638
+ server = nil
639
+ servers = Mongrel2::Config.servers
640
+
641
+ raise "No servers are configured." if servers.empty?
642
+
643
+ # If there's only one configured server, just make sure if a serverspec was given
644
+ # that it would have matched.
645
+ if servers.length == 1
646
+ server = servers.first if !serverspec ||
647
+ servers.first.values_at( :uuid, :default_host, :name ).include?( serverspec )
648
+
649
+ # Otherwise, require an argument and search for the desired server if there is one
650
+ else
651
+ raise "You must specify a server uuid/hostname/name when more " +
652
+ "than one server is configured." if servers.length > 1 && !serverspec
653
+
654
+ server = servers.find {|s| s.uuid == serverspec } ||
655
+ servers.find {|s| s.default_host == serverspec } ||
656
+ servers.find {|s| s.name == serverspec }
657
+ end
658
+
659
+ raise "No servers match '#{serverspec}'" unless server
660
+
661
+ return server
662
+ end
663
+
597
664
  end # class Mongrel2::M2SHCommand
598
665
 
599
666