Sha256: 99b0112d70907e261eea1bd852097b8564e7bfdd2cb5b6c1e2164cc989fdb6bb

Contents?: true

Size: 901 Bytes

Versions: 52

Compression:

Stored size: 901 Bytes

Contents

module SOULs
  class Delete < Thor
    desc "migration [migration_NAME]", "Delete Migration files Template"
    def migration(class_name)
      singularized_class_name = class_name.underscore.singularize
      pluralized_class_name = class_name.underscore.pluralize
      Dir.chdir(SOULs.get_mother_path.to_s) do
        file_paths = {
          model_file_path: "./apps/api/app/models/#{singularized_class_name}.rb",
          rspec_file_path: "./apps/api/spec/models/#{singularized_class_name}_spec.rb",
          rbs_file_path: "./sig/api/app/models/#{singularized_class_name}.rbs",
          migration_file_path: Dir["db/migrate/*create_#{pluralized_class_name}.rb"].first
        }
        file_paths.each do |_k, v|
          FileUtils.rm_f(v)
          SOULs::Painter.delete_file(v)
        rescue StandardError => e
          puts(e)
        end
        file_paths
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
souls-2.0.4 lib/souls/cli/delete/migration_file.rb
souls-2.0.3 lib/souls/cli/delete/migration_file.rb
souls-2.0.2 lib/souls/cli/delete/migration_file.rb
souls-2.0.1 lib/souls/cli/delete/migration_file.rb
souls-2.0.0 lib/souls/cli/delete/migration_file.rb
souls-1.23.0 lib/souls/cli/delete/migration_file.rb
souls-1.22.0 lib/souls/cli/delete/migration_file.rb
souls-1.21.11 lib/souls/cli/delete/migration_file.rb
souls-1.21.10 lib/souls/cli/delete/migration_file.rb
souls-1.21.9 lib/souls/cli/delete/migration_file.rb
souls-1.21.8 lib/souls/cli/delete/migration_file.rb
souls-1.21.7 lib/souls/cli/delete/migration_file.rb
souls-1.21.6 lib/souls/cli/delete/migration_file.rb
souls-1.21.5 lib/souls/cli/delete/migration_file.rb
souls-1.21.4 lib/souls/cli/delete/migration_file.rb
souls-1.21.3 lib/souls/cli/delete/migration_file.rb
souls-1.21.2 lib/souls/cli/delete/migration_file.rb
souls-1.21.1 lib/souls/cli/delete/migration_file.rb
souls-1.21.0 lib/souls/cli/delete/migration_file.rb
souls-1.20.13 lib/souls/cli/delete/migration_file.rb