<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,10 @@
+== 0.2.4 2008-02-26
+
+* Change prompt.password to take options
+* Adding password retry and check_hash
+* Fixing :shell option for build scripting
+* Add readline-devel to ruby centos install dependency
+
 == 0.2.3 2008-02-25
 
 * Various task and recipe fixes.</diff>
      <filename>History.txt</filename>
    </modified>
    <modified>
      <diff>@@ -110,6 +110,7 @@ module Capitate::Plugins::Base
     tasks
   end
   
+  # Task tree
   def task_tree
     top_node = Capitate::TaskNode.new(&quot;top&quot;)
     </diff>
      <filename>lib/capitate/plugins/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,4 @@
+require 'md5'
 
 module Capitate::Plugins::Prompt
   
@@ -5,21 +6,63 @@ module Capitate::Plugins::Prompt
     Capistrano::CLI.ui.ask(label, &amp;block)
   end
   
-  def password(label, verify = false, lazy = true)
+  # Prompt for password.
+  #
+  # ==== Options
+  # +label+:: Label
+  # +options+:: Options
+  # - +verify+:: If true, prompt twice and verify
+  # - +lazy+:: If true, returns a block. _Defaults to true_
+  # - +check_hash+:: If present, checks that md5 is same as password md5
+  #
+  def password(label, options = {})
+    
+    verify = options[:verify]
+    lazy = options[:lazy].nil? ? true : options[:lazy]
+    check_hash = options[:check_hash]
+    
     # Lazy
     password_prompt = Proc.new { 
-      password = Capistrano::CLI.password_prompt(label)
+      
+      max_attempts = 2
+      attempts = 0
+      password = nil
+      success = true
+
+      loop { 
+        password = Capistrano::CLI.password_prompt(label)
+        attempts += 1
     
-      if verify
-        password_verify = Capistrano::CLI.password_prompt(&quot;[VERIFY] #{label}&quot;)
-        raise &quot;Passwords do not match&quot; if password != password_verify
-      end
+        if verify
+          password_verify = Capistrano::CLI.password_prompt(&quot;[VERIFY] #{label}&quot;)
+          if password != password_verify
+            logger.important &quot;Passwords do not match&quot; 
+            success = false
+          end
+        end
+      
+        if check_hash
+          if MD5.md5(password).hexdigest != check_hash
+            logger.important &quot;Invalid password, try again.&quot; 
+            success = false
+          end         
+        end
+        
+        break if success
+        break if attempts &gt;= max_attempts
+      }
+      
+      raise &quot;Invalid password, too many tries&quot; unless success
     
       password
     }
     
     return password_prompt if lazy
     password_prompt.call
+  end  
+  
+  def check_password_hash(password, hash)
+    MD5.md5()
   end
   
 end</diff>
      <filename>lib/capitate/plugins/prompt.rb</filename>
    </modified>
    <modified>
      <diff>@@ -51,11 +51,8 @@ module Capitate::Plugins::Script
     build_dest = options[:build_dest]
     build_dest ||= &quot;/tmp/#{name}&quot;
     url = options[:url]    
-    dependencies = options[:dependencies]
     
-    package.install(dependencies) if dependencies
-    
-    unpack(url, build_dest, options[:clean], options[:unpack_dir]) do |dir|
+    unpack(url, build_dest, options) do |dir|
       yield(dir) if block_given?
     end      
   end
@@ -85,7 +82,10 @@ module Capitate::Plugins::Script
     end
     
     # If want verbose, -v
-    run_via &quot;sh -v #{dest} &amp;&amp; rm -rf #{File.dirname(dest)}&quot;
+    run_all &lt;&lt;-CMDS
+      sh -v #{dest}
+      rm -rf #{File.dirname(dest)}
+    CMDS
   end
   
   # Download and unpack URL.
@@ -94,15 +94,16 @@ module Capitate::Plugins::Script
   # ==== Options
   # +url+:: URL to download
   # +dest+:: Destination directory
-  # +clean+:: If true will remove the unpacked directory
-  # +unpack_dir+:: Directory that is unpacked from tgz (if not matching the file name)
+  # +options+::
+  # - +clean+:: If true will remove the unpacked directory. _Defaults to true_
+  # - +unpack_dir+:: Directory that is unpacked from tgz (if not matching the file name)
   #
   # ==== Examples
   #   script.unpack(&quot;http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz&quot;, &quot;/tmp/rubygems&quot;) do
   #     sudo &quot;ruby setup.rb&quot;
   #   end
   #
-  def unpack(url, dest, clean = true, unpack_dir = nil, &amp;block)        
+  def unpack(url, dest, options, &amp;block)        
     file = url.split(&quot;/&quot;).last
     
     # TODO: Support other types
@@ -110,12 +111,16 @@ module Capitate::Plugins::Script
       raise &quot;Can't unpack this file: #{file}; only support tar.gz and tgz formats&quot;
     end
     
+    options[:clean] = true if options[:clean].nil?
+    unpack_dir = options[:unpack_dir]
+    clean = options[:clean]
+    
     unpack_dir ||= file.gsub(/\.tar\.gz|\.tgz/, &quot;&quot;)
     
     http_get_method = fetch(:http_get_method, &quot;wget -nv&quot;)
-    
+        
     run_all &lt;&lt;-CMDS
-      mkdir -p #{dest} &amp;&amp; cd #{dest} &amp;&amp; #{http_get_method} #{url}
+      sh -c &quot;mkdir -p #{dest} &amp;&amp; cd #{dest} &amp;&amp; #{http_get_method} #{url}&quot;
       sh -c &quot;cd #{dest} &amp;&amp; tar zxf #{file}&quot;
     CMDS
     
@@ -133,10 +138,9 @@ module Capitate::Plugins::Script
   # +cmds+:: Commands (separated by newlines)
   # +options+:: See invoke_command options
   #
-  def run_all(cmds, options = {}, &amp;block)
+  def run_all(cmds, options = {}, &amp;block)    
     cmds.split(&quot;\n&quot;).each do |cmd|
-      cmd = cmd.gsub(/^\s+/, &quot;&quot;)
-      #sh_cmd = %{sh -c &quot;#{cmd.gsub(&quot;\&quot;&quot;, &quot;\&quot;\&quot;&quot;)}&quot;}
+      cmd = cmd.gsub(/^\s+/, &quot;&quot;)        
       run_via(cmd, options, &amp;block)
     end    
   end</diff>
      <filename>lib/capitate/plugins/script.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@ module Capitate #:nodoc:
   module VERSION #:nodoc:
     MAJOR = 0
     MINOR = 2
-    TINY  = 3
+    TINY  = 4
 
     STRING = [MAJOR, MINOR, TINY].join('.')
   end</diff>
      <filename>lib/capitate/version.rb</filename>
    </modified>
    <modified>
      <diff>@@ -58,7 +58,7 @@ task :install do
   
   # Gem installs
   gems.install([ &quot;rake&quot;, &quot;mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql --with-mysql-config&quot;, 
-    &quot;raspell&quot;, &quot;rmagick&quot;, &quot;mongrel&quot;, &quot;mongrel_cluster&quot;,&quot;json&quot; ])
+    &quot;raspell&quot;, &quot;rmagick&quot;, &quot;mongrel&quot;, &quot;mongrel_cluster&quot;,&quot;json&quot;, &quot;mime-types&quot; ])
   
   # Cleanup
   yum.clean</diff>
      <filename>lib/deployment/install-centos-rubyweb.rb</filename>
    </modified>
    <modified>
      <diff>@@ -30,7 +30,7 @@ namespace :centos do
           
     run &quot;chmod a+rx #{home}&quot; if home_readable
   
