hanami-assets 2.1.0.rc2 → 2.1.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71f6b2236cb6f96e86f9bbf25453b179685db554ef87faa5c64a09457aaefea3
4
- data.tar.gz: 513533d8e23d48cc02dbaad76188724c934ddc4bf51bcd31b706fa61ef611a35
3
+ metadata.gz: 524bcdefad223b559accd2e027f37b4a2b28af80ac8db368ece9c18d6676dcd6
4
+ data.tar.gz: 9baf4a521bbe0549503d2b79bb4ef38b0a65aeb141f2f9299c599edb7e78f2f5
5
5
  SHA512:
6
- metadata.gz: b47ce4c26181b7f0bb21ec64522162fd212ba33ab9284bdbfafd7c8b96bb983ca90a220266f1a5608dd0b990ca4ed40dd0a130445aab6de60f824ca018423347
7
- data.tar.gz: 4df3a64885b684132af03c206ae224ad1f3855180aac4b6f15fb323dba8199f5195a4a0c5f6123854427888e96ff2b3201d037a6035b5a396b5561f9c2a5d26a
6
+ metadata.gz: d6203631c1b5a42cd593e35f37a2274803c0a651e3d81f479a2c5c4ffb60e1df781397b26d087a5d36fd71435222ba7770c9c83b5458d3be55ab52f578501190
7
+ data.tar.gz: 3ae4c5aceccd0062ce40c73fe259320074bf14300bcc5aebd5d290af5ff1bce7db086c9b37317bc1ac8bcce07c7b52c91bd28dd85d882c35e7a586529fd84fc4
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Hanami::Assets
2
2
  Assets management for Ruby web applications
3
3
 
4
+ ## v2.1.0.rc3 - 2024-02-16
5
+ ### Changed
6
+ - [Tim Riley] Require a `root:` argument when initializing `Hanami::Assets`. This should be the directory containing the compiled assets and their `assets.json` manifest file.
7
+ - [Tim Riley] Removed `manifest_path` setting; the manifest path is no longer user-configurable.
8
+ - [Tim Riley] Replaced `package_manager_run_command` setting with `node_command` setting.
9
+ - [Tim Riley] Removed unused `sources`, `entry_point_patterns` and `destination` settings.
10
+ - [Tim Riley] Removed `bin/hanami-assets` executable.
11
+
4
12
  ## v2.1.0.rc2 - 2023-11-08
5
13
 
6
14
  ## v2.1.0.rc1 - 2023-11-01
@@ -7,11 +7,6 @@ module Hanami
7
7
  # @since 2.1.0
8
8
  # @api private
9
9
  class BaseUrl
10
- # @since 2.1.0
11
- # @api private
12
- SEPARATOR = "/"
13
- private_constant :SEPARATOR
14
-
15
10
  # @since 2.1.0
16
11
  # @api private
17
12
  attr_reader :url
@@ -17,12 +17,12 @@ module Hanami
17
17
  BASE_URL = ""
18
18
  private_constant :BASE_URL
19
19
 
20
- # @!attribute [rw] package_manager_run_command
20
+ # @!attribute [rw] node_command
21
21
  # @return [String]
22
22
  #
23
23
  # @api public
24
24
  # @since 2.1.0
25
- setting :package_manager_run_command, default: "npm run --silent"
25
+ setting :node_command, default: "node"
26
26
 
27
27
  # @!attribute [rw] path_prefix
28
28
  # @return [String]
@@ -51,13 +51,6 @@ module Hanami
51
51
  # @since 2.1.0
52
52
  setting :base_url, constructor: -> url { BaseUrl.new(url.to_s) }
53
53
 
54
- # @!attribute [rw] manifest_path
55
- # @return [String, nil]
56
- #
57
- # @api public
58
- # @since 2.1.0
59
- setting :manifest_path
60
-
61
54
  # @api public
62
55
  # @since 2.1.0
63
56
  def initialize(**values)
@@ -9,13 +9,6 @@ module Hanami
9
9
  class Error < ::StandardError
10
10
  end
11
11
 
12
- # Error raised when assets config is not valid.
13
- #
14
- # @api public
15
- # @since 2.1.0
16
- class ConfigError < Error
17
- end
18
-
19
12
  # Error returned when the assets manifest file is missing.
