parceler 1.0.5 → 1.0.6

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: 61d43a9ed1ad85be5977ae8ec05e049e7c840252a9a373c3791adf5735ce947e
4
- data.tar.gz: 5c4ece25b4c2f4dee83c1b351f40d8596b6ef65dcb6d84a4e63eb802501beb52
3
+ metadata.gz: a3d08a18d52609e20e4d84316fd2e5842b38dac4ee2f7140bd526e7c2d203622
4
+ data.tar.gz: 3b335f73578ab8deb0d0eac72f9d57b3c40f5789f9b1b27e077acf4b8d4f94ed
5
5
  SHA512:
6
- metadata.gz: 2d40af3578625f3331fb419953c5fb2e9dd941a64c492e87717df5c17b10d945947fc0c03216ec7c8c41c4fc47c7bf3d0af8750ed26511a5feb89c7e0936d421
7
- data.tar.gz: b144a9bbe86c5eb7ae94727e22ccdf75a7b247c7ad3bf755b18654f3b7cdb6f4c548d0ef781f063857a0c4ec528db2615518f242547a98a88efc1f96d7c3a20e
6
+ metadata.gz: 825ff8addd65ec02dc9510205402736fd43e9f13c51a9824c2b469d42ff710d9bce32f034ee8c692fad464416c942ad8f494dea7bc4e14499d747459757ad8eb
7
+ data.tar.gz: d39df2712207617218d3b1142f3663a4c5b9a7793687a64563d13d7f7954d08570eb4855ee40663eac8a1e4b2204c5f30e8f50eb665de6c2fe37cea4061c98fe
data/.gitignore CHANGED
@@ -1,2 +1,2 @@
1
- /node_modules
2
- *.gem
1
+ /node_modules
2
+ *.gem
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in parceler.gemspec
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in parceler.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Parceler
2
2
  [![version](https://img.shields.io/gem/v/parceler.svg?label=version&style=flat-square)
3
3
  ![downloads](https://img.shields.io/gem/dt/parceler.svg?style=flat-square)](https://rubygems.org/gems/parceler)
4
- [![license](https://img.shields.io/github/license/thearchitectoR/parceler.svg?style=flat-square)](/LICENSE)
4
+ ![license](https://img.shields.io/badge/license-CC--BY--NC--SA--4.0-green?style=flat-square)
5
5
 
6
6
  Parceler attempts to be an alternative asset compiler and manager for [Ruby on Rails](https://rubyonrails.org/). It provides functionality similar to Rails' own [Webpacker gem](https://github.com/rails/webpacker) but is powered by [Parcel](https://parceljs.org/) instead of [Webpack](https://webpack.js.org/). As a result and at the cost of some more advanced features, it requires significantly less out-of-the-box configuration. While meant for Rails, nothing inhibits using this gem outside of a Rails context.
7
7
 
@@ -55,4 +55,4 @@ While the above steps are not explicitly required, it is _highly_ recommended th
55
55
  I built this gem while working on the MAIS™ business managment and information system developed by [sdbase](sdbase.com). At the time of development, we were looking at upgrading the entire stack from EOLed versions of Ruby and Rails. Throughout the process, I realized that the new asset management system (`webpacker`) was overly complicated for many of our applications. As a result, it provided a reasonably steep learning curve to many of the burgeoning developers with which we were working. To mitigate those problems and to simplify the engineering learning process, I built Parceler to require very little out-of-the-box configuration while maintaining very transparent functionality.
56
56
 
57
57
  ## License
58
- This gem is released and published under the [3-Clause BSD License](https://opensource.org/licenses/BSD-3-Clause) by Elias Gabriel (@thearchitector).
58
+ This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
@@ -1,7 +1,7 @@
1
- class ParcelerGenerator < Rails::Generators::Base
2
- source_root File.expand_path("../templates", __FILE__)
3
-
4
- def create_initializer_file
5
- copy_file "config.rb", "config/initializers/parceler.rb"
6
- end
1
+ class ParcelerGenerator < Rails::Generators::Base
2
+ source_root File.expand_path("../templates", __FILE__)
3
+
4
+ def create_initializer_file
5
+ copy_file "config.rb", "config/initializers/parceler.rb"
6
+ end
7
7
  end
@@ -1,14 +1,14 @@
1
- # Configuration options defined here have direct relations to those defined in the official documentation.
2
- # https://parceljs.org/cli.html
3
- Parceler.configure do |c|
4
- c.entry_point = "app/javascript/application.js"
5
- c.destination = "public/parcels"
6
- c.cache = nil
7
- c.source_maps = false
8
- c.autoresolve = false
9
-
10
- # The following options only have an effect in production builds. You can parcel
11
- # your assets for production with rake tasks `parceler:build` or `assets:precompile`.
12
- c.minify = true
13
- c.content_hashing = true
1
+ # Configuration options defined here have direct relations to those defined in the official documentation.
2
+ # https://parceljs.org/cli.html
3
+ Parceler.configure do |c|
4
+ c.entry_point = "app/javascript/application.js"
5
+ c.destination = "public/parcels"
6
+ c.cache = nil
7
+ c.source_maps = false
8
+ c.autoresolve = false
9
+
10
+ # The following options only have an effect in production builds. You can parcel
11
+ # your assets for production with rake tasks `parceler:build` or `assets:precompile`.
12
+ c.minify = true
13
+ c.content_hashing = true
14
14
  end
@@ -1,32 +1,32 @@
1
- require "parceler/engine"
2
- require "parceler/railtie" if defined?(Rails)
3
-
4
- module Parceler
5
- class Error < StandardError; end
6
- class << self
7
- attr_accessor :configuration
8
- attr_accessor :engine
9
- end
10
-
11
- def self.configure
12
- self.configuration ||= Configuration.new
13
- yield(configuration)
14
- self.engine = Parceler::Engine.new(self.configuration)
15
- end
16
-
17
- # Configuration options defined here have direct relations to those defined in the official documentation
18
- # https://parceljs.org/cli.html
19
- class Configuration
20
- attr_accessor :entry_point, :destination, :cache, :source_maps, :minify, :content_hashing, :autoresolve
21
-
22
- def initialize
23
- @entry_point = "app/javascript/application.js"
24
- @destination = "public/parcels"
25
- @cache = nil
26
- @source_maps = false
27
- @minify = true
28
- @content_hashing = true
29
- @autoresolve = false
30
- end
31
- end
1
+ require "parceler/engine"
2
+ require "parceler/railtie" if defined?(Rails)
3
+
4
+ module Parceler
5
+ class Error < StandardError; end
6
+ class << self
7
+ attr_accessor :configuration
8
+ attr_accessor :engine
9
+ end
10
+
11
+ def self.configure
12
+ self.configuration ||= Configuration.new
13
+ yield(configuration)
14
+ self.engine = Parceler::Engine.new(self.configuration)
15
+ end
16
+
17
+ # Configuration options defined here have direct relations to those defined in the official documentation
18
+ # https://parceljs.org/cli.html
19
+ class Configuration
20
+ attr_accessor :entry_point, :destination, :cache, :source_maps, :minify, :content_hashing, :autoresolve
21
+
22
+ def initialize
23
+ @entry_point = "app/javascript/application.js"
24
+ @destination = "public/parcels"
25
+ @cache = nil
26
+ @source_maps = false
27
+ @minify = true
28
+ @content_hashing = true
29
+ @autoresolve = false
30
+ end
31
+ end
32
32
  end
@@ -1,20 +1,20 @@
1
- module Parceler
2
- class Engine
3
- def initialize(config)
4
- @args = [config.entry_point, "--out-dir", config.destination]
5
- @args.append("--cache-dir") if config.cache.present?
6
- @args.append("--no-source-maps") if !config.source_maps
7
- @args.append("--no-content-hash") if !config.content_hashing
8
- @args.append("--no-autoinstall") if !config.autoresolve
9
- @args.append("--no-minify") if !config.minify
10
- end
11
-
12
- def getcmd(cmd = '')
13
- return "yarn run parcel #{cmd} #{@args.join(' ')}"
14
- end
15
-
16
- def execute(cmd = '')
17
- exec(self.getcmd(cmd))
18
- end
19
- end
1
+ module Parceler
2
+ class Engine
3
+ def initialize(config)
4
+ @args = [config.entry_point, "--out-dir", config.destination]
5
+ @args.append("--cache-dir") if config.cache.present?
6
+ @args.append("--no-source-maps") if !config.source_maps
7
+ @args.append("--no-content-hash") if !config.content_hashing
8
+ @args.append("--no-autoinstall") if !config.autoresolve
9
+ @args.append("--no-minify") if !config.minify
10
+ end
11
+
12
+ def getcmd(cmd = '')
13
+ return "yarn run parcel #{cmd} #{@args.join(' ')}"
14
+ end
15
+
16
+ def execute(cmd = '')
17
+ exec(self.getcmd(cmd))
18
+ end
19
+ end
20
20
  end
@@ -1,41 +1,41 @@
1
- require 'posix/spawn'
2
-
3
- module Parceler
4
- class Railtie < ::Rails::Railtie
5
- railtie_name :parceler
6
-
7
- rake_tasks do
8
- load 'parceler/tasks.rake'
9
- end
10
-
11
- # Parcel's HMR server should only be used in development mode, so we restrict it
12
- if Rails.env.development? && defined?(Rails::Server)
13
- initializer "parceler.start_hmr" do |app|
14
- app.config.after_initialize do
15
- puts "\033[36m~~~ Launching a Parcel server for hot compliation ~~~\033[0m"
16
-
17
- if Parceler.engine.nil?
18
- Parceler.configure do |c|
19
- puts "\033[31m -> No configuration found. Falling back to defaults...\033[0m"
20
- end
21
- end
22
-
23
- pid = POSIX::Spawn::spawn(Parceler.engine.getcmd(:watch))
24
-
25
- # Wait for the parent (Rails server) to die, and then kill the child process
26
- #
27
- # NOTE: We cannot use Signal.trap here because it does not automatically respect
28
- # previously defined handlers, and thus Rails does not pass the event onto Parceler.
29
- at_exit do
30
- puts "\033[1m~~~ Gracefully stopping the Parcel watch server ~~~\033[0m"
31
- Process.kill("SIGKILL", pid)
32
- Process.waitpid(pid)
33
- puts "=== parceler shutdown: #{Time.now.strftime("%Y-%m-%d %H:%M:%S %z")} ==="
34
- puts "\033[36mAu revoir!\033[0m"
35
- exit
36
- end
37
- end
38
- end
39
- end
40
- end
1
+ require 'posix/spawn'
2
+
3
+ module Parceler
4
+ class Railtie < ::Rails::Railtie
5
+ railtie_name :parceler
6
+
7
+ rake_tasks do
8
+ load 'parceler/tasks.rake'
9
+ end
10
+
11
+ # Parcel's HMR server should only be used in development mode, so we restrict it
12
+ if Rails.env.development? && defined?(Rails::Server)
13
+ initializer "parceler.start_hmr" do |app|
14
+ app.config.after_initialize do
15
+ puts "\033[36m~~~ Launching a Parcel server for hot compliation ~~~\033[0m"
16
+
17
+ if Parceler.engine.nil?
18
+ Parceler.configure do |c|
19
+ puts "\033[31m -> No configuration found. Falling back to defaults...\033[0m"
20
+ end
21
+ end
22
+
23
+ pid = POSIX::Spawn::spawn(Parceler.engine.getcmd(:watch))
24
+
25
+ # Wait for the parent (Rails server) to die, and then kill the child process
26
+ #
27
+ # NOTE: We cannot use Signal.trap here because it does not automatically respect
28
+ # previously defined handlers, and thus Rails does not pass the event onto Parceler.
29
+ at_exit do
30
+ puts "\033[1m~~~ Gracefully stopping the Parcel watch server ~~~\033[0m"
31
+ Process.kill("SIGKILL", pid)
32
+ Process.waitpid(pid)
33
+ puts "=== parceler shutdown: #{Time.now.strftime("%Y-%m-%d %H:%M:%S %z")} ==="
34
+ puts "\033[36mAu revoir!\033[0m"
35
+ exit
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
41
  end
@@ -1,22 +1,22 @@
1
- namespace :parceler do
2
- desc 'Installs the Parcel dependency with Yarn'
3
- task install: :environment do
4
- exec("yarn add parcel-bundler --dev")
5
- end
6
-
7
- desc 'Launches a Parcel process for proactive compilation'
8
- task watch: :environment do
9
- Parceler.engine.execute(:watch)
10
- end
11
-
12
- desc 'Builds a production-ready asset package using Parcel'
13
- task build: :environment do
14
- Parceler.engine.execute(:build)
15
- end
16
- end
17
-
18
- if Rake::Task.task_defined?('assets:precompile')
19
- Rake::Task['assets:precompile'].enhance do
20
- Rake::Task['parceler:build'].invoke
21
- end
1
+ namespace :parceler do
2
+ desc 'Installs the Parcel dependency with Yarn'
3
+ task install: :environment do
4
+ exec("yarn add parcel-bundler --dev")
5
+ end
6
+
7
+ desc 'Launches a Parcel process for proactive compilation'
8
+ task watch: :environment do
9
+ Parceler.engine.execute(:watch)
10
+ end
11
+
12
+ desc 'Builds a production-ready asset package using Parcel'
13
+ task build: :environment do
14
+ Parceler.engine.execute(:build)
15
+ end
16
+ end
17
+
18
+ if Rake::Task.task_defined?('assets:precompile')
19
+ Rake::Task['assets:precompile'].enhance do
20
+ Rake::Task['parceler:build'].invoke
21
+ end
22
22
  end
@@ -1,31 +1,31 @@
1
- lib = File.expand_path("lib", __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "parceler"
6
- spec.version = "1.0.5"
7
- spec.platform = Gem::Platform::RUBY
8
- spec.author = "Elias Gabriel"
9
- spec.email = "me@eliasfgabriel.com"
10
- spec.summary = "A Parcel-based asset manager"
11
- spec.description = "An alternative Parcel-powered asset manager and compiler, meant for Rails but built for Ruby."
12
- spec.homepage = "https://github.com/thearchitector/parceler"
13
- spec.license = "BSD-3-Clause"
14
-
15
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
16
- spec.metadata["homepage_uri"] = spec.metadata["source_code_uri"] = spec.homepage
17
- spec.extra_rdoc_files = ["README.md"]
18
-
19
- spec.requirements = ["Node.js", "Yarn"]
20
-
21
- spec.require_paths = ["lib"]
22
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
- `git ls-files -z`.split("\x0")
24
- end
25
-
26
- spec.required_ruby_version = '>= 1.9'
27
-
28
- spec.add_runtime_dependency "posix-spawn", '~> 0.3'
29
- spec.add_development_dependency "bundler", '~> 2.0'
30
- spec.add_development_dependency "rake", '~> 10.0'
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "parceler"
6
+ spec.version = "1.0.6"
7
+ spec.platform = Gem::Platform::RUBY
8
+ spec.author = "Elias Gabriel"
9
+ spec.email = "me@eliasfgabriel.com"
10
+ spec.summary = "A Parcel-based asset manager"
11
+ spec.description = "An alternative Parcel-powered asset manager and compiler, meant for Rails but built for Ruby."
12
+ spec.homepage = "https://github.com/thearchitector/parceler"
13
+ spec.license = "CC-BY-NC-SA-4.0"
14
+
15
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
16
+ spec.metadata["homepage_uri"] = spec.metadata["source_code_uri"] = spec.homepage
17
+ spec.extra_rdoc_files = ["README.md"]
18
+
19
+ spec.requirements = ["Node.js", "Yarn"]
20
+
21
+ spec.require_paths = ["lib"]
22
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
+ `git ls-files -z`.split("\x0")
24
+ end
25
+
26
+ spec.required_ruby_version = '>= 1.9'
27
+
28
+ spec.add_runtime_dependency "posix-spawn", '~> 0.3'
29
+ spec.add_development_dependency "bundler", '~> 2.0'
30
+ spec.add_development_dependency "rake", '~> 10.0'
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parceler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elias Gabriel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-26 00:00:00.000000000 Z
11
+ date: 2019-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: posix-spawn
@@ -62,7 +62,6 @@ extra_rdoc_files:
62
62
  files:
63
63
  - ".gitignore"
64
64
  - Gemfile
65
- - LICENSE
66
65
  - README.md
67
66
  - lib/generators/parceler_generator.rb
68
67
  - lib/generators/templates/config.rb
@@ -75,7 +74,7 @@ files:
75
74
  - yarn.lock
76
75
  homepage: https://github.com/thearchitector/parceler
77
76
  licenses:
78
- - BSD-3-Clause
77
+ - CC-BY-NC-SA-4.0
79
78
  metadata:
80
79
  allowed_push_host: https://rubygems.org
81
80
  source_code_uri: https://github.com/thearchitector/parceler
@@ -97,8 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
96
  requirements:
98
97
  - Node.js
99
98
  - Yarn
100
- rubyforge_project:
101
- rubygems_version: 2.7.6.2
99
+ rubygems_version: 3.0.4
102
100
  signing_key:
103
101
  specification_version: 4
104
102
  summary: A Parcel-based asset manager
data/LICENSE DELETED
@@ -1,29 +0,0 @@
1
- BSD 3-Clause License
2
-
3
- Copyright (c) 2019, Elias Gabriel
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without
7
- modification, are permitted provided that the following conditions are met:
8
-
9
- 1. Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- 2. Redistributions in binary form must reproduce the above copyright notice,
13
- this list of conditions and the following disclaimer in the documentation
14
- and/or other materials provided with the distribution.
15
-
16
- 3. Neither the name of the copyright holder nor the names of its
17
- contributors may be used to endorse or promote products derived from
18
- this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.