hecks 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/bin/hecks +6 -0
  3. data/bin/hecks_console +10 -0
  4. data/lib/adapters/adapters.rb +6 -0
  5. data/lib/adapters/events/events.rb +27 -0
  6. data/lib/adapters/logger/logger.rb +18 -0
  7. data/lib/adapters/memory_database/memory_database.rb +18 -0
  8. data/lib/adapters/resource_server/methods.rb +22 -0
  9. data/lib/adapters/resource_server/methods/create.rb +49 -0
  10. data/lib/adapters/resource_server/methods/delete.rb +45 -0
  11. data/lib/adapters/resource_server/methods/read.rb +44 -0
  12. data/lib/adapters/resource_server/methods/update.rb +50 -0
  13. data/lib/adapters/resource_server/resource_server.rb +52 -0
  14. data/lib/adapters/validator/validator.rb +33 -0
  15. data/lib/application/application.rb +45 -0
  16. data/lib/application/commands/commands.rb +5 -0
  17. data/lib/application/commands/create.rb +52 -0
  18. data/lib/application/commands/crud_handler.rb +40 -0
  19. data/lib/application/commands/delete.rb +40 -0
  20. data/lib/application/commands/runner.rb +48 -0
  21. data/lib/application/commands/update.rb +41 -0
  22. data/lib/application/queries/find_by_id.rb +19 -0
  23. data/lib/application/queries/queries.rb +2 -0
  24. data/lib/application/queries/query_runner.rb +28 -0
  25. data/lib/cli/cli.rb +24 -0
  26. data/lib/cli/command_runner.rb +25 -0
  27. data/lib/cli/commands.rb +5 -0
  28. data/lib/cli/commands/build.rb +10 -0
  29. data/lib/cli/commands/console.rb +8 -0
  30. data/lib/cli/commands/generate.rb +26 -0
  31. data/lib/cli/commands/generate/builder.rb +60 -0
  32. data/lib/cli/commands/generate/builder/aggregate_command_line_builder.rb +18 -0
  33. data/lib/cli/commands/generate/builder/reference_command_line_builder.rb +19 -0
  34. data/lib/cli/commands/generate/builder/value_object_command_line_builder.rb +19 -0
  35. data/lib/cli/commands/generate/generate_aws_package.rb +17 -0
  36. data/lib/cli/commands/generate/generate_binary_package.rb +92 -0
  37. data/lib/cli/commands/generate/generate_domain_object.rb +71 -0
  38. data/lib/cli/commands/generate/generate_domain_object/assignment_template.rb +36 -0
  39. data/lib/cli/commands/generate/generate_domain_object/option_formatter.rb +30 -0
  40. data/lib/cli/commands/generate/generate_lambda_package.rb +20 -0
  41. data/lib/cli/commands/generate/generate_resource_server.rb +17 -0
  42. data/lib/cli/commands/generate/new.rb +47 -0
  43. data/lib/cli/commands/generate/templates/aggregate/lib/domain/%name%/%head_name%.rb.tt +16 -0
  44. data/lib/cli/commands/generate/templates/aggregate/lib/domain/%name%/%name%.rb.tt +9 -0
  45. data/lib/cli/commands/generate/templates/aggregate/lib/domain/%name%/repository.rb.tt +40 -0
  46. data/lib/cli/commands/generate/templates/binary_package/build/linux-x86_64/lib/app/hello.rb +1 -0
  47. data/lib/cli/commands/generate/templates/binary_package/build/resources/%domain_name%.rb.tt +17 -0
  48. data/lib/cli/commands/generate/templates/binary_package/build/resources/Dockerfile.tt +8 -0
  49. data/lib/cli/commands/generate/templates/binary_package/build/resources/Gemfile.tt +4 -0
  50. data/lib/cli/commands/generate/templates/binary_package/build/resources/bundle/config +3 -0
  51. data/lib/cli/commands/generate/templates/binary_package/build/resources/wrapper.tt +13 -0
  52. data/lib/cli/commands/generate/templates/domain/%name%.gemspec.tt +12 -0
  53. data/lib/cli/commands/generate/templates/domain/Version +1 -0
  54. data/lib/cli/commands/generate/templates/domain/lib/%name%.rb.tt +21 -0
  55. data/lib/cli/commands/generate/templates/domain/spec/spec_helper.rb.tt +4 -0
  56. data/lib/cli/commands/generate/templates/lambda_package/handler.js.tt +12 -0
  57. data/lib/cli/commands/generate/templates/lambda_package/serverless.yml.tt +100 -0
  58. data/lib/cli/commands/generate/templates/reference/lib/domain/%module_name%/%file_name%.rb.tt +25 -0
  59. data/lib/cli/commands/generate/templates/resource_server/config.ru.tt +8 -0
  60. data/lib/cli/commands/generate/templates/value_object/lib/domain/%module_name%/%name%.rb.tt +24 -0
  61. data/lib/cli/commands/package.rb +16 -0
  62. data/lib/cli/commands/test.rb +41 -0
  63. data/lib/console/commands.rb +9 -0
  64. data/lib/console/console.rb +24 -0
  65. data/lib/domain_builder/attribute.rb +33 -0
  66. data/lib/domain_builder/domain.rb +17 -0
  67. data/lib/domain_builder/domain_builder.rb +35 -0
  68. data/lib/domain_builder/domain_module.rb +26 -0
  69. data/lib/domain_builder/domain_object.rb +37 -0
  70. data/lib/domain_builder/head.rb +6 -0
  71. data/lib/domain_builder/reference.rb +17 -0
  72. data/lib/domain_builder/value.rb +6 -0
  73. data/lib/hecks.rb +7 -0
  74. metadata +229 -0
