Sha256: ef362cdcf263a61a7b5ceab6f4971518746db12726229262b56d724f22888ac3

Contents?: true

Size: 1.22 KB

Versions: 38

Compression:

Stored size: 1.22 KB

Contents

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

      include Utils::DriverHelper

      TEMPLATE = <<~EOF
      # 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
      # end

      # target :spec do
      #   signature "sig", "sig-private"
      #
      #   check "spec"
      #
      #   # library "pathname", "set"       # Standard libraries
      #   # library "rspec"
      # 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

38 entries across 38 versions & 1 rubygems

Version Path
steep-0.45.0 lib/steep/drivers/init.rb
steep-0.44.1 lib/steep/drivers/init.rb
steep-0.44.0 lib/steep/drivers/init.rb
steep-0.43.1 lib/steep/drivers/init.rb
steep-0.43.0 lib/steep/drivers/init.rb
steep-0.42.0 lib/steep/drivers/init.rb
steep-0.41.0 lib/steep/drivers/init.rb
steep-0.40.0 lib/steep/drivers/init.rb
steep-0.39.0 lib/steep/drivers/init.rb
steep-0.38.0 lib/steep/drivers/init.rb
steep-0.37.0 lib/steep/drivers/init.rb
steep-0.36.0 lib/steep/drivers/init.rb
steep-0.35.0 lib/steep/drivers/init.rb
steep-0.34.0 lib/steep/drivers/init.rb
steep-0.33.0 lib/steep/drivers/init.rb
steep-0.32.0 lib/steep/drivers/init.rb
steep-0.31.1 lib/steep/drivers/init.rb
steep-0.31.0 lib/steep/drivers/init.rb
steep-0.30.0 lib/steep/drivers/init.rb
steep-0.29.0 lib/steep/drivers/init.rb