hanami-cli 2.0.0.alpha7 → 2.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.action_hero.yml +11 -0
  3. data/.github/FUNDING.yml +1 -0
  4. data/CHANGELOG.md +58 -0
  5. data/Gemfile +2 -3
  6. data/LICENSE.md +22 -0
  7. data/README.md +14 -10
  8. data/hanami-cli.gemspec +3 -2
  9. data/lib/hanami/cli/bundler.rb +3 -7
  10. data/lib/hanami/cli/commands/app/command.rb +68 -0
  11. data/lib/hanami/cli/commands/{monolith → app}/console.rb +6 -6
  12. data/lib/hanami/cli/commands/{monolith → app}/db/create.rb +3 -3
  13. data/lib/hanami/cli/commands/{monolith → app}/db/create_migration.rb +3 -3
  14. data/lib/hanami/cli/commands/{monolith → app}/db/drop.rb +3 -3
  15. data/lib/hanami/cli/commands/{monolith → app}/db/migrate.rb +4 -4
  16. data/lib/hanami/cli/commands/{monolith → app}/db/reset.rb +3 -3
  17. data/lib/hanami/cli/commands/{monolith → app}/db/rollback.rb +4 -4
  18. data/lib/hanami/cli/commands/{monolith → app}/db/sample_data.rb +4 -4
  19. data/lib/hanami/cli/commands/{monolith → app}/db/seed.rb +4 -4
  20. data/lib/hanami/cli/commands/{monolith → app}/db/setup.rb +3 -3
  21. data/lib/hanami/cli/commands/{monolith → app}/db/structure/dump.rb +3 -3
  22. data/lib/hanami/cli/commands/{monolith → app}/db/version.rb +3 -3
  23. data/lib/hanami/cli/commands/{monolith → app}/generate/action.rb +3 -3
  24. data/lib/hanami/cli/commands/{monolith → app}/generate/slice.rb +4 -4
  25. data/lib/hanami/cli/commands/{monolith → app}/generate.rb +1 -1
  26. data/lib/hanami/cli/commands/{monolith → app}/install.rb +1 -1
  27. data/lib/hanami/cli/commands/app/routes.rb +82 -0
  28. data/lib/hanami/cli/commands/app/server.rb +58 -0
  29. data/lib/hanami/cli/commands/{monolith → app}/version.rb +1 -1
  30. data/lib/hanami/cli/commands/app.rb +46 -0
  31. data/lib/hanami/cli/commands/db/utils/database.rb +14 -10
  32. data/lib/hanami/cli/commands/gem/new.rb +29 -38
  33. data/lib/hanami/cli/commands/gem/version.rb +21 -1
  34. data/lib/hanami/cli/commands/gem.rb +2 -4
  35. data/lib/hanami/cli/commands.rb +9 -10
  36. data/lib/hanami/cli/generators/{monolith → app}/action/action.erb +0 -0
  37. data/lib/hanami/cli/generators/{monolith → app}/action/template.erb +0 -0
  38. data/lib/hanami/cli/generators/{monolith → app}/action/template.html.erb +0 -0
  39. data/lib/hanami/cli/generators/{monolith → app}/action/view.erb +0 -0
  40. data/lib/hanami/cli/generators/{monolith → app}/action.rb +2 -2
  41. data/lib/hanami/cli/generators/{monolith → app}/action_context.rb +1 -1
  42. data/lib/hanami/cli/generators/{monolith → app}/slice/action.erb +0 -0
  43. data/lib/hanami/cli/generators/{monolith → app}/slice/entities.erb +0 -0
  44. data/lib/hanami/cli/generators/{gem/application/monolith → app/slice}/keep.erb +0 -0
  45. data/lib/hanami/cli/generators/{monolith → app}/slice/repository.erb +0 -0
  46. data/lib/hanami/cli/generators/{monolith → app}/slice/routes.erb +0 -0
  47. data/lib/hanami/cli/generators/{monolith → app}/slice/view.erb +0 -0
  48. data/lib/hanami/cli/generators/{monolith → app}/slice.rb +2 -2
  49. data/lib/hanami/cli/generators/{monolith → app}/slice_context.rb +1 -1
  50. data/lib/hanami/cli/generators/context.rb +2 -2
  51. data/lib/hanami/cli/generators/gem/{application/monolith/entities.erb → app/action.erb} +3 -3
  52. data/lib/hanami/cli/generators/gem/{application/monolith/application.erb → app/app.erb} +1 -1
  53. data/lib/hanami/cli/generators/gem/{application/monolith → app}/config_ru.erb +0 -0
  54. data/lib/hanami/cli/generators/gem/{application/monolith → app}/env.erb +0 -0
  55. data/lib/hanami/cli/generators/gem/app/gemfile.erb +15 -0
  56. data/lib/hanami/cli/generators/{monolith/slice → gem/app}/keep.erb +0 -0
  57. data/lib/hanami/cli/generators/gem/app/operation.erb +9 -0
  58. data/lib/hanami/cli/generators/gem/app/rakefile.erb +3 -0
  59. data/lib/hanami/cli/generators/gem/{application/monolith → app}/readme.erb +0 -0
  60. data/lib/hanami/cli/generators/gem/app/relation.erb +7 -0
  61. data/lib/hanami/cli/generators/gem/app/repository.erb +9 -0
  62. data/lib/hanami/cli/generators/gem/app/routes.erb +11 -0
  63. data/lib/hanami/cli/generators/gem/app/settings.erb +9 -0
  64. data/lib/hanami/cli/generators/gem/{application/monolith/functions.erb → app/transformations.erb} +1 -1
  65. data/lib/hanami/cli/generators/gem/{application/monolith → app}/types.erb +0 -0
  66. data/lib/hanami/cli/generators/gem/app/validator.erb +12 -0
  67. data/lib/hanami/cli/generators/gem/app/view.erb +9 -0
  68. data/lib/hanami/cli/generators/gem/{application/monolith → app}/view_context.erb +1 -6
  69. data/lib/hanami/cli/generators/gem/app/view_part.erb +10 -0
  70. data/lib/hanami/cli/generators/gem/app.rb +64 -0
  71. data/lib/hanami/cli/generators/version.rb +55 -0
  72. data/lib/hanami/cli/rake_tasks.rb +54 -0
  73. data/lib/hanami/cli/repl/core.rb +7 -7
  74. data/lib/hanami/cli/server.rb +45 -0
  75. data/lib/hanami/cli/version.rb +1 -1
  76. data/lib/hanami/console/context.rb +12 -12
  77. data/lib/hanami/console/plugins/slice_readers.rb +3 -3
  78. data/project.yml +2 -0
  79. metadata +88 -60
  80. data/LICENSE.txt +0 -21
  81. data/lib/hanami/cli/commands/application.rb +0 -63
  82. data/lib/hanami/cli/commands/monolith.rb +0 -55
  83. data/lib/hanami/cli/generators/gem/application/monolith/action.erb +0 -21
  84. data/lib/hanami/cli/generators/gem/application/monolith/gemfile.erb +0 -19
  85. data/lib/hanami/cli/generators/gem/application/monolith/operation.erb +0 -18
  86. data/lib/hanami/cli/generators/gem/application/monolith/rakefile.erb +0 -3
  87. data/lib/hanami/cli/generators/gem/application/monolith/repository.erb +0 -13
  88. data/lib/hanami/cli/generators/gem/application/monolith/routes.erb +0 -4
  89. data/lib/hanami/cli/generators/gem/application/monolith/settings.erb +0 -6
  90. data/lib/hanami/cli/generators/gem/application/monolith/validation_contract.erb +0 -14
  91. data/lib/hanami/cli/generators/gem/application/monolith.rb +0 -83
  92. data/lib/hanami/cli/generators/gem/application.rb +0 -21
  93. data/lib/hanami/rake_tasks.rb +0 -52
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.alpha7
4
+ version: 2.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-10 00:00:00.000000000 Z
11
+ date: 2022-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,28 +44,34 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.6'
47
+ version: '0.7'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.6'
54
+ version: '0.7'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: dry-files
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.1'
61
+ version: '0.2'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 0.2.0
62
65
  type: :runtime
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
66
69
  - - "~>"
