README.rdoc in tailor-1.1.5 vs README.rdoc in tailor-1.2.0
- old
+ new
@@ -91,15 +91,20 @@
$ tailor test/**/*.rb
Check defaults (lib/**/*.rb):
$ tailor
-
+
+Printing the results in a output file (if using a formatter that accepts output files, like 'yaml'):
+
+ $ tailor path/to/check --output-file=my-results.yaml
+ $ tailor --output-file=my-results-from-defaults.yaml
+
Use defaults via a Rake task (if you have a .tailor file, it'll use those settings):
require 'tailor/rake_task'
-
+
Tailor::RakeTask.new
==== On style...
The features list, above, shows some aspects of style that should be fairly
@@ -268,10 +273,25 @@
style.indentation_spaces 2, level: :off
end
end
+===== Formatters
+
+By default Tailor uses the text formatter, printing the results on console. Tailor
+also provides a YAML formatter, that accepts an output file if using the option
+--output-file=*.yaml
+
+ # .tailor
+ Tailor.config do |config|
+ config.formatters 'text', 'yaml'
+
+ # just one
+ config.formatters 'text'
+ end
+
+
=== Define A Custom Ruler
While tailor provides a number of Rulers for checking style, it also provides a
way for you to add your own rulers without having to delve into its innards. To
do this, you need to do the following.
@@ -341,13 +361,33 @@
end
end
Next time you run tailor, your Ruler will get initialized and used.
+=== Using the lib
+
+Sometimes you could use tailor as a lib, getting the results as a hash
+and manipulate them according your domain.
+
+ require 'tailor/cli'
+
+ # only results from a specific path
+ tailor = Tailor::CLI.new %w(app/controllers)
+ tailor.result # result should be a hash {"filename" => [problems]}
+
+ # using other file config (hiding path, it'll use from default config)
+ Tailor::CLI.new %w(--config-file=.other-config)
+ Tailor::CLI.new [] # uses file set from .tailor file config
+
+ # printing the results in a output file
+ tailor = Tailor::CLI.new %w(--output-file=results.yaml)
+ tailor.execute!
+
== REQUIREMENTS:
* Rubies (tested)
* 1.9.3
+ * 2.0.0
* Gems
* log_switch
* term-ansicolor
* text-table