Sha256: a48235318aef2f9e03f67181e280b1c52899c48bb26d6a6927cc1f19fefa8080

Contents?: true

Size: 1.59 KB

Versions: 31

Compression:

Stored size: 1.59 KB

Contents

module Steep
  module Drivers
    class Init
      attr_reader :stdout
      attr_reader :stderr
      attr_accessor :force_write

      include Utils::DriverHelper

      TEMPLATE = <<~EOF
      # D = Steep::Diagnostic
      #
      # target :lib do
      #   signature "sig"
      #
      #   check "lib"                       # Directory name
      #   check "Gemfile"                   # File name
      #   check "app/models/**/*.rb"        # Glob
      #   # ignore "lib/templates/*.rb"
      #
      #   # library "pathname", "set"       # Standard libraries
      #   # library "strong_json"           # Gems
      #   
      #   # configure_code_diagnostics(D::Ruby.strict)       # `strict` diagnostics setting
      #   # configure_code_diagnostics(D::Ruby.lenient)      # `lenient` diagnostics setting
      #   # configure_code_diagnostics do |hash|             # You can setup everything yourself
      #   #   hash[D::Ruby::NoMethod] = :information
      #   # end
      # end

      # target :test do
      #   signature "sig", "sig-private"
      #
      #   check "test"
      #
      #   # library "pathname", "set"       # Standard libraries
      # end
      EOF

      def initialize(stdout:, stderr:)
        @stdout = stdout
        @stderr = stderr
        @force_write = false
      end

      def run
        path = steepfile || Pathname("Steepfile")

        if path.file? && !force_write
          stdout.puts "#{path} already exists, --force to overwrite"
          return 1
        end

        stdout.puts "Writing #{path}..."
        path.write(TEMPLATE)

        0
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
steep-0.52.2 lib/steep/drivers/init.rb
steep-0.52.1 lib/steep/drivers/init.rb
steep-0.52.0 lib/steep/drivers/init.rb
steep-0.51.0 lib/steep/drivers/init.rb
steep-0.50.0 lib/steep/drivers/init.rb
steep-0.49.1 lib/steep/drivers/init.rb
steep-0.49.0 lib/steep/drivers/init.rb
steep-0.48.0 lib/steep/drivers/init.rb
steep-0.47.1 lib/steep/drivers/init.rb
steep-0.47.0 lib/steep/drivers/init.rb
steep-0.46.0 lib/steep/drivers/init.rb