67
70
  - !ruby/object:Gem::Version
68
- version: '0.1'
71
+ version: '0.2'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 0.2.0
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: dry-inflector
71
77
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +114,20 @@ dependencies:
108
114
  - - "~>"
109
115
  - !ruby/object:Gem::Version
110
116
  version: '1.0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: puma
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
111
131
  description: Hanami command line
112
132
  email:
113
133
  - me@lucaguidi.com
@@ -116,6 +136,8 @@ executables:
116
136
  extensions: []
117
137
  extra_rdoc_files: []
118
138
  files:
139
+ - ".action_hero.yml"
140
+ - ".github/FUNDING.yml"
119
141
  - ".github/workflows/ci.yml"
120
142
  - ".gitignore"
121
143
  - ".rspec"
@@ -123,7 +145,7 @@ files:
123
145
  - CHANGELOG.md
124
146
  - CODE_OF_CONDUCT.md
125
147
  - Gemfile
126
- - LICENSE.txt
148
+ - LICENSE.md
127
149
  - README.md
128
150
  - Rakefile
129
151
  - bin/console
@@ -135,7 +157,27 @@ files:
135
157
  - lib/hanami/cli/command.rb
136
158
  - lib/hanami/cli/command_line.rb
137
159
  - lib/hanami/cli/commands.rb
