File tree Expand file tree Collapse file tree 37 files changed +396
-0
lines changed Expand file tree Collapse file tree 37 files changed +396
-0
lines changed Original file line number Diff line number Diff line change
1
+ .idea /
Original file line number Diff line number Diff line change
1
+ # Files and directories created by pub
2
+ .dart_tool /
3
+ .packages
4
+ # Remove the following pattern if you wish to check in your lock file
5
+ pubspec.lock
6
+
7
+ # Conventional directory for build outputs
8
+ build /
9
+
10
+ # Directory created by dartdoc
11
+ doc /api /
Original file line number Diff line number Diff line change
1
+ ## 1.0.0
2
+
3
+ - Initial version, created by Stagehand
Original file line number Diff line number Diff line change
1
+ A library for Dart developers.
2
+
3
+ Created from templates made available by Stagehand under a BSD-style
4
+ [ license] ( https://github.com/dart-lang/stagehand/blob/master/LICENSE ) .
5
+
6
+ ## Usage
7
+
8
+ A simple usage example:
9
+
10
+ ``` dart
11
+ import 'package:demo/demo.dart';
12
+
13
+ main() {
14
+ var awesome = new Awesome();
15
+ }
16
+ ```
17
+
18
+ ## Features and bugs
19
+
20
+ Please file feature requests and bugs at the [ issue tracker] [ tracker ] .
21
+
22
+ [ tracker ] : http://example.com/issues/replaceme
Original file line number Diff line number Diff line change
1
+ analyzer :
2
+ # exclude:
3
+ # - path/to/excluded/files/**
4
+
5
+ # Lint rules and documentation, see http://dart-lang.github.io/linter/lints
6
+ linter :
7
+ rules :
8
+ - cancel_subscriptions
9
+ - hash_and_equals
10
+ - iterable_contains_unrelated_type
11
+ - list_remove_unrelated_type
12
+ - test_types_in_equals
13
+ - unrelated_type_equality_checks
14
+ - valid_regexps
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <module type =" WEB_MODULE" version =" 4" >
3
+ <component name =" NewModuleRootManager" inherit-compiler-output =" true" >
4
+ <exclude-output />
5
+ <content url =" file://$MODULE_DIR$" >
6
+ <excludeFolder url =" file://$MODULE_DIR$/.dart_tool" />
7
+ <excludeFolder url =" file://$MODULE_DIR$/.pub" />
8
+ <excludeFolder url =" file://$MODULE_DIR$/build" />
9
+ </content >
10
+ <orderEntry type =" sourceFolder" forTests =" false" />
11
+ <orderEntry type =" library" name =" Dart SDK" level =" project" />
12
+ </component >
13
+ </module >
Original file line number Diff line number Diff line change
1
+ library demo;
Original file line number Diff line number Diff line change
1
+ import 'package:rua/rua.dart' ;
2
+ import 'package:demo/src/rua/ioc.dart' ;
3
+
4
+ class $_A extends A {}
5
+
6
+ class $_B extends B {}
7
+
8
+ class $_C extends C {}
9
+
10
+ class $_Ioc extends Ioc {}
Original file line number Diff line number Diff line change
1
+ import "package:rua/rua.dart" ;
2
+
3
+ @component
4
+ class A {}
5
+
6
+ @service
7
+ class B {}
8
+
9
+ @factory
10
+ class C {}
11
+
12
+ @component
13
+ class Ioc {
14
+ @autowired
15
+ A a;
16
+
17
+ @autowired
18
+ B b;
19
+
20
+ @autowired
21
+ C c;
22
+ }
Original file line number Diff line number Diff line change
1
+ name : demo
2
+ description : A starting point for Dart libraries or applications.
3
+ # version: 1.0.0
4
+ # homepage: https://www.example.com
5
+ # author: shallow <email@example.com>
6
+
7
+ environment :
8
+ sdk : ' >=2.0.0 <3.0.0'
9
+
10
+ dependencies :
11
+ rua :
12
+ path : ../rua
13
+ # path: ^1.4.1
14
+
15
+ dev_dependencies :
16
+ test : ^1.0.0
17
+ build_runner : any
18
+ rua_generator :
19
+ path : ../rua_generator
Original file line number Diff line number Diff line change
1
+ # Files and directories created by pub
2
+ .dart_tool /
3
+ .packages
4
+ # Remove the following pattern if you wish to check in your lock file
5
+ pubspec.lock
6
+
7
+ # Conventional directory for build outputs
8
+ build /
9
+
10
+ # Directory created by dartdoc
11
+ doc /api /
Original file line number Diff line number Diff line change
1
+ ## 1.0.0
2
+
3
+ - Initial version, created by Stagehand
Original file line number Diff line number Diff line change
1
+ # Rua Framework
2
+
3
+ Coming Soon
Original file line number Diff line number Diff line change
1
+ analyzer :
2
+ # exclude:
3
+ # - path/to/excluded/files/**
4
+
5
+ # Lint rules and documentation, see http://dart-lang.github.io/linter/lints
6
+ linter :
7
+ rules :
8
+ - cancel_subscriptions
9
+ - hash_and_equals
10
+ - iterable_contains_unrelated_type
11
+ - list_remove_unrelated_type
12
+ - test_types_in_equals
13
+ - unrelated_type_equality_checks
14
+ - valid_regexps
Original file line number Diff line number Diff line change
1
+ library rua;
2
+
3
+ /// shared
4
+ export "src/shared/annotation/rua_annotation.dart" ;
5
+
6
+ /// runtime
7
+ export "src/ioc/runtime/bean_container.dart" ;
8
+
9
+ /// annotation
10
+ export "src/ioc/annotation/autowired.dart" ;
11
+ export "src/ioc/annotation/component.dart" ;
12
+ export "src/ioc/annotation/service.dart" ;
13
+ export "src/ioc/annotation/factory.dart" ;
Original file line number Diff line number Diff line change
1
+ //class RuaApplication extends RuaAnnotation {
2
+ // final String configurationFile;
3
+ //
4
+ // const RuaApplication({
5
+ // this.configurationFile = '',
6
+ // });
7
+ //}
Original file line number Diff line number Diff line change
1
+ import 'package:rua/src/shared/annotation/rua_annotation.dart' ;
2
+
3
+ class Config extends RuaAnnotation {
4
+ const Config ();
5
+ }
6
+
7
+ const config = const Config ();
Original file line number Diff line number Diff line change
1
+ class Autowired {
2
+ const Autowired ();
3
+ }
4
+
5
+ const autowired = const Autowired ();
Original file line number Diff line number Diff line change
1
+ import 'package:rua/src/shared/annotation/rua_annotation.dart' ;
2
+
3
+ class Component extends RuaAnnotation {
4
+ const Component ();
5
+ }
6
+
7
+ const Component component = const Component ();
Original file line number Diff line number Diff line change
1
+ import 'package:rua/src/shared/annotation/rua_annotation.dart' ;
2
+
3
+ class Factory extends RuaAnnotation {
4
+ const Factory ();
5
+ }
6
+
7
+ const Factory factory = const Factory ();
Original file line number Diff line number Diff line change
1
+ import 'package:rua/src/shared/annotation/rua_annotation.dart' ;
2
+
3
+ class Service extends RuaAnnotation {
4
+ const Service ();
5
+ }
6
+
7
+ const service = Service ();
Original file line number Diff line number Diff line change
1
+ import 'package:get_it/get_it.dart' ;
2
+
3
+ typedef FactoryFunc <T > = T Function ();
4
+
5
+ /// Dependency injection container
6
+ ///
7
+ /// All the injection will be register in the container
8
+ class BeanContainer {
9
+ /// using GetIt as di
10
+ GetIt _getIt = GetIt ()..allowReassignment = true ;
11
+
12
+ void registerFactory <T >(FactoryFunc <T > func) {
13
+ _getIt.registerFactory <T >(func);
14
+ }
15
+
16
+ void registerSingleton <T >(T instance) {
17
+ _getIt.registerSingleton <T >(instance);
18
+ }
19
+
20
+ void registerLazySingleton <T >(FactoryFunc <T > func) {
21
+ _getIt.registerLazySingleton <T >(func);
22
+ }
23
+
24
+ T get <T >() {
25
+ return _getIt.get <T >();
26
+ }
27
+
28
+ void reset () {
29
+ _getIt.reset ();
30
+ }
31
+ }
32
+
33
+ BeanContainer container = new BeanContainer ();
Original file line number Diff line number Diff line change
1
+ class RuaAnnotation {
2
+ final bool shouldGenerateDock;
3
+
4
+ const RuaAnnotation ({
5
+ this .shouldGenerateDock = true ,
6
+ });
7
+ }
Original file line number Diff line number Diff line change
1
+ name : rua
2
+ description : A starting point for Dart libraries or applications.
3
+ # version: 1.0.0
4
+ # homepage: https://www.example.com
5
+ # author: shallow <email@example.com>
6
+
7
+ environment :
8
+ sdk : ' >=2.0.0 <3.0.0'
9
+
10
+ dependencies :
11
+ reflectable : ^2.0.7
12
+ build_runner : any
13
+ get_it : any
14
+
15
+ dev_dependencies :
16
+ test : ^1.0.0
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <module type =" WEB_MODULE" version =" 4" >
3
+ <component name =" NewModuleRootManager" inherit-compiler-output =" true" >
4
+ <exclude-output />
5
+ <content url =" file://$MODULE_DIR$" >
6
+ <excludeFolder url =" file://$MODULE_DIR$/.dart_tool" />
7
+ <excludeFolder url =" file://$MODULE_DIR$/.pub" />
8
+ <excludeFolder url =" file://$MODULE_DIR$/build" />
9
+ </content >
10
+ <orderEntry type =" sourceFolder" forTests =" false" />
11
+ <orderEntry type =" library" name =" Dart SDK" level =" project" />
12
+ <orderEntry type =" library" name =" Dart Packages" level =" project" />
13
+ </component >
14
+ </module >
Original file line number Diff line number Diff line change
1
+ # Files and directories created by pub
2
+ .dart_tool /
3
+ .packages
4
+ # Remove the following pattern if you wish to check in your lock file
5
+ pubspec.lock
6
+
7
+ # Conventional directory for build outputs
8
+ build /
9
+
10
+ # Directory created by dartdoc
11
+ doc /api /
Original file line number Diff line number Diff line change
1
+ ## 1.0.0
2
+
3
+ - Initial version, created by Stagehand
Original file line number Diff line number Diff line change
1
+ A library for Dart developers.
2
+
3
+ Created from templates made available by Stagehand under a BSD-style
4
+ [ license] ( https://github.com/dart-lang/stagehand/blob/master/LICENSE ) .
5
+
6
+ ## Usage
7
+
8
+ A simple usage example:
9
+
10
+ ``` dart
11
+ import 'package:rua_generator/rua_generator.dart';
12
+
13
+ main() {
14
+ var awesome = new Awesome();
15
+ }
16
+ ```
17
+
18
+ ## Features and bugs
19
+
20
+ Please file feature requests and bugs at the [ issue tracker] [ tracker ] .
21
+
22
+ [ tracker ] : http://example.com/issues/replaceme
Original file line number Diff line number Diff line change
1
+ analyzer :
2
+ # exclude:
3
+ # - path/to/excluded/files/**
4
+
5
+ # Lint rules and documentation, see http://dart-lang.github.io/linter/lints
6
+ linter :
7
+ rules :
8
+ - cancel_subscriptions
9
+ - hash_and_equals
10
+ - iterable_contains_unrelated_type
11
+ - list_remove_unrelated_type
12
+ - test_types_in_equals
13
+ - unrelated_type_equality_checks
14
+ - valid_regexps
Original file line number Diff line number Diff line change
1
+ # Read about `build.yaml` at https://pub.dartlang.org/packages/build_config
2
+ targets :
3
+ $default :
4
+ builders :
5
+ rua_generator|pre_builder :
6
+ enabled : true
7
+ generate_for :
8
+ exclude : ['**.g.dart', 'lib/generated/**']
9
+ rua_generator|post_builder :
10
+ enabled : true
11
+ generate_for :
12
+ exclude : ['**.g.dart', 'lib/generated/**']
13
+ builders :
14
+ pre_builder :
15
+ import : ' package:rua_generator/src/builder.dart'
16
+ builder_factories : ['preBuilder']
17
+ build_extensions : { '.dart': ['.g.dart'] }
18
+ auto_apply : root_package
19
+ runs_before : ['rua_generator|post_builder']
20
+ build_to : source
21
+ post_builder :
22
+ import : ' package:rua_generator/src/builder.dart'
23
+ builder_factories : ['postBuilder']
24
+ build_extensions : { '.dart': ['.g.part'] }
25
+ auto_apply : dependents
26
+ build_to : cache
Original file line number Diff line number Diff line change
1
+ import 'package:build/build.dart' ;
2
+ import 'package:rua_generator/src/build/shared/generator/shared_post_builder.dart' ;
3
+ import 'package:rua_generator/src/build/shared/generator/shared_pre_builder.dart' ;
4
+ import 'package:source_gen/source_gen.dart' ;
5
+
6
+ Builder preBuilder (BuilderOptions options) => SharedPartBuilder (
7
+ [
8
+ SharedPreBuilder (),
9
+ ],
10
+ 'rua_pre_builder' ,
11
+ );
12
+
13
+ Builder postBuilder (BuilderOptions options) => LibraryBuilder (
14
+ SharedPostBuilder (),
15
+ generatedExtension: '.rua_share.dart' ,
16
+ );
You can’t perform that action at this time.
0 commit comments