20
13
  #
21
14
  # @api public
@@ -5,6 +5,6 @@ module Hanami
5
5
  # Defines the version
6
6
  #
7
7
  # @since 0.1.0
8
- VERSION = "2.1.0.rc2"
8
+ VERSION = "2.1.0.rc3"
9
9
  end
10
10
  end
data/lib/hanami/assets.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "json"
4
+ require "pathname"
4
5
  require "zeitwerk"
5
6
 
6
7
  module Hanami
@@ -30,17 +31,22 @@ module Hanami
30
31
 
31
32
  # @api private
32
33
  # @since 2.1.0
33
- SEPARATOR = "/"
34
- private_constant :SEPARATOR
34
+ MANIFEST_PATH = "assets.json"
35
+ private_constant :MANIFEST_PATH
35
36
 
36
37
  # @api private
37
38
  # @since 2.1.0
38
39
  attr_reader :config
39
40
 
41
+ # @api private
42
+ # @since 2.1.0
43
+ attr_reader :root
44
+
40
45
  # @api public
41
46
  # @since 2.1.0
42
- def initialize(config:)
47
+ def initialize(config:, root:)
43
48
  @config = config
49
+ @root = Pathname(root)
44
50
  end
45
51
 
46
52
  # Returns the asset at the given path.
@@ -92,15 +98,13 @@ module Hanami
92
98
  def manifest
93
99
  return @manifest if instance_variable_defined?(:@manifest)
94
100
 
95
- unless config.manifest_path
96
- raise ConfigError, "no manifest_path configured"
97
- end
101
+ full_manifest_path = root.join(MANIFEST_PATH)
98
102
 
99
- unless File.exist?(config.manifest_path)
100
- raise ManifestMissingError.new(config.manifest_path)
103
+ unless full_manifest_path.exist?
104
+ raise ManifestMissingError.new(full_manifest_path.to_s)
101
105
  end
102
106
 
103
- @manifest = JSON.parse(File.read(config.manifest_path))
107
+ @manifest = JSON.parse(File.read(full_manifest_path))
104
108
  end
105
109
  end
106
110
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.rc2
4
+ version: 2.1.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-08 00:00:00.000000000 Z
11
+ date: 2024-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -145,15 +145,13 @@ dependencies:
145
145
  description: Assets management for Ruby web applications
146
146
  email:
147
147
  - me@lucaguidi.com
148
- executables:
149
- - hanami-assets
148
+ executables: []
150
149
  extensions: []
151
150
  extra_rdoc_files: []
152
151
  files:
153
152
  - CHANGELOG.md
154
153
  - LICENSE.md
155
154
  - README.md
156
- - bin/hanami-assets
157
155
  - hanami-assets.gemspec
158
156
  - lib/hanami-assets.rb
159
157
  - lib/hanami/assets.rb
@@ -178,11 +176,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
178
176
  version: '3.0'
179
177
  required_rubygems_version: !ruby/object:Gem::Requirement
180
178
  requirements:
181
- - - ">"
179
+ - - ">="
182
180
  - !ruby/object:Gem::Version
183
- version: 1.3.1
181
+ version: '0'
184
182
  requirements: []
185
- rubygems_version: 3.4.21
183
+ rubygems_version: 3.5.6
186
184
  signing_key:
187
185
  specification_version: 4
188
186
  summary: Assets management
data/bin/hanami-assets DELETED
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "optparse"
5
- require "pathname"
6
-
7
- options = {}
8
- OptionParser.new do |opts|
9
- opts.banner = "Usage: hanami-assets --config=path/to/config.rb"
10
-
11
- opts.on("-c", "--config FILE", "Path to config") do |c|
12
- options[:config] = c
13
- end
14
- end.parse!
15
-
16
- config = options.fetch(:config) { raise ArgumentError.new("You must specify a configuration file") }
17
- config = Pathname.new(config)
18
- config.exist? or raise ArgumentError.new("Cannot find configuration file: #{config}")
19
-
20
- require "hanami/assets"
21
- load config
22
-
23
- Hanami::Assets.deploy