Showing posts with label yeoman. Show all posts
Showing posts with label yeoman. Show all posts

Thursday, June 26, 2014

Dancer2 and Yeoman integrating nicely

Dancer2 and Angular changes to
bin/app.pl

Generate the backend components...

  651  dancer2 gen -a CMA 
  652  cd CMA
  652  yo angular cma
Rearranging the public / dancer web directories.

  709  vi bin/app.psgi
    insert
BEGIN {
  $ENV{'DBIC_TRACE'}    = 1;
  $ENV{'RELATIVE'} = 1;
}
  710  cd app
  711  ln -s ../bower_components .
  712  cd ../lib && vi CMA.pm
    edit
use Cwd;
set auto_page => 1;
# set the new views directory to absolute path
set views => getcwd . "/app";


get '/' => sub {
 template 'index';
};

# catch anything that cannot be served html extension 
# with template, else just serve the files requested based on the absolute
# path of the files
any qr{.*} => sub {
  my $name = request->path;
  print "request for end of chain: $name\n";
  #print Dumper( config->{appdir} );
  if ( $name !~ /\.html$/ ) {
    send_file( config->{appdir} . "/app/$name", system_path => 1 );
  }
  else {
    template $name;
  }
};

  
  712  cd ..
  719  plackup -r bin/app.psgi 
After this you could remove the public and views directory since they have no purpose. The 'app' directory generated by Yeoman contains all the application files.

Monday, May 26, 2014

Dancer & Yeoman scaffolding... what needs changed

So here a quick one for integrating dancer and yeoman angular generation.
$ dancer -a myapp
$ cd myapp
$ yo angular myapp
$ rm public
# This is the main configuration file of your Dancer app
# env-related settings should go to environments/$env.yml
# all the settings in this file will be loaded at Dancer's startup.

# Your application's name
appname: "myapp"

# The default layout to use for your application (located in
# views/layouts/main.tt)
layout: "main"

# when the charset is set to UTF-8 Dancer will handle for you
# all the magic of encoding and decoding. You should not care
# about unicode within your app when this setting is set (recommended).
charset: "UTF-8"

# template engine
# simple: default and very basic template engine
# template_toolkit: 
serializer: JSON

template: "template_toolkit"
engines:
  JSON:
    allow_blessed:   '1'
    canonical:       '1'
    convert_blessed: '1' 
  template_toolkit:
    encoding:  'utf8'
    start_tag: '[%'
    end_tag:   '%]'
    WRAPPER: layouts/main.tt
    EVAL_PERL: '1'
 
public: app
auto_reload : true

# For session support enable the following line and see Dancer::Session
# session: "YAML"
plugins:
  DBIC:
    default:
      schema_class: Schema::PMI
      dsn: 'dbi:Oracle:sid=DDB00334;host=ddb00334.com;port=1526'
      user: 'XXXX'
      password: 'xxxx'
      on_connect_call: 'datetime_setup'