hecks-domain 0.1.0 → 0.1.2.rc

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +5 -5
  2. data/lib/adapters/adapters.rb +2 -0
  3. data/lib/adapters/resource_server/cli/cli.rb +1 -0
  4. data/lib/adapters/resource_server/cli/generate_resource_server.rb +25 -0
  5. data/lib/adapters/resource_server/cli/templates/resource_server/config.ru.tt +8 -0
  6. data/lib/adapters/resource_server/resource_server.rb +3 -0
  7. data/lib/adapters/sql_database/cli/cli.rb +3 -0
  8. data/lib/adapters/sql_database/cli/generate_domain_migrations.rb +33 -0
  9. data/lib/adapters/sql_database/cli/generate_sql_database.rb +35 -0
  10. data/lib/adapters/sql_database/cli/migration_builder.rb +51 -0
  11. data/lib/adapters/sql_database/cli/templates/migration.rb.tt +14 -0
  12. data/lib/adapters/sql_database/cli/templates/repository.rb.tt +24 -0
  13. data/lib/adapters/sql_database/cli/templates/sql_database/Rakefile +15 -0
  14. data/lib/adapters/sql_database/commands/read/fetch_references.rb +58 -0
  15. data/lib/adapters/sql_database/commands/update/delete_references.rb +45 -0
  16. data/lib/adapters/sql_database/commands/update/link_to_references.rb +45 -0
  17. data/lib/adapters/sql_database/sql_database.rb +1 -0
  18. data/lib/cli/builder/aggregate_command_line_builder.rb +22 -0
  19. data/lib/cli/builder/builder.rb +3 -0
  20. data/lib/cli/builder/reference_command_line_builder.rb +23 -0
  21. data/lib/cli/builder/value_object_command_line_builder.rb +23 -0
  22. data/lib/cli/cli.rb +8 -0
  23. data/lib/cli/command_builder.rb +60 -0
  24. data/lib/cli/domain_object/assignment_template.rb +43 -0
  25. data/lib/cli/domain_object/option_formatter.rb +36 -0
  26. data/lib/cli/generate_domain_object.rb +71 -0
  27. data/lib/cli/new.rb +50 -0
  28. data/lib/cli/templates/aggregate/lib/domain/%name%/%head_name%.rb.tt +16 -0
  29. data/lib/cli/templates/aggregate/lib/domain/%name%/%name%.rb.tt +9 -0
  30. data/lib/cli/templates/aggregate/lib/domain/%name%/repository.rb.tt +41 -0
  31. data/lib/cli/templates/domain/%name%.gemspec.tt +12 -0
  32. data/lib/cli/templates/domain/Version +1 -0
  33. data/lib/cli/templates/domain/lib/%name%.rb.tt +21 -0
  34. data/lib/cli/templates/domain/spec/spec_helper.rb.tt +4 -0
  35. data/lib/cli/templates/reference/lib/domain/%module_name%/%file_name%.rb.tt +25 -0
  36. data/lib/cli/templates/value_object/lib/domain/%module_name%/%name%.rb.tt +24 -0
  37. data/lib/domain_builder/attribute.rb +60 -0
  38. data/lib/domain_builder/domain.rb +19 -0
  39. data/lib/domain_builder/domain_builder.rb +37 -0
  40. data/lib/domain_builder/domain_module.rb +28 -0
  41. data/lib/domain_builder/domain_object.rb +43 -0
  42. data/lib/domain_builder/head.rb +8 -0
  43. data/lib/domain_builder/reference.rb +19 -0
  44. data/lib/domain_builder/value.rb +8 -0
  45. data/lib/hecks-domain.rb +6 -0
  46. metadata +58 -101
  47. data/lib/hecks/domain/commands/generate.rb +0 -98
  48. data/lib/hecks/domain/commands.rb +0 -1
  49. data/lib/hecks/domain/generators/domain.rb +0 -21
  50. data/lib/hecks/domain/generators/domain_files.rb +0 -28
  51. data/lib/hecks/domain/generators/entity.rb +0 -30
  52. data/lib/hecks/domain/generators/operation.rb +0 -32
  53. data/lib/hecks/domain/generators/root.rb +0 -30
  54. data/lib/hecks/domain/generators/spec.rb +0 -30
  55. data/lib/hecks/domain/generators/value_object.rb +0 -30
  56. data/lib/hecks/domain/generators.rb +0 -7
  57. data/lib/hecks/domain/parser/aggregate.rb +0 -44
  58. data/lib/hecks/domain/parser/domain_object.rb +0 -123
  59. data/lib/hecks/domain/parser/entity_field.rb +0 -55
  60. data/lib/hecks/domain/parser/fields.rb +0 -16
  61. data/lib/hecks/domain/parser/list_field.rb +0 -13
  62. data/lib/hecks/domain/parser/operation.rb +0 -15
  63. data/lib/hecks/domain/parser/reference_field.rb +0 -12
  64. data/lib/hecks/domain/parser/spec_helper.rb +0 -0
  65. data/lib/hecks/domain/parser/value_field.rb +0 -48
  66. data/lib/hecks/domain/parser.rb +0 -95
  67. data/lib/hecks/domain/support/string.rb +0 -9
  68. data/lib/hecks/domain/support.rb +0 -1
  69. data/lib/hecks/domain/templates/%domain_name%.gemspec.tt +0 -12
  70. data/lib/hecks/domain/templates/%folder_name%/Domainfile.tt +0 -9
  71. data/lib/hecks/domain/templates/%folder_name%/events/command_will_run.rb.tt +0 -11
  72. data/lib/hecks/domain/templates/%folder_name%/spec/spec_helper.rb.tt +0 -1
  73. data/lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/commands.rb.tt +0 -11
  74. data/lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/events.rb.tt +0 -11
  75. data/lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/factories/build.rb.tt +0 -37
  76. data/lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/factories.rb.tt +0 -11
  77. data/lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/invariants.rb.tt +0 -11
  78. data/lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/queries.rb.tt +0 -11
  79. data/lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/repository.rb.tt +0 -68
  80. data/lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/subscribers.rb.tt +0 -11
  81. data/lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%.rb.tt +0 -34
  82. data/lib/hecks/domain/templates/lib/%domain_name%.rb.tt +0 -9
  83. data/lib/hecks/domain/templates/lib/support/commands/command_loader.rb +0 -18
  84. data/lib/hecks/domain/templates/lib/support/commands/command_runner.rb +0 -17
  85. data/lib/hecks/domain/templates/lib/support/commands.rb +0 -2
  86. data/lib/hecks/domain/templates/lib/support/domain_object.rb +0 -25
  87. data/lib/hecks/domain/templates/lib/support/events/domain_event.rb +0 -14
  88. data/lib/hecks/domain/templates/lib/support/events/domain_event_publisher.rb +0 -34
  89. data/lib/hecks/domain/templates/lib/support/events.rb +0 -14
  90. data/lib/hecks/domain/templates/lib/support/factories/factory_loader.rb +0 -21
  91. data/lib/hecks/domain/templates/lib/support/factories.rb +0 -1
  92. data/lib/hecks/domain/templates/lib/support/invariants/invariant_loader.rb +0 -24
  93. data/lib/hecks/domain/templates/lib/support/queries/query_loader.rb +0 -18
  94. data/lib/hecks/domain/templates/lib/support/queries.rb +0 -1
  95. data/lib/hecks/domain/templates/lib/support/repositories/repository_loader.rb +0 -32
  96. data/lib/hecks/domain/templates/lib/support/root.rb +0 -27
  97. data/lib/hecks/domain/templates/lib/support/support/string.rb +0 -9
  98. data/lib/hecks/domain/templates/lib/support.rb +0 -11
  99. data/lib/hecks/domain/templates/operation/%aggregate_name%/%domain_object_name%/commands/%operation_name%.rb.tt +0 -21
  100. data/lib/hecks/domain/templates/root/%aggregate_name%/root.rb.tt +0 -14
  101. data/lib/hecks/domain/templates/spec/%aggregate_name%/%root_name%_spec.rb.tt +0 -12
  102. data/lib/hecks/domain/templates/value_object/%aggregate_name%/%domain_object_name%/factories/build.rb.tt +0 -37
  103. data/lib/hecks/domain/templates/value_object/%aggregate_name%/%domain_object_name%/factories.rb.tt +0 -11
  104. data/lib/hecks/domain/templates/value_object/%aggregate_name%/%domain_object_name%.rb.tt +0 -34
  105. data/lib/hecks/domain/top_level_methods.rb +0 -3
  106. data/lib/hecks/domain.rb +0 -22
