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.70.3 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.71.0.beta.20171221010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.70.2 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.71.0.beta.20171220010004 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.71.0.beta.20171219010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.70.1 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.70.0 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.70.0.beta.20171217010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.70.0.beta.20171216010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.70.0.beta.20171215010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.3 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.70.0.beta.20171214010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.2 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.1 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.70.0.beta.20171213010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.0 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.0.beta.20171212010004 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.0.beta.20171211010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.0.beta.20171210010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.0.beta.20171209010003 screengrab/lib/screengrab/reports_generator.rb