Sha256: f277c058aca8be42e659b729370c6c9417788a5d3436d2b846b239db73b1b4d2

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

##
# Usage example:
#
# result = ConvenientService::Examples::Dry::Gemfile::Services::Format.result(path: "Gemfile")
# result = ConvenientService::Examples::Dry::Gemfile::Services::Format.result(path: "spec/cli/gemfile/format/fixtures/Gemfile")
#
module ConvenientService
  module Examples
    module Dry
      class Gemfile
        module Services
          class Format
            include DryService::Config

            option :path

            step Services::ReadFileContent, in: :path, out: :content
            step Services::StripComments, in: :content, out: :content_without_comments
            step Services::ParseContent, in: {content: :content_without_comments}, out: :parsed_content
            step Services::FormatHeader, in: :parsed_content, out: {formatted_content: :formatted_header_content}
            step Services::FormatBody, in: :parsed_content, out: {formatted_content: :formatted_body_content}

            before :result do
              @progressbar = ::ProgressBar.create(title: "Formatting", total: steps.count)
            end

            after :step do |step_result|
              @progressbar.increment
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
convenient_service-0.17.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.16.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.15.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.14.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.13.0 lib/convenient_service/examples/dry/gemfile/services/format.rb