<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>bin/newrelic_cmd</filename>
    </added>
    <added>
      <filename>lib/new_relic/commands/deployments.rb</filename>
    </added>
    <added>
      <filename>lib/new_relic/commands/new_relic_commands.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -22,7 +22,7 @@ spec = Gem::Specification.new do |s|
   s.email = EMAIL
   s.homepage = HOMEPAGE
   s.require_path = 'lib'
-  s.files = %w(install.rb LICENSE README newrelic.yml Rakefile) + Dir.glob(&quot;{lib,recipes,test,ui}/**/*&quot;) 
+  s.files = %w(install.rb LICENSE README newrelic.yml Rakefile) + Dir.glob(&quot;{lib,bin,recipes,test,ui}/**/*&quot;) 
   
 end
 </diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -660,15 +660,7 @@ module NewRelic::Agent
       # to go for higher compression instead, we could use Zlib::BEST_COMPRESSION and 
       # pay a little more CPU.
       post_data = Zlib::Deflate.deflate(Marshal.dump(args), Zlib::BEST_SPEED)
-      
-      # Proxy returns regular HTTP if @proxy_host is nil (the default)
-      http = Net::HTTP::Proxy(config.proxy_server.host, config.proxy_server.port, 
-                              config.proxy_server.user, config.proxy_server.password).new(config.server.host, config.server.port)
-      if config.use_ssl?
-        http.use_ssl = true 
-        http.verify_mode = OpenSSL::SSL::VERIFY_NONE
-      end
-      
+      http = config.http_connection
       http.read_timeout = @request_timeout
       
       # params = {:method =&gt; method, :license_key =&gt; license_key, :protocol_version =&gt; PROTOCOL_VERSION }</diff>
      <filename>lib/new_relic/agent/agent.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,6 @@
 require 'yaml'
 #require 'new_relic/version'
 require 'singleton'
-require 'new_relic/agent'
 require 'erb'
 
 # Configuration supports the behavior of the agent which is dependent
@@ -23,7 +22,6 @@ module NewRelic
       @instance ||= new_instance
     end
     
-    attr_reader :settings
     
     
     @settings = nil
@@ -49,6 +47,15 @@ module NewRelic
       fetch(key)
     end
     ####################################
+    def env=(env_name)
+      @env = env_name
+      @settings = @yaml[env_name]
+    end
+    
+    def settings
+      @settings ||= @yaml[env] || {}
+    end
+    
     def []=(key, value)
       settings[key] = value
     end
@@ -58,7 +65,7 @@ module NewRelic
     end
     
     def fetch(key, default=nil)
-      @settings[key].nil? ? default : @settings[key]
+      settings[key].nil? ? default : settings[key]
     end
     
     ###################################
@@ -92,7 +99,7 @@ module NewRelic
     
     def api_server
       @api_server ||= 
-      NewRelic::Config::Server.new fetch('api_host', 'rpm.newrelic.com'), fetch('api_port', use_ssl? ? 443 : 80).to_i
+      NewRelic::Config::Server.new fetch('api_host', 'rpm.newrelic.com'), fetch('api_port', fetch('port', use_ssl? ? 443 : 80)).to_i
     end
     
     def proxy_server
@@ -101,8 +108,19 @@ module NewRelic
       fetch('proxy_user', nil), fetch('proxy_pass', nil)
     end      
     
