File Coverage

lib/UR/Namespace/Command/Show/Properties.pm
Criterion Covered Total %
statement 15 19 78.9
branch 1 2 50.0
condition n/a
subroutine 4 6 66.6
pod 0 3 0.0
total 20 30 66.6


line stmt bran cond sub pod time code
1             package UR::Namespace::Command::Show::Properties;
2 2     2   35 use strict;
  2         3  
  2         55  
3 2     2   7 use warnings;
  2         2  
  2         47  
4 2     2   7 use UR;
  2         5  
  2         13  
5             our $VERSION = "0.46"; # UR $VERSION;
6              
7             UR::Object::Type->define(
8             class_name => __PACKAGE__,
9             is => 'UR::Namespace::Command::RunsOnModulesInTree',
10             has => [
11             classes_or_modules => {
12             is_optional => 0,
13             is_many => 1,
14             shell_args_position => 99,
15             doc => 'classes to describe by class name or module path',
16             },
17             ],
18             doc => 'show class properties, relationships, meta-data',
19             );
20              
21 0     0 0 0 sub sub_command_sort_position { 3 }
22              
23             sub help_synopsis {
24             return <
25             ur show properties UR::Object
26              
27             ur show properties Acme::Order Acme::Product Acme::Order::LineItem
28              
29             EOS
30 0     0 0 0 }
31              
32             sub for_each_class_object {
33 1     1 0 2 my $self = shift;
34 1         2 my $class_meta = shift;
35              
36 1         42 my $view = UR::Object::Type->create_view(
37             perspective => 'default',
38             toolkit => 'text',
39             aspects => [
40             'namespace', 'table_name', 'data_source_id', 'is_abstract', 'is_final',
41             'is_singleton', 'is_transactional', 'schema_name', 'meta_class_name',
42             {
43             label => 'Inherits from',
44             name => 'ancestry_class_names',
45             },
46            
47             {
48             label => 'Properties',
49             name => 'properties',
50             subject_class_name => 'UR::Object::Property',
51             perspective => 'description line item',
52             toolkit => 'text',
53             aspects => ['is_id', 'property_name', 'column_name', 'data_type', 'is_optional' ],
54             },
55             {
56             label => "References",
57             name => 'all_id_by_property_metas',
58             subject_class_name => 'UR::Object::Property',
59             perspective => 'reference description',
60             toolkit => 'text',
61             aspects => [],
62             },
63             {
64             label => "Referents",
65             name => 'all_reverse_as_property_metas',
66             subject_class_name => 'UR::Object::Property',
67             perspective => 'reference description',
68             toolkit => 'text',
69             aspects => [],
70             },
71             ],
72             );
73 1 50       14 unless ($view) {
74 0         0 $self->error_message("Can't initialize view");
75 0         0 return;
76             }
77              
78 1         16 $view->subject($class_meta);
79 1         8 $view->show();
80             }
81              
82             1;