Sha256: 8b0ba628aed2f6c7152889d80d9f32787aed34e691aa2275d88ed4027bc77ce9

Contents?: true

Size: 770 Bytes

Versions: 4

Compression:

Stored size: 770 Bytes

Contents

class BrowserShooter
  module Configurator
    def self.load_config( config_file_path )
      config = {
        "output_path" => "~/browser_shooter",
        "logs_format" => "csv"
      }

      config.merge! YAML.load_file( config_file_path )

      config["output_path"] = set_up_output_path( config["output_path"] )

      config
    end

    def self.set_up_output_path( output_path )
      output_path = File.expand_path( "#{output_path}/#{timestamp}" )
      BrowserShooter::Logger.log( "output_path: #{output_path}" )

      FileUtils.mkdir_p( output_path )
      FileUtils.mkdir( "#{output_path}/shots" )
      FileUtils.mkdir( "#{output_path}/logs" )

      output_path
    end

    def self.timestamp
      Time.now.strftime("%Y%m%d%H%M%S")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
browser_shooter-0.2.3 lib/browser_shooter/configurator.rb
browser_shooter-0.1.3 lib/browser_shooter/configurator.rb
browser_shooter-0.1.1 lib/browser_shooter/configurator.rb
browser_shooter-0.0.5 lib/browser_shooter/configurator.rb