hanami-cli 2.2.0.rc1 → 2.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6ace925a2c5186088911d5df3d309d72ee0359e4691f70199c3f53f99db0fc3
4
- data.tar.gz: 7fd1959ffcaf64ebc0b95a839a68ed1f052370ed6a7043863068087a1893489d
3
+ metadata.gz: f7c2e2213ec21d8e65e4a07b1f5035d082e58ff8e5f0368112aa58b4be53a4f2
4
+ data.tar.gz: 7191dcdef8dd7683ada1caf68fab01c6047c3b9368006ce821d01453b77fb00d
5
5
  SHA512:
6
- metadata.gz: 6133308e48b0623616598a23d1b0fe079b08f31e991791e6ae76867441eec1d25427deef5755e445fd8c3f2f2e294c143eeb58272e278721897ab290c48024cb
7
- data.tar.gz: '068ad2b891fa99e16ff6c0be6931e98d708ce3c7bab67e0dd3fd354ef00f4bdb110ad84007592ccc98e65ebbe643f7e4420b0406f8b0b76500968a5571718398'
6
+ metadata.gz: 7ee16c77ac4c7f721c02678ba7bbe1735ba84f66b41a04c738706ab704600230b58ae573c12a3b460851bffb7177403c7df402f8242afdd35949a670b6c30595
7
+ data.tar.gz: a93f0f48ae108ecdcd0f33812b0c83c09a88e9891c3712edd461c55cba09b3b96df3067828ff3f14cad0bc03e320cb634fc9098fd6777107f4d75b8dfec88c57
data/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  Hanami Command Line Interface
4
4
 
