[Pkg-javascript-commits] [libjs-jquery-selectize.js] 02/03: Initial release of libjs-jquery-seletize.js.

Sergio Durigan Junior sergiodj-guest at moszumanska.debian.org
Fri Aug 19 23:56:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

sergiodj-guest pushed a commit to branch master
in repository libjs-jquery-selectize.js.

commit 8dc44c63876350433724a0794df99637ded58e97
Author: Sergio Durigan Junior <sergiodj at sergiodj.net>
Date:   Fri Aug 19 19:40:29 2016 -0400

    Initial release of libjs-jquery-seletize.js.
    
    Closes: #834865
---
 debian/README.source |  20 +++++
 debian/build.sh      | 213 +++++++++++++++++++++++++++++++++++++++++++++++++++
 debian/compat        |   1 +
 debian/control       |  70 +++++++++++++++++
 debian/copyright     |  67 ++++++++++++++++
 debian/docs          |   1 +
 debian/install       |   4 +
 debian/rules         |  16 ++++
 debian/source/format |   1 +
 debian/watch         |   6 ++
 10 files changed, 399 insertions(+)

diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..ab7877d
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,20 @@
+libjs-jquery-selectize.js for Debian
+------------------------------------
+
+A few things worth mentioning about this package.
+
+- The examples/ directory is not being installed because of a minified
+  JS, examples/js/es5.js, which is not package by Debian.  Well,
+  actually it is packaged apparently, but by a Ruby package, and I
+  don't feel like adding more dependencies just for testing.
+
+- The script debian/build.sh tries to mimick what Grunt does.  I was
+  only able to regenerated the JS file (selectize.js); unfortunately,
+  in order to regenerated the .less and CSS files I would have to
+  package more things, and I do not currently have the time/energy to
+  do so.  Therefore, for the specific cases of .less and CSS files, I
+  opted to install what comes with the upstream source, under the
+  dist/{css,less} directories.  This should not be a big issue,
+  because there is no minified code there.
+
+ -- Sergio Durigan Junior <sergiodj at sergiodj.net>  Wed, 17 Aug 2016 19:00:31 -0400
diff --git a/debian/build.sh b/debian/build.sh
new file mode 100755
index 0000000..26efd91
--- /dev/null
+++ b/debian/build.sh
@@ -0,0 +1,213 @@
+#!/bin/bash
+
+# Author: Sergio Durigan Junior <sergiodj at sergiodj.net>
+
+# Disclaimer: This script contains bashisms.  It will probably not
+# work very well with other shell interpreters.
+
+# The source directory of selectize.js.  If building the Debian
+# package, this is $(CURDIR)/../ (from debian/rules).
+SOURCEDIR=
+
+# The build directory, where we'll put the generated selectize.js.
+BUILDDIR=
+
+# The version of selectize.js being built.  'dpkg-parsechangelog -S
+# Version' should be helpful here.
+VERSION=
+
+
+# Print the usage message on stdout.
+
+usage ()
+{
+    cat <<EOF
+$0 -- build selectize.js without using grant
+
+Usage:
+
+$0 SOURCE_DIR BUILD_DIR VERSION
+
+Where:
+
+  SOURCE_DIR -- The source directory (i.e., where selectize.js source
+  is located).  If this script is being called from debian/rules, this
+  is "\$(CURDIR)/../".
+
+  BUILD_DIR -- Where the built files will be put.
+
+  VERSION -- The version of selectize.js.
+EOF
+}
+
+# Sanitize the arguments received via CLI.
+
+sanitize_cli_args ()
+{
+    # source dir
+    local sdir=$1
+    # build dir
+    local bdir=$2
+    # version
+    local ver=$3
+
+    # Does the source directory exist?
+    if test ! -d $sdir ; then
+	echo "E: '$1' is not a valid directory."
+	exit 1
+    fi
+
+    # Do we have a 'src/' directory inside the source directory?
+    if test ! -d $sdir/src/ ; then
+	echo "E: '$1/src/' doesn't exist.  Are you sure you provided the source directory?"
+	exit 1
+    fi
+
+    # Change to the source directory.  That's where we'll make the
+    # build.
+    cd $sdir
+
+    # Setting the global variables.
+    SOURCEDIR=$sdir
+    BUILDDIR=$bdir
+    VERSION=$ver
+}
+
+# Prepare the build directory to receive the generated files.  This
+# basically means removing the old directory and creating it again.
+
+prepare_build_dir ()
+{
+    rm -rf $BUILDDIR
+    mkdir -p $BUILDDIR
+}
+
+# Build selectize.js.
+#
+# This is the most important function of this script, of course.  It
+# was heavily inspired by the original Gruntfile.js, from upstream.
+# Since Debian does not ship Grunt, I had to write this "poor man's
+# builder" for selectize.js.
+
+build_js ()
+{
+    # List of files that will compose the final selectize.js script.
+    # The order of the files on this list *matters*!
+    local file_list="src/contrib/*.js src/constants.js src/utils.js \
+src/selectize.js src/defaults.js src/selectize.jquery.js \
+src/plugins/drag_drop/*.js src/plugins/dropdown_header/*.js \
+src/plugins/optgroup_columns/*.js src/plugins/remove_button/*.js \
+src/plugins/restore_on_backspace/*.js"
+    # Temporary directory where we'll do some file manipulations.
+    local tmpdir=`mktemp -d -p .`
+
+    for files in $file_list ; do
+	for file in `ls $files` ; do
+	    # We'll do some modifications to the file, so we copy it
+	    # to the temporary directory.
+	    local b=`dirname $file`
+	    mkdir -p $tmpdir/$b
+	    cp -a $file $tmpdir/$file
+
+	    if head -n1 $tmpdir/$file | grep -q '^\/\*\*' ; then
+		# If the first line of the file is a comment, then
+		# this means the file has a license header and we need
+		# to remove it (Grunt calls it a 'banner').  The code
+		# below is just a quick and dirty way of getting rid
+		# of the banner without resorting to magical sed
+		# expressions.
+		local SAW_FIRST_COMMENT_BEGIN=0
+		local SAW_FIRST_COMMENT_END=0
+
+		while IFS= read -r line || test -n "$line" ; do
+		    if test $SAW_FIRST_COMMENT_BEGIN -eq 0 ; then
+			if echo "$line" | grep -q '^\/\*\*' ; then
+			    SAW_FIRST_COMMENT_BEGIN=1
+			    continue
+			fi
+		    elif test $SAW_FIRST_COMMENT_END -eq 0 ; then
+			if echo "$line" | grep -q '^ \*\/$' ; then
+			    SAW_FIRST_COMMENT_END=1
+			fi
+			continue
+		    fi
+		    echo "$line" >> $tmpdir/$file.1
+		done < $tmpdir/$file
+
+		mv $tmpdir/$file.1 $tmpdir/$file
+	    fi
+
+	    # Every line must be prepended with a TAB.
+	    sed -i -e 's/^/\t/' $tmpdir/$file
+
+	    # Concatenating the file.
+	    cat $tmpdir/$file >> $BUILDDIR/selectize.js.1
+	    /bin/echo -ne '\n\n\t\n' >> $BUILDDIR/selectize.js.1
+	done
+    done
+
+    # Taking care of src/.wrapper.js now.
+    cp -a src/.wrapper.js $tmpdir/
+    sed -i "s/@@version/$VERSION/" $tmpdir/.wrapper.js
+
+    local FOUND_JS=0
+    # src/.wrapper.js is really a wrapper...  selectize.js.1 needs to
+    # be put "in the middle" of it, and we need to get rid of a
+    # special mark (@@js) where selectize.js.1 will be placed.
+    while IFS= read -r line || test -n "$line" ; do
+	if echo "$line" | grep -q '^\s@@js$' > /dev/null 2>&1 ; then
+	    FOUND_JS=1
+	    continue
+	fi
+
+	if test $FOUND_JS -eq 0 ; then
+	    echo "$line" >> $BUILDDIR/selectize.js
+	else
+	    echo "$line" >> $BUILDDIR/selectize.js.epilogue
+	fi
+    done < $tmpdir/.wrapper.js
+
+    # Final concatenation.
+    cat $BUILDDIR/selectize.js.1 >> $BUILDDIR/selectize.js
+    cat $BUILDDIR/selectize.js.epilogue >> $BUILDDIR/selectize.js
+
+    # Cleaning up.
+    rm -rf $tmpdir
+}
+
+# Check that the generated selectize.js is equivalent to the one that
+# comes with the upstream source.  Note: this function will have to be
+# rewritten/adjusted/skipped if we ever have to patch the JavaScript
+# sources.
+
+check_js ()
+{
+    if ! diff --unified \
+	 --ignore-tab-expansion \
+	 --ignore-space-change \
+	 --ignore-blank-lines \
+	 dist/js/selectize.js \
+	 $BUILDDIR/selectize.js ; then
+	echo "E: The generated selectize.js is NOT equal to the dist/js/selectize.js."
+	exit 1
+    fi
+}
+
+# Check that we received the exact number of arguments expected.  See
+# 'usage' for an explanation of each argument.
+if test $# -ne 3 ; then
+    usage
+    exit 1
+fi
+
+# Sanitize the arguments received.
+sanitize_cli_args $@
+
+# Prepare the build directory.
+prepare_build_dir
+
+# Build and check the generated JavaScript file.
+build_js
+check_js
+
+exit 0
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..df5e969
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,70 @@
+Source: libjs-jquery-selectize.js
+Section: web
+Priority: optional
+Maintainer: Sergio Durigan Junior <sergiodj at sergiodj.net>
+Build-Depends:
+ debhelper (>=9),
+ yui-compressor,
+ libjs-jquery,
+ libjs-sifter.js,
+ libjs-microplugin.js,
+ npm,
+Standards-Version: 3.9.8
+Homepage: https://github.com/selectize/selectize.js
+Vcs-Git: https://anonscm.debian.org/git/pkg-javascript/libjs-jquery-selectize.js.git
+Vcs-Browser: https://anonscm.debian.org/cgit/pkg-javascript/libjs-jquery-selectize.js.git
+
+Package: libjs-jquery-selectize.js
+Architecture: all
+Depends:
+ ${misc:Depends},
+ libjs-jquery,
+ libjs-sifter.js,
+ libjs-microplugin.js,
+Description: Extensible jQuery-based custom select UI control
+ Selectize is an extensible jQuery-based custom <select> UI
+ control. It's useful for tagging, contact lists, country selectors,
+ and so on. The goal is to provide a solid & usable experience with a
+ clean and powerful API.
+ .
+ Features
+ .
+  * Smart Option Searching / Ranking
+ .
+    Options are efficiently scored and sorted on-the-fly (using
+    libjs-sifter.js). Want to search an item's title *and*
+    description?  No problem.
+ .
+  * Caret between items
+ .
+    Order matters sometimes. Use the left and right arrow keys to move
+    between selected items.
+ .
+  * Select and delete multiple items at once
+ .
+    Hold down the CTRL key to select more than one item to delete.
+ .
+  * Díåcritîçs supported
+ .
+    Great for international environments.
+ .
+  * Item creation
+ .
+    Allow users to create items on the fly (async saving is supported;
+    the control locks until the callback is fired).
+ .
+  * Remote data loading
+ .
+    For when you have thousands of options and want them provided by
+    the server as the user types.
+ .
+  * Clean API and code
+ .
+    Interface with it and make modifications easily.
+ .
+  * Extensible
+ .
+    Plugin API for developing custom features (uses
+    libjs-microplugin.js).
+ .
+  * Touch Support
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..fbb5b5d
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,67 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: selectize.js
+Source: https://github.com/selectize/selectize.js
+Files-Excluded:
+ dist/js/standalone/selectize.min.js
+ dist/js/selectize.min.js
+ examples/js/jquery.js
+ examples/js/jqueryui.js
+ examples/js/es5.js
+
+Files: *
+Copyright: 2013-2016 Brian Reavis <brian at thirdroute.com>
+License: Apache-2.0
+
+Files: examples/css/normalize.css
+Copyright:
+ Nicolas Gallagher <nicolas at nicolasgallagher.com>
+ Jonathan Neal <jonathantneal+github at gmail.com>
+License: Expat
+
+Files: src/contrib/highlight.js
+Copyright: Johann Burkard <jb at eaio.com>
+License: Expat
+
+Files: test/support/syn.js
+Copyright: 2014 Bitovi <contact at bitovi.com>
+License: Expat
+
+Files: debian/*
+Copyright: 2016 Sergio Durigan Junior <sergiodj at sergiodj.net>
+License: Apache-2.0
+
+License: Apache-2.0
+ Licensed under the Apache License, Version 2.0 (the "License"); you
+ may not use this file except in compliance with the License.  You may
+ obtain a copy of the License at
+ .
+ http://www.apache.org/licenses/LICENSE-2.0
+ .
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.  See the License for the specific language governing
+ permissions and limitations under the License.
+ .
+ On Debian systems, the complete text of the Apache 2.0 License can be
+ found in /usr/share/common-licenses/Apache-2.0 file.
+
+License: Expat
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+ .
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..2e117bf
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+docs/*.md
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..3a6765d
--- /dev/null
+++ b/debian/install
@@ -0,0 +1,4 @@
+_build/selectize.js usr/share/javascript/selectize.js/
+_build/selectize.min.js usr/share/javascript/selectize.js/
+dist/css/ usr/share/javascript/selectize.js/
+dist/less/ usr/share/javascript/selectize.js/
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..9fbd755
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,16 @@
+#!/usr/bin/make -f
+
+VER = $(shell dpkg-parsechangelog -S Version | sed 's@\(.*\)+dfsg.*@\1@')
+
+%:
+	dh $@
+
+override_dh_auto_build:
+	bash ./debian/build.sh $(CURDIR) $(CURDIR)/_build/ $(VER)
+	yui-compressor -o _build/selectize.min.js  _build/selectize.js
+
+override_dh_auto_clean:
+	dh_auto_clean
+	rm -rf _build/
+
+override_dh_auto_test:
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..800b04b
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,6 @@
+version=4
+opts="dversionmangle=s@\+dfsg(\.\d+)?@@,\
+	repacksuffix=+dfsg,\
+	filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%@PACKAGE at -$1.tar.gz%" \
+   https://github.com/selectize/selectize.js/tags \
+   (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/libjs-jquery-selectize.js.git



More information about the Pkg-javascript-commits mailing list