1119 changed files with 153033 additions and 90 deletions
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
# Generated by makepkg 4.2.1 |
||||
# Fri Jul 10 11:24:35 UTC 2015 |
||||
pkgbase = libunarr-git |
||||
pkgdesc = A lightweight decompression library with support for rar, tar and zip archives. |
||||
pkgver = r189.91c3eb5 |
||||
pkgrel = 2 |
||||
url = https://github.com/zeniko/unarr |
||||
arch = i686 |
||||
arch = x86_64 |
||||
makedepends = cmake |
||||
makedepends = git |
||||
source = git+https://github.com/zeniko/unarr |
||||
source = https://raw.githubusercontent.com/selmf/unarr/master/CMakeLists.txt |
||||
md5sums = SKIP |
||||
md5sums = 056fd95cfab5889c591f1ee53d389a97 |
||||
|
||||
pkgname = libunarr-git |
||||
|
@ -0,0 +1,98 @@
@@ -0,0 +1,98 @@
|
||||
cmake_minimum_required(VERSION 2.6) |
||||
project(unarr C) |
||||
|
||||
#Set up api and release version for later use. |
||||
#Increase in major api version indicates api |
||||
#breakage!! For non-breaking changes, use |
||||
#minor api version instead. |
||||
set (UNARR_API_VERSION_MAJOR 1) |
||||
set (UNARR_API_VERSION_MINOR 0) |
||||
|
||||
#set build type to default if unset |
||||
if( NOT CMAKE_BUILD_TYPE ) |
||||
set( CMAKE_BUILD_TYPE Release CACHE STRING |
||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo |
||||
MinSizeRel." |
||||
FORCE ) |
||||
endif() |
||||
|
||||
find_package(ZLIB) |
||||
find_package(BZip2) |
||||
|
||||
if (UNIX OR MINGW) |
||||
add_compile_options(-fomit-frame-pointer -D_FILE_OFFSET_BITS=64) |
||||
endif (UNIX OR MINGW) |
||||
|
||||
#sources |
||||
|
||||
set (HEADERS common/allocator.h |
||||
common/unarr-imp.h |
||||
rar/rar.h |
||||
rar/lzss.h |
||||
rar/rarvm.h |
||||
lzmasdk/LzmaDec.h |
||||
lzmasdk/Ppmd7.h |
||||
lzmasdk/CpuArch.h |
||||
lzmasdk/Ppmd.h |
||||
lzmasdk/7zTypes.h |
||||
lzmasdk/Ppmd8.h |
||||
lzmasdk/Precomp.h |
||||
_7z/_7z.h |
||||
zip/zip.h |
||||
zip/inflate.h |
||||
tar/tar.h) |
||||
|
||||
set (SOURCES rar/uncompress-rar.c |
||||
rar/huffman-rar.c |
||||
rar/rar.c |
||||
rar/filter-rar.c |
||||
rar/rarvm.c |
||||
rar/parse-rar.c |
||||
_7z/_7z.c |
||||
zip/zip.c |
||||
zip/inflate.c |
||||
zip/parse-zip.c |
||||
zip/uncompress-zip.c |
||||
tar/tar.c |
||||
tar/parse-tar.c |
||||
lzmasdk/Ppmd7.c |
||||
lzmasdk/Ppmd8.c |
||||
lzmasdk/CpuArch.c |
||||
lzmasdk/LzmaDec.c |
||||
lzmasdk/Ppmd7Dec.c |
||||
lzmasdk/Ppmd8Dec.c |
||||
common/custalloc.c |
||||
common/unarr.c |
||||
common/stream.c |
||||
common/conv.c |
||||
common/crc32.c |
||||
) |
||||
|
||||
#build targets |
||||
|
||||
add_library(unarr SHARED unarr.h ${HEADERS} ${SOURCES}) |
||||
add_library(unarr_static STATIC unarr.h ${HEADERS} ${SOURCES}) |
||||
set_target_properties(unarr PROPERTIES VERSION ${UNARR_API_VERSION_MAJOR}.${UNARR_API_VERSION_MINOR} SOVERSION ${UNARR_API_VERSION_MAJOR}) |
||||
set_target_properties(unarr_static PROPERTIES OUTPUT_NAME unarr VERSION ${UNARR_API_VERSION_MAJOR}.${UNARR_API_VERSION_MINOR} SOVERSION ${UNARR_API_VERSION_MAJOR}) |
||||
|
||||
#library detection macros |
||||
|
||||
if (ZLIB_FOUND) |
||||
include_directories(${ZLIB_INCLUDE_DIRS}) |
||||
target_link_libraries(unarr ${ZLIB_LIBRARIES}) |
||||
target_link_libraries(unarr_static ${ZLIB_LIBRARIES}) |
||||
add_definitions(-DHAVE_ZLIB) |
||||
endif(ZLIB_FOUND) |
||||
|
||||
if (BZIP2_FOUND) |
||||
include_directories(${BZIP_INCLUDE_DIRS}) |
||||
target_link_libraries (unarr ${BZIP2_LIBRARIES}) |
||||
target_link_libraries (unarr_static ${BZIP2_LIBRARIES}) |
||||
add_definitions(-DHAVE_BZIP2) |
||||
endif (BZIP2_FOUND) |
||||
|
||||
#make install targets |
||||
|
||||
install(TARGETS unarr DESTINATION lib) |
||||
install(TARGETS unarr_static DESTINATION lib) |
||||
install(FILES unarr.h DESTINATION include) |
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
pkgname=libunarr-git |
||||
pkgver=r189.91c3eb5 |
||||
pkgrel=2 |
||||
arch=('i686' 'x86_64') |
||||
url="https://github.com/zeniko/unarr" |
||||
pkgdesc=('A lightweight decompression library with support for rar, tar and zip archives.') |
||||
source=('git+https://github.com/zeniko/unarr' |
||||
'https://raw.githubusercontent.com/selmf/unarr/master/CMakeLists.txt' |
||||
) |
||||
makedepends=('cmake' 'git') |
||||
|
||||
pkgver() { |
||||
cd "${srcdir}/unarr" |
||||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" |
||||
} |
||||
|
||||
prepare() { |
||||
cd "${srcdir}/unarr" |
||||
cp ../CMakeLists.txt . |
||||
} |
||||
|
||||
build() { |
||||
cd "${srcdir}/unarr" |
||||
cmake ./ -DCMAKE_INSTALL_PREFIX=/usr |
||||
make |
||||
} |
||||
|
||||
package() { |
||||
cd "${srcdir}/unarr" |
||||
make DESTDIR=$pkgdir install |
||||
} |
||||
md5sums=('SKIP' |
||||
'056fd95cfab5889c591f1ee53d389a97') |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
# Generated by makepkg 4.2.1 |
||||
# using fakeroot version 1.20.2 |
||||
# Fri Jul 10 20:44:33 UTC 2015 |
||||
pkgname = libunarr-git |
||||
pkgver = r189.91c3eb5-2 |
||||
pkgdesc = A lightweight decompression library with support for rar, tar and zip archives. |
||||
url = https://github.com/zeniko/unarr |
||||
builddate = 1436561073 |
||||
packager = Unknown Packager |
||||
size = 172032 |
||||
arch = x86_64 |
||||
makedepend = cmake |
||||
makedepend = git |
||||
makepkgopt = strip |
||||
makepkgopt = docs |
||||
makepkgopt = !libtool |
||||
makepkgopt = !staticlibs |
||||
makepkgopt = emptydirs |
||||
makepkgopt = zipman |
||||
makepkgopt = purge |
||||
makepkgopt = !upx |
||||
makepkgopt = !debug |
@ -0,0 +1,94 @@
@@ -0,0 +1,94 @@
|
||||
/* Copyright 2015 the unarr project authors (see AUTHORS file).
|
||||
License: LGPLv3 */ |
||||
|
||||
#ifndef unarr_h |
||||
#define unarr_h |
||||
|
||||
#include <stddef.h> |
||||
#include <stdint.h> |
||||
#include <stdbool.h> |
||||
typedef int64_t off64_t; |
||||
typedef int64_t time64_t; |
||||
|
||||
#define UNARR_API_VERSION 100 |
||||
|
||||
/***** common/stream *****/ |
||||
|
||||
typedef struct ar_stream_s ar_stream; |
||||
|
||||
/* opens a read-only stream for the given file path; returns NULL on error */ |
||||
ar_stream *ar_open_file(const char *path); |
||||
#ifdef _WIN32 |
||||
ar_stream *ar_open_file_w(const wchar_t *path); |
||||
#endif |
||||
/* opens a read-only stream for the given chunk of memory; the pointer must be valid until ar_close is called */ |
||||
ar_stream *ar_open_memory(const void *data, size_t datalen); |
||||
#ifdef _WIN32 |
||||
typedef struct IStream IStream; |
||||
/* opens a read-only stream based on the given IStream */ |
||||
ar_stream *ar_open_istream(IStream *stream); |
||||
#endif |
||||
|
||||
/* closes the stream and releases underlying resources */ |
||||
void ar_close(ar_stream *stream); |
||||
/* tries to read 'count' bytes into buffer, advancing the read offset pointer; returns the actual number of bytes read */ |
||||
size_t ar_read(ar_stream *stream, void *buffer, size_t count); |
||||
/* moves the read offset pointer (same as fseek); returns false on failure */ |
||||
bool ar_seek(ar_stream *stream, off64_t offset, int origin); |
||||
/* shortcut for ar_seek(stream, count, SEEK_CUR); returns false on failure */ |
||||
bool ar_skip(ar_stream *stream, off64_t count); |
||||
/* returns the current read offset (or 0 on error) */ |
||||
off64_t ar_tell(ar_stream *stream); |
||||
|
||||
/***** common/unarr *****/ |
||||
|
||||
typedef struct ar_archive_s ar_archive; |
||||
|
||||
/* frees all data stored for the given archive; does not close the underlying stream */ |
||||
void ar_close_archive(ar_archive *ar); |
||||
/* reads the next archive entry; returns false on error or at the end of the file (use ar_at_eof to distinguish the two cases) */ |
||||
bool ar_parse_entry(ar_archive *ar); |
||||
/* reads the archive entry at the given offset as returned by ar_entry_get_offset (offset 0 always restarts at the first entry); should always succeed */ |
||||
bool ar_parse_entry_at(ar_archive *ar, off64_t offset); |
||||
/* reads the (first) archive entry associated with the given name; returns false if the entry couldn't be found */ |
||||
bool ar_parse_entry_for(ar_archive *ar, const char *entry_name); |
||||
/* returns whether the last ar_parse_entry call has reached the file's expected end */ |
||||
bool ar_at_eof(ar_archive *ar); |
||||
|
||||
/* returns the name of the current entry as UTF-8 string; this pointer is only valid until the next call to ar_parse_entry; returns NULL on failure */ |
||||
const char *ar_entry_get_name(ar_archive *ar); |
||||
/* returns the stream offset of the current entry for use with ar_parse_entry_at */ |
||||
off64_t ar_entry_get_offset(ar_archive *ar); |
||||
/* returns the total size of uncompressed data of the current entry; read exactly that many bytes using ar_entry_uncompress */ |
||||
size_t ar_entry_get_size(ar_archive *ar); |
||||
/* returns the stored modification date of the current entry in 100ns since 1601/01/01 */ |
||||
time64_t ar_entry_get_filetime(ar_archive *ar); |
||||
/* WARNING: don't manually seek in the stream between ar_parse_entry and the last corresponding ar_entry_uncompress call! */ |
||||
/* uncompresses the next 'count' bytes of the current entry into buffer; returns false on error */ |
||||
bool ar_entry_uncompress(ar_archive *ar, void *buffer, size_t count); |
||||
|
||||
/* copies at most 'count' bytes of the archive's global comment (if any) into buffer; returns the actual amout of bytes copied (or, if 'buffer' is NULL, the required buffer size) */ |
||||
size_t ar_get_global_comment(ar_archive *ar, void *buffer, size_t count); |
||||
|
||||
/***** rar/rar *****/ |
||||
|
||||
/* checks whether 'stream' could contain RAR data and prepares for archive listing/extraction; returns NULL on failure */ |
||||
ar_archive *ar_open_rar_archive(ar_stream *stream); |
||||
|
||||
/***** tar/tar *****/ |
||||
|
||||
/* checks whether 'stream' could contain TAR data and prepares for archive listing/extraction; returns NULL on failure */ |
||||
ar_archive *ar_open_tar_archive(ar_stream *stream); |
||||
|
||||
/***** zip/zip *****/ |
||||
|
||||
/* checks whether 'stream' could contain ZIP data and prepares for archive listing/extraction; returns NULL on failure */ |
||||
/* set deflatedonly for extracting XPS, EPUB, etc. documents where non-Deflate compression methods are not supported by specification */ |
||||
ar_archive *ar_open_zip_archive(ar_stream *stream, bool deflatedonly); |
||||
|
||||
/***** _7z/_7z *****/ |
||||
|
||||
/* checks whether 'stream' could contain 7Z data and prepares for archive listing/extraction; returns NULL on failure */ |
||||
ar_archive *ar_open_7z_archive(ar_stream *stream); |
||||
|
||||
#endif |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
libunarr.so.1 |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
libunarr.so.1.0 |
Binary file not shown.
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
[core] |
||||
repositoryformatversion = 0 |
||||
filemode = true |
||||
bare = true |
||||
[remote "origin"] |
||||
url = https://github.com/zeniko/unarr |
||||
fetch = +refs/*:refs/* |
||||
mirror = true |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository. |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh |
||||
# |
||||
# An example hook script to check the commit log message taken by |
||||
# applypatch from an e-mail message. |
||||
# |
||||
# The hook should exit with non-zero status after issuing an |
||||
# appropriate message if it wants to stop the commit. The hook is |
||||
# allowed to edit the commit message file. |
||||
# |
||||
# To enable this hook, rename this file to "applypatch-msg". |
||||
|
||||
. git-sh-setup |
||||
test -x "$GIT_DIR/hooks/commit-msg" && |
||||
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} |
||||
: |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh |
||||
# |
||||
# An example hook script to check the commit log message. |
||||
# Called by "git commit" with one argument, the name of the file |
||||
# that has the commit message. The hook should exit with non-zero |
||||
# status after issuing an appropriate message if it wants to stop the |
||||
# commit. The hook is allowed to edit the commit message file. |
||||
# |
||||
# To enable this hook, rename this file to "commit-msg". |
||||
|
||||
# Uncomment the below to add a Signed-off-by line to the message. |
||||
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg |
||||
# hook is more suited to it. |
||||
# |
||||
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') |
||||
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" |
||||
|
||||
# This example catches duplicate Signed-off-by lines. |
||||
|
||||
test "" = "$(grep '^Signed-off-by: ' "$1" | |
||||
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { |
||||
echo >&2 Duplicate Signed-off-by lines. |
||||
exit 1 |
||||
} |
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh |
||||
# |
||||
# An example hook script to prepare a packed repository for use over |
||||
# dumb transports. |
||||
# |
||||
# To enable this hook, rename this file to "post-update". |
||||
|
||||
exec git update-server-info |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh |
||||
# |
||||
# An example hook script to verify what is about to be committed |
||||
# by applypatch from an e-mail message. |
||||
# |
||||
# The hook should exit with non-zero status after issuing an |
||||
# appropriate message if it wants to stop the commit. |
||||
# |
||||
# To enable this hook, rename this file to "pre-applypatch". |
||||
|
||||
. git-sh-setup |
||||
test -x "$GIT_DIR/hooks/pre-commit" && |
||||
exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} |
||||
: |
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh |
||||
# |
||||
# An example hook script to verify what is about to be committed. |
||||
# Called by "git commit" with no arguments. The hook should |
||||
# exit with non-zero status after issuing an appropriate message if |
||||
# it wants to stop the commit. |
||||
# |
||||
# To enable this hook, rename this file to "pre-commit". |
||||
|
||||
if git rev-parse --verify HEAD >/dev/null 2>&1 |
||||
then |
||||
against=HEAD |
||||
else |
||||
# Initial commit: diff against an empty tree object |
||||
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 |
||||
fi |
||||
|
||||
# If you want to allow non-ASCII filenames set this variable to true. |
||||
allownonascii=$(git config --bool hooks.allownonascii) |
||||
|
||||
# Redirect output to stderr. |
||||
exec 1>&2 |
||||
|
||||
# Cross platform projects tend to avoid non-ASCII filenames; prevent |
||||
# them from being added to the repository. We exploit the fact that the |
||||
# printable range starts at the space character and ends with tilde. |
||||
if [ "$allownonascii" != "true" ] && |
||||
# Note that the use of brackets around a tr range is ok here, (it's |
||||
# even required, for portability to Solaris 10's /usr/bin/tr), since |
||||
# the square bracket bytes happen to fall in the designated range. |
||||
test $(git diff --cached --name-only --diff-filter=A -z $against | |
||||
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 |
||||
then |
||||
cat <<\EOF |
||||
Error: Attempt to add a non-ASCII file name. |
||||
|
||||
This can cause problems if you want to work with people on other platforms. |
||||
|
||||
To be portable it is advisable to rename the file. |
||||
|
||||
If you know what you are doing you can disable this check using: |
||||
|
||||
git config hooks.allownonascii true |
||||
EOF |
||||
exit 1 |
||||
fi |
||||
|
||||
# If there are whitespace errors, print the offending file names and fail. |
||||
exec git diff-index --check --cached $against -- |
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh |
||||
|
||||
# An example hook script to verify what is about to be pushed. Called by "git |
||||
# push" after it has checked the remote status, but before anything has been |
||||
# pushed. If this script exits with a non-zero status nothing will be pushed. |
||||
# |
||||
# This hook is called with the following parameters: |
||||
# |
||||
# $1 -- Name of the remote to which the push is being done |
||||
# $2 -- URL to which the push is being done |
||||
# |
||||
# If pushing without using a named remote those arguments will be equal. |
||||
# |
||||
# Information about the commits which are being pushed is supplied as lines to |
||||
# the standard input in the form: |
||||
# |
||||
# <local ref> <local sha1> <remote ref> <remote sha1> |
||||
# |
||||
# This sample shows how to prevent push of commits where the log message starts |
||||
# with "WIP" (work in progress). |
||||
|
||||
remote="$1" |
||||
url="$2" |
||||
|
||||
z40=0000000000000000000000000000000000000000 |
||||
|
||||
while read local_ref local_sha remote_ref remote_sha |
||||
do |
||||
if [ "$local_sha" = $z40 ] |
||||
then |
||||
# Handle delete |
||||
: |
||||
else |
||||
if [ "$remote_sha" = $z40 ] |
||||
then |
||||
# New branch, examine all commits |
||||
range="$local_sha" |
||||
else |
||||
# Update to existing branch, examine new commits |
||||
range="$remote_sha..$local_sha" |
||||
fi |
||||
|
||||
# Check for WIP commit |
||||
commit=`git rev-list -n 1 --grep '^WIP' "$range"` |
||||
if [ -n "$commit" ] |
||||
then |
||||
echo >&2 "Found WIP commit in $local_ref, not pushing" |
||||
exit 1 |
||||
fi |
||||
fi |
||||
done |
||||
|
||||
exit 0 |
@ -0,0 +1,169 @@
@@ -0,0 +1,169 @@
|
||||
#!/bin/sh |
||||
# |
||||
# Copyright (c) 2006, 2008 Junio C Hamano |
||||
# |
||||
# The "pre-rebase" hook is run just before "git rebase" starts doing |
||||
# its job, and can prevent the command from running by exiting with |
||||
# non-zero status. |
||||
# |
||||
# The hook is called with the following parameters: |
||||
# |
||||
# $1 -- the upstream the series was forked from. |
||||
# $2 -- the branch being rebased (or empty when rebasing the current branch). |
||||
# |
||||
# This sample shows how to prevent topic branches that are already |
||||
# merged to 'next' branch from getting rebased, because allowing it |
||||
# would result in rebasing already published history. |
||||
|
||||
publish=next |
||||
basebranch="$1" |
||||
if test "$#" = 2 |
||||
then |
||||
topic="refs/heads/$2" |
||||
else |
||||
topic=`git symbolic-ref HEAD` || |
||||
exit 0 ;# we do not interrupt rebasing detached HEAD |
||||
fi |
||||
|
||||
case "$topic" in |
||||
refs/heads/??/*) |
||||
;; |
||||
*) |
||||
exit 0 ;# we do not interrupt others. |
||||
;; |
||||
esac |
||||
|
||||
# Now we are dealing with a topic branch being rebased |
||||
# on top of master. Is it OK to rebase it? |
||||
|
||||
# Does the topic really exist? |
||||
git show-ref -q "$topic" || { |
||||
echo >&2 "No such branch $topic" |
||||
exit 1 |
||||
} |
||||
|
||||
# Is topic fully merged to master? |
||||
not_in_master=`git rev-list --pretty=oneline ^master "$topic"` |
||||
if test -z "$not_in_master" |
||||
then |
||||
echo >&2 "$topic is fully merged to master; better remove it." |
||||
exit 1 ;# we could allow it, but there is no point. |
||||
fi |
||||
|
||||
# Is topic ever merged to next? If so you should not be rebasing it. |
||||
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` |
||||
only_next_2=`git rev-list ^master ${publish} | sort` |
||||
if test "$only_next_1" = "$only_next_2" |
||||
then |
||||
not_in_topic=`git rev-list "^$topic" master` |
||||
if test -z "$not_in_topic" |
||||
then |
||||
echo >&2 "$topic is already up-to-date with master" |
||||
exit 1 ;# we could allow it, but there is no point. |
||||
else |
||||
exit 0 |
||||
fi |
||||
else |
||||
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` |
||||
/usr/bin/perl -e ' |
||||
my $topic = $ARGV[0]; |
||||
my $msg = "* $topic has commits already merged to public branch:\n"; |
||||
my (%not_in_next) = map { |
||||
/^([0-9a-f]+) /; |
||||
($1 => 1); |
||||
} split(/\n/, $ARGV[1]); |
||||
for my $elem (map { |
||||
/^([0-9a-f]+) (.*)$/; |
||||
[$1 => $2]; |
||||
} split(/\n/, $ARGV[2])) { |
||||
if (!exists $not_in_next{$elem->[0]}) { |
||||
if ($msg) { |
||||
print STDERR $msg; |
||||
undef $msg; |
||||
} |
||||
print STDERR " $elem->[1]\n"; |
||||
} |
||||
} |
||||
' "$topic" "$not_in_next" "$not_in_master" |
||||
exit 1 |
||||
fi |
||||
|
||||
exit 0 |
||||
|
||||
################################################################ |
||||
|
||||
This sample hook safeguards topic branches that have been |
||||
published from being rewound. |
||||
|
||||
The workflow assumed here is: |
||||
|
||||
* Once a topic branch forks from "master", "master" is never |
||||
merged into it again (either directly or indirectly). |
||||
|
||||
* Once a topic branch is fully cooked and merged into "master", |
||||
it is deleted. If you need to build on top of it to correct |
||||
earlier mistakes, a new topic branch is created by forking at |
||||
the tip of the "master". This is not strictly necessary, but |
||||
it makes it easier to keep your history simple. |
||||
|
||||
* Whenever you need to test or publish your changes to topic |
||||
branches, merge them into "next" branch. |
||||
|
||||
The script, being an example, hardcodes the publish branch name |
||||
to be "next", but it is trivial to make it configurable via |
||||
$GIT_DIR/config mechanism. |
||||
|
||||
With this workflow, you would want to know: |
||||
|
||||
(1) ... if a topic branch has ever been merged to "next". Young |
||||
topic branches can have stupid mistakes you would rather |
||||
clean up before publishing, and things that have not been |
||||
merged into other branches can be easily rebased without |
||||
affecting other people. But once it is published, you would |
||||
not want to rewind it. |
||||
|
||||
(2) ... if a topic branch has been fully merged to "master". |
||||
Then you can delete it. More importantly, you should not |
||||
build on top of it -- other people may already want to |
||||
change things related to the topic as patches against your |
||||
"master", so if you need further changes, it is better to |
||||
fork the topic (perhaps with the same name) afresh from the |
||||
tip of "master". |
||||
|
||||
Let's look at this example: |
||||
|
||||
o---o---o---o---o---o---o---o---o---o "next" |
||||
/ / / / |
||||
/ a---a---b A / / |
||||
/ / / / |
||||
/ / c---c---c---c B / |
||||
/ / / \ / |
||||
/ / / b---b C \ / |
||||
/ / / / \ / |
||||
---o---o---o---o---o---o---o---o---o---o---o "master" |
||||
|
||||
|
||||
A, B and C are topic branches. |
||||
|
||||
* A has one fix since it was merged up to "next". |
||||
|
||||
* B has finished. It has been fully merged up to "master" and "next", |
||||
and is ready to be deleted. |
||||
|
||||
* C has not merged to "next" at all. |
||||
|
||||
We would want to allow C to be rebased, refuse A, and encourage |
||||
B to be deleted. |
||||
|
||||
To compute (1): |
||||
|
||||
git rev-list ^master ^topic next |
||||
git rev-list ^master next |
||||
|
||||
if these match, topic has not merged in next at all. |
||||
|
||||
To compute (2): |
||||
|
||||
git rev-list master..topic |
||||
|
||||
if this is empty, it is fully merged to "master". |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh |
||||
# |
||||
# An example hook script to prepare the commit log message. |
||||
# Called by "git commit" with the name of the file that has the |
||||
# commit message, followed by the description of the commit |
||||
# message's source. The hook's purpose is to edit the commit |
||||
# message file. If the hook fails with a non-zero status, |
||||
# the commit is aborted. |
||||
# |
||||
# To enable this hook, rename this file to "prepare-commit-msg". |
||||
|
||||
# This hook includes three examples. The first comments out the |
||||
# "Conflicts:" part of a merge commit. |
||||
# |
||||
# The second includes the output of "git diff --name-status -r" |
||||
# into the message, just before the "git status" output. It is |
||||
# commented because it doesn't cope with --amend or with squashed |
||||
# commits. |
||||
# |
||||
# The third example adds a Signed-off-by line to the message, that can |
||||
# still be edited. This is rarely a good idea. |
||||
|
||||
case "$2,$3" in |
||||
merge,) |
||||
/usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; |
||||
|
||||
# ,|template,) |
||||
# /usr/bin/perl -i.bak -pe ' |
||||
# print "\n" . `git diff --cached --name-status -r` |
||||
# if /^#/ && $first++ == 0' "$1" ;; |
||||
|
||||
*) ;; |
||||
esac |
||||
|
||||
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') |
||||
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" |
@ -0,0 +1,128 @@
@@ -0,0 +1,128 @@
|
||||
#!/bin/sh |
||||
# |
||||
# An example hook script to blocks unannotated tags from entering. |
||||
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new |
||||
# |
||||
# To enable this hook, rename this file to "update". |
||||
# |
||||
# Config |
||||
# ------ |
||||
# hooks.allowunannotated |
||||
# This boolean sets whether unannotated tags will be allowed into the |
||||
# repository. By default they won't be. |
||||
# hooks.allowdeletetag |
||||
# This boolean sets whether deleting tags will be allowed in the |
||||
# repository. By default they won't be. |
||||
# hooks.allowmodifytag |
||||
# This boolean sets whether a tag may be modified after creation. By default |
||||
# it won't be. |
||||
# hooks.allowdeletebranch |
||||
# This boolean sets whether deleting branches will be allowed in the |
||||
# repository. By default they won't be. |
||||
# hooks.denycreatebranch |
||||
# This boolean sets whether remotely creating branches will be denied |
||||
# in the repository. By default this is allowed. |
||||
# |
||||
|
||||
# --- Command line |
||||
refname="$1" |
||||
oldrev="$2" |
||||
newrev="$3" |
||||
|
||||
# --- Safety check |
||||
if [ -z "$GIT_DIR" ]; then |
||||
echo "Don't run this script from the command line." >&2 |
||||
echo " (if you want, you could supply GIT_DIR then run" >&2 |
||||
echo " $0 <ref> <oldrev> <newrev>)" >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then |
||||
echo "usage: $0 <ref> <oldrev> <newrev>" >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
# --- Config |
||||
allowunannotated=$(git config --bool hooks.allowunannotated) |
||||
allowdeletebranch=$(git config --bool hooks.allowdeletebranch) |
||||
denycreatebranch=$(git config --bool hooks.denycreatebranch) |
||||
allowdeletetag=$(git config --bool hooks.allowdeletetag) |
||||
allowmodifytag=$(git config --bool hooks.allowmodifytag) |
||||
|
||||
# check for no description |
||||
projectdesc=$(sed -e '1q' "$GIT_DIR/description") |
||||
case "$projectdesc" in |
||||
"Unnamed repository"* | "") |
||||
echo "*** Project description file hasn't been set" >&2 |
||||
exit 1 |
||||
;; |
||||
esac |
||||
|
||||
# --- Check types |
||||
# if $newrev is 0000...0000, it's a commit to delete a ref. |
||||
zero="0000000000000000000000000000000000000000" |
||||
if [ "$newrev" = "$zero" ]; then |
||||
newrev_type=delete |
||||
else |
||||
newrev_type=$(git cat-file -t $newrev) |
||||
fi |
||||
|
||||
case "$refname","$newrev_type" in |
||||
refs/tags/*,commit) |
||||
# un-annotated tag |
||||
short_refname=${refname##refs/tags/} |
||||
if [ "$allowunannotated" != "true" ]; then |
||||
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 |
||||
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 |
||||
exit 1 |
||||
fi |
||||
;; |
||||
refs/tags/*,delete) |
||||
# delete tag |
||||
if [ "$allowdeletetag" != "true" ]; then |
||||
echo "*** Deleting a tag is not allowed in this repository" >&2 |
||||
exit 1 |
||||
fi |
||||
;; |
||||
refs/tags/*,tag) |
||||
# annotated tag |
||||
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 |
||||
then |
||||
echo "*** Tag '$refname' already exists." >&2 |
||||
echo "*** Modifying a tag is not allowed in this repository." >&2 |
||||
exit 1 |
||||
fi |
||||
;; |
||||
refs/heads/*,commit) |
||||
# branch |
||||
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then |
||||
echo "*** Creating a branch is not allowed in this repository" >&2 |
||||
exit 1 |
||||
fi |
||||
;; |
||||
refs/heads/*,delete) |
||||
# delete branch |
||||
if [ "$allowdeletebranch" != "true" ]; then |
||||
echo "*** Deleting a branch is not allowed in this repository" >&2 |
||||
exit 1 |
||||
fi |
||||
;; |
||||
refs/remotes/*,commit) |
||||
# tracking branch |
||||
;; |
||||
refs/remotes/*,delete) |
||||
# delete tracking branch |
||||
if [ "$allowdeletebranch" != "true" ]; then |
||||
echo "*** Deleting a tracking branch is not allowed in this repository" >&2 |
||||
exit 1 |
||||
fi |
||||
;; |
||||
*) |
||||
# Anything else (is there anything else?) |
||||
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 |
||||
exit 1 |
||||
;; |
||||
esac |
||||
|
||||
# --- Finished |
||||
exit 0 |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
# git ls-files --others --exclude-from=.git/info/exclude |
||||
# Lines that start with '#' are comments. |
||||
# For a project mostly in C, the following would be a good set of |
||||
# exclude patterns (uncomment them if you want to use them): |
||||
# *.[oa] |
||||
# *~ |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
# pack-refs with: peeled fully-peeled |
||||
91c3eb501dcd7a0aacf5c181c6cfadb0c2c787aa refs/heads/master |
||||
c80c218f385b490f3fe2f6ba9808f59de85042d4 refs/pull/1/head |
||||
03aa557a91194a8737c79f1b9483e66b029557c2 refs/pull/1/merge |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
# Generated by makepkg 4.2.1 |
||||
# using fakeroot version 1.20.2 |
||||
# Wed Jul 8 20:38:41 UTC 2015 |
||||
pkgname = nodejs-psdinfo |
||||
pkgver = 1.0.2-1 |
||||
pkgdesc = Inspect PSD files from the command line |
||||
url = https://github.com/rstacruz/psdinfo |
||||
builddate = 1436387921 |
||||
packager = Unknown Packager |
||||
size = 5569536 |
||||
arch = any |
||||
license = Simplifed |
||||
license = BSD |
||||
license = License |
||||
depend = nodejs |
||||
depend = npm |
||||
makepkgopt = strip |
||||
makepkgopt = docs |
||||
makepkgopt = !libtool |
||||
makepkgopt = !staticlibs |
||||
makepkgopt = emptydirs |
||||
makepkgopt = zipman |
||||
makepkgopt = purge |
||||
makepkgopt = !upx |
||||
makepkgopt = !debug |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
../lib/node_modules/psdinfo/bin/psdinfo |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
node_modules |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
## v1.0.0 - Jul 2, 2015 |
||||
|
||||
Initial version. |
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
# psdinfo |
||||
|
||||
> Inspect PSD files from the command line. |
||||
|
||||
 |
||||
|
||||
``` |
||||
npm install -g psdinfo |
||||
``` |
||||
|
||||
```sh |
||||
$ psdinfo file.psd --fonts |
||||
|
||||
# file.psd |
||||
fonts: |
||||
- DIN-Bold |
||||
- FreightSansLight |
||||
- Glosa-Roman |
||||
- ... |
||||
``` |
||||
|
||||
```sh |
||||
$ psdinfo file.psd --text |
||||
|
||||
# file.psd |
||||
text: |
||||
- "Hello" |
||||
- "This is text from the document" |
||||
- ... |
||||
``` |
||||
|
||||
<br> |
||||
|
||||
## Thanks |
||||
|
||||
**psdinfo** ยฉ 2015+, Rico Sta. Cruz. Released under the [MIT] License.<br> |
||||
Authored and maintained by Rico Sta. Cruz with help from contributors ([list][contributors]). |
||||
|
||||
> [ricostacruz.com](http://ricostacruz.com) · |
||||
> GitHub [@rstacruz](https://github.com/rstacruz) · |
||||
> Twitter [@rstacruz](https://twitter.com/rstacruz) |
||||
|
||||
[MIT]: http://mit-license.org/ |
||||
[contributors]: http://github.com/rstacruz/psdinfo/contributors |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,129 @@
@@ -0,0 +1,129 @@
|
||||
#!/usr/bin/env node |
||||
var argv = require('yargs') |
||||
.option('fonts', { alias: 'f', type: 'boolean' }) |
||||
.option('text', { alias: 't', type: 'boolean' }) |
||||
.option('doc', { alias: 'd', type: 'boolean' }) |
||||
.option('full', { alias: 'F', type: 'boolean' }) |
||||
.argv |
||||
|
||||
var assign = require('util')._extend |
||||
|
||||
if (!module.parent) { |
||||
if (argv._.length === 0 || argv.help || argv.h) { |
||||
console.log("Usage:") |
||||
console.log(" psdinfo FILE.psd [--fonts] [--text] [--doc] [--full]") |
||||
process.exit(0) |
||||
} |
||||
|
||||
run(argv._) |
||||
} |
||||
|
||||
/* |
||||
* Returns a summary of the PSD document |
||||
*/ |
||||
|
||||
function getSummary (data) { |
||||
return { |
||||
document: { |
||||
width: data.document.width, |
||||
height: data.document.height |
||||
} |
||||
} |
||||
} |
||||
|
||||
/* |
||||
* Returns fonts in the document |
||||
*/ |
||||
|
||||
function getFonts (data) { |
||||
return { |
||||
fonts: pluckOut(data, 'text', function (text) { |
||||
return text && text.font && text.font.name |
||||
}) |
||||
} |
||||
} |
||||
|
||||
/* |
||||
* Returns texts found in the document |
||||
*/ |
||||
|
||||
function getStrings (data) { |
||||
return { |
||||
text: pluckOut(data, 'text', function (text) { |
||||
return text && text.value |
||||
}) |
||||
} |
||||
} |
||||
|
||||
function pluckOut (data, parent, fn) { |
||||
var out = {} |
||||
walk(data, parent, function (node) { |
||||
var result = fn(node) |
||||
if (result) out[result] = true |
||||
}) |
||||
return Object.keys(out).sort() |
||||
} |
||||
|
||||
function walk (object, needle, fn) { |
||||
for (var key in object) { |
||||
if (key === needle) { |
||||
fn(object[key]) |
||||
} else if (typeof object[key] === 'object') { |
||||
walk(object[key], needle, fn) |
||||
} |
||||
} |
||||
} |
||||
|
||||
function run (files) { |
||||
if (!argv.fonts && !argv.text && !argv.doc && !argv.full) { |
||||
console.error('options missing; see --help') |
||||
process.exit(1) |
||||
} |
||||
|
||||
files.forEach(function (file) { |
||||
require('psd').open(file) |
||||
.then(function (psd) { |
||||
return psd.tree().export() |
||||
}) |
||||
.then(function (data) { |
||||
if (argv.full) return data |
||||
|
||||
var obj = {} |
||||
if (argv.fonts) assign(obj, getFonts(data)) |
||||
if (argv.text) assign(obj, getStrings(data)) |
||||
if (argv.doc) assign(obj, getSummary(data)) |
||||
return obj |
||||
}) |
||||
.then(function (data) { |
||||
log(data, file) |
||||
}) |
||||
.catch(function (err) { |
||||
console.error(err.message) |
||||
process.exit(1) |
||||
}) |
||||
}) |
||||
} |
||||
|
||||
/* |
||||
* Logs a block of JSON data to the console |
||||
*/ |
||||
|
||||
function log (data, heading) { |
||||
var repr = '' |
||||
if (process.stdout.isTTY) { |
||||
if (heading) repr += '\033[32m โ\033[30m ' + heading + '\033[0m\n\n' |
||||
repr += ' ' + require('js-yaml').dump(data).replace(/\n/g, '\n ') |
||||
repr = '\n' + repr.trim() |
||||
} else { |
||||
repr = JSON.stringify(data, null, 2) |
||||
} |
||||
console.log(repr) |
||||
} |
||||
|
||||
/* |
||||
* export |
||||
*/ |
||||
|
||||
exports.getFonts = getFonts |
||||
exports.getStrings = getStrings |
||||
exports.getSummary = getSummary |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
../js-yaml/bin/js-yaml.js |
@ -0,0 +1,299 @@
@@ -0,0 +1,299 @@
|
||||
3.3.1 / 2015-05-13 |
||||
------------------ |
||||
|
||||
- Added `.sortKeys` dumper option, thanks to @rjmunro. |
||||
- Fixed astral characters support, #191. |
||||
|
||||
|
||||
3.3.0 / 2015-04-26 |
||||
------------------ |
||||
|
||||
- Significantly improved long strings formatting in dumper, thanks to @isaacs. |
||||
- Strip BOM if exists. |
||||
|
||||
|
||||
3.2.7 / 2015-02-19 |
||||
------------------ |
||||
|
||||
- Maintenance release. |
||||
- Updated dependencies. |
||||
- HISTORY.md -> CHANGELOG.md |
||||
|
||||
|
||||
3.2.6 / 2015-02-07 |
||||
------------------ |
||||
|
||||
- Fixed encoding of UTF-16 surrogate pairs. (e.g. "\U0001F431" CAT FACE). |
||||
- Fixed demo dates dump (#113, thanks to @Hypercubed). |
||||
|
||||
|
||||
3.2.5 / 2014-12-28 |
||||
------------------ |
||||
|
||||
- Fixed resolving of all built-in types on empty nodes. |
||||
- Fixed invalid warning on empty lines within quoted scalars and flow collections. |
||||
- Fixed bug: Tag on an empty node didn't resolve in some cases. |
||||
|
||||
|
||||
3.2.4 / 2014-12-19 |
||||
------------------ |
||||
|
||||
- Fixed resolving of !!null tag on an empty node. |
||||
|
||||
|
||||
3.2.3 / 2014-11-08 |
||||
------------------ |
||||
|
||||
- Implemented dumping of objects with circular and cross references. |
||||
- Partially fixed aliasing of constructed objects. (see issue #141 for details) |
||||
|
||||
|
||||
3.2.2 / 2014-09-07 |
||||
------------------ |
||||
|
||||
- Fixed infinite loop on unindented block scalars. |
||||
- Rewritten base64 encode/decode in binary type, to keep code licence clear. |
||||
|
||||
|
||||
3.2.1 / 2014-08-24 |
||||
------------------ |
||||
|
||||
- Nothig new. Just fix npm publish error. |
||||
|
||||
|
||||
3.2.0 / 2014-08-24 |
||||
------------------ |
||||
|
||||
- Added input piping support to CLI. |
||||
- Fixed typo, that could cause hand on initial indent (#139). |
||||
|
||||
|
||||
3.1.0 / 2014-07-07 |
||||
------------------ |
||||
|
||||
- 1.5x-2x speed boost. |
||||
- Removed deprecated `require('xxx.yml')` support. |
||||
- Significant code cleanup and refactoring. |
||||
- Internal API changed. If you used custom types - see updated examples. |
||||
Others are not affected. |
||||
- Even if the input string has no trailing line break character, |
||||
it will be parsed as if it has one. |
||||
- Added benchmark scripts. |
||||
- Moved bower files to /dist folder |
||||
- Bugfixes. |
||||
|
||||
|
||||
3.0.2 / 2014-02-27 |
||||
------------------ |
||||
|
||||
- Fixed bug: "constructor" string parsed as `null`. |
||||
|
||||
|
||||
3.0.1 / 2013-12-22 |
||||
------------------ |
||||
|
||||
- Fixed parsing of literal scalars. (issue #108) |
||||
- Prevented adding unnecessary spaces in object dumps. (issue #68) |
||||
- Fixed dumping of objects with very long (> 1024 in length) keys. |
||||
|
||||
|
||||
3.0.0 / 2013-12-16 |
||||
------------------ |
||||
|
||||
- Refactored code. Changed API for custom types. |
||||
- Removed output colors in CLI, dump json by default. |
||||
- Removed big dependencies from browser version (esprima, buffer) |
||||
- load `esprima` manually, if !!js/function needed |
||||
- !!bin now returns Array in browser |
||||
- AMD support. |
||||
- Don't quote dumped strings because of `-` & `?` (if not first char). |
||||
- __Deprecated__ loading yaml files via `require()`, as not recommended |
||||
behaviour for node. |
||||
|
||||
|
||||
2.1.3 / 2013-10-16 |
||||
------------------ |
||||
|
||||
- Fix wrong loading of empty block scalars. |
||||
|
||||
|
||||
2.1.2 / 2013-10-07 |
||||
------------------ |
||||
|
||||
- Fix unwanted line breaks in folded scalars. |
||||
|
||||
|
||||
2.1.1 / 2013-10-02 |
||||
------------------ |
||||
|
||||
- Dumper now respects deprecated booleans syntax from YAML 1.0/1.1 |
||||
- Fixed reader bug in JSON-like sequences/mappings. |
||||
|
||||
|
||||
2.1.0 / 2013-06-05 |
||||
------------------ |
||||
|
||||
- Add standard YAML schemas: Failsafe (`FAILSAFE_SCHEMA`), |
||||
JSON (`JSON_SCHEMA`) and Core (`CORE_SCHEMA`). |
||||
- Rename `DEFAULT_SCHEMA` to `DEFAULT_FULL_SCHEMA` |
||||
and `SAFE_SCHEMA` to `DEFAULT_SAFE_SCHEMA`. |
||||
- Bug fix: export `NIL` constant from the public interface. |
||||
- Add `skipInvalid` dumper option. |
||||
- Use `safeLoad` for `require` extension. |
||||
|
||||
|
||||
2.0.5 / 2013-04-26 |
||||
------------------ |
||||
|
||||
- Close security issue in !!js/function constructor. |
||||
Big thanks to @nealpoole for security audit. |
||||
|
||||
|
||||
2.0.4 / 2013-04-08 |
||||
------------------ |
||||
|
||||
- Updated .npmignore to reduce package size |
||||
|
||||
|
||||
2.0.3 / 2013-02-26 |
||||
------------------ |
||||
|
||||
- Fixed dumping of empty arrays ans objects. ([] and {} instead of null) |
||||
|
||||
|
||||
2.0.2 / 2013-02-15 |
||||
------------------ |
||||
|
||||
- Fixed input validation: tabs are printable characters. |
||||
|
||||
|
||||
2.0.1 / 2013-02-09 |
||||
------------------ |
||||
|
||||
- Fixed error, when options not passed to function cass |
||||
|
||||
|
||||
2.0.0 / 2013-02-09 |
||||
------------------ |
||||
|
||||
- Full rewrite. New architecture. Fast one-stage parsing. |
||||
- Changed custom types API. |
||||
- Added YAML dumper. |
||||
|
||||
|
||||
1.0.3 / 2012-11-05 |
||||
------------------ |
||||
|
||||
- Fixed utf-8 files loading. |
||||
|
||||
|
||||
1.0.2 / 2012-08-02 |
||||
------------------ |
||||
|
||||
- Pull out hand-written shims. Use ES5-Shims for old browsers support. See #44. |
||||
- Fix timstamps incorectly parsed in local time when no time part specified. |
||||
|
||||
|
||||
1.0.1 / 2012-07-07 |
||||
------------------ |
||||
|
||||
- Fixes `TypeError: 'undefined' is not an object` under Safari. Thanks Phuong. |
||||
- Fix timestamps incorrectly parsed in local time. Thanks @caolan. Closes #46. |
||||
|
||||
|
||||
1.0.0 / 2012-07-01 |
||||
------------------ |
||||
|
||||
- `y`, `yes`, `n`, `no`, `on`, `off` are not converted to Booleans anymore. |
||||
Fixes #42. |
||||
- `require(filename)` now returns a single document and throws an Error if |
||||
file contains more than one document. |
||||
- CLI was merged back from js-yaml.bin |
||||
|
||||
|
||||
0.3.7 / 2012-02-28 |
||||
------------------ |
||||
|
||||
- Fix export of `addConstructor()`. Closes #39. |
||||
|
||||
|
||||
0.3.6 / 2012-02-22 |
||||
------------------ |
||||
|
||||
- Removed AMD parts - too buggy to use. Need help to rewrite from scratch |
||||
- Removed YUI compressor warning (renamed `double` variable). Closes #40. |
||||
|
||||
|
||||
0.3.5 / 2012-01-10 |
||||
------------------ |
||||
|
||||
- Workagound for .npmignore fuckup under windows. Thanks to airportyh. |
||||
|
||||
|
||||
0.3.4 / 2011-12-24 |
||||
------------------ |
||||
|
||||
- Fixes str[] for oldIEs support. |
||||
- Adds better has change support for browserified demo. |
||||
- improves compact output of Error. Closes #33. |
||||
|
||||
|
||||
0.3.3 / 2011-12-20 |
||||
------------------ |
||||
|
||||
- jsyaml executable moved to separate module. |
||||
- adds `compact` stringification of Errors. |
||||
|
||||
|
||||
0.3.2 / 2011-12-16 |
||||
------------------ |
||||
|
||||
- Fixes ug with block style scalars. Closes #26. |
||||
- All sources are passing JSLint now. |
||||
- Fixes bug in Safari. Closes #28. |
||||
- Fixes bug in Opers. Closes #29. |
||||
- Improves browser support. Closes #20. |
||||
- Added jsyaml executable. |
||||
- Added !!js/function support. Closes #12. |
||||
|
||||
|
||||
0.3.1 / 2011-11-18 |
||||
------------------ |
||||
|
||||
- Added AMD support for browserified version. |
||||
- Wrapped browserified js-yaml into closure. |
||||
- Fixed the resolvement of non-specific tags. Closes #17. |
||||
- Added permalinks for online demo YAML snippets. Now we have YPaste service, lol. |
||||
- Added !!js/regexp and !!js/undefined types. Partially solves #12. |
||||
- Fixed !!set mapping. |
||||
- Fixed month parse in dates. Closes #19. |
||||
|
||||
|
||||
0.3.0 / 2011-11-09 |
||||
------------------ |
||||
|
||||
- Removed JS.Class dependency. Closes #3. |
||||
- Added browserified version. Closes #13. |
||||
- Added live demo of browserified version. |
||||
- Ported some of the PyYAML tests. See #14. |
||||
- Fixed timestamp bug when fraction was given. |
||||
|
||||
|
||||
0.2.2 / 2011-11-06 |
||||
------------------ |
||||
|
||||
- Fixed crash on docs without ---. Closes #8. |
||||
- Fixed miltiline string parse |
||||
- Fixed tests/comments for using array as key |
||||
|
||||
|
||||
0.2.1 / 2011-11-02 |
||||
------------------ |
||||
|
||||
- Fixed short file read (<4k). Closes #9. |
||||
|
||||
|
||||
0.2.0 / 2011-11-02 |
||||
------------------ |
||||
|
||||
- First public release |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
(The MIT License) |
||||
|
||||
Copyright (C) 2011-2015 by Vitaly Puzrin |
||||
|
||||
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. |
@ -0,0 +1,290 @@
@@ -0,0 +1,290 @@
|
||||
JS-YAML - YAML 1.2 parser and serializer for JavaScript |
||||
======================================================= |
||||
|
||||
[](https://travis-ci.org/nodeca/js-yaml) |
||||
[](https://www.npmjs.org/package/js-yaml) |
||||
|
||||
[Online Demo](http://nodeca.github.com/js-yaml/) |
||||
|
||||
|
||||
This is an implementation of [YAML](http://yaml.org/), a human friendly data |
||||
serialization language. Started as [PyYAML](http://pyyaml.org/) port, it was |
||||
completely rewritten from scratch. Now it's very fast, and supports 1.2 spec. |
||||
|
||||
|
||||
Installation |
||||
------------ |
||||
|
||||
### YAML module for node.js |
||||
|
||||
``` |
||||
npm install js-yaml |
||||
``` |
||||
|
||||
|
||||
### CLI executable |
||||
|
||||
If you want to inspect your YAML files from CLI, install js-yaml globally: |
||||
|
||||
``` |
||||
npm install -g js-yaml |
||||
``` |
||||
|
||||
#### Usage |
||||
|
||||
``` |
||||
usage: js-yaml [-h] [-v] [-c] [-t] file |
||||
|
||||
Positional arguments: |
||||
file File with YAML document(s) |
||||
|
||||
Optional arguments: |
||||
-h, --help Show this help message and exit. |
||||
-v, --version Show program's version number and exit. |
||||
-c, --compact Display errors in compact mode |
||||
-t, --trace Show stack trace on error |
||||
``` |
||||
|
||||
|
||||
### Bundled YAML library for browsers |
||||
|
||||
``` html |
||||
<!-- esprima required only for !!js/function --> |
||||
<script src="esprima.js"></script> |
||||
<script src="js-yaml.min.js"></script> |
||||
<script type="text/javascript"> |
||||
var doc = jsyaml.load('greeting: hello\nname: world'); |
||||
</script> |
||||
``` |
||||
|
||||
Browser support was done mostly for online demo. If you find any errors - feel |
||||
free to send pull requests with fixes. Also note, that IE and other old browsers |
||||
needs [es5-shims](https://github.com/kriskowal/es5-shim) to operate. |
||||
|
||||
Notes: |
||||
|
||||
1. We have no resourses to support browserified version. Don't expect it to be |
||||
well tested. Don't expect fast fixes if something goes wrong there. |
||||
2. `!!js/function` in browser bundle will not work by default. If you really need |
||||
it - load `esprima` parser first (via amd or directly). |
||||
3. `!!bin` in browser will return `Array`, because browsers do not support |
||||
node.js `Buffer` and adding Buffer shims is completely useless on practice. |
||||
|
||||
|
||||
API |
||||
--- |
||||
|
||||
Here we cover the most 'useful' methods. If you need advanced details (creating |
||||
your own tags), see [wiki](https://github.com/nodeca/js-yaml/wiki) and |
||||
[examples](https://github.com/nodeca/js-yaml/tree/master/examples) for more |
||||
info. |
||||
|
||||
``` javascript |
||||
yaml = require('js-yaml'); |
||||
fs = require('fs'); |
||||
|
||||
// Get document, or throw exception on error |
||||
try { |
||||
var doc = yaml.safeLoad(fs.readFileSync('/home/ixti/example.yml', 'utf8')); |
||||
console.log(doc); |
||||
} catch (e) { |
||||
console.log(e); |
||||
} |
||||
``` |
||||
|
||||
|
||||
### safeLoad (string [ , options ]) |
||||
|
||||
**Recommended loading way.** Parses `string` as single YAML document. Returns a JavaScript |
||||
object or throws `YAMLException` on error. By default, does not support regexps, |
||||
functions and undefined. This method is safe for untrusted data. |
||||
|
||||
options: |
||||
|
||||
- `filename` _(default: null)_ - string to be used as a file path in |
||||
error/warning messages. |
||||
- `onWarning` _(default: null)_ - function to call on warning messages. |
||||
Loader will throw on warnings if this function is not provided. |
||||
- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ - specifies a schema to use. |
||||
- `FAILSAFE_SCHEMA` - only strings, arrays and plain objects: |
||||
http://www.yaml.org/spec/1.2/spec.html#id2802346 |
||||
- `JSON_SCHEMA` - all JSON-supported types: |
||||
http://www.yaml.org/spec/1.2/spec.html#id2803231 |
||||
- `CORE_SCHEMA` - same as `JSON_SCHEMA`: |
||||
http://www.yaml.org/spec/1.2/spec.html#id2804923 |
||||
- `DEFAULT_SAFE_SCHEMA` - all supported YAML types, without unsafe ones |
||||
(`!!js/undefined`, `!!js/regexp` and `!!js/function`): |
||||
http://yaml.org/type/ |
||||
- `DEFAULT_FULL_SCHEMA` - all supported YAML types. |
||||
|
||||
NOTE: This function **does not** understand multi-document sources, it throws |
||||
exception on those. |
||||
|
||||
NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions. |
||||
So, JSON schema is not as strict as defined in the YAML specification. |
||||
It allows numbers in any notaion, use `Null` and `NULL` as `null`, etc. |
||||
Core schema also has no such restrictions. It allows binary notation for integers. |
||||
|
||||
|
||||
### load (string [ , options ]) |
||||
|
||||
**Use with care with untrusted sources**. The same as `safeLoad()` but uses |
||||
`DEFAULT_FULL_SCHEMA` by default - adds some JavaScript-specific types: |
||||
`!!js/function`, `!!js/regexp` and `!!js/undefined`. For untrusted sources you |
||||
must additionally validate object structure, to avoid injections: |
||||
|
||||
``` javascript |
||||
var untrusted_code = '"toString": !<tag:yaml.org,2002:js/function> "function (){very_evil_thing();}"'; |
||||
|
||||
// I'm just converting that string, what could possibly go wrong? |
||||
require('js-yaml').load(untrusted_code) + '' |
||||
``` |
||||
|
||||
|
||||
### safeLoadAll (string, iterator [ , options ]) |
||||
|
||||
Same as `safeLoad()`, but understands multi-document sources and apply |
||||
`iterator` to each document. |
||||
|
||||
``` javascript |
||||
var yaml = require('js-yaml'); |
||||
|
||||
yaml.safeLoadAll(data, function (doc) { |
||||
console.log(doc); |
||||
}); |
||||
``` |
||||
|
||||
|
||||
### loadAll (string, iterator [ , options ]) |
||||
|
||||
Same as `safeLoadAll()` but uses `DEFAULT_FULL_SCHEMA` by default. |
||||
|
||||
|
||||
### safeDump (object [ , options ]) |
||||
|
||||
Serializes `object` as YAML document. Uses `DEFAULT_SAFE_SCHEMA`, so it will |
||||
throw exception if you try to dump regexps or functions. However, you can |
||||
disable exceptions by `skipInvalid` option. |
||||
|
||||
options: |
||||
|
||||
- `indent` _(default: 2)_ - indentation width to use (in spaces). |
||||
- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function |
||||
in the safe schema) and skip pairs and single values with such types. |
||||
- `flowLevel` (default: -1) - specifies level of nesting, when to switch from |
||||
block to flow style for collections. -1 means block style everwhere |
||||
- `styles` - "tag" => "style" map. Each tag may have own set of styles. |
||||
- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ specifies a schema to use. |
||||
- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a |
||||
function, use the function to sort the keys. |
||||
|
||||
styles: |
||||
|
||||
``` none |
||||
!!null |
||||
"canonical" => "~" |
||||
|
||||
!!int |
||||
"binary" => "0b1", "0b101010", "0b1110001111010" |
||||
"octal" => "01", "052", "016172" |
||||
"decimal" => "1", "42", "7290" |
||||
"hexadecimal" => "0x1", "0x2A", "0x1C7A" |
||||
|
||||
!!null, !!bool, !!float |
||||
"lowercase" => "null", "true", "false", ".nan", '.inf' |
||||
"uppercase" => "NULL", "TRUE", "FALSE", ".NAN", '.INF' |
||||
"camelcase" => "Null", "True", "False", ".NaN", '.Inf' |
||||
``` |
||||
|
||||
By default, !!int uses `decimal`, and !!null, !!bool, !!float use `lowercase`. |
||||
|
||||
|
||||
|
||||
### dump (object [ , options ]) |
||||
|
||||
Same as `safeDump()` but without limits (uses `DEFAULT_FULL_SCHEMA` by default). |
||||
|
||||
|
||||
Supported YAML types |
||||
-------------------- |
||||
|
||||
The list of standard YAML tags and corresponding JavaScipt types. See also |
||||
[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and |
||||
[YAML types repository](http://yaml.org/type/). |
||||
|
||||
``` |
||||
!!null '' # null |
||||
!!bool 'yes' # bool |
||||
!!int '3...' # number |
||||
!!float '3.14...' # number |
||||
!!binary '...base64...' # buffer |
||||
!!timestamp 'YYYY-...' # date |
||||
!!omap [ ... ] # array of key-value pairs |
||||