Sha256: d1e7d7508987a44cb4768d098f53846f54f6508dc4e9960652360cb275e750f9

Contents?: true

Size: 1.21 KB

Versions: 15

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
      module 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

15 entries across 15 versions & 1 rubygems

Version Path
convenient_service-0.12.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.11.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.10.1 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.10.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.9.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.8.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.7.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.6.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.5.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.4.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.3.1 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.3.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.2.1 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.2.0 lib/convenient_service/examples/dry/gemfile/services/format.rb
convenient_service-0.1.0 lib/convenient_service/examples/dry/gemfile/services/format.rb