AquariumHive

 view release on metacpan or  search on metacpan

lib/App/AquariumHive.pm  view on Meta::CPAN

package App::AquariumHive;
BEGIN {
  $App::AquariumHive::AUTHORITY = 'cpan:GETTY';
}
# ABSTRACT: Temporary Daemon - will later be replaced by HiveHub
$App::AquariumHive::VERSION = '0.003';
our $VERSION ||= '0.000';

use MooX qw(
  Options
);

use Path::Tiny;
use PocketIO;
use Plack::Builder;
use Twiggy::Server;
use AnyEvent;
use AnyEvent::SerialPort;
use AnyEvent::HTTP;
use File::ShareDir::ProjectDistDir;
use File::HomeDir;
use JSON::MaybeXS;
use DateTime;
use Config::INI::Reader;
use Config::INI::Writer;
use Carp qw( croak );
use DDP;
use Module::Runtime qw( use_module );
use Module::Pluggable
  sub_name => 'plugin_classes',
  search_path => ['App::AquariumHive::Plugin'],
  max_depth => 4,
  require => 1;

use HiveJSO;
use AnyEvent::HiveJSO;
use AquariumHive::Simulator;
use App::AquariumHive::DB;

use Log::Any::Adapter ('Stdout');

with 'App::AquariumHive::LogRole';

sub BUILD {
  my ( $self ) = @_;
  path($self->cfg)->mkpath unless -d $self->cfg;
}

option 'cfg' => (
  is => 'ro',
  format => 'i',
  default => sub {
    return path(File::HomeDir->my_home,'.aqhive')->absolute->stringify;
  },
  doc => 'directory for config',
);

option 'port' => (
  is => 'ro',
  format => 'i',
  default => '8888',
  doc => 'port for the webserver',
);

option 'simulation' => (
  is => 'ro',
  default => 0,
  doc => 'Simulate Aquarium Hive hardware',
);

option 'name' => (
  is => 'ro',
  format => 's',
  default => 'AQHIVE',
  doc => 'Name on top of interface',
);

option 'sensor_rows' => (
  is => 'ro',
  format => 's',
  default => 2,
  doc => 'Number of sensor rows in use',
);



( run in 1.317 second using v1.01-cache-2.11-cpan-5a3173703d6 )