hanami-cli 2.0.0.alpha3 → 2.0.0.alpha4
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/.rubocop.yml +4 -1
- data/CHANGELOG.md +8 -0
- data/Gemfile +1 -0
- data/hanami-cli.gemspec +3 -0
- data/lib/hanami/cli/commands/db/utils/database.rb +4 -4
- data/lib/hanami/cli/commands/monolith/console.rb +4 -5
- data/lib/hanami/cli/commands/monolith/db/version.rb +1 -1
- data/lib/hanami/cli/generators/monolith/action.rb +1 -1
- data/lib/hanami/cli/repl/irb.rb +16 -19
- data/lib/hanami/cli/repl/pry.rb +1 -1
- data/lib/hanami/cli/version.rb +1 -1
- data/lib/hanami/console/context.rb +19 -5
- data/lib/hanami/console/plugins/slice_readers.rb +3 -21
- metadata +4 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de637259c61267b5589f64a633fb38ba6e7eb5a8f5dcc0bd689a3942a57b6dba
|
4
|
+
data.tar.gz: 87be564477f075f9a357edcad9a39e69a74bc6971de10bd353f22f75f0964b01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23aa8295f0f6148ce79041296e4ea6a51a42378672ac95fadd0cbcd8b43f9e3325ff4fb7d263993331d620ae64daf099c3520a3b62ba253ebba5d9b6490cbebe
|
7
|
+
data.tar.gz: a5d92abd72e92442fb5c9e6a3471160906172dbd3013dd2248259deb233f1ceccb17faf9a320bec0b27a7fe9c44d2ab3d820af6b4152618e9f7b662e57e06832
|
data/.rubocop.yml
CHANGED
@@ -3,10 +3,13 @@
|
|
3
3
|
AllCops:
|
4
4
|
SuggestExtensions: false
|
5
5
|
inherit_from:
|
6
|
-
- https://raw.githubusercontent.com/hanami/devtools/
|
6
|
+
- https://raw.githubusercontent.com/hanami/devtools/main/.rubocop.yml
|
7
7
|
Layout/LineLength:
|
8
8
|
Exclude:
|
9
9
|
- Gemfile
|
10
|
+
Lint/EmptyFile:
|
11
|
+
Exclude:
|
12
|
+
- "spec/fixtures/**/*.rb"
|
10
13
|
Naming/HeredocDelimiterNaming:
|
11
14
|
Enabled: false
|
12
15
|
Naming/MethodParameterName:
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Hanami::CLI
|
2
2
|
Hanami Command Line Interface
|
3
3
|
|
4
|
+
## v2.0.0.alpha4 - 2021-12-07
|
5
|
+
### Added
|
6
|
+
- [Tim Riley] Display a custom prompt when using irb-based console (consistent with pry-based console)
|
7
|
+
- [Phil Arndt] Support `postgresql://` URL schemes (in addition to existing `postgres://` support) for `db` subcommands
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
- [Tim Riley] Ensure slice helper methods work in console (e.g. top-level `main` method will return `Main::Slice` if an app has a "main" slice defined)
|
11
|
+
|
4
12
|
## v2.0.0.alpha3 - 2021-11-09
|
5
13
|
No changes.
|
6
14
|
|
data/Gemfile
CHANGED
@@ -9,6 +9,7 @@ unless ENV["CI"]
|
|
9
9
|
end
|
10
10
|
|
11
11
|
gem "hanami", require: false, git: "https://github.com/hanami/hanami.git", branch: "main"
|
12
|
+
gem "hanami-router", require: false, git: "https://github.com/hanami/router.git", branch: "main"
|
12
13
|
gem "hanami-view", require: false, git: "https://github.com/hanami/view.git", branch: "main"
|
13
14
|
|
14
15
|
gem "rack"
|
data/hanami-cli.gemspec
CHANGED
@@ -19,6 +19,10 @@ module Hanami
|
|
19
19
|
require_relative("postgres")
|
20
20
|
Postgres
|
21
21
|
},
|
22
|
+
"postgresql" => -> {
|
23
|
+
require_relative("postgres")
|
24
|
+
Postgres
|
25
|
+
},
|
22
26
|
"mysql" => -> {
|
23
27
|
require_relative("mysql")
|
24
28
|
Mysql
|
@@ -74,10 +78,6 @@ module Hanami
|
|
74
78
|
config.db_name
|
75
79
|
end
|
76
80
|
|
77
|
-
def applied_migrations
|
78
|
-
sequel_migrator.applied_migrations
|
79
|
-
end
|
80
|
-
|
81
81
|
def gateway
|
82
82
|
rom_config.gateways[:default]
|
83
83
|
end
|
@@ -11,13 +11,13 @@ module Hanami
|
|
11
11
|
# @api public
|
12
12
|
class Console < Application
|
13
13
|
REPLS = {
|
14
|
-
"pry" => -> *args {
|
14
|
+
"pry" => -> (*args) {
|
15
15
|
begin
|
16
16
|
require "hanami/cli/repl/pry"
|
17
17
|
Repl::Pry.new(*args)
|
18
|
-
rescue LoadError; end
|
18
|
+
rescue LoadError; end # rubocop:disable Lint/SuppressedException
|
19
19
|
},
|
20
|
-
"irb" => -> *args {
|
20
|
+
"irb" => -> (*args) {
|
21
21
|
require "hanami/cli/repl/irb"
|
22
22
|
Repl::Irb.new(*args)
|
23
23
|
},
|
@@ -25,7 +25,7 @@ module Hanami
|
|
25
25
|
|
26
26
|
desc "Application REPL"
|
27
27
|
|
28
|
-
option :repl, required: false, desc: "REPL gem that should be used"
|
28
|
+
option :repl, required: false, desc: "REPL gem that should be used ('pry' or 'irb')"
|
29
29
|
|
30
30
|
# @api private
|
31
31
|
def call(repl: nil, **opts)
|
@@ -35,7 +35,6 @@ module Hanami
|
|
35
35
|
|
36
36
|
private
|
37
37
|
|
38
|
-
# @api private
|
39
38
|
def resolve_engine(repl, opts)
|
40
39
|
if repl
|
41
40
|
REPLS.fetch(repl).(application, opts)
|
@@ -12,7 +12,7 @@ module Hanami
|
|
12
12
|
|
13
13
|
option :target, desc: "Target migration number", aliases: ["-t"]
|
14
14
|
|
15
|
-
def call(target: nil, **)
|
15
|
+
def call(target: nil, **) # rubocop:disable Lint/UnusedMethodArgument
|
16
16
|
migration = database.applied_migrations.last
|
17
17
|
version = migration ? File.basename(migration, ".*") : "not available"
|
18
18
|
|
@@ -104,7 +104,7 @@ module Hanami
|
|
104
104
|
alias_method :t, :template
|
105
105
|
|
106
106
|
def route_url(controller, action, url)
|
107
|
-
CLI::URL.call(url || "/#{controller.join('/')}" + ROUTE_RESTFUL_URL_SUFFIXES.fetch(action))
|
107
|
+
CLI::URL.call(url || ("/#{controller.join('/')}" + ROUTE_RESTFUL_URL_SUFFIXES.fetch(action)))
|
108
108
|
end
|
109
109
|
|
110
110
|
def route_http(action, http)
|
data/lib/hanami/cli/repl/irb.rb
CHANGED
@@ -11,29 +11,26 @@ module Hanami
|
|
11
11
|
class Irb < Core
|
12
12
|
# @api public
|
13
13
|
def start
|
14
|
-
|
15
|
-
TOPLEVEL_BINDING.eval('self').extend(context)
|
16
|
-
|
17
|
-
IRB.conf[:PROMPT] = {}
|
14
|
+
$stdout.sync = true
|
18
15
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
ARGV.shift until ARGV.empty?
|
17
|
+
TOPLEVEL_BINDING.eval("self").extend(context)
|
18
|
+
|
19
|
+
# Initializes the IRB.conf; our own conf changes must be after this
|
20
|
+
IRB.setup(nil)
|
21
|
+
|
22
|
+
IRB.conf[:PROMPT][:HANAMI] = {
|
23
|
+
AUTO_INDENT: true,
|
24
|
+
PROMPT_I: "#{prompt}> ",
|
25
|
+
PROMPT_N: "#{prompt}> ",
|
26
|
+
PROMPT_S: "#{prompt} %l> ",
|
27
|
+
PROMPT_C: "#{prompt} ?> ",
|
28
|
+
RETURN: "=> %s\n"
|
25
29
|
}
|
26
30
|
|
27
|
-
IRB.conf[:PROMPT_MODE] = :
|
28
|
-
|
29
|
-
IRB.start
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
31
|
+
IRB.conf[:PROMPT_MODE] = :HANAMI
|
33
32
|
|
34
|
-
|
35
|
-
def conf
|
36
|
-
@conf ||= IRB.conf
|
33
|
+
IRB::Irb.new.run
|
37
34
|
end
|
38
35
|
end
|
39
36
|
end
|
data/lib/hanami/cli/repl/pry.rb
CHANGED
data/lib/hanami/cli/version.rb
CHANGED
@@ -9,24 +9,38 @@ module Hanami
|
|
9
9
|
# @api private
|
10
10
|
# @since 2.0.0
|
11
11
|
class Context < Module
|
12
|
+
# @api private
|
13
|
+
attr_reader :application
|
14
|
+
|
12
15
|
# @api private
|
13
16
|
def initialize(application)
|
17
|
+
super()
|
14
18
|
@application = application
|
19
|
+
|
20
|
+
define_context_methods
|
21
|
+
include Plugins::SliceReaders.new(application)
|
15
22
|
end
|
16
23
|
|
17
|
-
|
18
|
-
def extended(other)
|
19
|
-
super
|
20
|
-
app = @application
|
24
|
+
private
|
21
25
|
|
22
|
-
|
26
|
+
def define_context_methods
|
27
|
+
app = application
|
23
28
|
|
24
29
|
define_method(:inspect) do
|
25
30
|
"#<#{self.class} application=#{app} env=#{app.config.env}>"
|
26
31
|
end
|
27
32
|
|
33
|
+
define_method(:app) do
|
34
|
+
app
|
35
|
+
end
|
36
|
+
|
37
|
+
define_method(:application) do
|
38
|
+
app
|
39
|
+
end
|
40
|
+
|
28
41
|
define_method(:method_missing) do |name, *args, &block|
|
29
42
|
return app.public_send(name, *args, &block) if app.respond_to?(name)
|
43
|
+
|
30
44
|
super(name, *args, &block)
|
31
45
|
end
|
32
46
|
|
@@ -10,29 +10,11 @@ module Hanami
|
|
10
10
|
class SliceReaders < Module
|
11
11
|
# @api private
|
12
12
|
def initialize(application)
|
13
|
+
super()
|
14
|
+
|
13
15
|
application.slices.each do |(name, slice)|
|
14
16
|
define_method(name) do
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# @api private
|
21
|
-
# @since 2.0.0
|
22
|
-
class SliceDelegator < SimpleDelegator
|
23
|
-
# @api private
|
24
|
-
def respond_to_missing?(name)
|
25
|
-
key?(name)
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
# @api private
|
31
|
-
def method_missing(name, *args, &block)
|
32
|
-
if args.empty? && key?(name)
|
33
|
-
self[name]
|
34
|
-
else
|
35
|
-
super
|
17
|
+
slice
|
36
18
|
end
|
37
19
|
end
|
38
20
|
end
|
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.alpha4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -210,10 +210,7 @@ homepage: https://hanamirb.org
|
|
210
210
|
licenses:
|
211
211
|
- MIT
|
212
212
|
metadata:
|
213
|
-
|
214
|
-
homepage_uri: https://hanamirb.org
|
215
|
-
source_code_uri: https://github.com/hanami/cli
|
216
|
-
changelog_uri: https://github.com/hanami/cli/blob/master/CHANGELOG.md
|
213
|
+
rubygems_mfa_required: 'true'
|
217
214
|
post_install_message:
|
218
215
|
rdoc_options: []
|
219
216
|
require_paths:
|
@@ -229,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
226
|
- !ruby/object:Gem::Version
|
230
227
|
version: 1.3.1
|
231
228
|
requirements: []
|
232
|
-
rubygems_version: 3.2.
|
229
|
+
rubygems_version: 3.2.29
|
233
230
|
signing_key:
|
234
231
|
specification_version: 4
|
235
232
|
summary: Hanami CLI
|