Skip to content

Commit

Permalink
Change --from_file usage
Browse files Browse the repository at this point in the history
  • Loading branch information
dcadenas committed Mar 8, 2012
1 parent d623e9b commit e39815f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ The `--class_name_filter` option is similar to the `--path_filter` options excep

The `--to_file` option dumps the dependency graph data to a file so you can do filtering later, it does not create a dot file.

The `--from_file` option is used with the file dumped through `--to_file`. When you use this option the tests (or block) are not ran, the dependency graph is loaded directly from the file. This is useful to avoid rerunning code that didn't change just for the purpose of filtering with different combinations e.g.:
The `--from_file` option is only available when you don't specify a test command. Its argument is the file dumped through `--to_file` in a previous run. When you use this option the tests (or block) are not ran, the dependency graph is loaded directly from the file. This is useful to avoid rerunning code that didn't change just for the purpose of filtering with different combinations e.g.:

```bash
rubydeps rspec2 --to_file='dependencies.dump'
rubydeps rspec2 --from_file='dependencies.dump' --path_filter='app/models'
rubydeps rspec2 --from_file='dependencies.dump' --path_filter='app/models|app/controllers'
rubydeps --from_file='dependencies.dump' --path_filter='app/models'
rubydeps --from_file='dependencies.dump' --path_filter='app/models|app/controllers'
```

Library usage
Expand Down
14 changes: 10 additions & 4 deletions bin/rubydeps
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Rubydeps
class Runner < Thor
desc "testunit", "Create the dependency graph after runnning the testunit tests"
method_option :to_file, :type => :string
method_option :from_file, :type => :string
method_option :path_filter, :type => :string, :default => `pwd`.chomp, :required => true
method_option :class_name_filter, :type => :string, :default => '', :required => true
def testunit
Expand All @@ -28,7 +27,6 @@ module Rubydeps

desc "rspec", "Create the dependency graph after runnning the rspec tests"
method_option :to_file, :type => :string
method_option :from_file, :type => :string
#TODO: this breaks when using underscores, investigate
method_option :path_filter, :type => :string, :default => `pwd`.chomp, :required => true
method_option :class_name_filter, :type => :string, :default => '', :required => true
Expand All @@ -44,9 +42,17 @@ module Rubydeps
end
end

desc "", "Loads dependencies saved by a --to_file option in a previous run. Doesn't run tests"
method_option :from_file, :type => :string, :required => true
method_option :path_filter, :type => :string, :default => `pwd`.chomp, :required => true
method_option :class_name_filter, :type => :string, :default => '', :required => true
default_task :load_deps
def load_deps
puts options[:from_file]
end

desc "rspec2", "Create the dependency graph after runnning the rspec 2 tests"
method_option :to_file, :type => :string
method_option :from_file, :type => :string
method_option :path_filter, :type => :string, :default => `pwd`.chomp, :required => true
method_option :class_name_filter, :type => :string, :default => '', :required => true
def rspec2
Expand All @@ -60,7 +66,7 @@ module Rubydeps
end
end

private
private

def create_dependencies_dot_for(options)
ARGV.clear
Expand Down
Binary file modified lib/call_site_analyzer.bundle
Binary file not shown.

0 comments on commit e39815f

Please sign in to comment.