Class: DontRepeatYourself::SimianRunner
- Inherits:
-
Object
- Object
- DontRepeatYourself::SimianRunner
- Defined in:
- lib/dont_repeat_yourself/simian_runner.rb
Overview
See Simian doc in www.redhillconsulting.com.au/products/simian/installation.html#cli
Constant Summary collapse
- DEFAULT_THRESHOLD =
3
- SIMIAN_LOGFILE_NAME =
"simian_log.yaml"
Instance Attribute Summary collapse
-
#basedir ⇒ Object
Returns the value of attribute basedir.
-
#executable ⇒ Object
readonly
Returns the value of attribute executable.
-
#formatter_option ⇒ Object
readonly
Returns the value of attribute formatter_option.
-
#patterns_of_directories_to_search_for_duplicate_lines ⇒ Object
readonly
Returns the value of attribute patterns_of_directories_to_search_for_duplicate_lines.
-
#simian_jar_path ⇒ Object
readonly
Returns the value of attribute simian_jar_path.
-
#simian_log_file ⇒ Object
readonly
Returns the value of attribute simian_log_file.
-
#threshold ⇒ Object
Returns the value of attribute threshold.
Instance Method Summary collapse
- #add_html_directory_to_search_for_duplicate_lines(path) ⇒ Object
- #add_ruby_directory_to_search_for_duplicate_lines(path) ⇒ Object
- #ignore_directory(path) ⇒ Object
- #ignore_file(path) ⇒ Object
-
#initialize ⇒ SimianRunner
constructor
A new instance of SimianRunner.
- #run ⇒ Object
Constructor Details
#initialize ⇒ SimianRunner
Returns a new instance of SimianRunner.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 19 def initialize() @threshold = DEFAULT_THRESHOLD @patterns_of_directories_to_search_for_duplicate_lines, @patterns_of_directories_to_exclude_for_duplicate_lines = [], [] @formatter_option = "-formatter=yaml" # extension is .txt because the selenium_on_rails project had a problem with jar files that could be # downloaded from the rubygems repository # In order to prevent this kind of problem, I decided to use another suffix as they did ... @simian_jar_path = File.join(File.dirname(__FILE__), '..', 'jars', 'simian-2.2.24.jar.xyz') @executable = "java -jar #{@simian_jar_path}".freeze end |
Instance Attribute Details
#basedir ⇒ Object
Returns the value of attribute basedir.
8 9 10 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 8 def basedir @basedir end |
#executable ⇒ Object (readonly)
Returns the value of attribute executable.
8 9 10 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 8 def executable @executable end |
#formatter_option ⇒ Object (readonly)
Returns the value of attribute formatter_option.
8 9 10 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 8 def formatter_option @formatter_option end |
#patterns_of_directories_to_search_for_duplicate_lines ⇒ Object (readonly)
Returns the value of attribute patterns_of_directories_to_search_for_duplicate_lines.
8 9 10 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 8 def patterns_of_directories_to_search_for_duplicate_lines @patterns_of_directories_to_search_for_duplicate_lines end |
#simian_jar_path ⇒ Object (readonly)
Returns the value of attribute simian_jar_path.
8 9 10 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 8 def simian_jar_path @simian_jar_path end |
#simian_log_file ⇒ Object (readonly)
Returns the value of attribute simian_log_file.
8 9 10 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 8 def simian_log_file @simian_log_file end |
#threshold ⇒ Object
Returns the value of attribute threshold.
8 9 10 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 8 def threshold @threshold end |
Instance Method Details
#add_html_directory_to_search_for_duplicate_lines(path) ⇒ Object
52 53 54 55 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 52 def add_html_directory_to_search_for_duplicate_lines(path) valid_directory_path(path) @patterns_of_directories_to_search_for_duplicate_lines << (path + "/**/*.*html") end |
#add_ruby_directory_to_search_for_duplicate_lines(path) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 45 def add_ruby_directory_to_search_for_duplicate_lines(path) valid_directory_path(path) # TODO if the next line usefull ? @patterns_of_directories_to_search_for_duplicate_lines << (path + "/*.rb") @patterns_of_directories_to_search_for_duplicate_lines << (path + "/**/*.rb") end |
#ignore_directory(path) ⇒ Object
62 63 64 65 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 62 def ignore_directory(path) valid_directory_path(path) @patterns_of_directories_to_exclude_for_duplicate_lines << add_ruby_pattern(path) end |
#ignore_file(path) ⇒ Object
57 58 59 60 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 57 def ignore_file(path) valid_file_path(path) @patterns_of_directories_to_exclude_for_duplicate_lines << "/" + path end |
#run ⇒ Object
67 68 69 70 71 72 |
# File 'lib/dont_repeat_yourself/simian_runner.rb', line 67 def run run_java results_yaml = YAML.load(simian_output_with_header_removed) delete_simian_log_file results_yaml end |