metadata CHANGED
@@ -1,124 +1,80 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hecks-domain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2.rc
5
5
  platform: ruby
6
6
  authors:
7
- - Hecks Domain Developer
7
+ - Chris Young
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-23 00:00:00.000000000 Z
11
+ date: 2017-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: colorize
14
+ name: hecks-adapters-sql-database
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.8'
19
+ version: '0.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.8'
27
- - !ruby/object:Gem::Dependency
28
- name: erubis
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.7'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.7'
41
- - !ruby/object:Gem::Dependency
42
- name: thor
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '0.20'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0.20'
55
- description: A Domain Specific Language for generating Domain Driven Designs
56
- email: dev@hecks_domain.com
26
+ version: '0.0'
27
+ description: Make the Domain the center of your programming world
28
+ email: chris@example.com
57
29
  executables: []
58
30
  extensions: []
59
31
  extra_rdoc_files: []
60
32
  files:
61
- - lib/hecks/domain.rb
62
- - lib/hecks/domain/commands.rb
63
- - lib/hecks/domain/commands/generate.rb
64
- - lib/hecks/domain/generators.rb
65
- - lib/hecks/domain/generators/domain.rb
66
- - lib/hecks/domain/generators/domain_files.rb
67
- - lib/hecks/domain/generators/entity.rb
68
- - lib/hecks/domain/generators/operation.rb
69
- - lib/hecks/domain/generators/root.rb
70
- - lib/hecks/domain/generators/spec.rb
71
- - lib/hecks/domain/generators/value_object.rb
72
- - lib/hecks/domain/parser.rb
73
- - lib/hecks/domain/parser/aggregate.rb
74
- - lib/hecks/domain/parser/domain_object.rb
75
- - lib/hecks/domain/parser/entity_field.rb
76
- - lib/hecks/domain/parser/fields.rb
77
- - lib/hecks/domain/parser/list_field.rb
78
- - lib/hecks/domain/parser/operation.rb
79
- - lib/hecks/domain/parser/reference_field.rb
80
- - lib/hecks/domain/parser/spec_helper.rb
81
- - lib/hecks/domain/parser/value_field.rb
82
- - lib/hecks/domain/support.rb
83
- - lib/hecks/domain/support/string.rb
84
- - lib/hecks/domain/templates/%domain_name%.gemspec.tt
85
- - lib/hecks/domain/templates/%folder_name%/Domainfile.tt
86
- - lib/hecks/domain/templates/%folder_name%/events/command_will_run.rb.tt
87
- - lib/hecks/domain/templates/%folder_name%/spec/spec_helper.rb.tt
88
- - lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%.rb.tt
89
- - lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/commands.rb.tt
90
- - lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/events.rb.tt
91
- - lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/factories.rb.tt
92
- - lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/factories/build.rb.tt
93
- - lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/invariants.rb.tt
94
- - lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/queries.rb.tt
95
- - lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/repository.rb.tt
96
- - lib/hecks/domain/templates/entity/%aggregate_name%/%domain_object_name%/subscribers.rb.tt
97
- - lib/hecks/domain/templates/lib/%domain_name%.rb.tt
98
- - lib/hecks/domain/templates/lib/support.rb
99
- - lib/hecks/domain/templates/lib/support/commands.rb
100
- - lib/hecks/domain/templates/lib/support/commands/command_loader.rb
101
- - lib/hecks/domain/templates/lib/support/commands/command_runner.rb
102
- - lib/hecks/domain/templates/lib/support/domain_object.rb
103
- - lib/hecks/domain/templates/lib/support/events.rb
104
- - lib/hecks/domain/templates/lib/support/events/domain_event.rb
105
- - lib/hecks/domain/templates/lib/support/events/domain_event_publisher.rb
106
- - lib/hecks/domain/templates/lib/support/factories.rb
107
- - lib/hecks/domain/templates/lib/support/factories/factory_loader.rb
108
- - lib/hecks/domain/templates/lib/support/invariants/invariant_loader.rb
109
- - lib/hecks/domain/templates/lib/support/queries.rb
110
- - lib/hecks/domain/templates/lib/support/queries/query_loader.rb
111
- - lib/hecks/domain/templates/lib/support/repositories/repository_loader.rb
112
- - lib/hecks/domain/templates/lib/support/root.rb
113
- - lib/hecks/domain/templates/lib/support/support/string.rb
114
- - lib/hecks/domain/templates/operation/%aggregate_name%/%domain_object_name%/commands/%operation_name%.rb.tt
115
- - lib/hecks/domain/templates/root/%aggregate_name%/root.rb.tt
116
- - lib/hecks/domain/templates/spec/%aggregate_name%/%root_name%_spec.rb.tt
117
- - lib/hecks/domain/templates/value_object/%aggregate_name%/%domain_object_name%.rb.tt
118
- - lib/hecks/domain/templates/value_object/%aggregate_name%/%domain_object_name%/factories.rb.tt
119
- - lib/hecks/domain/templates/value_object/%aggregate_name%/%domain_object_name%/factories/build.rb.tt
120
- - lib/hecks/domain/top_level_methods.rb
121
- homepage: http://www.example.com
33
+ - lib/adapters/adapters.rb
34
+ - lib/adapters/resource_server/cli/cli.rb
35
+ - lib/adapters/resource_server/cli/generate_resource_server.rb
36
+ - lib/adapters/resource_server/cli/templates/resource_server/config.ru.tt
37
+ - lib/adapters/resource_server/resource_server.rb
38
+ - lib/adapters/sql_database/cli/cli.rb
39
+ - lib/adapters/sql_database/cli/generate_domain_migrations.rb
40
+ - lib/adapters/sql_database/cli/generate_sql_database.rb
41
+ - lib/adapters/sql_database/cli/migration_builder.rb
42
+ - lib/adapters/sql_database/cli/templates/migration.rb.tt
43
+ - lib/adapters/sql_database/cli/templates/repository.rb.tt
44
+ - lib/adapters/sql_database/cli/templates/sql_database/Rakefile
45
+ - lib/adapters/sql_database/commands/read/fetch_references.rb
46
+ - lib/adapters/sql_database/commands/update/delete_references.rb
47
+ - lib/adapters/sql_database/commands/update/link_to_references.rb
48
+ - lib/adapters/sql_database/sql_database.rb
49
+ - lib/cli/builder/aggregate_command_line_builder.rb
50
+ - lib/cli/builder/builder.rb
51
+ - lib/cli/builder/reference_command_line_builder.rb
52
+ - lib/cli/builder/value_object_command_line_builder.rb
53
+ - lib/cli/cli.rb
54
+ - lib/cli/command_builder.rb
55
+ - lib/cli/domain_object/assignment_template.rb
56
+ - lib/cli/domain_object/option_formatter.rb
57
+ - lib/cli/generate_domain_object.rb
58
+ - lib/cli/new.rb
59
+ - lib/cli/templates/aggregate/lib/domain/%name%/%head_name%.rb.tt
60
+ - lib/cli/templates/aggregate/lib/domain/%name%/%name%.rb.tt
61
+ - lib/cli/templates/aggregate/lib/domain/%name%/repository.rb.tt
62
+ - lib/cli/templates/domain/%name%.gemspec.tt
63
+ - lib/cli/templates/domain/Version
64
+ - lib/cli/templates/domain/lib/%name%.rb.tt
65
+ - lib/cli/templates/domain/spec/spec_helper.rb.tt
66
+ - lib/cli/templates/reference/lib/domain/%module_name%/%file_name%.rb.tt
67
+ - lib/cli/templates/value_object/lib/domain/%module_name%/%name%.rb.tt
68
+ - lib/domain_builder/attribute.rb
69
+ - lib/domain_builder/domain.rb
70
+ - lib/domain_builder/domain_builder.rb
71
+ - lib/domain_builder/domain_module.rb
72
+ - lib/domain_builder/domain_object.rb
73
+ - lib/domain_builder/head.rb
74
+ - lib/domain_builder/reference.rb
75
+ - lib/domain_builder/value.rb
76
+ - lib/hecks-domain.rb
77
+ homepage: https://github.com/chrisyoung/hecks-domain
122
78
  licenses:
123
79
  - MIT
124
80
  metadata: {}
@@ -133,12 +89,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
89
  version: '0'
134
90
  required_rubygems_version: !ruby/object:Gem::Requirement
135
91
  requirements:
136
- - - ">="
92
+ - - ">"
137
93
  - !ruby/object:Gem::Version
138
- version: '0'
94
+ version: 1.3.1
139
95
  requirements: []
140
- rubygems_version: 3.0.3
96
+ rubyforge_project:
97
+ rubygems_version: 2.6.10
141
98
  signing_key:
142
99
  specification_version: 4
143
- summary: 3DSL
100
+ summary: DDD and Hexagonal Code Generators
144
101
  test_files: []
@@ -1,98 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class HecksDomain
4
- module Commands
5
- # Generate a Domainfile
6
- class Generate < Thor
7
- package_name 'Hecks'
8
- include Thor::Actions
9
-
10
- HECKS_FILE_NAME = 'Domainfile'
11
-
12
- def self.source_root
13
- File.dirname(__FILE__) + '/../templates'
14
- end
15
-
16
- desc 'domain', 'Generate domain objects from a Domainfile'
17
- method_option :skip_operations, default: true, type: :boolean
18
- method_option :skip_spec_generation, default: true, type: :boolean
19
- def domain_from_domain_file
20
- generate_domain_objects(domain_get)
21
- generate_domain_files(domain_get)
22
- generate_roots(domain_get)
23
- generate_operations(domain_get, options)
24
- generate_specs(domain_get, options)
25
- end
26
-
27
- private
28
-
29
- def generate_roots(domain)
30
- domain.aggregates.each do |aggregate|
31
- aggregate.domain_objects.each do |domain_object|
32
- next unless domain_object.is_a?(HecksDomain::Parser::Root)
33
-
34
- Generators::Root.new(
35
- [domain, aggregate, domain_object]
36
- ).invoke_all
37
- end
38
- end
39
- end
40
-
41
- def generate_specs(domain, options)
42
- domain.for_each_domain_object do |aggregate, domain_object|
43
- next unless domain_object.is_a?(HecksDomain::Parser::Root)
44
-
45
- Generators::Spec.new(
46
- [domain, aggregate, domain_object], options
47
- ).invoke_all
48
- end
49
- end
50
-
51
- def domain_get
52
- instance_eval(domain_file).domain
53
- end
54
-
55
- def domain_file
56
- return unless File.exist?(HECKS_FILE_NAME)
57
-
58
- File.open(HECKS_FILE_NAME).read
59
- end
60
-
61
- def generate_domain_files(domain)
62
- Generators::DomainFiles.new([domain]).invoke_all
63
- end
64
-
65
- def generate_operations(domain, options)
66
- domain.for_each_operation do |aggregate, domain_object, operation|
67
- Generators::Operation.new(
68
- [domain, aggregate, domain_object, operation],
69
- skip: options[:skip_operations]
70
- ).invoke_all
71
- end
72
- end
73
-
74
- def generate_domain_objects(domain)
75
- domain.for_each_domain_object do |aggregate, domain_object|
76
- generate_entity(domain, aggregate, domain_object)
77
- generate_value_object(domain, aggregate, domain_object)
78
- end
79
- end
80
-
81
- def generate_value_object(domain, aggregate, domain_object)
82
- return unless domain_object.is_a?(HecksDomain::Parser::ValueObject)
83
-
84
- Generators::ValueObject.new(
85
- [domain, aggregate, domain_object]
86
- ).invoke_all
87
- end
88
-
89
- def generate_entity(domain, aggregate, domain_object)
90
- return unless domain_object.is_a?(HecksDomain::Parser::Entity)
91
-
92
- Generators::Entity.new(
93
- [domain, aggregate, domain_object]
94
- ).invoke_all
95
- end
96
- end
97
- end
98
- end
@@ -1 +0,0 @@
1
- require_relative 'commands/generate'
@@ -1,21 +0,0 @@
1
- class HecksDomain
2
- module Generators
3
- class Domain < Thor::Group
4
- include Thor::Actions
5
-
6
- argument :domain_name, optional: true
7
-
8
- def self.source_root
9
- File.dirname(__FILE__) + '/../templates'
10
- end
11
-
12
- def folder_name
13
- domain_name.underscore
14
- end
15
-
16
- def write_domain_directory
17
- directory('%folder_name%')
18
- end
19
- end
20
- end
21
- end
@@ -1,28 +0,0 @@
1
- class HecksDomain
2
- module Generators
3
- class DomainFiles < Thor::Group
4
- include Thor::Actions
5
-
6
- attr_reader :domain_name, :domain, :gemspec
7
-
8
- def initialize(args)
9
- @domain = args.first
10
- @gemspec = @domain.gemspec
11
-
12
- @domain_name = @domain.name.to_s.underscore
13
- super
14
- end
15
-
16
- argument :name
17
-
18
- def self.source_root
19
- File.dirname(__FILE__) + '/../templates'
20
- end
21
-
22
- def write_gemspec
23
- template('%domain_name%.gemspec.tt')
24
- directory('lib')
25
- end
26
- end
27
- end
28
- end
@@ -1,30 +0,0 @@
1
- class HecksDomain
2
- module Generators
3
- class Entity < Thor::Group
4
- include Thor::Actions
5
-
6
- attr_reader :aggregate_name, :domain_name, :domain_object_name, :domain, :aggregate, :domain_object
7
-
8
- def initialize(args)
9
- @domain = args[0]
10
- @aggregate = args[1]
11
- @domain_object = args[2]
12
-
13
- @domain_name = @domain.name.to_s.underscore
14
- @aggregate_name = @aggregate.name.to_s.underscore
15
- @domain_object_name = @domain_object.name.to_s.underscore
16
- super
17
- end
18
-
19
- argument :name
20
-
21
- def self.source_root
22
- File.dirname(__FILE__) + '/../templates'
23
- end
24
-
25
- def write_aggregate_directory
26
- directory('entity', 'domain')
27
- end
28
- end
29
- end
30
- end
@@ -1,32 +0,0 @@
1
- class HecksDomain
2
- module Generators
3
- class Operation < Thor::Group
4
- include Thor::Actions
5
-
6
- attr_reader :aggregate_name, :domain_name, :operation_name, :domain_object_name, :domain, :aggregate, :domain_object, :operation
7
-
8
- def initialize(args, options)
9
- @domain = args[0]
10
- @aggregate = args[1]
11
- @domain_object = args[2]
12
- @operation = args[3]
13
-
14
- @domain_name = @domain.name.to_s.underscore
15
- @aggregate_name = @aggregate.name.to_s.underscore
16
- @domain_object_name = @domain_object.name.to_s.underscore
17
- @operation_name = @operation.name.to_s.underscore
18
- super(args, options)
19
- end
20
-
21
- argument :name
22
-
23
- def self.source_root
24
- File.dirname(__FILE__) + '/../templates'
25
- end
26
-
27
- def write_aggregate_directory
28
- directory('operation', 'domain')
29
- end
30
- end
31
- end
32
- end
@@ -1,30 +0,0 @@
1
- class HecksDomain
2
- module Generators
3
- class Root < Thor::Group
4
- include Thor::Actions
5
-
6
- attr_reader :aggregate_name, :domain_name, :root_name, :domain, :aggregate, :root
7
-
8
- def initialize(args)
9
- @domain = args[0]
10
- @aggregate = args[1]
11
- @root = args[2]
12
-
13
- @domain_name = @domain.name.to_s.underscore
14
- @aggregate_name = @aggregate.name.to_s.underscore
15
- @root_name = @root.name.to_s.underscore
16
- super
17
- end
18
-
19
- argument :name
20
-
21
- def self.source_root
22
- File.dirname(__FILE__) + '/../templates'
23
- end
24
-
25
- def write_aggregate_directory
26
- directory('root', 'domain')
27
- end
28
- end
29
- end
30
- end
@@ -1,30 +0,0 @@
1
- class HecksDomain
2
- module Generators
3
- class Spec < Thor::Group
4
- include Thor::Actions
5
-
6
- attr_reader :aggregate_name, :domain_name, :root_name, :domain, :aggregate, :root
7
-
8
- def initialize(args, options)
9
- @domain = args[0]
10
- @aggregate = args[1]
11
- @root = args[2]
12
-
13
- @domain_name = @domain.name.to_s.underscore
14
- @aggregate_name = @aggregate.name.to_s.underscore
15
- @root_name = @root.name.to_s.underscore
16
- super
17
- end
18
-
19
- argument :name
20
-
21
- def self.source_root
22
- File.dirname(__FILE__) + '/../templates'
23
- end
24
-
25
- def write_directory
26
- directory('spec', skip: options[:skip_spec_generation])
27
- end
28
- end
29
- end
30
- end
@@ -1,30 +0,0 @@
1
- class HecksDomain
2
- module Generators
3
- class ValueObject < Thor::Group
4
- include Thor::Actions
5
-
6
- attr_reader :aggregate_name, :domain_name, :domain_object_name, :domain, :aggregate, :domain_object
7
-
8
- def initialize(args)
9
- @domain = args[0]
10
- @aggregate = args[1]
11
- @domain_object = args[2]
12
-
13
- @domain_name = @domain.name.to_s.underscore
14
- @aggregate_name = @aggregate.name.to_s.underscore
15
- @domain_object_name = @domain_object.name.to_s.underscore
16
- super
17
- end
18
-
19
- argument :name
20
-
21
- def self.source_root
22
- File.dirname(__FILE__) + '/../templates'
23
- end
24
-
25
- def write_aggregate_directory
26
- directory('value_object', 'domain')
27
- end
28
- end
29
- end
30
- end
@@ -1,7 +0,0 @@
1
- require_relative 'generators/domain'
2
- require_relative 'generators/entity'
3
- require_relative 'generators/root'
4
- require_relative 'generators/value_object'
5
- require_relative 'generators/operation'
6
- require_relative 'generators/domain_files'
7
- require_relative 'generators/spec'
@@ -1,44 +0,0 @@
1
- class HecksDomain
2
- class Parser
3
- class Aggregate
4
- attr_reader :domain, :name, :domain_objects
5
-
6
- def initialize(name, domain, &block)
7
- @name = name
8
- @entities = []
9
- @value_objects = []
10
- @domain = domain
11
- instance_eval(&block)
12
- @domain_objects = @entities + @value_objects
13
- end
14
-
15
- def entity(name, &block)
16
- Entity.new(name, self, &block).tap do |entity|
17
- @entities << entity
18
- end
19
- end
20
-
21
- def file_name
22
- folder_name + '.rb'
23
- end
24
-
25
- def folder_name
26
- name.to_s.underscore
27
- end
28
-
29
- def root(name, &block)
30
- @root = Root.new(name, self, &block).tap do |root|
31
- @entities << root
32
- end
33
- end
34
-
35
- def value(name, &block)
36
- @value_objects << ValueObject.new(name, self, &block)
37
- end
38
-
39
- def binding
40
- super
41
- end
42
- end
43
- end
44
- end