Class: Hanami::Annotate::CLI::Generate

Inherits:
CLI::Command
  • Object
show all
Defined in:
lib/hanami/annotate/cli/generate.rb

Overview

TODO:

add support for mysql and sqlite3 etc..

Generate annotation for Hanami entities and repositories

usage:

$ bundle exec hanami annotate

Instance Method Summary collapse

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/hanami/annotate/cli/generate.rb', line 14

def call(*)
  postgres
  @tables.each do |table|
    table_info = \
      `ruby -e "print %q{\\d #{table}}" | bundle exec hanami db console`

    comment = commentize(table_info)

    files = entity_and_repository_path(table)
    remove_head_comments(files)
    adds_comments(files, comment)
  end
end