Sha256: 87c06ea8c4e7f54c2fd2e15d984325ea201e9946d75b9d0b25cb2dce07f6a10f

Contents?: true

Size: 1.64 KB

Versions: 79

Compression:

Stored size: 1.64 KB

Contents

# frozen_string_literal: true

module RailsAppGenerator
  module Cli
    # Folder Diff
    class Diff < Thor
      desc 'diff lhs_folder rhs_folder [options]', 'Diff two different rails folders'

      # Run report to console for following options
      option :show_left_only  , type: :boolean
      option :show_right_only , type: :boolean
      option :show_same       , type: :boolean
      option :show_different  , type: :boolean

      # Open files in VSCode for for following options
      option :open_left_only  , type: :boolean
      option :open_right_only , type: :boolean
      option :open_same       , type: :boolean
      option :open_different  , type: :boolean

      # rubocop:disable Metrics/AbcSize
      def diff(lhs_folder, rhs_folder)
        # puts "Diffing #{lhs_folder} and #{rhs_folder}"
        # puts JSON.pretty_generate(options)
        processor = RailsAppGenerator::Diff::Processor.new(lhs_folder, rhs_folder)
        compare_info = processor.compare

        report = RailsAppGenerator::Diff::Report.new(
          compare_info,
          show_left_only: options[:show_left_only],
          show_right_only: options[:show_right_only],
          show_same: options[:show_same],
          show_different: options[:show_different]
        )
        report.display

        vscode = RailsAppGenerator::Diff::OpenInEditor.new(
          compare_info,
          open_left_only: options[:open_left_only],
          open_right_only: options[:open_right_only],
          open_same: options[:open_same],
          open_different: options[:show_different]
        )
        vscode.open
      end
      # rubocop:enable Metrics/AbcSize
    end
  end
end

Version data entries

79 entries across 79 versions & 1 rubygems

Version Path
rails_app_generator-0.3.6 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.3.5 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.3.4 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.3.3 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.3.2 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.3.1 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.3.0 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.43 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.42 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.41 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.40 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.39 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.38 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.37 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.36 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.35 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.34 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.33 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.32 lib/rails_app_generator/cli/diff.rb
rails_app_generator-0.2.31 lib/rails_app_generator/cli/diff.rb