Sha256: 2c437365cf4d04eb6b7540a01e85f76cba2ce0e2d7e0ebeb353bcc64451744e9

Contents?: true

Size: 851 Bytes

Versions: 4

Compression:

Stored size: 851 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.exists?(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

4 entries across 4 versions & 1 rubygems

Version Path
ree-1.0.9 lib/ree/cli/delete_object_schema.rb
ree-1.0.8 lib/ree/cli/delete_object_schema.rb
ree-1.0.7 lib/ree/cli/delete_object_schema.rb
ree-1.0.6 lib/ree/cli/delete_object_schema.rb