Sha256: 7b7ef78da71204a3079665c39d7bc2103eefba4fa692cb4e54b36c06b962477e

Contents?: true

Size: 821 Bytes

Versions: 16

Compression:

Stored size: 821 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",
          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

16 entries across 16 versions & 1 rubygems

Version Path
souls-4.1.2 lib/souls/cli/delete/migration_file.rb
souls-4.1.1 lib/souls/cli/delete/migration_file.rb
souls-4.1.0 lib/souls/cli/delete/migration_file.rb
souls-4.0.3 lib/souls/cli/delete/migration_file.rb
souls-4.0.2 lib/souls/cli/delete/migration_file.rb
souls-4.0.1 lib/souls/cli/delete/migration_file.rb
souls-4.0.0 lib/souls/cli/delete/migration_file.rb
souls-3.0.8 lib/souls/cli/delete/migration_file.rb
souls-3.0.7 lib/souls/cli/delete/migration_file.rb
souls-3.0.6 lib/souls/cli/delete/migration_file.rb
souls-3.0.5 lib/souls/cli/delete/migration_file.rb
souls-3.0.4 lib/souls/cli/delete/migration_file.rb
souls-3.0.3 lib/souls/cli/delete/migration_file.rb
souls-3.0.2 lib/souls/cli/delete/migration_file.rb
souls-3.0.1 lib/souls/cli/delete/migration_file.rb
souls-3.0.0 lib/souls/cli/delete/migration_file.rb