# This package is different from most node packages in Fedora because # CoffeeScript is written in itself, and per Fedora policy we need to compile # it--we can't ship the precompiled version. # uglify-js is now in the distro, so we can build the browser version, but # we have one test that fails, but only inside of mock :-( %global enable_minified 0 %global commit f26d33d418dcdcfcc6ad3ab774d9cabbf7af659c %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: coffee-script Version: 1.10.0 Release: 5%{?dist} Summary: A programming language that transcompiles to JavaScript License: MIT Group: Development/Languages URL: http://coffeescript.org/ Source0: https://github.com/jashkenas/%{name}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch ExclusiveArch: %{nodejs_arches} noarch # some fixes for Cakefile, including: # - follow FHS and Fedora Node.js packaging guidelines # - support DESTDIR # - preserve timestamps when installing Patch1: %{name}-%{version}-Cakefile.patch BuildRequires: nodejs-packaging BuildRequires: npm(underscore) BuildRequires: npm(uglify-js) Requires: %{name}-common == %{version}-%{release} %if 0%{?enable_minified} BuildRequires: npm(uglify-js) %endif %description CoffeeScript is a little language that compiles into JavaScript. Underneath all of those embarrassing braces and semicolons, JavaScript has always had a gorgeous object model at its heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way. The golden rule of CoffeeScript is: "It's just JavaScript". The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. You can use any existing JavaScript library seamlessly (and vice-versa). The compiled output is readable and pretty-printed, passes through JavaScript Lint without warnings, will work in every JavaScript implementation, and tends to run as fast or faster than the equivalent handwritten JavaScript. %package common Summary: A programming that transcompiles to JavaScript - core compiler Group: Development/Languages %description common This is the core compiler for the CoffeeScript language, suitable for use in browsers or by other JavaScript implementations. For the primary compiler and cake utility used in conjunction with Node.js, install the 'coffee-script' package. %package doc Summary: A programming language that transcompiles to JavaScript - documentation Group: Documentation %description doc The documentation for the CoffeeScript programming language. %prep %setup -qn coffeescript-%{commit} %patch1 -p1 #rename documentation directory to html cause that's what we want in %%doc mv documentation html %build mkdir -p node_modules ln -sf %{nodejs_sitelib}/underscore node_modules/underscore ./bin/cake build %if 0%{?enable_minified} #build the minified coffee-script browser version and put it in its place ln -sf %{nodejs_sitelib}/uglify-js node_modules/uglify-js ./bin/cake build:browser mv extras/coffee-script.js extras/coffee-script.min.js %endif #also build the unminifed version MINIFY=false ./bin/cake build:browser %install rm -rf %{buildroot} mkdir -p %{buildroot}%{_datadir}/%{name}/ cp -pr lib extras %{buildroot}%{_datadir}/%{name}/ chmod 0644 %{buildroot}%{_datadir}/%{name}/lib/coffee-script/parser.js mkdir -p %{buildroot}%{nodejs_sitelib}/%{name} cp -pr bin package.json %{buildroot}%{nodejs_sitelib}/%{name} ln -sf %{_datadir}/%{name}/lib %{buildroot}%{nodejs_sitelib}/%{name}/lib ln -sf %{_datadir}/%{name}/extras %{buildroot}%{nodejs_sitelib}/%{name}/extras ln -sf %{nodejs_sitelib}/%{name}/bin/ %{buildroot}%{_datadir}/%{name}/bin for i in $(ls %{_datadir}/%{name}/lib/coffee-script/*.js) do ln -sf $i %{buildroot}%{nodejs_sitelib}/%{name}/$(basename $i) done mkdir -p %{buildroot}%{_bindir} ln -sf ../lib/node_modules/%{name}/bin/coffee %{buildroot}%{_bindir}/coffee ln -sf ../lib/node_modules/%{name}/bin/cake %{buildroot}%{_bindir}/cake # we purposely don't run %%nodejs_symlink_deps because if we did, it would need # special treatment anyway %check # tests pass but something weird is going on with node itself at the end #./bin/cake test || : %__nodejs ./bin/cake test %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %{nodejs_sitelib}/%{name} %{_bindir}/coffee %{_bindir}/cake %files common %{!?_licensedir:%global license %doc} %defattr(-,root,root,-) %{_datadir}/%{name} %doc *.md %license LICENSE %files doc %defattr(-,root,root,-) %doc html/ examples/ %changelog * Sat Nov 07 2015 Jared Smith - 1.10.0-5 - Fix things so that you can require('coffee-script/register') * Wed Nov 04 2015 Jared Smith - 1.10.0-3 - Symlink back from the shared directory in -common to the bin directory in coffee-script, see line 52 of lib/coffee-script/register.js * Wed Nov 04 2015 Jared Smith - 1.10.0-1 - Update to upstream 1.10.0 release * Wed Jun 17 2015 Fedora Release Engineering - 1.6.3-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Sat Jun 07 2014 Fedora Release Engineering - 1.6.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Sat Aug 03 2013 Fedora Release Engineering - 1.6.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild * Wed Jun 19 2013 T.C. Hollingsworth - 1.6.3-1 - new upstream release 1.6.3 http://coffeescript.org/#changelog - restrict architectures to ones that node works on * Sun Feb 10 2013 T.C. Hollingsworth - 1.4.0-4 - fix rpmlint warnings - rename documentation subpackage to "coffee-script-doc" * Fri Feb 01 2013 T.C. Hollingsworth - 1.4.0-3 - rearrange symlinks to dep/provides generation works - conditionalize minification so it works in the absence of uglify-js * Thu Jan 31 2013 T.C. Hollingsworth - 1.4.0-2 - provide a -common subpackage with stuff useful for other JS runtimes/browsers - split off the docs too * Tue Jan 15 2013 T.C. Hollingsworth - 1.4.0-1 - new upstream release 1.4.0 - clean up for submission * Sat Aug 20 2011 T.C. Hollingsworth - 1.1.2-1 - initial package