From 4da867e42eca6264ca59a6ac999f49aa684385ba Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 17 May 2017 15:13:58 +0200 Subject: Use JSON models instead of XML JSON is easier to (de)serialize and the manual editing possibilities of XML don't matter after the switch to model file autogeneration using attributes and aspects --- lib/Kratos/DFADriver.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/Kratos/DFADriver.pm') diff --git a/lib/Kratos/DFADriver.pm b/lib/Kratos/DFADriver.pm index 7ceaa4a..c94101a 100644 --- a/lib/Kratos/DFADriver.pm +++ b/lib/Kratos/DFADriver.pm @@ -38,7 +38,7 @@ sub new { $self->{repo} = AspectC::Repo->new; $self->{lp}{iteration} = 1; - if ( -r $opt{xml_file} ) { + if ( -r $opt{model_file} ) { $self->{model} = Kratos::DFADriver::Model->new(%opt); $self->{class_name} = $self->{model}->class_name; } @@ -46,11 +46,11 @@ sub new { $self->{model} = Kratos::DFADriver::Model->new_from_repo( repo => $self->{repo}, class_name => $opt{class_name}, - xml_file => $opt{xml_file}, + model_file => $opt{model_file}, ); } else { - die('Neither driver.xml nor class name specified, cannot continue'); + die('Neither driver.json nor class name specified, cannot continue'); } bless( $self, $class ); @@ -64,10 +64,10 @@ sub new { sub set_paths { my ($self) = @_; - my $xml_path = $self->{xml_file}; - $xml_path =~ s{ /?+dfa-driver/[^/]+[.]xml $ }{}x; + my $model_path = $self->{model_file}; + $model_path =~ s{ /?+dfa-driver/[^/]+[.] ( xml | json ) $ }{}x; - my $prefix = $self->{prefix} = cwd() . "/${xml_path}/src"; + my $prefix = $self->{prefix} = cwd() . "/${model_path}/src"; my $class_prefix = $self->repo->get_class_path_prefix( $self->{class_name} ); $self->{ah_file} = "${prefix}/${class_prefix}_dfa.ah"; @@ -1087,7 +1087,7 @@ sub archive_files { my @mim_files = grep { m{ \. mim }x } read_dir('.'); - $tar->add_files( $self->{xml_file}, @eval_files, @mim_files ); + $tar->add_files( $self->{model_file}, @eval_files, @mim_files ); $tar->add_data( 'setup.json', -- cgit v1.2.3