@@ -0,0 +1,26 @@
1
+ module Hecks
2
+ class DomainBuilder
3
+ class DomainModule
4
+ attr_reader :objects, :name, :references
5
+
6
+ def initialize(name:)
7
+ @name = name
8
+ @objects = []
9
+ @references = []
10
+ end
11
+
12
+ def head(name=nil)
13
+ return (@objects << Head.new(name: name)).last if name
14
+ objects.find{ |o| o.is_a?(Head) }
15
+ end
16
+
17
+ def value(name)
18
+ (@objects << Value.new(name: name)).last
19
+ end
20
+
21
+ def reference(name)
22
+ (@references << Reference.new(name)).last
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,37 @@
1
+ module Hecks
2
+ class DomainBuilder
3
+ class DomainObject
4
+ attr_reader :name, :attributes
5
+
6
+ def initialize(name:)
7
+ @name = name
8
+ end
9
+
10
+ def attributes(*values)
11
+ return @attributes if @attributes
12
+ @attributes = values.map { |value| Attribute.new(value) }
13
+ end
14
+
15
+ def attribute_hash
16
+ attributes.map do |attribute|
17
+ [attribute.name.to_sym, attribute.type]
18
+ end.to_h
19
+ end
20
+
21
+ def attribute_string
22
+ attributes.map do |attribute|
23
+ [attribute.name, type_with_domain_module(attribute)].join(':')
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def type_with_domain_module(attribute)
30
+ type = attribute.type
31
+ type = '[' + attribute.type + ']' if attribute.list?
32
+ return type unless attribute.domain_module
33
+ [attribute.domain_module, type].join("::")
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,6 @@
1
+ module Hecks
2
+ class DomainBuilder
3
+ class Head < DomainObject
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,17 @@
1
+ module Hecks
2
+ class DomainBuilder
3
+ class Reference
4
+ def initialize(reference)
5
+ @reference = reference
6
+ end
7
+
8
+ def referenced_entity
9
+ @reference.split("::").map(&:camelcase).join("::")
10
+ end
11
+
12
+ def name
13
+ @reference.split("::").last.camelcase + "Reference"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,6 @@
1
+ module Hecks
2
+ class DomainBuilder
3
+ class Value < DomainObject
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ require 'thor'
3
+ require 'active_support/inflector'
4
+ require_relative 'application/application'
5
+ require_relative 'adapters/adapters'
6
+ require_relative 'domain_builder/domain_builder'
7
+ require_relative 'cli/cli'
metadata ADDED
@@ -0,0 +1,229 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hecks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
5
+ platform: ruby
6
+ authors:
7
+ - Chris Young
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-02-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sinatra
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: codeclimate-test-reporter
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard-rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.12'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.12'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rack-test
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.6'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.10'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.10'
111
+ - !ruby/object:Gem::Dependency
112
+ name: thor
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.19'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.19'
125
+ description: Make the Domain the center of your programming world
126
+ email: chris@example.com
127
+ executables:
128
+ - hecks
129
+ - hecks_console
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - bin/hecks
134
+ - bin/hecks_console
135
+ - lib/adapters/adapters.rb
136
+ - lib/adapters/events/events.rb
137
+ - lib/adapters/logger/logger.rb
138
+ - lib/adapters/memory_database/memory_database.rb
139
+ - lib/adapters/resource_server/methods.rb
140
+ - lib/adapters/resource_server/methods/create.rb
141
+ - lib/adapters/resource_server/methods/delete.rb
142
+ - lib/adapters/resource_server/methods/read.rb
143
+ - lib/adapters/resource_server/methods/update.rb
144
+ - lib/adapters/resource_server/resource_server.rb
145
+ - lib/adapters/validator/validator.rb
146
+ - lib/application/application.rb
147
+ - lib/application/commands/commands.rb
148
+ - lib/application/commands/create.rb
149
+ - lib/application/commands/crud_handler.rb
150
+ - lib/application/commands/delete.rb
151
+ - lib/application/commands/runner.rb
152
+ - lib/application/commands/update.rb
153
+ - lib/application/queries/find_by_id.rb
154
+ - lib/application/queries/queries.rb
155
+ - lib/application/queries/query_runner.rb
156
+ - lib/cli/cli.rb
157
+ - lib/cli/command_runner.rb
158
+ - lib/cli/commands.rb
159
+ - lib/cli/commands/build.rb
160
+ - lib/cli/commands/console.rb
161
+ - lib/cli/commands/generate.rb
162
+ - lib/cli/commands/generate/builder.rb
163
+ - lib/cli/commands/generate/builder/aggregate_command_line_builder.rb
164
+ - lib/cli/commands/generate/builder/reference_command_line_builder.rb
165
+ - lib/cli/commands/generate/builder/value_object_command_line_builder.rb
166
+ - lib/cli/commands/generate/generate_aws_package.rb
167
+ - lib/cli/commands/generate/generate_binary_package.rb
168
+ - lib/cli/commands/generate/generate_domain_object.rb
169
+ - lib/cli/commands/generate/generate_domain_object/assignment_template.rb
170
+ - lib/cli/commands/generate/generate_domain_object/option_formatter.rb
171
+ - lib/cli/commands/generate/generate_lambda_package.rb
172
+ - lib/cli/commands/generate/generate_resource_server.rb
173
+ - lib/cli/commands/generate/new.rb
174
+ - lib/cli/commands/generate/templates/aggregate/lib/domain/%name%/%head_name%.rb.tt
175
+ - lib/cli/commands/generate/templates/aggregate/lib/domain/%name%/%name%.rb.tt
176
+ - lib/cli/commands/generate/templates/aggregate/lib/domain/%name%/repository.rb.tt
177
+ - lib/cli/commands/generate/templates/binary_package/build/linux-x86_64/lib/app/hello.rb
178
+ - lib/cli/commands/generate/templates/binary_package/build/resources/%domain_name%.rb.tt
179
+ - lib/cli/commands/generate/templates/binary_package/build/resources/Dockerfile.tt
180
+ - lib/cli/commands/generate/templates/binary_package/build/resources/Gemfile.tt
181
+ - lib/cli/commands/generate/templates/binary_package/build/resources/bundle/config
182
+ - lib/cli/commands/generate/templates/binary_package/build/resources/wrapper.tt
183
+ - lib/cli/commands/generate/templates/domain/%name%.gemspec.tt
184
+ - lib/cli/commands/generate/templates/domain/Version
185
+ - lib/cli/commands/generate/templates/domain/lib/%name%.rb.tt
186
+ - lib/cli/commands/generate/templates/domain/spec/spec_helper.rb.tt
187
+ - lib/cli/commands/generate/templates/lambda_package/handler.js.tt
188
+ - lib/cli/commands/generate/templates/lambda_package/serverless.yml.tt
189
+ - lib/cli/commands/generate/templates/reference/lib/domain/%module_name%/%file_name%.rb.tt
190
+ - lib/cli/commands/generate/templates/resource_server/config.ru.tt
191
+ - lib/cli/commands/generate/templates/value_object/lib/domain/%module_name%/%name%.rb.tt
192
+ - lib/cli/commands/package.rb
193
+ - lib/cli/commands/test.rb
194
+ - lib/console/commands.rb
195
+ - lib/console/console.rb
196
+ - lib/domain_builder/attribute.rb
197
+ - lib/domain_builder/domain.rb
198
+ - lib/domain_builder/domain_builder.rb
199
+ - lib/domain_builder/domain_module.rb
200
+ - lib/domain_builder/domain_object.rb
201
+ - lib/domain_builder/head.rb
202
+ - lib/domain_builder/reference.rb
203
+ - lib/domain_builder/value.rb
204
+ - lib/hecks.rb
205
+ homepage: https://github.com/chrisyoung/heckson
206
+ licenses:
207
+ - MIT
208
+ metadata: {}
209
+ post_install_message:
210
+ rdoc_options: []
211
+ require_paths:
212
+ - lib
213
+ required_ruby_version: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ">="
216
+ - !ruby/object:Gem::Version
217
+ version: '0'
218
+ required_rubygems_version: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ requirements: []
224
+ rubyforge_project:
225
+ rubygems_version: 2.6.6
226
+ signing_key:
227
+ specification_version: 4
228
+ summary: DDD and Hexagonal Code Generators
229
+ test_files: []