20aebcd
%global commitdate  20140204
20aebcd
%global commit      3d7767b6b1f3da363c625ff54e63bbf20e9e83ac
20aebcd
%global shortcommit %(c=%{commit}; echo ${c:0:7})
20aebcd
38cef87
%if 0%{?fedora}
20aebcd
%global installdir  %{_jsdir}/json
38cef87
%else
38cef87
%global installdir  %{_datadir}/javascript
38cef87
%endif
20aebcd
20aebcd
Name:            js-json
20aebcd
Version:         %{commitdate}git%{shortcommit}
38cef87
Release:         3%{?dist}
20aebcd
Summary:         An implementation of JSON encoders/decoders in JavaScript
20aebcd
20aebcd
Group:           System Environment/Libraries
20aebcd
License:         Public Domain
20aebcd
URL:             https://github.com/douglascrockford/JSON-js
20aebcd
Source0:         https://github.com/douglascrockford/JSON-js/archive/%{commit}/%{name}-%{version}.tar.gz
20aebcd
20aebcd
BuildArch:       noarch
20aebcd
38cef87
%if 0%{?fedora}
20aebcd
BuildRequires:   web-assets-devel
20aebcd
Requires:        web-assets-filesystem
38cef87
%endif
20aebcd
20aebcd
%description
20aebcd
JSON is a light-weight, language independent, data interchange format.
20aebcd
See http://www.JSON.org/
20aebcd
20aebcd
This software is an implementation of JSON encoders/decoders in Javascript.
20aebcd
20aebcd
json2.js: This file creates a JSON property in the global object, if there
20aebcd
isn't already one, setting its value to an object containing a stringify
20aebcd
method and a parse method. The parse method uses the eval method to do the
20aebcd
parsing, guarding it with several regular expressions to defend against
20aebcd
accidental code execution hazards. On current browsers, this file does nothing,
20aebcd
preferring the built-in JSON object.
20aebcd
20aebcd
json.js: This file does everything that json2.js does. It also adds a
20aebcd
toJSONString method and a parseJSON method to Object.prototype. Use of this
20aebcd
file is not recommended.
20aebcd
20aebcd
json_parse.js: This file contains an alternative JSON parse function that
20aebcd
uses recursive descent instead of eval.
20aebcd
20aebcd
json_parse_state.js: This files contains an alternative JSON parse function that
20aebcd
uses a state machine instead of eval.
20aebcd
20aebcd
cycle.js: This file contains two functions, JSON.decycle and JSON.retrocycle,
20aebcd
which make it possible to encode cyclical structures and dags in JSON, and to
20aebcd
then recover them. JSONPath is used to represent the links.
20aebcd
http://GOESSNER.net/articles/JsonPath/
20aebcd
20aebcd
20aebcd
%prep
20aebcd
%setup -q -n JSON-js-%{commit}
20aebcd
20aebcd
20aebcd
%build
20aebcd
# nothing to do
20aebcd
20aebcd
%install
20aebcd
mkdir -p %{buildroot}%{installdir}
20aebcd
install -p -m0644 -D cycle.js \
20aebcd
    %{buildroot}%{installdir}/cycle.js
20aebcd
install -p -m0644 -D json.js \
20aebcd
    %{buildroot}%{installdir}/json.js
20aebcd
install -p -m0644 -D json2.js \
20aebcd
    %{buildroot}%{installdir}/json2.js
20aebcd
install -p -m0644 -D json_parse.js \
20aebcd
    %{buildroot}%{installdir}/json_parse.js
20aebcd
install -p -m0644 -D json_parse_state.js \
20aebcd
    %{buildroot}%{installdir}/json_parse_state.js
20aebcd
20aebcd
20aebcd
%files
20aebcd
%doc README
20aebcd
%{installdir}
20aebcd
20aebcd
20aebcd
%changelog
38cef87
* Sun Feb 23 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 20140204git3d7767b-3
38cef87
- add logic for building on EPEL 6
38cef87
20aebcd
* Sun Feb 23 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 20140204git3d7767b-2
20aebcd
- install to %%{_jsdir}/json instead of %%{_jsdir}/js-json
20aebcd
20aebcd
* Sun Feb 23 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 20140204git3d7767b-1
20aebcd
- initial package
20aebcd