darkroom 0.0.9 → 0.0.10
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 +9 -0
- data/README.md +175 -131
- data/VERSION +1 -1
- data/lib/darkroom/asset.rb +173 -151
- data/lib/darkroom/darkroom.rb +140 -124
- data/lib/darkroom/delegate.rb +208 -101
- data/lib/darkroom/delegates/{css.rb → css_delegate.rb} +1 -0
- data/lib/darkroom/delegates/{html.rb → html_delegate.rb} +4 -3
- data/lib/darkroom/delegates/{htx.rb → htx_delegate.rb} +3 -2
- data/lib/darkroom/delegates/{javascript.rb → javascript_delegate.rb} +9 -8
- data/lib/darkroom/errors/asset_error.rb +6 -17
- data/lib/darkroom/errors/asset_not_found_error.rb +4 -8
- data/lib/darkroom/errors/circular_reference_error.rb +4 -8
- data/lib/darkroom/errors/duplicate_asset_error.rb +7 -16
- data/lib/darkroom/errors/invalid_path_error.rb +5 -14
- data/lib/darkroom/errors/missing_library_error.rb +7 -16
- data/lib/darkroom/errors/processing_error.rb +13 -20
- data/lib/darkroom/errors/unrecognized_extension_error.rb +4 -8
- data/lib/darkroom/version.rb +1 -1
- data/lib/darkroom.rb +4 -6
- metadata +17 -21
@@ -1,31 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Darkroom
|
4
|
-
##
|
5
4
|
# Error class used when a needed library cannot be loaded. See Asset#require_libs.
|
6
|
-
#
|
7
5
|
class MissingLibraryError < StandardError
|
8
6
|
attr_reader(:library, :need, :extension)
|
9
7
|
|
10
|
-
|
11
|
-
# Creates a new instance.
|
12
|
-
#
|
13
|
-
# [library] Name of the library that's missing.
|
14
|
-
# [need] Reason the library is needed ('pre-process', 'post-process', or 'minify').
|
15
|
-
# [extension] Extension of the type of asset that needs the library.
|
8
|
+
# Public: Create a new instance.
|
16
9
|
#
|
10
|
+
# library - String name of the library that's missing.
|
11
|
+
# need - Symbol or String reason the library is needed (:compile, :finalize, or :minify).
|
12
|
+
# extension - String extension of the type of asset that needs the library.
|
17
13
|
def initialize(library, need, extension)
|
14
|
+
super("Cannot #{need} #{extension} files: '#{library}' library not available [hint: try adding " \
|
15
|
+
"gem('#{library}') to your Gemfile]")
|
16
|
+
|
18
17
|
@library = library
|
19
18
|
@need = need
|
20
19
|
@extension = extension
|
21
20
|
end
|
22
|
-
|
23
|
-
##
|
24
|
-
# Returns a string representation of the error.
|
25
|
-
#
|
26
|
-
def to_s
|
27
|
-
"Cannot #{@need} #{@extension} file(s): #{@library} library not available [hint: try adding "\
|
28
|
-
"gem('#{@library}') to your Gemfile]"
|
29
|
-
end
|
30
21
|
end
|
31
22
|
end
|
@@ -1,35 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Darkroom
|
4
|
-
##
|
5
4
|
# Error class used to wrap all accumulated errors encountered during asset processing.
|
6
|
-
#
|
7
5
|
class ProcessingError < StandardError
|
8
|
-
|
9
|
-
|
10
|
-
#
|
11
|
-
# [errors] Error or array of errors.
|
6
|
+
include(Enumerable)
|
7
|
+
|
8
|
+
# Public: Create a new instance.
|
12
9
|
#
|
10
|
+
# errors - Error or Array of errors.
|
13
11
|
def initialize(errors)
|
14
12
|
@errors = Array(errors)
|
15
|
-
end
|
16
13
|
|
17
|
-
|
18
|
-
# Returns a string representation of the error.
|
19
|
-
#
|
20
|
-
def to_s
|
21
|
-
lines = @errors.map do |error|
|
22
|
-
error.kind_of?(AssetError) ? error.to_s : "#{error.inspect} at #{error.backtrace[0]}"
|
23
|
-
end
|
24
|
-
|
25
|
-
"Errors were encountered while processing assets:\n #{lines.join("\n ")}"
|
14
|
+
super("Errors were encountered while processing assets:\n #{@errors.map(&:to_s).join("\n ")}")
|
26
15
|
end
|
27
16
|
|
28
|
-
|
29
|
-
#
|
17
|
+
# Public: Iterate over each error.
|
18
|
+
#
|
19
|
+
# block - Block to call and pass each error to.
|
20
|
+
#
|
21
|
+
# Yields each error to the provided block.
|
30
22
|
#
|
31
|
-
|
32
|
-
|
23
|
+
# Returns Enumerator object.
|
24
|
+
def each(&block)
|
25
|
+
@errors.each(&block)
|
33
26
|
end
|
34
27
|
end
|
35
28
|
end
|
@@ -3,17 +3,13 @@
|
|
3
3
|
require_relative('asset_error')
|
4
4
|
|
5
5
|
class Darkroom
|
6
|
-
##
|
7
6
|
# Error class used when a reference is made to a file with an unrecognized extension.
|
8
|
-
#
|
9
7
|
class UnrecognizedExtensionError < AssetError
|
10
|
-
|
11
|
-
# Creates a new instance.
|
12
|
-
#
|
13
|
-
# [file] File with the unrecognized extension.
|
14
|
-
# [source_path] Path of the asset that contains the error.
|
15
|
-
# [source_line_num] Line number in the asset where the error is located.
|
8
|
+
# Public: Create a new instance.
|
16
9
|
#
|
10
|
+
# file - String file path with the unrecognized extension.
|
11
|
+
# source_path - String path of the asset that contains the error.
|
12
|
+
# source_line_num - Integer line number in the asset file where the error is located.
|
17
13
|
def initialize(file, source_path = nil, source_line_num = nil)
|
18
14
|
super('File extension not recognized', file, source_path, source_line_num)
|
19
15
|
end
|
data/lib/darkroom/version.rb
CHANGED
data/lib/darkroom.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require('darkroom/asset')
|
4
3
|
require('darkroom/darkroom')
|
5
|
-
require('darkroom/delegate')
|
6
4
|
require('darkroom/version')
|
7
5
|
|
8
|
-
require('darkroom/delegates/
|
9
|
-
require('darkroom/delegates/
|
10
|
-
require('darkroom/delegates/
|
11
|
-
require('darkroom/delegates/
|
6
|
+
require('darkroom/delegates/css_delegate')
|
7
|
+
require('darkroom/delegates/html_delegate')
|
8
|
+
require('darkroom/delegates/htx_delegate')
|
9
|
+
require('darkroom/delegates/javascript_delegate')
|
12
10
|
|
13
11
|
Darkroom.register('.apng', 'image/apng')
|
14
12
|
Darkroom.register('.avif', 'image/avif')
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: darkroom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nate Pickens
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-02-19 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: base64
|
@@ -25,38 +24,37 @@ dependencies:
|
|
25
24
|
- !ruby/object:Gem::Version
|
26
25
|
version: '0.2'
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
27
|
+
name: minitest
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - "~>"
|
32
31
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
32
|
+
version: '5.24'
|
34
33
|
type: :development
|
35
34
|
prerelease: false
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
37
36
|
requirements:
|
38
37
|
- - "~>"
|
39
38
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
39
|
+
version: '5.24'
|
41
40
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: minitest
|
41
|
+
name: minitest-reporters
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
44
|
- - "~>"
|
46
45
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
46
|
+
version: '1.7'
|
48
47
|
type: :development
|
49
48
|
prerelease: false
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
51
50
|
requirements:
|
52
51
|
- - "~>"
|
53
52
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
53
|
+
version: '1.7'
|
55
54
|
description: Darkroom provides web asset compilation, bundling, and minification without
|
56
55
|
any external tools, manifest files, or special comment syntax. CSS and JavaScript
|
57
56
|
bundles are automatically generated based on import statements native to each language.
|
58
57
|
Darkroom is also extensible, allowing support to be added for arbitrary file types.
|
59
|
-
email:
|
60
58
|
executables: []
|
61
59
|
extensions: []
|
62
60
|
extra_rdoc_files: []
|
@@ -69,10 +67,10 @@ files:
|
|
69
67
|
- lib/darkroom/asset.rb
|
70
68
|
- lib/darkroom/darkroom.rb
|
71
69
|
- lib/darkroom/delegate.rb
|
72
|
-
- lib/darkroom/delegates/
|
73
|
-
- lib/darkroom/delegates/
|
74
|
-
- lib/darkroom/delegates/
|
75
|
-
- lib/darkroom/delegates/
|
70
|
+
- lib/darkroom/delegates/css_delegate.rb
|
71
|
+
- lib/darkroom/delegates/html_delegate.rb
|
72
|
+
- lib/darkroom/delegates/htx_delegate.rb
|
73
|
+
- lib/darkroom/delegates/javascript_delegate.rb
|
76
74
|
- lib/darkroom/errors/asset_error.rb
|
77
75
|
- lib/darkroom/errors/asset_not_found_error.rb
|
78
76
|
- lib/darkroom/errors/circular_reference_error.rb
|
@@ -88,9 +86,8 @@ licenses:
|
|
88
86
|
metadata:
|
89
87
|
bug_tracker_uri: https://github.com/npickens/darkroom/issues
|
90
88
|
changelog_uri: https://github.com/npickens/darkroom/blob/master/CHANGELOG.md
|
91
|
-
documentation_uri: https://github.com/npickens/darkroom/blob/0.0.
|
92
|
-
source_code_uri: https://github.com/npickens/darkroom/tree/0.0.
|
93
|
-
post_install_message:
|
89
|
+
documentation_uri: https://github.com/npickens/darkroom/blob/0.0.10/README.md
|
90
|
+
source_code_uri: https://github.com/npickens/darkroom/tree/0.0.10
|
94
91
|
rdoc_options: []
|
95
92
|
require_paths:
|
96
93
|
- lib
|
@@ -98,15 +95,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
95
|
requirements:
|
99
96
|
- - ">="
|
100
97
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
98
|
+
version: 3.0.0
|
102
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
100
|
requirements:
|
104
101
|
- - ">="
|
105
102
|
- !ruby/object:Gem::Version
|
106
103
|
version: 2.0.0
|
107
104
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
109
|
-
signing_key:
|
105
|
+
rubygems_version: 3.6.3
|
110
106
|
specification_version: 4
|
111
|
-
summary: A
|
107
|
+
summary: A simple and straightforward web asset management library.
|
112
108
|
test_files: []
|