138
- - lib/hanami/cli/commands/application.rb
160
+ - lib/hanami/cli/commands/app.rb
161
+ - lib/hanami/cli/commands/app/command.rb
162
+ - lib/hanami/cli/commands/app/console.rb
163
+ - lib/hanami/cli/commands/app/db/create.rb
164
+ - lib/hanami/cli/commands/app/db/create_migration.rb
165
+ - lib/hanami/cli/commands/app/db/drop.rb
166
+ - lib/hanami/cli/commands/app/db/migrate.rb
167
+ - lib/hanami/cli/commands/app/db/reset.rb
168
+ - lib/hanami/cli/commands/app/db/rollback.rb
169
+ - lib/hanami/cli/commands/app/db/sample_data.rb
170
+ - lib/hanami/cli/commands/app/db/seed.rb
171
+ - lib/hanami/cli/commands/app/db/setup.rb
172
+ - lib/hanami/cli/commands/app/db/structure/dump.rb
173
+ - lib/hanami/cli/commands/app/db/version.rb
174
+ - lib/hanami/cli/commands/app/generate.rb
175
+ - lib/hanami/cli/commands/app/generate/action.rb
176
+ - lib/hanami/cli/commands/app/generate/slice.rb
177
+ - lib/hanami/cli/commands/app/install.rb
178
+ - lib/hanami/cli/commands/app/routes.rb
179
+ - lib/hanami/cli/commands/app/server.rb
180
+ - lib/hanami/cli/commands/app/version.rb
139
181
  - lib/hanami/cli/commands/db/utils/database.rb
140
182
  - lib/hanami/cli/commands/db/utils/database_config.rb
141
183
  - lib/hanami/cli/commands/db/utils/mysql.rb
@@ -144,68 +186,54 @@ files:
144
186
  - lib/hanami/cli/commands/gem.rb
145
187
  - lib/hanami/cli/commands/gem/new.rb
146
188
  - lib/hanami/cli/commands/gem/version.rb
147
- - lib/hanami/cli/commands/monolith.rb
148
- - lib/hanami/cli/commands/monolith/console.rb
149
- - lib/hanami/cli/commands/monolith/db/create.rb
150
- - lib/hanami/cli/commands/monolith/db/create_migration.rb
151
- - lib/hanami/cli/commands/monolith/db/drop.rb
152
- - lib/hanami/cli/commands/monolith/db/migrate.rb
153
- - lib/hanami/cli/commands/monolith/db/reset.rb
154
- - lib/hanami/cli/commands/monolith/db/rollback.rb
155
- - lib/hanami/cli/commands/monolith/db/sample_data.rb
156
- - lib/hanami/cli/commands/monolith/db/seed.rb
157
- - lib/hanami/cli/commands/monolith/db/setup.rb
158
- - lib/hanami/cli/commands/monolith/db/structure/dump.rb
159
- - lib/hanami/cli/commands/monolith/db/version.rb
160
- - lib/hanami/cli/commands/monolith/generate.rb
161
- - lib/hanami/cli/commands/monolith/generate/action.rb
162
- - lib/hanami/cli/commands/monolith/generate/slice.rb
163
- - lib/hanami/cli/commands/monolith/install.rb
164
- - lib/hanami/cli/commands/monolith/version.rb
165
189
  - lib/hanami/cli/error.rb
