<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 == (unreleased)
 
+* Convert arguments to -s and -S into integers, booleans, etc. based on whether the arguments appear to be those types [Jamis Buck]
+
 * Add descriptions of -n and -d to the verbose help text [Jamis Buck]
 
 * Make rollbacks work with processes that need the current directory to be valid in order to restart properly (e.g. mongrel_rails) [Jamis Buck]</diff>
      <filename>CHANGELOG.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -124,6 +124,8 @@ module Capistrano
 
         option_parser.parse!(args)
 
+        coerce_variable_types!
+
         # if no verbosity has been specified, be verbose
         options[:verbose] = 3 if !options.has_key?(:verbose)
 
@@ -186,6 +188,26 @@ module Capistrano
           &quot;/&quot;
       end
 
+      def coerce_variable_types!
+        [:pre_vars, :vars].each do |collection|
+          options[collection].keys.each do |key|
+            options[collection][key] = coerce_variable(options[collection][key])
+          end
+        end
+      end
+
+      def coerce_variable(value)
+        case value
+        when /^&quot;(.*)&quot;$/ then $1
+        when /^'(.*)'$/ then $1
+        when /^\d+$/ then value.to_i
+        when /^\d+\.\d*$/ then value.to_f
+        when &quot;true&quot; then true
+        when &quot;false&quot; then false
+        when &quot;nil&quot; then nil
+        else value
+        end
+      end
     end
   end
 end</diff>
      <filename>lib/capistrano/cli/options.rb</filename>
    </modified>
    <modified>
      <diff>@@ -99,12 +99,84 @@ class CLIOptionsTest &lt; Test::Unit::TestCase
     assert_equal &quot;bar&quot;, @cli.options[:pre_vars][:foo]
   end
 
+  def test_S_should_coerce_digits_to_integers
+    @cli.args &lt;&lt; &quot;-S&quot; &lt;&lt; &quot;foo=1234&quot;
+    @cli.parse_options!
+    assert_equal 1234, @cli.options[:pre_vars][:foo]
+  end
+
+  def test_S_should_treat_quoted_integers_as_string
+    @cli.args &lt;&lt; &quot;-S&quot; &lt;&lt; &quot;foo=\&quot;1234\&quot;&quot;
+    @cli.parse_options!
+    assert_equal &quot;1234&quot;, @cli.options[:pre_vars][:foo]
+  end
+
+  def test_S_should_treat_digits_with_dot_as_floating_point
+    @cli.args &lt;&lt; &quot;-S&quot; &lt;&lt; &quot;foo=3.1415&quot;
+    @cli.parse_options!
+    assert_equal 3.1415, @cli.options[:pre_vars][:foo]
+  end
+
+  def test_S_should_treat_true_as_boolean_true
+    @cli.args &lt;&lt; &quot;-S&quot; &lt;&lt; &quot;foo=true&quot;
+    @cli.parse_options!
+    assert_equal true, @cli.options[:pre_vars][:foo]
+  end
+
+  def test_S_should_treat_false_as_boolean_false
+    @cli.args &lt;&lt; &quot;-S&quot; &lt;&lt; &quot;foo=false&quot;
+    @cli.parse_options!
+    assert_equal false, @cli.options[:pre_vars][:foo]
+  end
+
+  def test_S_should_treat_nil_as_nil
+    @cli.args &lt;&lt; &quot;-S&quot; &lt;&lt; &quot;foo=nil&quot;
+    @cli.parse_options!
+    assert_equal nil, @cli.options[:pre_vars][:foo]
+  end
+
   def test_parse_options_with_s_should_set_vars
     @cli.args &lt;&lt; &quot;-s&quot; &lt;&lt; &quot;foo=bar&quot;
     @cli.parse_options!
     assert_equal &quot;bar&quot;, @cli.options[:vars][:foo]
   end
 
+  def test_s_should_coerce_digits_to_integers
+    @cli.args &lt;&lt; &quot;-s&quot; &lt;&lt; &quot;foo=1234&quot;
+    @cli.parse_options!
+    assert_equal 1234, @cli.options[:vars][:foo]
+  end
+
+  def test_s_should_treat_quoted_integers_as_string
+    @cli.args &lt;&lt; &quot;-s&quot; &lt;&lt; &quot;foo=\&quot;1234\&quot;&quot;
+    @cli.parse_options!
+    assert_equal &quot;1234&quot;, @cli.options[:vars][:foo]
+  end
+
+  def test_s_should_treat_digits_with_dot_as_floating_point
+    @cli.args &lt;&lt; &quot;-s&quot; &lt;&lt; &quot;foo=3.1415&quot;
+    @cli.parse_options!
+    assert_equal 3.1415, @cli.options[:vars][:foo]
+  end
+
+  def test_s_should_treat_true_as_boolean_true
+    @cli.args &lt;&lt; &quot;-s&quot; &lt;&lt; &quot;foo=true&quot;
+    @cli.parse_options!
+    assert_equal true, @cli.options[:vars][:foo]
+  end
+
+  def test_s_should_treat_false_as_boolean_false
+    @cli.args &lt;&lt; &quot;-s&quot; &lt;&lt; &quot;foo=false&quot;
+    @cli.parse_options!
+    assert_equal false, @cli.options[:vars][:foo]
+  end
+
+  def test_s_should_treat_nil_as_nil
+    @cli.args &lt;&lt; &quot;-s&quot; &lt;&lt; &quot;foo=nil&quot;
+    @cli.parse_options!
+    assert_equal nil, @cli.options[:vars][:foo]
+  end
+
   def test_parse_options_with_T_should_set_tasks_option_and_set_verbose_off
     @cli.args &lt;&lt; &quot;-T&quot;
     @cli.parse_options!</diff>
      <filename>test/cli/options_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1a87270a3abc119ee7512e15691d294615bebd0d</id>
    </parent>
  </parents>
  <author>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </author>
  <url>http://github.com/jamis/capistrano/commit/bd3819766178e18e9287b95586098d2bc804f6df</url>
  <id>bd3819766178e18e9287b95586098d2bc804f6df</id>
  <committed-date>2008-08-21T20:14:27-07:00</committed-date>
  <authored-date>2008-08-21T20:14:27-07:00</authored-date>
  <message>Auto-convert arguments to -S and -s to integer, boolean, etc. if they look convertable</message>
  <tree>c46aa61b706baf33f9300cdc6c760bfd59096c55</tree>
  <committer>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </committer>
</commit>
