tinypacker 0.1.0 → 0.2.0
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/README.md +21 -3
- data/lib/install/config/tinypacker.yml +14 -0
- data/lib/install/template.rb +10 -0
- data/lib/tasks/install.rake +9 -0
- data/lib/tinypacker/version.rb +1 -1
- data/lib/tinypacker.rb +8 -5
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06acf7757df545c98d3a0b8dd2456df838ad5703796a69910a0c8fb33dbbb1e9
|
4
|
+
data.tar.gz: 8e506319646a4e60dbbfd392a353db0e026591063b75d0f070da73fea08b76c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60ef145be61223969d2e0a3d1de33bca57f2395e91d5a5f5d704c36a4908dfe4fc3a3c8593d8d58ce85c0b3bc2d0d63211ac92e1f1b142a5144d68c48aad3224
|
7
|
+
data.tar.gz: 4fc4ff31dfda69e22d5dffeb2ced10085c6e92723bc826939bbb34e245ca9a59ede36092a40b898d7ac60b19cd8b4a9e70283ef60ddc3cde8bc05e3ecf020d74
|
data/README.md
CHANGED
@@ -18,9 +18,27 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install tinypacker
|
20
20
|
|
21
|
+
Finally, run the following to install
|
22
|
+
|
23
|
+
$ bundle exec rails tinypacker:install
|
24
|
+
|
21
25
|
## Usage
|
22
26
|
|
23
|
-
|
27
|
+
As with Webpacker, an asset manifest file is required to use Tinypacker. You need to specify the path of the asset manifest file in `manifest_path` of `tinypacker.yml`.
|
28
|
+
|
29
|
+
The format of the asset manifest file is as follows:
|
30
|
+
|
31
|
+
```json
|
32
|
+
{
|
33
|
+
"application.js": "/packs/js/application-12345.js",
|
34
|
+
}
|
35
|
+
```
|
36
|
+
|
37
|
+
And on the view file, you can use `javascript_pack_tag`.
|
38
|
+
|
39
|
+
```
|
40
|
+
<%= javascript_pack_tag 'application.js' %>
|
41
|
+
```
|
24
42
|
|
25
43
|
## Development
|
26
44
|
|
@@ -30,7 +48,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
30
48
|
|
31
49
|
## Contributing
|
32
50
|
|
33
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/taogawa/tinypacker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/taogawa/tinypacker/blob/main/CODE_OF_CONDUCT.md).
|
34
52
|
|
35
53
|
## License
|
36
54
|
|
@@ -38,4 +56,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
38
56
|
|
39
57
|
## Code of Conduct
|
40
58
|
|
41
|
-
Everyone interacting in the Tinypacker project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
59
|
+
Everyone interacting in the Tinypacker project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/taogawa/tinypacker/blob/main/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,9 @@
|
|
1
|
+
install_template_path = File.expand_path("../install/template.rb", __dir__).freeze
|
2
|
+
bin_path = ENV["BUNDLE_BIN"] || "./bin"
|
3
|
+
|
4
|
+
namespace :tinypacker do
|
5
|
+
desc "Install Tinypacker in this application"
|
6
|
+
task :install do
|
7
|
+
exec "#{RbConfig.ruby} #{bin_path}/rails app:template LOCATION=#{install_template_path}"
|
8
|
+
end
|
9
|
+
end
|
data/lib/tinypacker/version.rb
CHANGED
data/lib/tinypacker.rb
CHANGED
@@ -9,9 +9,9 @@ module Tinypacker
|
|
9
9
|
@instance ||= Tinypacker::Instance.new
|
10
10
|
end
|
11
11
|
|
12
|
-
class Error < StandardError; end
|
13
|
-
|
14
12
|
class Manifest
|
13
|
+
class FileNotFoundError < ::StandardError; end
|
14
|
+
|
15
15
|
def initialize(configuration)
|
16
16
|
@configuration = configuration
|
17
17
|
end
|
@@ -25,7 +25,7 @@ module Tinypacker
|
|
25
25
|
def load
|
26
26
|
JSON.parse(File.read(@configuration.manifest_path))
|
27
27
|
rescue Errno::ENOENT => e
|
28
|
-
raise Tinypacker::
|
28
|
+
raise Tinypacker::Manifest::FileNotFoundError, "manifest file not found #{@configuration.manifest_path}. Error: #{e.message}"
|
29
29
|
end
|
30
30
|
|
31
31
|
def data
|
@@ -49,6 +49,9 @@ module Tinypacker
|
|
49
49
|
end
|
50
50
|
|
51
51
|
class Configuration
|
52
|
+
class FileNotFoundError < ::StandardError; end
|
53
|
+
class SyntaxError < ::StandardError; end
|
54
|
+
|
52
55
|
attr_reader :root_path, :config_path
|
53
56
|
|
54
57
|
def initialize(root_path:, env: Rails.env)
|
@@ -76,9 +79,9 @@ module Tinypacker
|
|
76
79
|
end
|
77
80
|
config[@env].deep_symbolize_keys
|
78
81
|
rescue Errno::ENOENT => e
|
79
|
-
raise Tinypacker::
|
82
|
+
raise Tinypacker::Configuration::FileNotFoundError, "Tinypacker configuration file not found #{config_path}. Error: #{e.message}"
|
80
83
|
rescue Psych::SyntaxError => e
|
81
|
-
raise Tinypacker::
|
84
|
+
raise Tinypacker::Configuration::SyntaxError, "YAML syntax error occurred while parsing #{config_path}. Error: #{e.message}"
|
82
85
|
end
|
83
86
|
end
|
84
87
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tinypacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- taogawa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -95,6 +95,9 @@ files:
|
|
95
95
|
- Rakefile
|
96
96
|
- bin/console
|
97
97
|
- bin/setup
|
98
|
+
- lib/install/config/tinypacker.yml
|
99
|
+
- lib/install/template.rb
|
100
|
+
- lib/tasks/install.rake
|
98
101
|
- lib/tinypacker.rb
|
99
102
|
- lib/tinypacker/version.rb
|
100
103
|
- sig/tinypacker.rbs
|