190
+ - lib/hanami/cli/generators/app/action.rb
191
+ - lib/hanami/cli/generators/app/action/action.erb
192
+ - lib/hanami/cli/generators/app/action/template.erb
193
+ - lib/hanami/cli/generators/app/action/template.html.erb
194
+ - lib/hanami/cli/generators/app/action/view.erb
195
+ - lib/hanami/cli/generators/app/action_context.rb
196
+ - lib/hanami/cli/generators/app/slice.rb
197
+ - lib/hanami/cli/generators/app/slice/action.erb
198
+ - lib/hanami/cli/generators/app/slice/entities.erb
199
+ - lib/hanami/cli/generators/app/slice/keep.erb
200
+ - lib/hanami/cli/generators/app/slice/repository.erb
201
+ - lib/hanami/cli/generators/app/slice/routes.erb
202
+ - lib/hanami/cli/generators/app/slice/view.erb
203
+ - lib/hanami/cli/generators/app/slice_context.rb
166
204
  - lib/hanami/cli/generators/context.rb
167
- - lib/hanami/cli/generators/gem/application.rb
168
- - lib/hanami/cli/generators/gem/application/monolith.rb
169
- - lib/hanami/cli/generators/gem/application/monolith/action.erb
170
- - lib/hanami/cli/generators/gem/application/monolith/application.erb
171
- - lib/hanami/cli/generators/gem/application/monolith/config_ru.erb
172
- - lib/hanami/cli/generators/gem/application/monolith/entities.erb
173
- - lib/hanami/cli/generators/gem/application/monolith/env.erb
174
- - lib/hanami/cli/generators/gem/application/monolith/functions.erb
175
- - lib/hanami/cli/generators/gem/application/monolith/gemfile.erb
176
- - lib/hanami/cli/generators/gem/application/monolith/keep.erb
177
- - lib/hanami/cli/generators/gem/application/monolith/operation.erb
178
- - lib/hanami/cli/generators/gem/application/monolith/rakefile.erb
179
- - lib/hanami/cli/generators/gem/application/monolith/readme.erb
180
- - lib/hanami/cli/generators/gem/application/monolith/repository.erb
181
- - lib/hanami/cli/generators/gem/application/monolith/routes.erb
182
- - lib/hanami/cli/generators/gem/application/monolith/settings.erb
183
- - lib/hanami/cli/generators/gem/application/monolith/types.erb
184
- - lib/hanami/cli/generators/gem/application/monolith/validation_contract.erb
185
- - lib/hanami/cli/generators/gem/application/monolith/view_context.erb
186
- - lib/hanami/cli/generators/monolith/action.rb
187
- - lib/hanami/cli/generators/monolith/action/action.erb
188
- - lib/hanami/cli/generators/monolith/action/template.erb
189
- - lib/hanami/cli/generators/monolith/action/template.html.erb
190
- - lib/hanami/cli/generators/monolith/action/view.erb
191
- - lib/hanami/cli/generators/monolith/action_context.rb
192
- - lib/hanami/cli/generators/monolith/slice.rb
193
- - lib/hanami/cli/generators/monolith/slice/action.erb
194
- - lib/hanami/cli/generators/monolith/slice/entities.erb
195
- - lib/hanami/cli/generators/monolith/slice/keep.erb
196
- - lib/hanami/cli/generators/monolith/slice/repository.erb
197
- - lib/hanami/cli/generators/monolith/slice/routes.erb
198
- - lib/hanami/cli/generators/monolith/slice/view.erb
199
- - lib/hanami/cli/generators/monolith/slice_context.rb
205
+ - lib/hanami/cli/generators/gem/app.rb
206
+ - lib/hanami/cli/generators/gem/app/action.erb
207
+ - lib/hanami/cli/generators/gem/app/app.erb
208
+ - lib/hanami/cli/generators/gem/app/config_ru.erb
209
+ - lib/hanami/cli/generators/gem/app/env.erb
210
+ - lib/hanami/cli/generators/gem/app/gemfile.erb
211
+ - lib/hanami/cli/generators/gem/app/keep.erb
212
+ - lib/hanami/cli/generators/gem/app/operation.erb
213
+ - lib/hanami/cli/generators/gem/app/rakefile.erb
214
+ - lib/hanami/cli/generators/gem/app/readme.erb
215
+ - lib/hanami/cli/generators/gem/app/relation.erb
216
+ - lib/hanami/cli/generators/gem/app/repository.erb
217
+ - lib/hanami/cli/generators/gem/app/routes.erb
218
+ - lib/hanami/cli/generators/gem/app/settings.erb
219
+ - lib/hanami/cli/generators/gem/app/transformations.erb
220
+ - lib/hanami/cli/generators/gem/app/types.erb
221
+ - lib/hanami/cli/generators/gem/app/validator.erb
222
+ - lib/hanami/cli/generators/gem/app/view.erb
223
+ - lib/hanami/cli/generators/gem/app/view_context.erb
224
+ - lib/hanami/cli/generators/gem/app/view_part.erb
225
+ - lib/hanami/cli/generators/version.rb
226
+ - lib/hanami/cli/rake_tasks.rb
200
227
  - lib/hanami/cli/repl/core.rb
