line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package UR::Namespace::Command::Old::ExportDbicClasses; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
23
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
5
|
1
|
|
|
1
|
|
3
|
use UR; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.46"; # UR $VERSION; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
UR::Object::Type->define( |
9
|
|
|
|
|
|
|
class_name => __PACKAGE__, |
10
|
|
|
|
|
|
|
is => 'UR::Namespace::Command::RunsOnModulesInTree', |
11
|
|
|
|
|
|
|
has => [ |
12
|
|
|
|
|
|
|
bare_args => { |
13
|
|
|
|
|
|
|
is_optional => 1, |
14
|
|
|
|
|
|
|
is_many => 1, |
15
|
|
|
|
|
|
|
shell_args_position => 1 |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
] |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub help_brief { |
21
|
0
|
|
|
0
|
0
|
|
"Create or update a DBIx::Class class from an already existing UR class"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub help_detail { |
25
|
0
|
|
|
0
|
0
|
|
return <
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Given one or more UR class names on the command line, this will create |
28
|
|
|
|
|
|
|
or update a DBIx::Class class. The files will appear under the DBIx directory |
29
|
|
|
|
|
|
|
in the namespace. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
EOS |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub x_execute { |
37
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
38
|
0
|
|
|
|
|
|
my $params = shift; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
#$DB::single = 1; |
41
|
0
|
0
|
|
|
|
|
unless ($self->bare_args) { |
42
|
0
|
|
|
|
|
|
$self->error_message("No class names were specified on the command line"); |
43
|
0
|
|
|
|
|
|
$self->status_message($self->help_usage_complete_text,"\n"); |
44
|
0
|
|
|
|
|
|
return; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $namespace = $self->namespace_name; |
48
|
0
|
0
|
|
|
|
|
unless ($namespace) { |
49
|
0
|
|
|
|
|
|
$self->error_message("This command must be run from a namespace directory."); |
50
|
0
|
|
|
|
|
|
return; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
eval "use $namespace"; |
54
|
0
|
0
|
|
|
|
|
if ($@) { |
55
|
0
|
|
|
|
|
|
$self->error_message("Failed to load namespace $namespace"); |
56
|
0
|
|
|
|
|
|
return; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
foreach my $class_name ( $self->bare_args ) { |
60
|
0
|
|
|
|
|
|
my $class = UR::Object::Type->get(class_name => $class_name); |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
unless ($class) { |
63
|
0
|
|
|
|
|
|
$self->error_message("Couldn't load class metadata for $class_name"); |
64
|
0
|
|
|
|
|
|
next; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$class->dbic_rewrite_module_header(); |
68
|
|
|
|
|
|
|
} |
69
|
0
|
|
|
|
|
|
return 1; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub for_each_class_object { |
74
|
0
|
|
|
0
|
0
|
|
my($self,$class) = @_; |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
return 1 unless ($class->table_name); # Skip classes without tables |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
$class->dbic_rewrite_module_header(); |
79
|
0
|
|
|
|
|
|
return 1; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|