Class: Maximus::Phantomas
- Defined in:
- lib/maximus/statistics/phantomas.rb
Overview
Instance Attribute Summary
Attributes inherited from Statistic
Instance Method Summary collapse
-
#result ⇒ Object
Phantomas evaluates page performance with phantomjs and node.
Methods inherited from Statistic
Methods included from Helper
#check_default_config_path, #edit_yaml, #file_count, #file_list, #is_rails?, #lines_added_to_range, #node_module_exists, #path_exists?, #prompt, #reporter_path, #root_dir, #truthy?
Constructor Details
This class inherits a constructor from Maximus::Statistic
Instance Method Details
#result ⇒ Object
Phantomas evaluates page performance with phantomjs and node
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/maximus/statistics/phantomas.rb', line 8 def result return if @settings[:phantomas].blank? node_module_exists('phantomjs', 'brew install') node_module_exists('phantomas') @path = @settings[:paths] if @path.blank? @domain = @config.domain # Phantomas doesn't actually skip the skip-modules defined in the config BUT here's to hoping for future support phantomas_cli = "phantomas --config=#{@settings[:phantomas]} " phantomas_cli += @config.is_dev? ? '--colors' : '--reporter=json:no-skip' phantomas_cli += " --proxy=#{@domain}" @path.is_a?(Hash) ? @path.each { |label, url| phantomas_by_url(url, phantomas_cli) } : phantomas_by_url(@path, phantomas_cli) @output end |