5
+ ## v2.2.1 - 2024-11-12
6
+
7
+ ### Changed
8
+
9
+ - [Tim Riley] Run a bundle install inside `hanami install`. Combined with first-party extension gems modifying the new app's `Gemfile` via a `before "install"` command hook, this ensures that all necessary gems are installed duringthe `hanami new` command. (#269)
10
+
11
+ ### Fixed
12
+
13
+ - [Tim Riley] Allow `hanami new` to be called with `--skip-db` (#266)
14
+
15
+ ## v2.2.0 - 2024-11-05
16
+
17
+ ### Changed
18
+
19
+ - [Kyle Plump] Add `--gateway` optiopn to `generate relation` (#261)
20
+ - [Tim Riley] Depend on stable release of dry-operation in new app `Gemfile` (#262)
21
+ - [Tim Riley] Depend on newser dry-types with a simpler version constraint in new app `Gemfile` (#263)
22
+ - [Adam Lassek] Point to Hanami's own migrations guide from generated migration files (#264)
23
+
5
24
  ## v2.2.0.rc1 - 2024-10-29
6
25
 
7
26
  ### Added
@@ -15,10 +15,10 @@ module Hanami
15
15
  option :slice, required: false, desc: "Slice name"
16
16
 
17
17
  example [
18
- %(operations.create_user (MyApp::Operations::CreateUser)),
19
- %(operations.user.create (MyApp::Operations::Create::User)),
20
- %(operations.create_user --slice=admin (Admin::Operations::CreateUser)),
21
- %(Operations::CreateUser (MyApp::Operations::CreateUser)),
18
+ %(isbn_decoder (MyApp::IsbnDecoder)),
19
+ %(recommenders.fiction (MyApp::Recommenders::Fiction)),
20
+ %(isbn_decoder --slice=admin (Admin::IsbnDecoder)),
21
+ %(Exporters::Complete::CSV (MyApp::Exporters::Complete::CSV)),
22
22
  ]
23
23
  attr_reader :generator
24
24
  private :generator
@@ -9,11 +9,13 @@ module Hanami
9
9
  # @api private
10
10
  class Relation < Command
11
11
  argument :name, required: true, desc: "Relation name"
12
+ option :gateway, desc: "Generate relation for gateway"
12
13
 
13
14
  example [
14
15
  %(books (MyApp::Relation::Book)),
15
16
  %(books/drafts (MyApp::Relations::Books::Drafts)),
16
17
  %(books --slice=admin (Admin::Relations::Books)),
18
+ %(books --slice=admin --gateway=extra (Admin::Relations::Books)),
17
19
  ]
18
20
 
19
21
  # @since 2.2.0
@@ -21,6 +23,24 @@ module Hanami
21
23
  def generator_class
22
24
  Generators::App::Relation
23
25
  end
26
+
27
+ def call(name:, slice: nil, gateway: nil)
28
+ if slice
29
+ generator.call(
30
+ key: name,
31
+ namespace: slice,
32
+ base_path: fs.join("slices", inflector.underscore(slice)),
33
+ gateway: gateway
34
+ )
35
+ else
36
+ generator.call(
37
+ key: name,
38
+ namespace: app.namespace,
39
+ base_path: "app",
40
+ gateway: gateway
41
+ )
42
+ end
43
+ end
24
44
  end
25
45
  end
26
46
  end
@@ -33,9 +33,21 @@ module Hanami
33
33
  # @api private
34
34
  option :head, type: :flag, desc: "Install head deps", default: DEFAULT_HEAD
35
35
 
36
+ # @api private
37
+ private attr_reader :bundler
38
+
39
+ def initialize(
40
+ fs:,
41
+ bundler: CLI::Bundler.new(fs: fs),
42
+ **opts
43
+ )
44
+ @bundler = bundler
45
+ end
46
+
36
47
  # @since 2.0.0
37
48
  # @api private
38
49
  def call(head: DEFAULT_HEAD, **)
50
+ bundler.install!
39
51
  end
40
52
  end
41
53
  end
@@ -126,7 +126,6 @@ module Hanami
126
126
  app = inflector.underscore(app)
127
127
 
128
128
  raise PathAlreadyExistsError.new(app) if fs.exist?(app)
129
- raise ConflictingOptionsError.new("--skip-db", "--database") if skip_db && database
130
129
 
131
130
  normalized_database ||= normalize_database(database)
132
131
 
@@ -144,11 +143,11 @@ module Hanami
144
143
  if skip_install
145
144
  out.puts "Skipping installation, please enter `#{app}' directory and run `bundle exec hanami install'"
146
145
  else
147
- out.puts "Running Bundler install..."
146
+ out.puts "Running bundle install..."
148
147
  bundler.install!
149
148
 
150
149
  unless skip_assets
151
- out.puts "Running NPM install..."
150
+ out.puts "Running npm install..."
152
151
  system_call.call("npm", ["install"]).tap do |result|
153
152
  unless result.successful?
154
153
  puts "NPM ERROR:"
@@ -157,7 +156,7 @@ module Hanami
157
156
  end
158
157
  end
159
158
 
160
- out.puts "Running Hanami install..."
159
+ out.puts "Running hanami install..."
161
160
  run_install_command!(head: head)
162
161
  end
163
162
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "erb"
4
4
  require "dry/files"
5
+
5
6
  module Hanami
6
7
  module CLI
7
8
  module Generators
@@ -55,7 +55,7 @@ module Hanami
55
55
  ROM::SQL.migration do
56
56
  # Add your migration here.
57
57
  #
58
- # See https://sequel.jeremyevans.net/rdoc/files/doc/migration_rdoc.html for details.
58
+ # See https://guides.hanamirb.org/v2.2/database/migrations/ for details.
59
59
  change do
60
60
  end
61
61
  end
@@ -19,8 +19,11 @@ module Hanami
19
19
 
20
20
  # @since 2.2.0
21
21
  # @api private
22
- def call(key:, namespace:, base_path:)
22
+ def call(key:, namespace:, base_path:, gateway:)
23
23
  schema_name = key.split(KEY_SEPARATOR).last
24
+ body_content = ["schema :#{schema_name}, infer: true"]
25
+
26
+ body_content.prepend("gateway :#{gateway}") if gateway
24
27
 
25
28
  RubyFileWriter.new(
26
29
  fs: fs,
@@ -31,7 +34,7 @@ module Hanami
31
34
  base_path: base_path,
32
35
  extra_namespace: "Relations",
33
36
  relative_parent_class: "DB::Relation",
34
- body: ["schema :#{schema_name}, infer: true"],
37
+ body: body_content,
35
38
  )
36
39
  end
37
40
 
@@ -14,8 +14,8 @@ source "https://rubygems.org"
14
14
  <%= hanami_gem("validations") %>
15
15
  <%= hanami_gem("view") %>
16
16
 
17
- gem "dry-types", "~> 1.0", ">= 1.6.1"
18
- gem "dry-operation", github: "dry-rb/dry-operation"
17
+ gem "dry-types", "~> 1.7"
18
+ gem "dry-operation"
19
19
  gem "puma"
20
20
  gem "rake"
21
21
  <%- if generate_sqlite? -%>
@@ -6,6 +6,6 @@ module Hanami
6
6
  #
7
7
  # @api public
8
8
  # @since 2.0.0
9
- VERSION = "2.2.0.rc1"
9
+ VERSION = "2.2.1"
10
10
  end
11
11
  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.2.0.rc1
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-29 00:00:00.000000000 Z
11
+ date: 2024-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler