mongrel2 0.29.0 → 0.30.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/History.rdoc CHANGED
@@ -1,3 +1,11 @@
1
+ == v0.30.0 [2012-07-27] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Add a static index page to the quickstart Dir directory.
4
+ - Make the failure to find a mongrel2 binary friendlier.
5
+ - Fix parameter name of ::by_send_ident for auto-mapping by the rest
6
+ service.
7
+
8
+
1
9
  == v0.29.0 [2012-07-13] Michael Granger <ged@FaerieMUD.org>
2
10
 
3
11
  - Make m2sh.rb write audit log events for modifying actions
data/Manifest.txt CHANGED
@@ -11,6 +11,7 @@ data/mongrel2/bootstrap.html
11
11
  data/mongrel2/config.rb.in
12
12
  data/mongrel2/config.sql
13
13
  data/mongrel2/css/master.css
14
+ data/mongrel2/index.html.in
14
15
  data/mongrel2/js/websock-test.js
15
16
  data/mongrel2/mimetypes.sql
16
17
  data/mongrel2/websock-test.html
data/Rakefile CHANGED
@@ -27,7 +27,6 @@ hoespec = Hoe.spec 'mongrel2' do
27
27
 
28
28
  self.dependency 'nokogiri', '~> 1.5'
29
29
  self.dependency 'sequel', '~> 3.34'
30
- self.dependency 'amalgalite', '~> 1.1'
31
30
  self.dependency 'tnetstring', '~> 0.3'
32
31
  self.dependency 'yajl-ruby', '~> 1.0'
33
32
  self.dependency 'trollop', '~> 1.16'
data/bin/m2sh.rb CHANGED
@@ -49,7 +49,7 @@ class Mongrel2::M2SHCommand
49
49
  extend ::Sysexits,
50
50
  Loggability
51
51
  include Sysexits,
52
- Mongrel2::Constants
52
+ Mongrel2::Constants
53
53
 
54
54
  # Loggability API -- set up logging under the 'strelka' log host
55
55
  log_to :mongrel2
@@ -431,7 +431,7 @@ class Mongrel2::M2SHCommand
431
431
  ### The 'start' command
432
432
  def start_command( *args )
433
433
  server = find_server( args.shift )
434
- mongrel2 = ENV['MONGREL2'] || 'mongrel2'
434
+ mongrel2 = find_mongrel2()
435
435
 
436
436
  if options.port
437
437
  message "Resetting %s server's port to %d" % [ server.name, options.port ]
@@ -439,7 +439,7 @@ class Mongrel2::M2SHCommand
439
439
  server.save
440
440
  end
441
441
 
442
- cmd = [ mongrel2, Mongrel2::Config.dbname.to_s, server.uuid ]
442
+ cmd = [ mongrel2.to_s, Mongrel2::Config.dbname.to_s, server.uuid ]
443
443
  cmd.unshift( 'sudo' ) if self.options.sudo
444
444
 
445
445
  url = "http%s://%s:%d" % [
@@ -449,7 +449,9 @@ class Mongrel2::M2SHCommand
449
449
  ]
450
450
 
451
451
  Mongrel2::Config.log_action( "Starting server: #{server}", self.options.why )
452
+ message '*' * 70
452
453
  header "Starting mongrel2 at: #{url}"
454
+ message '*' * 70
453
455
  exec( *cmd )
454
456
  end
455
457
  help :start, "Starts a server."
@@ -524,12 +526,14 @@ class Mongrel2::M2SHCommand
524
526
 
525
527
  ### The 'bootstrap' command.
526
528
  def bootstrap_command( *args )
527
- scriptname = args.shift || DEFAULT_CONFIG_SCRIPT
528
- template = Mongrel2::DATA_DIR + 'config.rb.in'
529
- data = template.read
529
+ scriptname = args.shift || DEFAULT_CONFIG_SCRIPT
530
+ template = Mongrel2::DATA_DIR + 'config.rb.in'
530
531
 
