<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/controllers/runs.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,6 @@
-Copyright (c) 2008 YOUR NAME
+(The FiveRuns License)
+
+Copyright (c) 2008 FiveRuns Corporation
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the</diff>
      <filename>LICENSE</filename>
    </modified>
    <modified>
      <diff>@@ -1,170 +1,70 @@
-FiverunsTuneupMerb
-==================
-
-A slice for the Merb framework.
-
-------------------------------------------------------------------------------
-
-fiveruns_tuneup_merb
-|-- LICENSE
-|-- README
-|-- Rakefile [1]
-|-- TODO
-|-- app [2]
-|   |-- controllers
-|   |   |-- application.rb
-|   |   `-- main.rb
-|   |-- helpers
-|   |   `-- application_helper.rb
-|   `-- views
-|       |-- layout
-|       |   `-- fiveruns_tuneup_merb.html.erb [3]
-|       `-- main
-|           `-- index.html.erb
-|-- lib
-|   |-- fiveruns_tuneup_merb
-|   |   |-- merbtasks.rb [4]
-|   |   `-- slicetasks.rb [5]
-|   `-- fiveruns_tuneup_merb.rb [6]
-|-- log
-|   `-- merb_test.log
-|-- public [7]
-|   |-- javascripts 
-|   |   `-- master.js
-|   `-- stylesheets
-|       `-- master.css
-|-- spec [8]
-|   |-- fiveruns_tuneup_merb_spec.rb
-|   |-- controllers
-|   |   `-- main_spec.rb
-|   `-- spec_helper.rb
-`-- stubs [9]
-    `-- app
-        `-- controllers
-            |-- application.rb
-            `-- main.rb
-
-
-1. Rake tasks to package/install the gem - edit this to modify the manifest.
-2. The slice application: controllers, models, helpers, views.
-3. The default layout, as specified in Merb::Slices::config[:fiveruns_tuneup_merb][:layout]
-   change this to :application to use the app's layout.
-4. Standard rake tasks available to your application.
-5. Your custom application rake tasks.
-6. The main slice file - contains all slice setup logic/config.
-7. Public assets you (optionally) install using rake slices:fiveruns_tuneup_merb:install
-8. Specs for basis slice behaviour - you usually adapt these for your slice.
-9. Stubs of classes/views/files for the end-user to override - usually these 
-   mimic the files in app/ and/or public/; use rake slices:fiveruns_tuneup_merb:stubs to
-   get started with the override stubs. Also, slices:fiveruns_tuneup_merb:patch will
-   copy over views to override in addition to the files found in /stubs.
-   
-
-To see all available tasks for FiverunsTuneupMerb run:
-
-rake -T slices:fiveruns_tuneup_merb
-
-------------------------------------------------------------------------------
-
-Instructions for installation:
-
-file: config/init.rb
-
-# add the slice as a regular dependency
-
-dependency 'fiveruns_tuneup_merb'
-
-# if needed, configure which slices to load and in which order
-
-Merb::Plugins.config[:merb_slices] = { :queue =&gt; [&quot;FiverunsTuneupMerb&quot;, ...] }
-
-# optionally configure the plugins in a before_app_loads callback
-
-Merb::BootLoader.before_app_loads do
-  
-  Merb::Slices::config[:fiveruns_tuneup_merb][:option] = value
-  
-end
-
-file: config/router.rb
-
-# example: /fiveruns_tuneup_merb/:controller/:action/:id
+= FiveRuns TuneUp panel for Merb
 
-r.add_slice(:FiverunsTuneupMerb)
+== Requirements
 
-# example: /foo/:controller/:action/:id
+* fiveruns_tuneup_core gem
+* merb-core &gt;= 0.9.5
+* merb-slices &gt;= 0.9.5
 
-r.add_slice(:FiverunsTuneupMerb, 'foo') # same as :path =&gt; 'foo'
+== Synopsis
 
-# example: /:lang/:controller/:action/:id (with :a param set)
+FiveRuns TuneUp for Merb.
 
-r.add_slice(:FiverunsTuneupMerb, :path =&gt; ':lang', :params =&gt; { :a =&gt; 'b' })
+See http://blog.fiveruns.com/2008/10/11/fiveruns-tuneup-for-merb for the announcement.
 
-# example: /:controller/:action/:id
+== Installation
 
-r.slice(:FiverunsTuneupMerb)
+1. Install the gem:
 
-Normally you should also run the following rake task:
+  sudo gem install fiveruns_tuneup_merb
 
-rake slices:fiveruns_tuneup_merb:install
+2. Add the following to your desired environment file (eg, config/environments/development.rb):
 
-------------------------------------------------------------------------------
+  dependency 'fiveruns_tuneup_merb'
 
-You can put your application-level overrides in:
+3. Run the following in your Merb.root:
 
-host-app/slices/fiveruns_tuneup_merb/app - controllers, models, views ...
+  rake slices:fiveruns_tuneup_merb:install
 