-    ####################################
- 
+    # Return the Net::HTTP with proxy configuration given the NewRelic::Config::Server object.
+    # Default is the collector but for api calls you need to pass api_server
+    def http_connection(host = server)
+      # Proxy returns regular HTTP if @proxy_host is nil (the default)
+      http = Net::HTTP::Proxy(proxy_server.host, proxy_server.port, 
+                              proxy_server.user, proxy_server.password).new(host.host, host.port)
+      if use_ssl?
+        http.use_ssl = true 
+        http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+      end
+      http
+    end
+    
     def to_s
       puts self.inspect
       &quot;Config[#{self.app}]&quot;
@@ -142,7 +160,7 @@ module NewRelic
     end
     
     def local_env
-      @env ||= NewRelic::LocalEnvironment.new
+      @local_env ||= NewRelic::LocalEnvironment.new
     end
     
     # send the given message to STDERR so that it shows
@@ -151,7 +169,7 @@ module NewRelic
     # This will NOT print anything if the environment is unknown because this is
     # probably not an environment the agent will be running in.
     def log!(msg, level=:info)
-      return if @settings &amp;&amp; !tracers_enabled?
+      return if settings &amp;&amp; !tracers_enabled?
       to_stderr msg
       log.send level, msg if log
     end
@@ -184,6 +202,7 @@ module NewRelic
     end
     
     def log_file_name(identifier=&quot;&quot;)
+      identifier ||= &quot;&quot;
       &quot;newrelic_agent.#{identifier.gsub(/[^-\w.]/, '_')}.log&quot;
     end
     
@@ -223,7 +242,7 @@ module NewRelic
       else
         yaml = ERB.new(File.read(config_file)).result(binding)
       end
-      @settings = YAML.load(yaml)[env] || {}
+      @yaml = YAML.load(yaml)
     rescue ScriptError, StandardError =&gt; e
       puts e
       puts e.backtrace.join(&quot;\n&quot;)</diff>
      <filename>lib/new_relic/config.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@ class NewRelic::Config::Merb &lt; NewRelic::Config
   def app; :merb; end
   
   def env
-    ::Merb.env
+    @env ||= ::Merb.env
   end
   def root 
     ::Merb.root</diff>
      <filename>lib/new_relic/config/merb.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@ class NewRelic::Config::Rails &lt; NewRelic::Config
   def app; :rails; end
   
   def env
-    RAILS_ENV
+    @env ||= RAILS_ENV
   end
   def root
     RAILS_ROOT</diff>
      <filename>lib/new_relic/config/rails.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,22 @@
 class NewRelic::Config::Ruby &lt; NewRelic::Config
   def app; :ruby; end
   def env
-    ENV['RUBY_ENV'] || 'development'
+    @env ||= ENV['RUBY_ENV'] || ENV['RAILS_ENV'] || 'development'
   end
   def root
     Dir['.']
   end
+  # Check a sequence of file locations for newrelic.yml
+  def config_file
+    files = []
+    files &lt;&lt; File.join(root,&quot;config&quot;,&quot;newrelic.yml&quot;)
+    files &lt;&lt; File.join(root,&quot;newrelic.yml&quot;)
+    files &lt;&lt; File.join(ENV[&quot;HOME&quot;], &quot;.newrelic&quot;, &quot;newrelic.yml&quot;)
+    files &lt;&lt; File.join(ENV[&quot;HOME&quot;], &quot;newrelic.yml&quot;)
+    files.each do | file |
+      return File.expand_path(file) if File.exists? file
+    end
+    return File.expand_path(files.first)
+  end
+  
 end
\ No newline at end of file</diff>
      <filename>lib/new_relic/config/ruby.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,11 +4,11 @@ Gem::Specification.new do |s|
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;Bill Kayser&quot;]
-  s.date = %q{2009-01-20}
+  s.date = %q{2009-01-21}
   s.description = %q{New Relic Ruby Performance Monitoring Agent}
   s.email = %q{bkayser@newrelic.com}
   s.extra_rdoc_files = [&quot;README&quot;, &quot;LICENSE&quot;]