-    new_password = prompt.password(&quot;Password to set for #{user_add}: &quot;, true, false)
+    new_password = prompt.password(&quot;Password to set for #{user_add}: &quot;, :verify =&gt; true, :lazy =&gt; false)
   
     run &quot;passwd #{user_add}&quot; do |channel, stream, data|
       logger.info data</diff>
      <filename>lib/recipes/centos/centos.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,7 +19,7 @@ namespace :monit do
       
       # Settings
       fetch_or_default(:monit_port, 2812)
-      fetch_or_default(:monit_password, prompt.password('Monit admin password (to set): ', true))
+      fetch_or_default(:monit_password, prompt.password('Monit admin password (to set): ', :verify =&gt; true))
       fetch_or_default(:monit_conf_dir, &quot;/etc/monit&quot;)
       fetch_or_default(:monit_pid_path, &quot;/var/run/monit.pid&quot;)
       fetch(:monit_build_options)</diff>
      <filename>lib/recipes/centos/monit.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@ namespace :mysql do
     task :install do    
       
       # Settings
-      fetch_or_default(:mysql_admin_password_set, prompt.password('Mysql admin password (to set): ', true))
+      fetch_or_default(:mysql_admin_password_set, prompt.password('Mysql admin password (to set): ', :verify =&gt; true))
 
       # Install through package manager
       yum.install([ &quot;mysql&quot;, &quot;mysql-devel&quot;, &quot;mysql-server&quot; ])</diff>
      <filename>lib/recipes/centos/mysql.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,14 +15,14 @@ namespace :ruby do
       fetch(:rubygems_build_options)
     
       # Install dependencies
-      yum.install([ &quot;zlib&quot;, &quot;zlib-devel&quot; ])
+      yum.install([ &quot;zlib&quot;, &quot;zlib-devel&quot;, &quot;readline-devel&quot; ])
     
       # Install ruby 1.8.6
       script.make_install(&quot;ruby&quot;, ruby_build_options)
     
       # Install rubygems
       script.install(&quot;rubygems&quot;, rubygems_build_options) do |dir|
-        run_via &quot;echo 'Running setup...' &amp;&amp; cd #{dir} &amp;&amp; ruby setup.rb &gt; install.log&quot;
+        run_via &quot;cd #{dir} &amp;&amp; ruby setup.rb &gt; install.log&quot;, { :shell =&gt; true }
       end
     
     end        </diff>
      <filename>lib/recipes/centos/ruby.rb</filename>
    </modified>
    <modified>
      <diff>@@ -23,6 +23,16 @@ namespace :rails do
     fetch_or_default(:db_host, nil)
     fetch_or_default(:db_socket, nil)
     
+    unless db_host.blank?
+      set :db_connect_type, &quot;host&quot;
+      set :db_connect, db_host
+    end
+    
+    unless db_socket.blank?
+      set :db_connect_type, &quot;socket&quot;
+      set :db_connect, db_socket
+    end
+    
     run &quot;mkdir -p #{shared_path}/config&quot;
     put template.load(&quot;rails/database.yml.erb&quot;), &quot;#{shared_path}/config/database.yml&quot;
   end</diff>
      <filename>lib/recipes/rails.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,5 +4,4 @@ production:
   database: &lt;%= db_name %&gt;
   username: &lt;%= db_user %&gt;
   password: &lt;%= db_pass %&gt;
-  &lt;%= &quot;host: #{db_host}&quot; unless db_host.blank? %&gt;
-  &lt;%= &quot;socket: #{db_socket}&quot; unless db_socket.blank? %&gt;
+  &lt;%= &quot;#{db_connect_type}: #{db_connect}&quot; %&gt;  </diff>
      <filename>lib/templates/rails/database.yml.erb</filename>
    </modified>
    <modified>
      <diff>@@ -38,7 +38,7 @@
 
     &lt;div id=&quot;version&quot; class=&quot;clickable box&quot; onclick='document.location = &quot;http://rubyforge.org/projects/capitate&quot;; return false'&gt;
       &lt;p&gt;Get Version&lt;/p&gt;
-      &lt;a href=&quot;http://rubyforge.org/projects/capitate&quot; class=&quot;numbers&quot;&gt;0.2.3&lt;/a&gt;
+      &lt;a href=&quot;http://rubyforge.org/projects/capitate&quot; class=&quot;numbers&quot;&gt;0.2.4&lt;/a&gt;
     &lt;/div&gt;
     
     &lt;div id=&quot;recipes&quot;&gt;</diff>
      <filename>website/index.html</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0735ff383d2533745ae1faec057bf75e07e607cc</id>
    </parent>
  </parents>
  <author>
    <name>Gabriel Handford</name>
    <email>gabrielh@gmail.com</email>
  </author>
  <url>http://github.com/gabriel/capitate/commit/77c05af6f2991874f054a14222e3977b4e9686f1</url>
  <id>77c05af6f2991874f054a14222e3977b4e9686f1</id>
  <committed-date>2008-02-26T17:26:39-08:00</committed-date>
  <authored-date>2008-02-26T17:26:39-08:00</authored-date>
  <message>fixes, see history for 0.2.4</message>
  <tree>07a1ca9b58030103da92adca2751ac5b9cdf61aa</tree>
  <committer>
    <name>Gabriel Handford</name>
    <email>gabrielh@gmail.com</email>
  </committer>
</commit>
