Sha256: 814c317bb9f4da7a1e4086de09302d07afe6cc49bce3b90766a4fec968a7b05f

Contents?: true

Size: 850 Bytes

Versions: 12

Compression:

Stored size: 850 Bytes

Contents

require 'fileutils'

module Ree
  module CLI
    class DeleteObjectSchema
      class << self
        def run(object_path:, project_path:, silence: false)
          ENV['REE_SKIP_ENV_VARS_CHECK'] = 'true'

          path = Ree.locate_packages_schema(project_path)
          dir = Pathname.new(path).dirname.to_s

          Ree.init(dir)

          object_name = object_path.split('/')[-1].split('.').first.to_sym

          puts("Deleting old #{object_name}.schema.json") if !silence

          schema_path = Ree::PathHelper.object_schema_rpath(object_path)
          abs_schema_path = File.join(dir, schema_path)

          if File.exist?(abs_schema_path)
            FileUtils.rm(abs_schema_path)

            puts(" #{schema_path}: is deleted") if !silence
          end

          puts("done") if !silence
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ree-1.0.21 lib/ree/cli/delete_object_schema.rb
ree-1.0.20 lib/ree/cli/delete_object_schema.rb
ree-1.0.19 lib/ree/cli/delete_object_schema.rb
ree-1.0.18 lib/ree/cli/delete_object_schema.rb
ree-1.0.17 lib/ree/cli/delete_object_schema.rb
ree-1.0.16 lib/ree/cli/delete_object_schema.rb
ree-1.0.15 lib/ree/cli/delete_object_schema.rb
ree-1.0.14 lib/ree/cli/delete_object_schema.rb
ree-1.0.13 lib/ree/cli/delete_object_schema.rb
ree-1.0.12 lib/ree/cli/delete_object_schema.rb
ree-1.0.11 lib/ree/cli/delete_object_schema.rb
ree-1.0.10 lib/ree/cli/delete_object_schema.rb