sprockets-manifestjs_env 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b33db7257064f20677fd143217b86f76929cfb79ab9c478473056787abcf42f7
4
+ data.tar.gz: 919d5c4357b2a3562aeb330cf966e7d1575b86b4766bc18a16d78252cc38a1b8
5
+ SHA512:
6
+ metadata.gz: 697198010feda5e5579c26bdacd8e527998586bae45e73981f9a92a619255cd2d559bed5b7b1c4d41b5122c7e09efa40257f912e6f183d2cc7280d1ff823cfbc
7
+ data.tar.gz: 1b0b04bd0aac19cadaa67cdbfcb2d8edbd4ee544418a891e4efe440d39c473b693259f5689b8a24c895fabad7eaa02155297066a9686aee068d51d755fcaceeb
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in sprockets-manifestjs_env.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,76 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sprockets-manifestjs_env (0.1.0)
5
+ railties
6
+ sprockets (>= 4.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (7.0.2.2)
12
+ actionview (= 7.0.2.2)
13
+ activesupport (= 7.0.2.2)
14
+ rack (~> 2.0, >= 2.2.0)
15
+ rack-test (>= 0.6.3)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
+ actionview (7.0.2.2)
19
+ activesupport (= 7.0.2.2)
20
+ builder (~> 3.1)
21
+ erubi (~> 1.4)
22
+ rails-dom-testing (~> 2.0)
23
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
+ activesupport (7.0.2.2)
25
+ concurrent-ruby (~> 1.0, >= 1.0.2)
26
+ i18n (>= 1.6, < 2)
27
+ minitest (>= 5.1)
28
+ tzinfo (~> 2.0)
29
+ builder (3.2.4)
30
+ concurrent-ruby (1.1.9)
31
+ crass (1.0.6)
32
+ erubi (1.10.0)
33
+ i18n (1.10.0)
34
+ concurrent-ruby (~> 1.0)
35
+ loofah (2.14.0)
36
+ crass (~> 1.0.2)
37
+ nokogiri (>= 1.5.9)
38
+ method_source (1.0.0)
39
+ minitest (5.15.0)
40
+ nokogiri (1.13.3-x86_64-linux)
41
+ racc (~> 1.4)
42
+ racc (1.6.0)
43
+ rack (2.2.3)
44
+ rack-test (1.1.0)
45
+ rack (>= 1.0, < 3)
46
+ rails-dom-testing (2.0.3)
47
+ activesupport (>= 4.2.0)
48
+ nokogiri (>= 1.6)
49
+ rails-html-sanitizer (1.4.2)
50
+ loofah (~> 2.3)
51
+ railties (7.0.2.2)
52
+ actionpack (= 7.0.2.2)
53
+ activesupport (= 7.0.2.2)
54
+ method_source
55
+ rake (>= 12.2)
56
+ thor (~> 1.0)
57
+ zeitwerk (~> 2.5)
58
+ rake (13.0.6)
59
+ sprockets (4.0.3)
60
+ concurrent-ruby (~> 1.0)
61
+ rack (> 1, < 3)
62
+ thor (1.2.1)
63
+ tzinfo (2.0.4)
64
+ concurrent-ruby (~> 1.0)
65
+ zeitwerk (2.5.4)
66
+
67
+ PLATFORMS
68
+ x86_64-linux
69
+
70
+ DEPENDENCIES
71
+ minitest (~> 5.0)
72
+ rake (~> 13.0)
73
+ sprockets-manifestjs_env!
74
+
75
+ BUNDLED WITH
76
+ 2.2.32
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Yuji Yaginuma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Sprockets::ManifestjsEnv
2
+
3
+ [![Build Status](https://github.com/y-yagi/sprockets-manifestjs_env/actions/workflows/main.yml/badge.svg)](https://github.com/y-yagi/sprockets-manifestjs_env/actions)
4
+
5
+ Allow to switch `manifest.js` of `Sprockets` per environment.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'sprockets-manifestjs_env'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install sprockets-manifestjs_env
22
+
23
+ ## Usage
24
+
25
+ If your application have a `app/assets/config/manifest_#{::Rails.env}.js`, this gem switch to use it instead of `app/assets/config/manifest.js`.
26
+
27
+ So if want to use customized `manifest.js` for test, please create a `app/assets/config/manifest_test.js`.
28
+
29
+ For example: https://github.com/y-yagi/sprockets-manifestjs_env/blob/main/test/dummy/app/assets/config/manifest_test.js
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/y-yagi/sprockets-manifestjs_env.
34
+
35
+ ## License
36
+
37
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ task default: :test
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "sprockets/manifestjs_env"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,23 @@
1
+ require "rails"
2
+
3
+ module Sprockets
4
+ module ManifestjsEnv
5
+ class Railtie < ::Rails::Railtie
6
+ initializer "sprockets-manifestjs_env_set_precompile", after: :set_default_precompile do |app|
7
+ manifestjs = "manifest_#{::Rails.env}.js"
8
+ if ::Rails.root.join("app/assets/config/#{manifestjs}").exist?
9
+ app.config.assets.precompile[0] = manifestjs
10
+ end
11
+ end
12
+
13
+ initializer "sprockets-manifestjs_env_set_assets_path", after: :append_assets_path do |app|
14
+ manifestjs = "manifest_#{::Rails.env}.js"
15
+ if ::Rails.root.join("app/assets/config/#{manifestjs}").exist?
16
+ # TODO: If `manifest.js` for an environment exists, this gem assumes that an application doesn't use
17
+ # the default build directory. But this should be configured by an application.
18
+ app.config.assets.paths.delete_if { |d| d.to_s.end_with?('app/assets/builds') }
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ module Sprockets
2
+ module ManifestjsEnv
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "manifestjs_env/version"
4
+ require_relative "manifestjs_env/railtie"
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/sprockets/manifestjs_env/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "sprockets-manifestjs_env"
7
+ spec.version = Sprockets::ManifestjsEnv::VERSION
8
+ spec.authors = ["Yuji Yaginuma"]
9
+ spec.email = ["yuuji.yaginuma@gmail.com"]
10
+
11
+ spec.summary = "Allow to switch Sprocket manifest.js per environment."
12
+ spec.homepage = "https://github.com/y-yagi/sprockets-manifestjs_env"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = ">= 2.7.0"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+
18
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
+ `git ls-files -z`.split("\x0").reject do |f|
20
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
21
+ end
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+
27
+ spec.add_dependency "railties"
28
+ spec.add_dependency "sprockets", ">= 4.0"
29
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sprockets-manifestjs_env
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yuji Yaginuma
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-03-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sprockets
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '4.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '4.0'
41
+ description:
42
+ email:
43
+ - yuuji.yaginuma@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - Gemfile
49
+ - Gemfile.lock
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - bin/console
54
+ - bin/setup
55
+ - lib/sprockets/manifestjs_env.rb
56
+ - lib/sprockets/manifestjs_env/railtie.rb
57
+ - lib/sprockets/manifestjs_env/version.rb
58
+ - sprockets-manifestjs_env.gemspec
59
+ homepage: https://github.com/y-yagi/sprockets-manifestjs_env
60
+ licenses:
61
+ - MIT
62
+ metadata:
63
+ homepage_uri: https://github.com/y-yagi/sprockets-manifestjs_env
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 2.7.0
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubygems_version: 3.2.32
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Allow to switch Sprocket manifest.js per environment.
83
+ test_files: []