-Templates are located in this order:
+4. Add the following to your config/router.rb:
 
-1. host-app/slices/fiveruns_tuneup_merb/app/views/*
-2. gems/fiveruns_tuneup_merb/app/views/*
-3. host-app/app/views/*
+  slice FiverunsTuneupMerb
+  
+(If you're already mounting other slices with `all_slices' this step isn't necessary.)
 
-You can use the host application's layout by configuring the
-fiveruns_tuneup_merb slice in a before_app_loads block:
+5. Start your app!
 
-Merb::Slices.config[:fiveruns_tuneup_merb] = { :layout =&gt; :application }
+== Sharing
 
-By default :fiveruns_tuneup_merb is used. If you need to override
-stylesheets or javascripts, just specify your own files in your layout
-instead/in addition to the ones supplied (if any) in 
-host-app/public/slices/fiveruns_tuneup_merb.
+To enable run sharing on the http://tuneup.fiveruns.com service, you need to configure the slice with an API key. Create an account at http://tuneup.fiveruns.com/users/new and look at your profile to find your it.
 
-In any case don't edit those files directly as they may be clobbered any time
-rake fiveruns_tuneup_merb:install is run.
+In your environment file (ie, config/environments/development.rb), add the API key:
 
-------------------------------------------------------------------------------
+  Merb::BootLoader.before_app_loads do
+    Merb::Slices.config[:fiveruns_tuneup_merb][:api_key] = 'YOUR-API-KEY'
+  end	
+  
+When you restart your application, a &quot;Share this run&quot; link on the TuneUp panel should appear.
 
-About Slices
-============
+== Supported Browsers
 
-Merb-Slices is a Merb plugin for using and creating application 'slices' which
-help you modularize your application. Usually these are reuseable extractions
-from your main app. In effect, a Slice is just like a regular Merb MVC
-application, both in functionality as well as in structure.
+The TuneUp plugin has been tested with the following browsers:
 
-When you generate a Slice stub structure, a module is setup to serve as a
-namespace for your controller, models, helpers etc. This ensures maximum
-encapsulation. You could say a Slice is a mixture between a Merb plugin (a
-Gem) and a Merb application, reaping the benefits of both.
+* Firefox 2+
+* Safari 3.1+
 
-A host application can 'mount' a Slice inside the router, which means you have
-full over control how it integrates. By default a Slice's routes are prefixed
-by its name (a router :namespace), but you can easily provide your own prefix
-or leave it out, mounting it at the root of your url-schema. You can even
-mount a Slice multiple times and give extra parameters to customize an
-instance's behaviour.
+== Bugs and Feature Requests
 
-A Slice's Application controller uses controller_for_slice to setup slice
-specific behaviour, which mainly affects cascaded view handling. Additionaly,
-this method is available to any kind of controller, so it can be used for
-Merb Mailer too for example.
+Please let us know if you run into any problems with your application or browser. The plugin uses CSS isolation techniques that could interfere with your HTML or CSS code.
 
-There are many ways which let you customize a Slice's functionality and
-appearance without ever touching the Gem-level code itself. It's not only easy
-to add template/layout overrides, you can also add/modify controllers, models
-and other runtime code from within the host application.
+You can contact support at support@fiveruns.com
+  
+== Contributing
 
-To create your own Slice run this (somewhere outside of your merb app):
+Help us make TuneUp better on Merb by contributing via GitHub.
+  http://github.com/fiveruns/fiveruns_tuneup_merb
+  http://github.com/fiveruns/fiveruns_tuneup_core  
+    
+== License
 
-$ merb-gen slice &lt;your-lowercase-slice-name&gt;
\ No newline at end of file
+See LICENSE
\ No newline at end of file</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -10,7 +10,7 @@ AUTHOR = &quot;FiveRuns Development Team&quot;
 EMAIL = &quot;dev@fiveruns.com&quot;
 HOMEPAGE = &quot;http://tuneup.fiveruns.com/&quot;
 SUMMARY = &quot;Merb Slice that provides the FiveRuns TuneUp Panel (http://tuneup.fiveruns.com)&quot;
-GEM_VERSION = &quot;0.0.1&quot;
+GEM_VERSION = &quot;0.5.0&quot;
 
 spec = Gem::Specification.new do |s|
   s.rubyforge_project = 'fiveruns_tuneup_merb'</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,15 +1,2 @@
-TODO:
-
-- Fix FiverunsTuneupMerb.description and FiverunsTuneupMerb.version
-- Fix LICENSE with your name
-- Fix Rakefile with your name and contact info
-- Add your code to lib/fiveruns_tuneup_merb.rb
-- Add your Merb rake tasks to lib/fiveruns_tuneup_merb/merbtasks.rb
-
-Remove anything that you don't need:
-
-- app/controllers/main.rb FiverunsTuneupMerb::Main controller
-- app/views/layout/fiveruns_tuneup_merb.html.erb
-- spec/controllers/main_spec.rb controller specs
-- public/* any public files
-- stubs/* any stub files
\ No newline at end of file
+* Feedback on ORMs
+* Compatibility testing with live Merb apps (1.0)
\ No newline at end of file</diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -84,8 +84,10 @@ if defined?(Merb::Plugins)
     # @note prefix your named routes with :fiveruns_tuneup_merb_
     #   to avoid potential conflicts with global named routes.
     def self.setup_router(scope)
-      # example of a named route
-      scope.match('/share').to(:controller =&gt; 'runs', :action =&gt; 'share').name(:fiveruns_tuneup_merb_share_run)
+      if Fiveruns::Tuneup::Run.api_key?
+        # example of a named route
+        scope.match(%r{/share/(.+)}).to(:controller =&gt; 'runs', :action =&gt; 'share', :slug =&gt; '[1]').name(:fiveruns_tuneup_merb_share_run)
+      end
     end
     
   end</diff>
      <filename>lib/fiveruns_tuneup_merb.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,6 +4,10 @@ module FiverunsTuneupMerb
     
   module APIKey
     
+    def can_share?
+      Fiveruns::Tuneup::Run.api_key? &amp;&amp; routed?
+    end
+    
     def log_share_status
       if Fiveruns::Tuneup::Run.api_key?
         Merb.logger.debug &quot;TuneUp is configured for sharing.&quot;</diff>
      <filename>lib/fiveruns_tuneup_merb/api_key.rb</filename>
    </modified>
    <modified>
      <diff>@@ -62,11 +62,10 @@ module FiverunsTuneupMerb
 
            def body
              if content_type == :html &amp;&amp; request.tuneup
-               ::Merb.logger.debug &quot;TuneUp: Saving run and inserting panel into the response (#{request.tuneup.class})&quot;
+               ::Merb.logger.debug &quot;TuneUp: Saving run and inserting panel into the response&quot;
                run = Fiveruns::Tuneup::Run.new(request.uri, request.tuneup)
-               ::Merb.logger.debug &quot;TuneUp: Compressing #{run.to_json.size} bytes of JSON to persist&quot;
                run.save
-               Fiveruns::Tuneup.insert_panel(super, request.tuneup)
+               Fiveruns::Tuneup.insert_panel(super, run, FiverunsTuneupMerb.can_share?)
              else
                super
              end</diff>
      <filename>lib/fiveruns_tuneup_merb/instrumentation.rb</filename>
    </modified>
    <modified>
      <diff>@@ -46,7 +46,28 @@ var TuneUp = {
 }
         
 $(window).ready(function() {
-  
+        
+  page.find('#tuneup-save-link').click(function () {
+    var link = $(this);
+    link.hide();
+    $.getJSON($(this).attr('href'), {}, function(data) {
+      if (data.run_id) {
+        var url = &quot;http://tuneup.fiveruns.com/runs/&quot; + data.run_id;
+        var goToRun = function() {
+          if(!_window.open(url)) { page.location = url; }
+          return false;
+        }
+        link.html(&quot;Shared!&quot;);
+        link.click(goToRun);
+        goToRun();
+      } else if (data.error) {
+        alert(data.error);
+      }
+      link.show();
+    });
+    return false;
+  });
+    
   page.find('#tuneup .with_children .tuneup-title a.tuneup-step-name').toggle(
     // Note: Simple 'parent' lookup with selector doesn't seem to work
     function() { TuneUp.parentStepOf($(this)).addClass('tuneup-opened'); },
@@ -72,19 +93,5 @@ $(window).ready(function() {
     ));
   });
     
-  page.find('#fiveruns_tuneup_state').toggle(
-    function () {
-      var link = $(this);
-      $.getScript('/fiveruns_tuneup_merb/off.js', function() {
-        link.html('Turn On');
-      });
-    },
-    function () {
-      var link = $(this);
-      $.getScript('/fiveruns_tuneup_merb/on.js', function() {
-        link.html('Turn Off');
-      });
-    }
-  );
   TuneUp.adjustFixedElements(page);
 });
\ No newline at end of file</diff>
      <filename>public/javascripts/tuneup.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1e15f1458c612b45b359a1dbb5661f75cc51f54f</id>
    </parent>
  </parents>
  <author>
    <name>Bruce Williams</name>
    <email>bruce@codefluency.com</email>
  </author>
  <url>http://github.com/fiveruns/fiveruns_tuneup_merb/commit/767cad0b95c531812b6ce517e7c38d6aa5041b73</url>
  <id>767cad0b95c531812b6ce517e7c38d6aa5041b73</id>
  <committed-date>2008-10-11T08:39:40-07:00</committed-date>
  <authored-date>2008-10-11T08:39:40-07:00</authored-date>
  <message>Support for sharing with service
README, prep for initial release</message>
  <tree>3425e364e334adea6262e1796f1a3f037660d8af</tree>
  <committer>
    <name>Bruce Williams</name>
    <email>bruce@codefluency.com</email>
  </committer>
</commit>
