Sha256: e921eed0426c77f3578c20477681a5ee292692ac212bcb23d7785c8e37fdda41

Contents?: true

Size: 1.3 KB

Versions: 70

Compression:

Stored size: 1.3 KB

Contents

require 'erb'

module Screengrab
  class ReportsGenerator
    def generate
      UI.message "Generating HTML Report"

      screens_path = Screengrab.config[:output_directory]

      @data = {}

      Dir[File.join(screens_path, "*")].sort.each do |language_folder|
        language = File.basename(language_folder)
        Dir[File.join(language_folder, 'images', '*', '*.png')].sort.each do |screenshot|
          device_type_folder = File.basename(File.dirname(screenshot))
          @data[language] ||= {}
          @data[language][device_type_folder] ||= []
          resulting_path = File.join('.', language, 'images', device_type_folder, File.basename(screenshot))
          @data[language][device_type_folder] << resulting_path
        end
      end

      html_path = File.join(Screengrab::ROOT, "lib", "screengrab/page.html.erb")
      html = ERB.new(File.read(html_path)).result(binding) # https://web.archive.org/web/20160430190141/www.rrn.dk/rubys-erb-templating-system

      export_path = "#{screens_path}/screenshots.html"
      File.write(export_path, html)

      export_path = File.expand_path(export_path)
      UI.success "Successfully created HTML file with an overview of all the screenshots: '#{export_path}'"
      system("open '#{export_path}'") unless Screengrab.config[:skip_open_summary]
    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
fastlane-2.67.0.beta.20171122010004 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.66.2 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.66.1 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.67.0.beta.20171121010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.66.0 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.65.0 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.65.0.beta.20171120010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.65.0.beta.20171119010004 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.65.0.beta.20171118010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.65.0.beta.20171117010003 screengrab/lib/screengrab/reports_generator.rb