README.md in rspec_profiling-0.0.4 vs README.md in rspec_profiling-0.0.5

- old
+ new

@@ -82,28 +82,36 @@ By default, profiles are collected in an SQL database. Make sure you've run the installation rake task before attempting. You can review results by running the RspecProfiling console. +The console has a preloaded `results` variable. ``` bundle exec rake rspec_profiling:console > results.count => 1970 +``` +You can find the spec that runs the most queries: + +``` > results.order(:query_count).last.to_s => "Updating my account - ./spec/features/account_spec.rb:15" ``` -The console has a preloaded `results` variable. +Or find the spec that takes the most time: ``` -results.count -> 180 +> results.order(:time).last.to_s +=> "Updating my account - ./spec/features/account_spec.rb:15" ``` +There are additional attributes available on the `Result` instances to enable +debugging, such as `exception` and `status`. + #### CSV You can configure `RspecProfiling` to collect results in a CSV in `config/initializers/rspec_profiling.rb`: ```Ruby @@ -150,10 +158,21 @@ - `db_path` - the location of the SQLite database file - `table_name` - the database table name in which results are stored - `csv_path` - the directory in which CSV files are dumped - `collector` - collector to use +### Usage in a script + +If you want to access the results from a Ruby script instead of the `rake rspec_profiling:console` shell command: + +```ruby +require 'rspec_profiling' +require 'rspec_profiling/console' +``` + +Then `results` will be available as a variable to the script. + ## Uninstalling To remove the results database, run `bundle exec rake rspec_profiling:uninstall`. ## Contributing @@ -164,10 +183,10 @@ 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request ## About Foraker Labs -<img src="http://assets.foraker.com/foraker_logo.png" width="400" height="62"> +![Foraker Logo](http://assets.foraker.com/attribution_logo.png) -This project is maintained by Foraker Labs. The names and logos of Foraker Labs are fully owned and copyright Foraker Design, LLC. +Foraker Labs builds exciting web and mobile apps in Boulder, CO. Our work powers a wide variety of businesses with many different needs. We love open source software, and we're proud to contribute where we can. Interested to learn more? [Contact us today](https://www.foraker.com/contact-us). -Foraker Labs is a Boulder-based Ruby on Rails and iOS development shop. Please reach out if we can [help build your product](http://www.foraker.com). +This project is maintained by Foraker Labs. The names and logos of Foraker Labs are fully owned and copyright Foraker Design, LLC.