Sha256: 11c8426d9b0ee6e4f2525b8080e56f0c1a5118bde49d1dcbb410e10a832b580b

Contents?: true

Size: 728 Bytes

Versions: 52

Compression:

Stored size: 728 Bytes

Contents

module SOULs
  class DB < Thor
    desc "model_rbs [CLASS_NAME]", "Generate GraphQL Model RBS from schema.rb"
    def model_rbs(class_name)
      file_path = ""
      Dir.chdir(SOULs.get_mother_path.to_s) do
        file_dir = "./sig/api/app/models/"
        FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
        singularized_class_name = class_name.underscore.singularize
        file_path = "#{file_dir}#{singularized_class_name}.rbs"
        File.open(file_path, "w") do |f|
          f.write(<<~TEXT)
            class #{singularized_class_name.camelize} < ActiveRecord::Base
            end
          TEXT
        end
        SOULs::Painter.create_file(file_path.to_s)
      end
      file_path
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

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