Sha256: 182601e4dfd434e9165777f8416a8ac96b32c905bfba427a8f1683e204bf3bf6

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

##
# Usage example:
#
# result = ConvenientService::Examples::Dry::V1::Gemfile::Services::Format.result(path: "Gemfile")
# result = ConvenientService::Examples::Dry::V1::Gemfile::Services::Format.result(path: "spec/cli/gemfile/format/fixtures/Gemfile")
#
module ConvenientService
  module Examples
    module Dry
      module V1
        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
end

Version data entries

4 entries across 4 versions & 1 rubygems

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