201
228
  - lib/hanami/cli/repl/irb.rb
202
229
  - lib/hanami/cli/repl/pry.rb
230
+ - lib/hanami/cli/server.rb
203
231
  - lib/hanami/cli/system_call.rb
204
232
  - lib/hanami/cli/url.rb
205
233
  - lib/hanami/cli/version.rb
206
234
  - lib/hanami/console/context.rb
207
235
  - lib/hanami/console/plugins/slice_readers.rb
208
- - lib/hanami/rake_tasks.rb
236
+ - project.yml
209
237
  homepage: https://hanamirb.org
210
238
  licenses:
211
239
  - MIT
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2021 Luca Guidi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,63 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dry/files"
4
-
5
- require_relative "db/utils/database"
6
-
7
- module Hanami
8
- module CLI
9
- module Commands
10
- class Application < Hanami::CLI::Command
11
- module Environment
12
- def call(**opts)
13
- env = opts[:env]
14
- ENV["HANAMI_ENV"] = env.to_s
15
- super(**opts)
16
- end
17
- end
18
-
19
- def self.inherited(klass)
20
- super
21
- klass.option(:env, required: false, default: "development", desc: "Application's environment")
22
- klass.prepend(Environment)
23
- end
24
-
25
- def application
26
- @application ||=
27
- begin
28
- require "hanami/prepare"
29
- Hanami.application
30
- end
31
- end
32
-
33
- def run_command(klass, *args)
34
- klass.new(
35
- out: out,
36
- inflector: application.inflector,
37
- fs: Dry::Files
38
- ).call(*args)
39
- end
40
-
41
- def measure(desc)
42
- start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
43
- result = yield
44
- stop = Process.clock_gettime(Process::CLOCK_MONOTONIC)
45
-
46
- if result
47
- out.puts "=> #{desc} in #{(stop - start).round(4)}s"
48
- else
49
- out.puts "!!! => #{desc.inspect} FAILED"
50
- end
51
- end
52
-
53
- def database
54
- @database ||= Commands::DB::Utils::Database[application]
55
- end
56
-
57
- def database_config
58
- database.config
59
- end
60
- end
61
- end
62
- end
63
- end
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Hanami
4
- module CLI
5
- module Commands
6
- module Monolith
7
- require_relative "monolith/version"
8
- # require_relative "monolith/install"
9
- # require_relative "monolith/generate"
10
- require_relative "monolith/install"
11
- require_relative "monolith/generate"
12
- require_relative "monolith/console"
13
- require_relative "monolith/db/create"
14
- require_relative "monolith/db/create_migration"
15
- require_relative "monolith/db/drop"
16
- require_relative "monolith/db/migrate"
17
- require_relative "monolith/db/setup"
18
- require_relative "monolith/db/reset"
19
- require_relative "monolith/db/rollback"
20
- require_relative "monolith/db/sample_data"
21
- require_relative "monolith/db/seed"
22
- require_relative "monolith/db/structure/dump"
23
- require_relative "monolith/db/version"
24
-
25
- def self.extended(base)
26
- base.module_eval do
27
- register "version", Version, aliases: ["v", "-v", "--version"]
28
- # FIXME: temporary disabled for Hanami v2.0.0.alpha2
29
- # register "install", Install
30
-
31
- # FIXME: temporary disabled for Hanami v2.0.0.alpha2
32
- # register "generate", aliases: ["g"] do |prefix|
33
- # prefix.register "slice", Generate::Slice
34
- # prefix.register "action", Generate::Action
35
- # end
36
-
37
- register "console", Commands::Monolith::Console
38
-
39
- register "db create", Commands::Monolith::DB::Create
40
- register "db create_migration", Commands::Monolith::DB::CreateMigration
41
- register "db drop", Commands::Monolith::DB::Drop
42
- register "db migrate", Commands::Monolith::DB::Migrate
43
- register "db setup", Commands::Monolith::DB::Setup
44
- register "db reset", Commands::Monolith::DB::Reset
45
- register "db rollback", Commands::Monolith::DB::Rollback
46
- register "db sample_data", Commands::Monolith::DB::SampleData
47
- register "db seed", Commands::Monolith::DB::Seed
48
- register "db structure dump", Commands::Monolith::DB::Structure::Dump
49
- register "db version", Commands::Monolith::DB::Version
50
- end
51
- end
52
- end
53
- end
54
- end
55
- end
@@ -1,21 +0,0 @@
1
- # auto_register: false
2
- # frozen_string_literal: true
3
-
4
- require "json" # required for Hanami::Action::Flash to work
5
- require "hanami/action"
6
- require "hanami/action/cookies"
7
- require "hanami/action/csrf_protection"
8
- require "hanami/action/session"
9
-
10
- module <%= classified_app_name %>
11
- class Action < Hanami::Action
12
- def self.inherited(klass)
13
- super
14
-
15
- # These will need to be sorted by the framework eventually
16
- klass.include Hanami::Action::Cookies
17
- klass.include Hanami::Action::Session
18
- klass.include Hanami::Action::CSRFProtection
19
- end
20
- end
21
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rake"
6
-
7
- gem "hanami-router", "<%= hanami_version %>"
8
- gem "hanami-controller", "<%= hanami_version %>"
9
- gem "hanami-validations", "<%= hanami_version %>"
10
- gem "hanami-view", git: "https://github.com/hanami/view.git", branch: "master"
11
- gem "dry-cli", "~> 0.6", require: false, git: "https://github.com/dry-rb/dry-cli.git", branch: "feature/file-utils-class"
12
- gem "hanami-cli", git: "https://github.com/hanami/cli.git", branch: "main"
13
- gem "hanami", require: false, git: "https://github.com/hanami/hanami.git", branch: "feature/hanami-2-cli"
14
-
15
- gem "puma"
16
-
17
- group :cli, :development, :test do
18
- gem "hanami-rspec", git: "https://github.com/hanami/rspec.git", branch: "main"
19
- end
@@ -1,18 +0,0 @@
1
- # auto_register: false
2
- # frozen_string_literal: true
3
-
4
- require "dry/monads"
5
- require "dry/matcher/result_matcher"
6
-
7
- module <%= classified_app_name %>
8
- class Operation
9
- include Dry::Monads[:result, :try]
10
-
11
- class << self
12
- def inherited(klass)
13
- klass.include Dry::Monads[:do]
14
- klass.include Dry::Matcher::ResultMatcher.for(:call)
15
- end
16
- end
17
- end
18
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "hanami/application/rake_tasks"
@@ -1,13 +0,0 @@
1
- # auto_register: false
2
- # frozen_string_literal: true
3
-
4
- require "rom-repository"
5
- require_relative "entities"
6
-
7
- module <%= classified_app_name %>
8
- class Repository < ROM::Repository::Root
9
- include Deps[container: "persistence.rom"]
10
-
11
- struct_namespace Entities
12
- end
13
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Hanami.application.routes do
4
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "<%= underscored_app_name %>/types"
4
-
5
- Hanami.application.settings do
6
- end
@@ -1,14 +0,0 @@
1
- # auto_register: false
2
- # frozen_string_literal: true
3
-
4
- require "dry/validation"
5
- require "dry/schema/messages/i18n"
6
-
7
- module <%= classified_app_name %>
8
- module Validation
9
- class Contract < Dry::Validation::Contract
10
- config.messages.backend = :i18n
11
- config.messages.top_namespace = "validation"
12
- end
13
- end
14
- end
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "erb"
4
- require "shellwords"
5
- require "hanami/cli/generators/context"
6
-
7
- module Hanami
8
- module CLI
9
- module Generators
10
- module Gem
11
- module Application
12
- class Monolith
13
- def initialize(fs:, inflector:, command_line:)
14
- super()
15
- @fs = fs
16
- @inflector = inflector
17
- @command_line = command_line
18
- end
19
-
20
- def call(app, slice, slice_url_prefix, context: Context.new(inflector, app), &blk)
21
- generate_app(app, context)
22
- blk.call
23
- generate_slice!(slice, slice_url_prefix)
24
- end
25
-
26
- private
27
-
28
- attr_reader :fs
29
-
30
- attr_reader :inflector
31
-
32
- attr_reader :command_line
33
-
34
- def generate_app(app, context) # rubocop:disable Metrics/AbcSize
35
- fs.write(".env", t("env.erb", context))
36
-
37
- fs.write("README.md", t("readme.erb", context))
38
- fs.write("Gemfile", t("gemfile.erb", context))
39
- fs.write("Rakefile", t("rakefile.erb", context))
40
- fs.write("config.ru", t("config_ru.erb", context))
41
-
42
- fs.write("config/application.rb", t("application.erb", context))
43
- fs.write("config/settings.rb", t("settings.erb", context))
44
- fs.write("config/routes.rb", t("routes.erb", context))
45
-
46
- fs.write("lib/tasks/.keep", t("keep.erb", context))
47
-
48
- fs.write("lib/#{app}/entities/.keep", t("keep.erb", context))
49
- fs.write("lib/#{app}/persistence/relations/.keep", t("keep.erb", context))
50
- fs.write("lib/#{app}/validation/contract.rb", t("validation_contract.erb", context))
51
- fs.write("lib/#{app}/view/context.rb", t("view_context.erb", context))
52
- fs.write("lib/#{app}/action.rb", t("action.erb", context))
53
- fs.write("lib/#{app}/entities.rb", t("entities.erb", context))
54
- fs.write("lib/#{app}/functions.rb", t("functions.erb", context))
55
- fs.write("lib/#{app}/operation.rb", t("operation.erb", context))
56
- fs.write("lib/#{app}/repository.rb", t("repository.erb", context))
57
- fs.write("lib/#{app}/types.rb", t("types.erb", context))
58
- end
59
-
60
- def generate_slice!(slice_name, slice_url_prefix)
61
- slice_name = Shellwords.shellescape(slice_name)
62
- slice_url_prefix = Shellwords.shellescape(slice_url_prefix)
63
-
64
- command_line.call("hanami generate slice #{slice_name} --url-prefix=#{slice_url_prefix}").tap do |result|
65
- raise "hanami generate slice #{slice_name} failed\n\n\n#{result.err.inspect}" unless result.successful?
66
- end
67
- end
68
-
69
- def template(path, context)
70
- require "erb"
71
-
72
- ERB.new(
73
- File.read(__dir__ + "/monolith/#{path}")
74
- ).result(context.ctx)
75
- end
76
-
77
- alias_method :t, :template
78
- end
79
- end
80
- end
81
- end
82
- end
83
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Hanami
4
- module CLI
5
- module Generators
6
- module Gem
7
- module Application
8
- class << self
9
- def call(architecture, fs, inflector, command_line)
10
- require_relative "./application/#{architecture}"
11
-
12
- generator_name = inflector.classify(architecture).to_sym
13
- const_get(generator_name).new(fs: fs, inflector: inflector, command_line: command_line)
14
- end
15
- alias_method :[], :call
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rake"
4
- require "hanami/cli/bundler"
5
-
6
- module Hanami
7
- # Install Rake tasks in an application
8
- #
9
- # @since 2.0.0
10
- class RakeTasks
11
- include Rake::DSL
12
-
13
- # @since 2.0.0
14
- # @api private
15
- @tasks = []
16
-
17
- # @since 2.0.0
18
- # @api private
19
- @_mutex = Mutex.new
20
-
21
- # @since 2.0.0
22
- # @api private
23
- def self.register_tasks(&blk)
24
- @_mutex.synchronize do
25
- @tasks << blk
26
- @tasks.uniq!
27
- end
28
- end
29
-
30
- # @since 2.0.0
31
- # @api private
32
- def self.tasks
33
- @_mutex.synchronize do
34
- @tasks
35
- end
36
- end
37
-
38
- # @since 0.6.0
39
- # @api private
40
- def self.install_tasks
41
- new.call(tasks)
42
- end
43
-
44
- # @since 2.0.0
45
- # @api private
46
- def call(tasks)
47
- tasks.each(&:call)
48
- end
49
- end
50
- end
51
-
52
- Hanami::CLI::Bundler.require(:cli)