lib/percy/cli/snapshot_runner.rb in percy-cli-1.3.0 vs lib/percy/cli/snapshot_runner.rb in percy-cli-1.3.1
- old
+ new
@@ -23,26 +23,33 @@
def initialize
@client = Percy::Client.new(client_info: "percy-cli/#{VERSION}", environment_info: '')
end
def run(root_dir, options = {})
- repo = options[:repo] || Percy.config.repo
root_dir = File.expand_path(File.absolute_path(root_dir))
strip_prefix = File.expand_path(File.absolute_path(options[:strip_prefix] || root_dir))
- num_threads = options[:threads] || 10
- snapshot_limit = options[:snapshot_limit]
- baseurl = options[:baseurl] || '/'
+
+ # CLI Options
enable_javascript = !!options[:enable_javascript]
include_all = !!options[:include_all]
+ snapshot_limit = options[:snapshot_limit]
+ snapshots_regex = options[:snapshots_regex]
ignore_regex = options[:ignore_regex]
widths = options[:widths].map { |w| Integer(w) }
+ num_threads = options[:threads] || 10
+ repo = options[:repo] || Percy.config.repo
+ baseurl = options[:baseurl] || '/'
raise ArgumentError, 'baseurl must start with /' if baseurl[0] != '/'
base_resource_options = {strip_prefix: strip_prefix, baseurl: baseurl}
# Find all the static files in the given root directory.
- root_paths = _find_root_paths(root_dir, snapshots_regex: options[:snapshots_regex])
- opts = {include_all: include_all, ignore_regex: ignore_regex}
+ opts = {
+ include_all: include_all,
+ ignore_regex: ignore_regex,
+ snapshots_regex: snapshots_regex,
+ }
+ root_paths = _find_root_paths(root_dir, opts)
resource_paths = _find_resource_paths(root_dir, opts)
root_resources = _list_resources(root_paths, base_resource_options.merge(is_root: true))
build_resources = _list_resources(resource_paths, base_resource_options)
all_resources = root_resources + build_resources