[DRE-commits] [ruby-uglifier] 02/11: Use UglifyJS source from libjs-uglify
Antonio Terceiro
terceiro at moszumanska.debian.org
Mon Aug 8 01:05:07 UTC 2016
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to branch master
in repository ruby-uglifier.
commit 28a0f193dc766aa076d80cd0861d8ac6118957ed
Author: Antonio Terceiro <terceiro at debian.org>
Date: Sun Aug 7 17:48:41 2016 -0300
Use UglifyJS source from libjs-uglify
---
debian/changelog | 3 ++
debian/control | 4 ++
...0001-Use-packaged-UglifyJS-and-Source-Map.patch | 60 ++++++++++++++++++++++
debian/patches/change-javascript-files-path.patch | 37 -------------
debian/patches/series | 2 +-
5 files changed, 68 insertions(+), 38 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 5220f6b..1f39751 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,9 @@ ruby-uglifier (2.7.2-2) UNRELEASED; urgency=medium
* Bump Standards-Version to 3.9.7 (no changes needed)
* Run wrap-and-sort on packaging files
+ [ Antonio Terceiro ]
+ * Use UglifyJS source from libjs-uglify
+
-- Cédric Boutillier <boutil at moszumanska.debian.org> Sun, 07 Aug 2016 10:37:33 -0300
ruby-uglifier (2.7.2-1) unstable; urgency=medium
diff --git a/debian/control b/debian/control
index 47f5af1..e59c3a0 100644
--- a/debian/control
+++ b/debian/control
@@ -10,6 +10,8 @@ Build-Depends: debhelper (>= 9~),
ruby-json,
ruby-rspec,
ruby-source-map,
+ libjs-source-map,
+ libjs-uglify,
ruby-yajl
Standards-Version: 3.9.7
Vcs-Git: https://anonscm.debian.org/git/pkg-ruby-extras/ruby-uglifier.git
@@ -23,6 +25,8 @@ XB-Ruby-Versions: ${ruby:Versions}
Depends: ruby | ruby-interpreter,
ruby-execjs,
ruby-multi-json,
+ libjs-source-map,
+ libjs-uglify,
${misc:Depends},
${shlibs:Depends}
Description: Ruby wrapper for UglifyJS JavaScript compressor
diff --git a/debian/patches/0001-Use-packaged-UglifyJS-and-Source-Map.patch b/debian/patches/0001-Use-packaged-UglifyJS-and-Source-Map.patch
new file mode 100644
index 0000000..3c8bed3
--- /dev/null
+++ b/debian/patches/0001-Use-packaged-UglifyJS-and-Source-Map.patch
@@ -0,0 +1,60 @@
+From: Antonio Terceiro <terceiro at debian.org>
+Date: Sun, 7 Aug 2016 10:50:20 -0300
+Subject: Use packaged UglifyJS (and Source-Map)
+
+This patch is Debian-specific
+---
+ lib/uglifier.rb | 30 ++++++++++++++++++++++++------
+ 1 file changed, 24 insertions(+), 6 deletions(-)
+
+diff --git a/lib/uglifier.rb b/lib/uglifier.rb
+index a2b9671..7e3d7db 100644
+--- a/lib/uglifier.rb
++++ b/lib/uglifier.rb
+@@ -74,12 +74,21 @@ class Uglifier
+ })
+ JS
+
++ def self.find_asset(filename)
++ [
++ File.expand_path("../" + filename, __FILE__),
++ File.join("/usr/share/javascript/ruby-uglifier", filename)
++ ].find { |f| File.exists?(f) }
++ end
++
++ # SourceMap path
++ SourceMapPath = "/usr/share/javascript/source-map/source-map.js"
+ # UglifyJS source path
+- SourcePath = File.expand_path("../uglify.js", __FILE__)
++ SourcePath = "/usr/share/javascript/uglifyjs/uglify.js"
+ # ES5 shims source path
+- ES5FallbackPath = File.expand_path("../es5.js", __FILE__)
++ ES5FallbackPath = find_asset("es5.js")
+ # String.split shim source path
+- SplitFallbackPath = File.expand_path("../split.js", __FILE__)
++ SplitFallbackPath = find_asset("split.js")
+
+ # Default options for compilation
+ DEFAULTS = {
+@@ -191,9 +200,18 @@ class Uglifier
+ private
+
+ def uglifyjs_source
+- [ES5FallbackPath, SplitFallbackPath, SourcePath].map do |file|
+- File.open(file, "r:UTF-8") { |f| f.read }
+- end.join("\n")
++ [
++ __read__(ES5FallbackPath),
++ __read__(SplitFallbackPath),
++ 'window = this;',
++ __read__(SourceMapPath),
++ "MOZ_SourceMap = sourceMap;",
++ __read__(SourcePath),
++ ].join("\n")
++ end
++
++ def __read__(file)
++ File.open(file, "r:UTF-8") { |f| f.read }
+ end
+
+ # Run UglifyJS for given source code
diff --git a/debian/patches/change-javascript-files-path.patch b/debian/patches/change-javascript-files-path.patch
deleted file mode 100644
index 39dc25d..0000000
--- a/debian/patches/change-javascript-files-path.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-Description: Point to Javascript files at /usr/share
- This patch is Debian-specific.
-Author: Antonio Terceiro <terceiro at debian.org>
-
-Index: ruby-uglifier/lib/uglifier.rb
-===================================================================
---- ruby-uglifier.orig/lib/uglifier.rb
-+++ ruby-uglifier/lib/uglifier.rb
-@@ -74,14 +74,21 @@ class Uglifier
- })
- JS
-
-- # UglifyJS source path
-- SourcePath = File.expand_path("../uglify.js", __FILE__)
-- # ES5 shims source path
-- ES5FallbackPath = File.expand_path("../es5.js", __FILE__)
-- # String.split shim source path
-- SplitFallbackPath = File.expand_path("../split.js", __FILE__)
-+ def self.find_asset(filename)
-+ [
-+ File.expand_path("../" + filename, __FILE__),
-+ File.join("/usr/share/javascript/ruby-uglifier", filename)
-+ ].find { |f| File.exists?(f) }
-+ end
-
-- # Default options for compilation
-+ # UglifyJS source patch
-+ SourcePath = find_asset("uglify.js")
-+ # ES5 shims source path
-+ ES5FallbackPath = find_asset("es5.js")
-+ # String.split shim source path
-+ SplitFallbackPath = find_asset("split.js")
-+
-+ # Default options for compilation
- DEFAULTS = {
- # rubocop:disable LineLength
- :output => {
diff --git a/debian/patches/series b/debian/patches/series
index 32c144f..ec5598d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-change-javascript-files-path.patch
+0001-Use-packaged-UglifyJS-and-Source-Map.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-uglifier.git
More information about the Pkg-ruby-extras-commits
mailing list