-  s.files = [&quot;install.rb&quot;, &quot;LICENSE&quot;, &quot;README&quot;, &quot;newrelic.yml&quot;, &quot;Rakefile&quot;, &quot;lib/new_relic&quot;, &quot;lib/new_relic/agent&quot;, &quot;lib/new_relic/agent/agent.rb&quot;, &quot;lib/new_relic/agent/chained_call.rb&quot;, &quot;lib/new_relic/agent/collection_helper.rb&quot;, &quot;lib/new_relic/agent/error_collector.rb&quot;, &quot;lib/new_relic/agent/instrumentation&quot;, &quot;lib/new_relic/agent/instrumentation/active_record_instrumentation.rb&quot;, &quot;lib/new_relic/agent/instrumentation/controller_instrumentation.rb&quot;, &quot;lib/new_relic/agent/instrumentation/data_mapper.rb&quot;, &quot;lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb&quot;, &quot;lib/new_relic/agent/instrumentation/memcache.rb&quot;, &quot;lib/new_relic/agent/instrumentation/merb&quot;, &quot;lib/new_relic/agent/instrumentation/merb/controller.rb&quot;, &quot;lib/new_relic/agent/instrumentation/merb/dispatcher.rb&quot;, &quot;lib/new_relic/agent/instrumentation/merb/errors.rb&quot;, &quot;lib/new_relic/agent/instrumentation/rails&quot;, &quot;lib/new_relic/agent/instrumentation/rails/action_controller.rb&quot;, &quot;lib/new_relic/agent/instrumentation/rails/action_web_service.rb&quot;, &quot;lib/new_relic/agent/instrumentation/rails/dispatcher.rb&quot;, &quot;lib/new_relic/agent/instrumentation/rails/errors.rb&quot;, &quot;lib/new_relic/agent/instrumentation/rails/rails.rb&quot;, &quot;lib/new_relic/agent/method_tracer.rb&quot;, &quot;lib/new_relic/agent/patch_const_missing.rb&quot;, &quot;lib/new_relic/agent/samplers&quot;, &quot;lib/new_relic/agent/samplers/cpu.rb&quot;, &quot;lib/new_relic/agent/samplers/memory.rb&quot;, &quot;lib/new_relic/agent/samplers/mongrel.rb&quot;, &quot;lib/new_relic/agent/stats_engine.rb&quot;, &quot;lib/new_relic/agent/synchronize.rb&quot;, &quot;lib/new_relic/agent/transaction_sampler.rb&quot;, &quot;lib/new_relic/agent/worker_loop.rb&quot;, &quot;lib/new_relic/agent.rb&quot;, &quot;lib/new_relic/api&quot;, &quot;lib/new_relic/api/deployments.rb&quot;, &quot;lib/new_relic/config&quot;, &quot;lib/new_relic/config/merb.rb&quot;, &quot;lib/new_relic/config/rails.rb&quot;, &quot;lib/new_relic/config/ruby.rb&quot;, &quot;lib/new_relic/config.rb&quot;, &quot;lib/new_relic/local_environment.rb&quot;, &quot;lib/new_relic/merbtasks.rb&quot;, &quot;lib/new_relic/metric_data.rb&quot;, &quot;lib/new_relic/metric_spec.rb&quot;, &quot;lib/new_relic/metrics.rb&quot;, &quot;lib/new_relic/noticed_error.rb&quot;, &quot;lib/new_relic/shim_agent.rb&quot;, &quot;lib/new_relic/stats.rb&quot;, &quot;lib/new_relic/transaction_analysis.rb&quot;, &quot;lib/new_relic/transaction_sample.rb&quot;, &quot;lib/new_relic/version.rb&quot;, &quot;lib/new_relic_api.rb&quot;, &quot;lib/newrelic_rpm.rb&quot;, &quot;lib/tasks&quot;, &quot;lib/tasks/agent_tests.rake&quot;, &quot;lib/tasks/all.rb&quot;, &quot;lib/tasks/install.rake&quot;, &quot;recipes/newrelic.rb&quot;, &quot;test/config&quot;, &quot;test/config/newrelic.yml&quot;, &quot;test/config/test_config.rb&quot;, &quot;test/new_relic&quot;, &quot;test/new_relic/agent&quot;, &quot;test/new_relic/agent/mock_ar_connection.rb&quot;, &quot;test/new_relic/agent/mock_scope_listener.rb&quot;, &quot;test/new_relic/agent/model_fixture.rb&quot;, &quot;test/new_relic/agent/tc_active_record.rb&quot;, &quot;test/new_relic/agent/tc_agent.rb&quot;, &quot;test/new_relic/agent/tc_collection_helper.rb&quot;, &quot;test/new_relic/agent/tc_controller.rb&quot;, &quot;test/new_relic/agent/tc_dispatcher_instrumentation.rb&quot;, &quot;test/new_relic/agent/tc_error_collector.rb&quot;, &quot;test/new_relic/agent/tc_method_tracer.rb&quot;, &quot;test/new_relic/agent/tc_stats_engine.rb&quot;, &quot;test/new_relic/agent/tc_synchronize.rb&quot;, &quot;test/new_relic/agent/tc_transaction_sample.rb&quot;, &quot;test/new_relic/agent/tc_transaction_sample_builder.rb&quot;, &quot;test/new_relic/agent/tc_transaction_sampler.rb&quot;, &quot;test/new_relic/agent/tc_worker_loop.rb&quot;, &quot;test/new_relic/agent/testable_agent.rb&quot;, &quot;test/new_relic/tc_config.rb&quot;, &quot;test/new_relic/tc_deployments_api.rb&quot;, &quot;test/new_relic/tc_environment.rb&quot;, &quot;test/new_relic/tc_metric_spec.rb&quot;, &quot;test/new_relic/tc_shim_agent.rb&quot;, &quot;test/new_relic/tc_stats.rb&quot;, &quot;test/test_helper.rb&quot;, &quot;test/ui&quot;, &quot;test/ui/tc_newrelic_helper.rb&quot;, &quot;ui/controllers&quot;, &quot;ui/controllers/newrelic_controller.rb&quot;, &quot;ui/helpers&quot;, &quot;ui/helpers/google_pie_chart.rb&quot;, &quot;ui/helpers/newrelic_helper.rb&quot;, &quot;ui/views&quot;, &quot;ui/views/layouts&quot;, &quot;ui/views/layouts/newrelic_default.rhtml&quot;, &quot;ui/views/newrelic&quot;, &quot;ui/views/newrelic/_explain_plans.rhtml&quot;, &quot;ui/views/newrelic/_sample.rhtml&quot;, &quot;ui/views/newrelic/_segment.rhtml&quot;, &quot;ui/views/newrelic/_segment_row.rhtml&quot;, &quot;ui/views/newrelic/_show_sample_detail.rhtml&quot;, &quot;ui/views/newrelic/_show_sample_sql.rhtml&quot;, &quot;ui/views/newrelic/_show_sample_summary.rhtml&quot;, &quot;ui/views/newrelic/_sql_row.rhtml&quot;, &quot;ui/views/newrelic/_stack_trace.rhtml&quot;, &quot;ui/views/newrelic/_table.rhtml&quot;, &quot;ui/views/newrelic/explain_sql.rhtml&quot;, &quot;ui/views/newrelic/images&quot;, &quot;ui/views/newrelic/images/arrow-close.png&quot;, &quot;ui/views/newrelic/images/arrow-open.png&quot;, &quot;ui/views/newrelic/images/blue_bar.gif&quot;, &quot;ui/views/newrelic/images/gray_bar.gif&quot;, &quot;ui/views/newrelic/index.rhtml&quot;, &quot;ui/views/newrelic/javascript&quot;, &quot;ui/views/newrelic/javascript/transaction_sample.js&quot;, &quot;ui/views/newrelic/sample_not_found.rhtml&quot;, &quot;ui/views/newrelic/show_sample.rhtml&quot;, &quot;ui/views/newrelic/show_source.rhtml&quot;, &quot;ui/views/newrelic/stylesheets&quot;, &quot;ui/views/newrelic/stylesheets/style.css&quot;]
+  s.files = [&quot;install.rb&quot;, &quot;LICENSE&quot;, &quot;README&quot;, &quot;newrelic.yml&quot;, &quot;Rakefile&quot;, &quot;lib/new_relic&quot;, &quot;lib/new_relic/agent&quot;, &quot;lib/new_relic/agent/agent.rb&quot;, &quot;lib/new_relic/agent/chained_call.rb&quot;, &quot;lib/new_relic/agent/collection_helper.rb&quot;, &quot;lib/new_relic/agent/error_collector.rb&quot;, &quot;lib/new_relic/agent/instrumentation&quot;, &quot;lib/new_relic/agent/instrumentation/active_record_instrumentation.rb&quot;, &quot;lib/new_relic/agent/instrumentation/controller_instrumentation.rb&quot;, &quot;lib/new_relic/agent/instrumentation/data_mapper.rb&quot;, &quot;lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb&quot;, &quot;lib/new_relic/agent/instrumentation/memcache.rb&quot;, &quot;lib/new_relic/agent/instrumentation/merb&quot;, &quot;lib/new_relic/agent/instrumentation/merb/controller.rb&quot;, &quot;lib/new_relic/agent/instrumentation/merb/dispatcher.rb&quot;, &quot;lib/new_relic/agent/instrumentation/merb/errors.rb&quot;, &quot;lib/new_relic/agent/instrumentation/rails&quot;, &quot;lib/new_relic/agent/instrumentation/rails/action_controller.rb&quot;, &quot;lib/new_relic/agent/instrumentation/rails/action_web_service.rb&quot;, &quot;lib/new_relic/agent/instrumentation/rails/dispatcher.rb&quot;, &quot;lib/new_relic/agent/instrumentation/rails/errors.rb&quot;, &quot;lib/new_relic/agent/instrumentation/rails/rails.rb&quot;, &quot;lib/new_relic/agent/method_tracer.rb&quot;, &quot;lib/new_relic/agent/patch_const_missing.rb&quot;, &quot;lib/new_relic/agent/samplers&quot;, &quot;lib/new_relic/agent/samplers/cpu.rb&quot;, &quot;lib/new_relic/agent/samplers/memory.rb&quot;, &quot;lib/new_relic/agent/samplers/mongrel.rb&quot;, &quot;lib/new_relic/agent/stats_engine.rb&quot;, &quot;lib/new_relic/agent/synchronize.rb&quot;, &quot;lib/new_relic/agent/transaction_sampler.rb&quot;, &quot;lib/new_relic/agent/worker_loop.rb&quot;, &quot;lib/new_relic/agent.rb&quot;, &quot;lib/new_relic/api&quot;, &quot;lib/new_relic/api/deployments.rb&quot;, &quot;lib/new_relic/commands&quot;, &quot;lib/new_relic/commands/deployments.rb&quot;, &quot;lib/new_relic/commands/new_relic_commands.rb&quot;, &quot;lib/new_relic/config&quot;, &quot;lib/new_relic/config/merb.rb&quot;, &quot;lib/new_relic/config/rails.rb&quot;, &quot;lib/new_relic/config/ruby.rb&quot;, &quot;lib/new_relic/config.rb&quot;, &quot;lib/new_relic/local_environment.rb&quot;, &quot;lib/new_relic/merbtasks.rb&quot;, &quot;lib/new_relic/metric_data.rb&quot;, &quot;lib/new_relic/metric_spec.rb&quot;, &quot;lib/new_relic/metrics.rb&quot;, &quot;lib/new_relic/noticed_error.rb&quot;, &quot;lib/new_relic/shim_agent.rb&quot;, &quot;lib/new_relic/stats.rb&quot;, &quot;lib/new_relic/transaction_analysis.rb&quot;, &quot;lib/new_relic/transaction_sample.rb&quot;, &quot;lib/new_relic/version.rb&quot;, &quot;lib/new_relic_api.rb&quot;, &quot;lib/newrelic_rpm.rb&quot;, &quot;lib/tasks&quot;, &quot;lib/tasks/agent_tests.rake&quot;, &quot;lib/tasks/all.rb&quot;, &quot;lib/tasks/install.rake&quot;, &quot;bin/newrelic_cmd&quot;, &quot;recipes/newrelic.rb&quot;, &quot;test/config&quot;, &quot;test/config/newrelic.yml&quot;, &quot;test/config/test_config.rb&quot;, &quot;test/new_relic&quot;, &quot;test/new_relic/agent&quot;, &quot;test/new_relic/agent/mock_ar_connection.rb&quot;, &quot;test/new_relic/agent/mock_scope_listener.rb&quot;, &quot;test/new_relic/agent/model_fixture.rb&quot;, &quot;test/new_relic/agent/tc_active_record.rb&quot;, &quot;test/new_relic/agent/tc_agent.rb&quot;, &quot;test/new_relic/agent/tc_collection_helper.rb&quot;, &quot;test/new_relic/agent/tc_controller.rb&quot;, &quot;test/new_relic/agent/tc_dispatcher_instrumentation.rb&quot;, &quot;test/new_relic/agent/tc_error_collector.rb&quot;, &quot;test/new_relic/agent/tc_method_tracer.rb&quot;, &quot;test/new_relic/agent/tc_stats_engine.rb&quot;, &quot;test/new_relic/agent/tc_synchronize.rb&quot;, &quot;test/new_relic/agent/tc_transaction_sample.rb&quot;, &quot;test/new_relic/agent/tc_transaction_sample_builder.rb&quot;, &quot;test/new_relic/agent/tc_transaction_sampler.rb&quot;, &quot;test/new_relic/agent/tc_worker_loop.rb&quot;, &quot;test/new_relic/agent/testable_agent.rb&quot;, &quot;test/new_relic/tc_config.rb&quot;, &quot;test/new_relic/tc_deployments_api.rb&quot;, &quot;test/new_relic/tc_environment.rb&quot;, &quot;test/new_relic/tc_metric_spec.rb&quot;, &quot;test/new_relic/tc_shim_agent.rb&quot;, &quot;test/new_relic/tc_stats.rb&quot;, &quot;test/test_helper.rb&quot;, &quot;test/ui&quot;, &quot;test/ui/tc_newrelic_helper.rb&quot;, &quot;ui/controllers&quot;, &quot;ui/controllers/newrelic_controller.rb&quot;, &quot;ui/helpers&quot;, &quot;ui/helpers/google_pie_chart.rb&quot;, &quot;ui/helpers/newrelic_helper.rb&quot;, &quot;ui/views&quot;, &quot;ui/views/layouts&quot;, &quot;ui/views/layouts/newrelic_default.rhtml&quot;, &quot;ui/views/newrelic&quot;, &quot;ui/views/newrelic/_explain_plans.rhtml&quot;, &quot;ui/views/newrelic/_sample.rhtml&quot;, &quot;ui/views/newrelic/_segment.rhtml&quot;, &quot;ui/views/newrelic/_segment_row.rhtml&quot;, &quot;ui/views/newrelic/_show_sample_detail.rhtml&quot;, &quot;ui/views/newrelic/_show_sample_sql.rhtml&quot;, &quot;ui/views/newrelic/_show_sample_summary.rhtml&quot;, &quot;ui/views/newrelic/_sql_row.rhtml&quot;, &quot;ui/views/newrelic/_stack_trace.rhtml&quot;, &quot;ui/views/newrelic/_table.rhtml&quot;, &quot;ui/views/newrelic/explain_sql.rhtml&quot;, &quot;ui/views/newrelic/images&quot;, &quot;ui/views/newrelic/images/arrow-close.png&quot;, &quot;ui/views/newrelic/images/arrow-open.png&quot;, &quot;ui/views/newrelic/images/blue_bar.gif&quot;, &quot;ui/views/newrelic/images/gray_bar.gif&quot;, &quot;ui/views/newrelic/index.rhtml&quot;, &quot;ui/views/newrelic/javascript&quot;, &quot;ui/views/newrelic/javascript/transaction_sample.js&quot;, &quot;ui/views/newrelic/sample_not_found.rhtml&quot;, &quot;ui/views/newrelic/show_sample.rhtml&quot;, &quot;ui/views/newrelic/show_source.rhtml&quot;, &quot;ui/views/newrelic/stylesheets&quot;, &quot;ui/views/newrelic/stylesheets/style.css&quot;]
   s.has_rdoc = true
   s.homepage = %q{http://www.newrelic.com}
   s.require_paths = [&quot;lib&quot;]</diff>
      <filename>newrelic_rpm.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -17,14 +17,17 @@ make_notify_task = lambda do
       log_command = source.log(from_revision)
       # Because new_relic_api could be plugins or the gem dir, we rely
       # on the lib path to find it. 
-      script = [ 'load &quot;new_relic_api.rb&quot;' ] &lt;&lt;
+      ## script = [ ' ] &lt;&lt;
+      script = [ 'vendor/plugins/newrelic_rpm/bin/newrelic_cmd' ] &lt;&lt;
                  &quot;deployments&quot; &lt;&lt;
                  &quot;-u&quot; &lt;&lt; ENV['USER'] &lt;&lt;
+                 &quot;-e&quot; &lt;&lt; rails_env &lt;&lt;
                  &quot;-r&quot; &lt;&lt; current_revision &lt;&lt;
-                 &quot;-c&quot; 
+                 &quot;-c&quot;
+      
       script = script.map { | arg | &quot;'#{arg}'&quot; }.join(&quot; &quot;)
       begin
-        run &quot;cd #{current_release}; #{log_command} | script/runner -e #{rails_env} #{script}&quot; do | io, stream_id, output |
+        run &quot;cd #{current_release}; #{log_command} | ruby #{script}&quot; do | io, stream_id, output |
           logger.trace(output)
         end
       rescue CommandError</diff>
      <filename>recipes/newrelic.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,12 @@
-require File.expand_path(File.join(File.dirname(__FILE__),'/../test_helper'))
-require 'new_relic_api'
+#require File.expand_path(File.join(File.dirname(__FILE__),'/../test_helper'))
+require File.expand_path(File.join(File.dirname(__FILE__),'../../lib/new_relic/commands/deployments'))
+require 'rubygems'
+require 'mocha'
+
 class NewRelic::DeploymentsTests &lt; Test::Unit::TestCase
   
   def setup
-    NewRelic::API::Deployments.class_eval do
+    NewRelic::Commands::Deployments.class_eval do
       attr_accessor :messages, :exit_status, :errors, :revision
       def err(message); @errors = @errors ? @errors + message : message; end
       def info(message); @messages = @messages ? @messages + message : message; end
@@ -17,21 +20,34 @@ class NewRelic::DeploymentsTests &lt; Test::Unit::TestCase
     puts @deployment.exit_status
   end
   def test_help
-    @deployment = NewRelic::API::Deployments.new &quot;-?&quot;
+    @deployment = NewRelic::Commands::Deployments.new &quot;-?&quot;
     assert_equal 0, @deployment.exit_status
     assert_match /^Usage/, @deployment.messages
     assert_nil @deployment.revision
     @deployment = nil
   end
   def test_run
-    @deployment = NewRelic::API::Deployments.new(%w[-a APP -r 3838 --user=Bill] &lt;&lt; &quot;Some lengthy description&quot;)
+    mock_the_connection
+    @mock_response.expects(:body).returns(&quot;&lt;xml&gt;deployment&lt;/xml&gt;&quot;)
+    @deployment = NewRelic::Commands::Deployments.new(%w[-a APP -r 3838 --user=Bill] &lt;&lt; &quot;Some lengthy description&quot;)
     assert_nil @deployment.exit_status
     assert_nil @deployment.errors
     assert_equal '3838', @deployment.revision
     @deployment.run
-    assert_equal 1, @deployment.exit_status
-    assert_match /Unable to upload/, @deployment.errors
+
+    # This should pass because it's a bogus deployment
+    #assert_equal 1, @deployment.exit_status
+    #assert_match /Unable to upload/, @deployment.errors
+    
     @deployment = nil
   end
+  private
+  def mock_the_connection
+    mock_connection = mock()
+    @mock_response = mock()
+    @mock_response.expects(:is_a?).with(Net::HTTPSuccess).returns(true)
+    mock_connection.expects(:request).returns(@mock_response)
+    NewRelic::Config.instance.stubs(:http_connection).returns(mock_connection)
+  end
   
 end</diff>
      <filename>test/new_relic/tc_deployments_api.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a72e1f912863e90c1fdedb48398489008acc913f</id>
    </parent>
  </parents>
  <author>
    <name>James Gochee</name>
    <email>Jim@james-gochees-macbook-pro.local</email>
  </author>
  <url>http://github.com/mislav/newrelic_rpm/commit/6733ca65e648d6f4836f19382a11640443ceb886</url>
  <id>6733ca65e648d6f4836f19382a11640443ceb886</id>
  <committed-date>2009-01-21T15:30:33-08:00</committed-date>
  <authored-date>2009-01-21T15:30:33-08:00</authored-date>
  <message>sync agent beta 2.8.1-6142</message>
  <tree>5820727de613886997596b5fdbe7aaa25a0df64b</tree>
  <committer>
    <name>James Gochee</name>
    <email>Jim@james-gochees-macbook-pro.local</email>
  </committer>
</commit>
