hanami-cli 2.0.0.beta3 → 2.0.0.beta4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/hanami/cli/command.rb +4 -1
- data/lib/hanami/cli/commands/app/console.rb +22 -12
- data/lib/hanami/cli/commands/app/generate/action.rb +17 -1
- data/lib/hanami/cli/commands/app/generate/slice.rb +14 -8
- data/lib/hanami/cli/commands/app/install.rb +2 -0
- data/lib/hanami/cli/commands/app/{middlewares.rb → middleware.rb} +11 -6
- data/lib/hanami/cli/commands/app/routes.rb +8 -3
- data/lib/hanami/cli/commands/app/server.rb +5 -2
- data/lib/hanami/cli/commands/app/version.rb +2 -0
- data/lib/hanami/cli/commands/app.rb +2 -2
- data/lib/hanami/cli/commands/gem/new.rb +20 -8
- data/lib/hanami/cli/commands/gem/version.rb +2 -0
- data/lib/hanami/cli/files.rb +50 -0
- data/lib/hanami/cli/generators/app/action.rb +11 -12
- data/lib/hanami/cli/generators/app/slice/routes.erb +1 -1
- data/lib/hanami/cli/generators/app/slice.rb +13 -15
- data/lib/hanami/cli/generators/app/slice_context.rb +3 -3
- data/lib/hanami/cli/generators/gem/app/gemfile.erb +1 -1
- data/lib/hanami/cli/generators/gem/app/settings.erb +0 -2
- data/lib/hanami/cli/middleware_stack_inspector.rb +3 -3
- data/lib/hanami/cli/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e5786ce0557b00c863e145560473293d2d172f96c4bcdd10e7dcc32484a32a3
|
4
|
+
data.tar.gz: 036fb11ad8f805173889beb755daa50d8de1da678d74e853f9f8ddf65fa3dde1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bde684529fa1ae28f86bee5aa8b9fb42297a7e112ff272751c0a234f5cb22cb13ea6a3bf46d580a56d9804225fd2d0834e131eb53fd60184cb0d6096f8f2a08
|
7
|
+
data.tar.gz: de2d099cfe069f4fd6c85aa23c5ce60f0133e9a6c1858c9f237f9c104ee5f2e56ab11965a7b979de754d6cdcefc8cbb9b5abfc9b0acc58cda2e2402cb570c546
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
Hanami Command Line Interface
|
4
4
|
|
5
|
+
## v2.0.0.beta4 - 2022-10-24
|
6
|
+
|
7
|
+
### Changed
|
8
|
+
|
9
|
+
- [Sean Collins] Show output when generating files (e.g. in `hanami new`) (#49)
|
10
|
+
- [Luca Guidi] Advertise Bundler and Hanami install steps when running `hanami new` (#54)
|
11
|
+
|
5
12
|
## v2.0.0.beta3 - 2022-09-21
|
6
13
|
|
7
14
|
### Added
|
data/lib/hanami/cli/command.rb
CHANGED
@@ -7,9 +7,10 @@ require "dry/inflector"
|
|
7
7
|
module Hanami
|
8
8
|
module CLI
|
9
9
|
class Command < Dry::CLI::Command
|
10
|
-
def initialize(out: $stdout, fs: Dry::Files.new, inflector: Dry::Inflector.new)
|
10
|
+
def initialize(out: $stdout, err: $stderr, fs: Dry::Files.new, inflector: Dry::Inflector.new)
|
11
11
|
super()
|
12
12
|
@out = out
|
13
|
+
@err = err
|
13
14
|
@fs = fs
|
14
15
|
@inflector = inflector
|
15
16
|
end
|
@@ -18,6 +19,8 @@ module Hanami
|
|
18
19
|
|
19
20
|
attr_reader :out
|
20
21
|
|
22
|
+
attr_reader :err
|
23
|
+
|
21
24
|
attr_reader :fs
|
22
25
|
|
23
26
|
attr_reader :inflector
|
@@ -10,37 +10,47 @@ module Hanami
|
|
10
10
|
module App
|
11
11
|
# @api public
|
12
12
|
class Console < App::Command
|
13
|
-
|
13
|
+
ENGINES = {
|
14
14
|
"pry" => -> (*args) {
|
15
15
|
begin
|
16
16
|
require "hanami/cli/repl/pry"
|
17
17
|
Repl::Pry.new(*args)
|
18
|
-
rescue LoadError
|
18
|
+
rescue LoadError # rubocop:disable Lint/SuppressedException
|
19
|
+
end
|
19
20
|
},
|
20
21
|
"irb" => -> (*args) {
|
21
22
|
require "hanami/cli/repl/irb"
|
22
23
|
Repl::Irb.new(*args)
|
23
24
|
},
|
24
25
|
}.freeze
|
26
|
+
private_constant :ENGINES
|
25
27
|
|
26
|
-
|
28
|
+
DEFAULT_ENGINE = "irb"
|
29
|
+
private_constant :DEFAULT_ENGINE
|
27
30
|
|
28
|
-
|
29
|
-
|
31
|
+
desc "Start app console (REPL)"
|
32
|
+
|
33
|
+
option :engine, required: false, desc: "Console engine", values: ENGINES.keys
|
30
34
|
|
31
35
|
# @api private
|
32
|
-
def call(
|
33
|
-
|
34
|
-
|
36
|
+
def call(engine: nil, **opts)
|
37
|
+
console_engine = resolve_engine(engine, opts)
|
38
|
+
|
39
|
+
if console_engine.nil?
|
40
|
+
err.puts "`#{engine}' is not bundled. Please run `bundle add #{engine}' and retry."
|
41
|
+
exit(1)
|
42
|
+
end
|
43
|
+
|
44
|
+
console_engine.start
|
35
45
|
end
|
36
46
|
|
37
47
|
private
|
38
48
|
|
39
|
-
def resolve_engine(
|
40
|
-
if
|
41
|
-
|
49
|
+
def resolve_engine(engine, opts)
|
50
|
+
if engine
|
51
|
+
ENGINES.fetch(engine).(app, opts)
|
42
52
|
else
|
43
|
-
|
53
|
+
ENGINES.map { |(_, loader)| loader.(app, opts) }.compact.first
|
44
54
|
end
|
45
55
|
end
|
46
56
|
end
|
@@ -28,7 +28,23 @@ module Hanami
|
|
28
28
|
# desc: "Skip view and template generation"
|
29
29
|
option :slice, required: false, desc: "Slice name"
|
30
30
|
|
31
|
-
|
31
|
+
# rubocop:disable Layout/LineLength
|
32
|
+
example [
|
33
|
+
%(books.index # GET /books to: "books.index" (MyApp::Actions::Books::Index)),
|
34
|
+
%(books.new # GET /books/new to: "books.new" (MyApp::Actions::Books::New)),
|
35
|
+
%(books.create # POST /books to: "books.create" (MyApp::Actions::Books::Create)),
|
36
|
+
%(books.edit # GET /books/:id/edit to: "books.edit" (MyApp::Actions::Books::Edit)),
|
37
|
+
%(books.update # PATCH /books/:id to: "books.update" (MyApp::Actions::Books::Update)),
|
38
|
+
%(books.show # GET /books/:id to: "books.show" (MyApp::Actions::Books::Show)),
|
39
|
+
%(books.destroy # DELETE /books/:id to: "books.destroy" (MyApp::Actions::Books::Destroy)),
|
40
|
+
%(books.sale # GET /books/sale to: "books.sale" (MyApp::Actions::Books::Sale)),
|
41
|
+
%(sessions.new --url=/login # GET /login to: "sessions.new" (MyApp::Actions::Sessions::New)),
|
42
|
+
%(authors.update --http=put # PUT /authors/:id to: "authors.update" (MyApp::Actions::Authors::Update)),
|
43
|
+
%(users.index --slice=admin # GET /admin/users to: "users.index" (Admin::Actions::Users::Update))
|
44
|
+
]
|
45
|
+
# rubocop:enable Layout/LineLength
|
46
|
+
|
47
|
+
def initialize(fs: Hanami::CLI::Files.new, inflector: Dry::Inflector.new,
|
32
48
|
generator: Generators::App::Action.new(fs: fs, inflector: inflector), **)
|
33
49
|
@generator = generator
|
34
50
|
super(fs: fs)
|
@@ -5,6 +5,7 @@ require "hanami/cli/generators/app/slice"
|
|
5
5
|
require "dry/inflector"
|
6
6
|
require "dry/files"
|
7
7
|
require "shellwords"
|
8
|
+
require "hanami/cli/files"
|
8
9
|
require "hanami/cli/url"
|
9
10
|
|
10
11
|
module Hanami
|
@@ -14,22 +15,27 @@ module Hanami
|
|
14
15
|
module Generate
|
15
16
|
class Slice < Command
|
16
17
|
argument :name, required: true, desc: "The slice name"
|
17
|
-
option :
|
18
|
+
option :url, required: false, type: :string, desc: "The slice URL prefix"
|
18
19
|
|
19
|
-
|
20
|
+
example [
|
21
|
+
"admin # Admin slice (/admin URL prefix)",
|
22
|
+
"users --url=/u # Users slice (/u URL prefix)",
|
23
|
+
]
|
24
|
+
|
25
|
+
def initialize(fs: Hanami::CLI::Files.new, inflector: Dry::Inflector.new,
|
20
26
|
generator: Generators::App::Slice.new(fs: fs, inflector: inflector), **)
|
21
27
|
@generator = generator
|
22
28
|
super(fs: fs)
|
23
29
|
end
|
24
30
|
|
25
|
-
def call(name:,
|
31
|
+
def call(name:, url: nil, **)
|
26
32
|
require "hanami/setup"
|
27
33
|
|
28
34
|
app = inflector.underscore(Hanami.app.namespace)
|
29
35
|
name = inflector.underscore(Shellwords.shellescape(name))
|
30
|
-
|
36
|
+
url = sanitize_url_prefix(name, url)
|
31
37
|
|
32
|
-
generator.call(app, name,
|
38
|
+
generator.call(app, name, url)
|
33
39
|
end
|
34
40
|
|
35
41
|
private
|
@@ -39,14 +45,14 @@ module Hanami
|
|
39
45
|
|
40
46
|
attr_reader :generator
|
41
47
|
|
42
|
-
def sanitize_url_prefix(name,
|
43
|
-
result =
|
48
|
+
def sanitize_url_prefix(name, url)
|
49
|
+
result = url
|
44
50
|
result = inflector.underscore(Shellwords.shellescape(result)) unless result.nil?
|
45
51
|
|
46
52
|
result ||= DEFAULT_URL_PREFIX + name
|
47
53
|
CLI::URL.call(result)
|
48
54
|
rescue ArgumentError
|
49
|
-
raise ArgumentError.new("invalid URL prefix: `#{
|
55
|
+
raise ArgumentError.new("invalid URL prefix: `#{url}'")
|
50
56
|
end
|
51
57
|
|
52
58
|
def valid_url?(url)
|
@@ -7,30 +7,35 @@ module Hanami
|
|
7
7
|
module CLI
|
8
8
|
module Commands
|
9
9
|
module App
|
10
|
-
# List registered
|
10
|
+
# List registered middleware in the app router
|
11
11
|
#
|
12
|
-
# It outputs
|
12
|
+
# It outputs middleware registered along with the paths where they
|
13
13
|
# apply:
|
14
14
|
#
|
15
15
|
# ```
|
16
|
-
# $ hanami
|
16
|
+
# $ bundle exec hanami middleware
|
17
17
|
# / Rack::Session::Cookie
|
18
18
|
# ```
|
19
19
|
#
|
20
20
|
# Given arguments can be inspected:
|
21
21
|
#
|
22
22
|
# ```
|
23
|
-
# $ hanami
|
23
|
+
# $ bundle exec hanami middleware --with-arguments
|
24
24
|
# / Rack::Session::Cookie args: [{:secret=>"foo"}]
|
25
25
|
# ```
|
26
|
-
class
|
27
|
-
desc "
|
26
|
+
class Middleware < Hanami::CLI::Command
|
27
|
+
desc "Print app Rack middleware stack"
|
28
28
|
|
29
29
|
DEFAULT_WITH_ARGUMENTS = false
|
30
30
|
|
31
31
|
option :with_arguments, default: DEFAULT_WITH_ARGUMENTS, required: false,
|
32
32
|
desc: "Include inspected arguments", type: :boolean
|
33
33
|
|
34
|
+
example [
|
35
|
+
"middleware # Print app Rack middleware stack",
|
36
|
+
"middleware --with-arguments # Print app Rack middleware stack, including initialize arguments",
|
37
|
+
]
|
38
|
+
|
34
39
|
# @api private
|
35
40
|
def call(with_arguments: DEFAULT_WITH_ARGUMENTS)
|
36
41
|
require "hanami/prepare"
|
@@ -11,14 +11,14 @@ module Hanami
|
|
11
11
|
# All the formatters available from `hanami-router` are available:
|
12
12
|
#
|
13
13
|
# ```
|
14
|
-
# $ hanami routes --format=csv
|
14
|
+
# $ bundle exec hanami routes --format=csv
|
15
15
|
# ```
|
16
16
|
#
|
17
17
|
# Experimental: You can also use a custom formatter registered in the
|
18
18
|
# application container. You can identify it by its key:
|
19
19
|
#
|
20
20
|
# ```
|
21
|
-
# $ hanami routes --format=custom_routes_formatter
|
21
|
+
# $ bundle exec hanami routes --format=custom_routes_formatter
|
22
22
|
# ```
|
23
23
|
class Routes < Hanami::CLI::Command
|
24
24
|
DEFAULT_FORMAT = "human_friendly"
|
@@ -30,13 +30,18 @@ module Hanami
|
|
30
30
|
].freeze
|
31
31
|
private_constant :VALID_FORMATS
|
32
32
|
|
33
|
-
desc "
|
33
|
+
desc "Print app routes"
|
34
34
|
|
35
35
|
option :format,
|
36
36
|
default: DEFAULT_FORMAT,
|
37
37
|
required: false,
|
38
38
|
desc: "Output format"
|
39
39
|
|
40
|
+
example [
|
41
|
+
"routes # Print app routes",
|
42
|
+
"routes --format=csv # Print app routes, using CSV format",
|
43
|
+
]
|
44
|
+
|
40
45
|
# @api private
|
41
46
|
def call(format: DEFAULT_FORMAT, **)
|
42
47
|
require "hanami/router/inspector"
|
@@ -28,13 +28,16 @@ module Hanami
|
|
28
28
|
DEFAULT_PORT = 2300
|
29
29
|
private_constant :DEFAULT_PORT
|
30
30
|
|
31
|
-
|
31
|
+
DEFAULT_CONFIG_PATH = "config.ru"
|
32
|
+
private_constant :DEFAULT_CONFIG_PATH
|
33
|
+
|
34
|
+
desc "Start Hanami app server"
|
32
35
|
|
33
36
|
option :host, default: nil, required: false,
|
34
37
|
desc: "The host address to bind to (falls back to the rack handler)"
|
35
38
|
option :port, default: DEFAULT_PORT, required: false,
|
36
39
|
desc: "The port to run the server on (falls back to the rack handler)"
|
37
|
-
option :config, default:
|
40
|
+
option :config, default: DEFAULT_CONFIG_PATH, required: false, desc: "Rack configuration file"
|
38
41
|
option :debug, default: false, required: false, desc: "Turn on/off debug output", type: :boolean
|
39
42
|
option :warn, default: false, required: false, desc: "Turn on/off warnings", type: :boolean
|
40
43
|
|
@@ -10,7 +10,7 @@ module Hanami
|
|
10
10
|
require_relative "app/server"
|
11
11
|
require_relative "app/routes"
|
12
12
|
require_relative "app/generate"
|
13
|
-
require_relative "app/
|
13
|
+
require_relative "app/middleware"
|
14
14
|
# require_relative "app/db/create"
|
15
15
|
# require_relative "app/db/create_migration"
|
16
16
|
# require_relative "app/db/drop"
|
@@ -30,7 +30,7 @@ module Hanami
|
|
30
30
|
register "console", Commands::App::Console, aliases: ["c"]
|
31
31
|
register "server", Commands::App::Server, aliases: ["s"]
|
32
32
|
register "routes", Commands::App::Routes
|
33
|
-
register "
|
33
|
+
register "middleware", Commands::App::Middleware
|
34
34
|
|
35
35
|
register "generate", aliases: ["g"] do |prefix|
|
36
36
|
prefix.register "slice", Generate::Slice
|
@@ -4,7 +4,7 @@ require "hanami/cli/command"
|
|
4
4
|
require "hanami/cli/bundler"
|
5
5
|
require "hanami/cli/command_line"
|
6
6
|
require "hanami/cli/generators/gem/app"
|
7
|
-
require "
|
7
|
+
require "hanami/cli/files"
|
8
8
|
require "dry/inflector"
|
9
9
|
|
10
10
|
module Hanami
|
@@ -12,17 +12,25 @@ module Hanami
|
|
12
12
|
module Commands
|
13
13
|
module Gem
|
14
14
|
class New < Command
|
15
|
-
|
16
|
-
private_constant :
|
15
|
+
SKIP_INSTALL_DEFAULT = false
|
16
|
+
private_constant :SKIP_INSTALL_DEFAULT
|
17
|
+
|
18
|
+
desc "Generate a new Hanami app"
|
17
19
|
|
18
20
|
argument :app, required: true, desc: "App name"
|
19
21
|
|
20
|
-
option :
|
21
|
-
|
22
|
+
option :skip_install, type: :boolean, required: false,
|
23
|
+
default: SKIP_INSTALL_DEFAULT,
|
24
|
+
desc: "Skip app installation (Bundler, third-party Hanami plugins)"
|
25
|
+
|
26
|
+
example [
|
27
|
+
"bookshelf # Generate a new Hanami app in `bookshelf/' directory, using `Bookshelf' namespace", # rubocop:disable Layout/LineLength
|
28
|
+
"bookshelf --skip-install # Generate a new Hanami app, but it skips Hanami installation"
|
29
|
+
]
|
22
30
|
|
23
31
|
# rubocop:disable Metrics/ParameterLists
|
24
32
|
def initialize(
|
25
|
-
fs:
|
33
|
+
fs: Hanami::CLI::Files.new,
|
26
34
|
inflector: Dry::Inflector.new,
|
27
35
|
bundler: CLI::Bundler.new(fs: fs),
|
28
36
|
command_line: CLI::CommandLine.new(bundler: bundler),
|
@@ -36,14 +44,18 @@ module Hanami
|
|
36
44
|
end
|
37
45
|
# rubocop:enable Metrics/ParameterLists
|
38
46
|
|
39
|
-
def call(app:,
|
47
|
+
def call(app:, skip_install: SKIP_INSTALL_DEFAULT, **)
|
40
48
|
app = inflector.underscore(app)
|
41
49
|
|
42
50
|
fs.mkdir(app)
|
43
51
|
fs.chdir(app) do
|
44
52
|
generator.call(app) do
|
45
|
-
|
53
|
+
if skip_install
|
54
|
+
out.puts "Skipping installation, please enter `#{app}' directory and run `bundle exec hanami install'"
|
55
|
+
else
|
56
|
+
out.puts "Running Bundler install..."
|
46
57
|
bundler.install!
|
58
|
+
out.puts "Running Hanami install..."
|
47
59
|
run_install_commmand!
|
48
60
|
end
|
49
61
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hanami
|
4
|
+
module CLI
|
5
|
+
class Files < Dry::Files
|
6
|
+
def initialize(out: $stdout, **args)
|
7
|
+
super(**args)
|
8
|
+
@out = out
|
9
|
+
end
|
10
|
+
|
11
|
+
def write(path, *content)
|
12
|
+
already_exists = exist?(path)
|
13
|
+
super
|
14
|
+
if already_exists
|
15
|
+
updated(path)
|
16
|
+
else
|
17
|
+
created(path)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def mkdir(path)
|
22
|
+
unless exist?(path)
|
23
|
+
super
|
24
|
+
created("#{path}/")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def chdir(path, &blk)
|
29
|
+
within_folder(path)
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
attr_reader :out
|
36
|
+
|
37
|
+
def updated(path)
|
38
|
+
out.puts "Updated #{path}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def created(path)
|
42
|
+
out.puts "Created #{path}"
|
43
|
+
end
|
44
|
+
|
45
|
+
def within_folder(path)
|
46
|
+
out.puts "-> Within #{path}/"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "erb"
|
4
4
|
require "dry/files"
|
5
|
+
require "hanami/cli/files"
|
5
6
|
require "hanami/cli/generators/app/action_context"
|
6
7
|
require "hanami/cli/url"
|
7
8
|
|
@@ -69,18 +70,16 @@ module Hanami
|
|
69
70
|
route(controller, action, url, http)
|
70
71
|
)
|
71
72
|
|
72
|
-
fs.
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
# end
|
83
|
-
end
|
73
|
+
fs.mkdir(directory = fs.join(slice_directory, "actions", controller))
|
74
|
+
fs.write(fs.join(directory, "#{action}.rb"), t("slice_action.erb", context))
|
75
|
+
|
76
|
+
# unless skip_view
|
77
|
+
# fs.mkdir(directory = fs.join(slice_directory, "views", controller))
|
78
|
+
# fs.write(fs.join(directory, "#{action}.rb"), t("view.erb", context))
|
79
|
+
#
|
80
|
+
# fs.mkdir(directory = fs.join(slice_directory, "templates", controller))
|
81
|
+
# fs.write(fs.join(directory, "#{action}.#{format}.erb"), t(template_format(format), context))
|
82
|
+
# end
|
84
83
|
end
|
85
84
|
|
86
85
|
def generate_for_app(controller, action, url, http, _format, _skip_view, context)
|
@@ -14,27 +14,25 @@ module Hanami
|
|
14
14
|
@inflector = inflector
|
15
15
|
end
|
16
16
|
|
17
|
-
def call(app, slice,
|
17
|
+
def call(app, slice, url, context: SliceContext.new(inflector, app, slice, url))
|
18
18
|
fs.inject_line_at_class_bottom(
|
19
19
|
fs.join("config", "routes.rb"), "class Routes", t("routes.erb", context).chomp
|
20
20
|
)
|
21
21
|
|
22
22
|
fs.mkdir(directory = "slices/#{slice}")
|
23
23
|
|
24
|
-
fs.
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
# fs.write("repositories/.keep", t("keep.erb", context))
|
37
|
-
end
|
24
|
+
# fs.write("#{directory}/config/slice.rb", t("slice.erb", context))
|
25
|
+
fs.write(fs.join(directory, "action.rb"), t("action.erb", context))
|
26
|
+
# fs.write(fs.join(directory, "/view.rb"), t("view.erb", context))
|
27
|
+
# fs.write(fs.join(directory, "/entities.rb"), t("entities.erb", context))
|
28
|
+
# fs.write(fs.join(directory, "/repository.rb"), t("repository.erb", context))
|
29
|
+
|
30
|
+
fs.write(fs.join(directory, "actions/.keep"), t("keep.erb", context))
|
31
|
+
# fs.write(fs.join(directory, views/.keep"), t("keep.erb", context))
|
32
|
+
# fs.write(fs.join(directory, templates/.keep"), t("keep.erb", context))
|
33
|
+
# fs.write(fs.join(directory, templates/layouts/.keep"), t("keep.erb", context))
|
34
|
+
# fs.write(fs.join(directory, entities/.keep"), t("keep.erb", context))
|
35
|
+
# fs.write(fs.join(directory, repositories/.keep"), t("keep.erb", context))
|
38
36
|
end
|
39
37
|
|
40
38
|
private
|
@@ -7,9 +7,9 @@ module Hanami
|
|
7
7
|
module Generators
|
8
8
|
module App
|
9
9
|
class SliceContext < Generators::Context
|
10
|
-
def initialize(inflector, app, slice,
|
10
|
+
def initialize(inflector, app, slice, url)
|
11
11
|
@slice = slice
|
12
|
-
@
|
12
|
+
@url = url
|
13
13
|
super(inflector, app)
|
14
14
|
end
|
15
15
|
|
@@ -25,7 +25,7 @@ module Hanami
|
|
25
25
|
|
26
26
|
attr_reader :slice
|
27
27
|
|
28
|
-
attr_reader :
|
28
|
+
attr_reader :url
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -11,9 +11,9 @@ module Hanami
|
|
11
11
|
def inspect(include_arguments: false)
|
12
12
|
max_path_length = @stack.map { |(path)| path.length }.max
|
13
13
|
|
14
|
-
@stack.map { |path,
|
15
|
-
|
16
|
-
"#{path.ljust(max_path_length + 3)} #{format_middleware(
|
14
|
+
@stack.map { |path, middleware|
|
15
|
+
middleware.map { |(mware, arguments)|
|
16
|
+
"#{path.ljust(max_path_length + 3)} #{format_middleware(mware)}".tap { |line|
|
17
17
|
line << " #{format_arguments(arguments)}" if include_arguments
|
18
18
|
}
|
19
19
|
}
|
data/lib/hanami/cli/version.rb
CHANGED
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.
|
4
|
+
version: 2.0.0.beta4
|
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-
|
11
|
+
date: 2022-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -175,7 +175,7 @@ files:
|
|
175
175
|
- lib/hanami/cli/commands/app/generate/action.rb
|
176
176
|
- lib/hanami/cli/commands/app/generate/slice.rb
|
177
177
|
- lib/hanami/cli/commands/app/install.rb
|
178
|
-
- lib/hanami/cli/commands/app/
|
178
|
+
- lib/hanami/cli/commands/app/middleware.rb
|
179
179
|
- lib/hanami/cli/commands/app/routes.rb
|
180
180
|
- lib/hanami/cli/commands/app/server.rb
|
181
181
|
- lib/hanami/cli/commands/app/version.rb
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- lib/hanami/cli/commands/gem/new.rb
|
189
189
|
- lib/hanami/cli/commands/gem/version.rb
|
190
190
|
- lib/hanami/cli/error.rb
|
191
|
+
- lib/hanami/cli/files.rb
|
191
192
|
- lib/hanami/cli/generators/app/action.rb
|
192
193
|
- lib/hanami/cli/generators/app/action/action.erb
|
193
194
|
- lib/hanami/cli/generators/app/action/slice_action.erb
|
@@ -256,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
257
|
- !ruby/object:Gem::Version
|
257
258
|
version: 1.3.1
|
258
259
|
requirements: []
|
259
|
-
rubygems_version: 3.3.
|
260
|
+
rubygems_version: 3.3.7
|
260
261
|
signing_key:
|
261
262
|
specification_version: 4
|
262
263
|
summary: Hanami CLI
|