532
+ # Read the config DSL template
533
+ data = template.read
531
534
  data.gsub!( /%% PWD %%/, Dir.pwd )
532
535
 
536
+ # Write it out
533
537
  header "Writing a config-generation script to %s" % [ scriptname ]
534
538
  File.open( scriptname, File::WRONLY|File::EXCL|File::CREAT, 0755, encoding: 'utf-8' ) do |fh|
535
539
  fh.print( data )
@@ -542,12 +546,34 @@ class Mongrel2::M2SHCommand
542
546
 
543
547
  ### The 'quickstart' command.
544
548
  def quickstart_command( *args )
549
+ idx_template = Mongrel2::DATA_DIR + 'index.html.in'
545
550
  configfile = 'config.rb'
546
551
 
547
552
  header "Quickstart!"
548
553
  self.bootstrap_command( configfile )
549
554
  edit( configfile )
550
555
  self.load_command( configfile )
556
+
557
+ # Now load the new config DB and fetch the configured server
558
+ host = Mongrel2::Config.servers.first.hosts.first
559
+ hello_route = host.routes_dataset.filter( target_type: 'handler' ).first
560
+
561
+ # Read the index page template
562
+ data = idx_template.read
563
+ data.gsub!( /%% VERSION %%/, Mongrel2.version_string(true) )
564
+ data.gsub!( /%% HELLOWORLD_SEND_SPEC %%/, hello_route.target.send_spec )
565
+ data.gsub!( /%% HELLOWORLD_RECV_SPEC %%/, hello_route.target.recv_spec )
566
+ data.gsub!( /%% HELLOWORLD_URI %%/, hello_route.path[ /([^\(]*)/ ] )
567
+
568
+ # Write it out to the public directory
569
+ header "Writing an index file to public/index.html"
570
+ Dir.mkdir( 'public' ) unless File.directory?( 'public' )
571
+ File.open( 'public/index.html', File::WRONLY|File::EXCL|File::CREAT, 0755,
572
+ encoding: 'utf-8' ) do |fh|
573
+ fh.print( data )
574
+ end
575
+ message "Done."
576
+
551
577
  self.start_command()
552
578
  end
553
579
  help :quickstart, "Set up a basic mongrel2 server and run it."
@@ -658,6 +684,36 @@ class Mongrel2::M2SHCommand
658
684
  end
659
685
 
660
686
 
687
+ ### Search the PATH for a mongrel2 binary, returning the absolute Pathname to it if found, and
688
+ ### outputting a warning and describing how to set ENV['MONGREL2'] if not.
689
+ def find_mongrel2
690
+ if ENV['MONGREL2']
691
+ m2 = Pathname( ENV['MONGREL2'] )
692
+ error = nil
693
+ if !m2.file?
694
+ error = "but it isn't a plain file."
695
+ elsif !m2.executable?
696
+ error = "but it isn't executable."
697
+ end
698
+
699
+ raise "MONGREL2 was set to %p, #{error}" if error
700
+
701
+ return m2
702
+ else
703
+ m2 = ENV['PATH'].split( File::PATH_SEPARATOR ).
704
+ map {|dir| Pathname(dir) + 'mongrel2' }.
705
+ find {|path| path.executable? }
706
+
707
+ return m2 if m2
708
+
709
+ raise "The 'mongrel2' binary doesn't seem to be in your PATH. Either " +
710
+ "add the appropriate directory to your PATH or set the MONGREL2 " +
711
+ "environment variable to the full path."
712
+ end
713
+
714
+ end
715
+
716
+
661
717
 
662
718
  end # class Mongrel2::M2SHCommand
663
719
 
@@ -0,0 +1,51 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Ruby-Mongrel2 QuickStart</title>
5
+ <style type="text/css" media="screen" title="no title" charset="utf-8">
6
+ html {
7
+ margin: 0;
8
+ }
9
+
10
+ body {
11
+ background: rgb(206,220,231); /* Old browsers */
12
+ background: linear-gradient(to bottom, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* W3C */
13
+ color: #333;
14
+ margin: 0;
15
+ padding: 4em;
16
+ font-family: Menlo, Monaco, monospace;
17
+ font-size: 76%;
18
+ min-width: 785px;
19
+ }
20
+
21
+ footer {
22
+ position: absolute;
23
+ bottom: 5px;
24
+ font-size: 9px;
25
+ color: #666;
26
+ }
27
+
28
+ </style>
29
+ <meta charset="utf-8" />
30
+ </head>
31
+ <body>
32
+ <header>
33
+ <hgroup>
34
+ <h1>Ruby-Mongrel2 Quickstart</h1>
35
+ </hgroup>
36
+ </header>
37
+
38
+ <section>
39
+ <p>It Works!&trade;</p>
40
+
41
+ <p>If you have a Hello World application connected to <tt>%% HELLOWORLD_SEND_SPEC %%</tt> /
42
+ <tt>%% HELLOWORLD_RECV_SPEC %%</tt>, you can
43
+ <a href="%% HELLOWORLD_URI %%">run it here</a>. You should also try killing
44
+ the application, clicking the link, then restarting the app. Neat!</p>
45
+ </section>
46
+
47
+ <footer>
48
+ <p>Brought to you by %% VERSION %%.</p>
49
+ </footer>
50
+ </body>
51
+ </html>
data/lib/mongrel2.rb CHANGED
@@ -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.29.0'
23
+ VERSION = '0.30.0'
24
24
 
25
25
  # Version-control revision constant
26
- REVISION = %q$Revision: cc6fcfdf3335 $
26
+ REVISION = %q$Revision: 560f4524ebb0 $
27
27
 
28
28
 
29
29
  require 'mongrel2/constants'
@@ -42,8 +42,8 @@ class Mongrel2::Config::Handler < Mongrel2::Config( :handler )
42
42
  # :method: by_send_ident( uuid )
43
43
  #
44
44
  # Look up a Handler by its send_ident, which should be a +uuid+ or similar String.
45
- def_dataset_method( :by_send_ident ) do |ident|
46
- filter( :send_ident => ident )
45
+ def_dataset_method( :by_send_ident ) do |send_ident|
46
+ filter( :send_ident => send_ident )
47
47
  end
48
48
 
49
49
 
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.29.0
4
+ version: 0.30.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-13 00:00:00.000000000 Z
39
+ date: 2012-07-27 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: nokogiri
@@ -70,22 +70,6 @@ dependencies:
70
70
  - - ~>
71
71
  - !ruby/object:Gem::Version
72
72
  version: '3.34'
73
- - !ruby/object:Gem::Dependency
74
- name: amalgalite
75
- requirement: !ruby/object:Gem::Requirement
76
- none: false
77
- requirements:
78
- - - ~>
79
- - !ruby/object:Gem::Version
80
- version: '1.1'
81
- type: :runtime
82
- prerelease: false
83
- version_requirements: !ruby/object:Gem::Requirement
84
- none: false
85
- requirements:
86
- - - ~>
87
- - !ruby/object:Gem::Version
88
- version: '1.1'
89
73
  - !ruby/object:Gem::Dependency
90
74
  name: tnetstring
91
75
  requirement: !ruby/object:Gem::Requirement
@@ -331,6 +315,7 @@ files:
331
315
  - data/mongrel2/config.rb.in
332
316
  - data/mongrel2/config.sql
333
317
  - data/mongrel2/css/master.css
318
+ - data/mongrel2/index.html.in
334
319
  - data/mongrel2/js/websock-test.js
335
320
  - data/mongrel2/mimetypes.sql
336
321
  - data/mongrel2/websock-test.html
metadata.gz.sig CHANGED
Binary file