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.69.0.beta.20171208010004 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.0.beta.20171207010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.0.beta.20171206010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.68.2 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.0.beta.20171205010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.68.1 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.0.beta.20171204010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.0.beta.20171203010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.0.beta.20171202010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.69.0.beta.20171201010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.68.0 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.68.0.beta.20171130010004 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.68.0.beta.20171129010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.67.0 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.67.0.beta.20171128010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.67.0.beta.20171127010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.67.0.beta.20171126010003 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.67.0.beta.20171125010004 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.67.0.beta.20171124010004 screengrab/lib/screengrab/reports_generator.rb
fastlane-2.67.0.beta.20171123010003 screengrab/lib/screengrab/reports_generator.rb