Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #213 from ebollens/fix/106
Browse files Browse the repository at this point in the history
Download compiled jQuery rather than compile it directly [fixes #106]
  • Loading branch information
Eric Bollens committed Jan 3, 2013
2 parents 1fc1409 + 457024b commit b9f73dc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
41 changes: 20 additions & 21 deletions lib/Build/Package/Jquery.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'rubygems'
require 'extensions/kernel'
require 'net/http'
require_relative '../../Path'
require_relative '../Submodule'
require_relative '../Utilities'
Expand All @@ -13,25 +14,19 @@ module Package

class Jquery

def domain
'code.jquery.com'
end

def path
config[:build][:debug] ? '/jquery-1.8.3.js' : '/jquery-1.8.3.min.js'
end

include ::WebBlocks::Logger
include ::WebBlocks::Path::Temporary_Build
include ::WebBlocks::Build::Submodule
include ::WebBlocks::Build::Utilities

def preprocess

preprocess_js

end

def preprocess_js

preprocess_submodule :jquery
preprocess_submodule_submodules :jquery
preprocess_submodule_npm :jquery

end

def compile

compile_js
Expand All @@ -40,15 +35,19 @@ def compile

def compile_js

unless File.exists? "#{package_dir :jquery}/dist/jquery.js"
filename = "#{package_dir :jquery}/dist/jquery.js"

unless File.exists? filename

log.task "Package: jQuery", "Compiling jQuery" do
Dir.chdir package_dir :jquery do
status, stdout, stderr = systemu "#{config[:exec][:npm]} install"
log.failure "Builder: jQuery", "NPM execution failed" if stderr.length > 0
status, stdout, stderr = systemu "#{config[:exec][:grunt]}"
log.failure "Builder: jQuery", "Grunt execution failed" if stderr.length > 0
log.task "Package: jQuery", "Downloading compiled version of jQuery" do
Net::HTTP.start(domain) do |http|
resp = http.get(path)
FileUtils.mkdir_p File.dirname(filename)
open(filename, "w") do |file|
file.write(resp.body)
end
end

end

end
Expand Down
2 changes: 1 addition & 1 deletion package/jquery
Submodule jquery updated 68 files
+10 −3 .editorconfig
+11 −0 .jshintrc
+135 −0 AUTHORS.txt
+216 −0 CONTRIBUTING.md
+0 −278 GPL-LICENSE.txt
+2 −1 MIT-LICENSE.txt
+0 −25 Makefile
+24 −3 README.md
+4 −4 build/release-notes.js
+166 −128 build/release.js
+130 −81 grunt.js
+30 −33 package.json
+12 −12 speed/jquery-basis.js
+28 −0 src/.jshintrc
+91 −201 src/ajax.js
+7 −8 src/ajax/xhr.js
+43 −62 src/attributes.js
+11 −8 src/callbacks.js
+117 −143 src/core.js
+68 −52 src/css.js
+23 −45 src/data.js
+1 −1 src/deferred.js
+63 −0 src/deprecated.js
+6 −9 src/dimensions.js
+95 −55 src/effects.js
+31 −41 src/event.js
+4 −6 src/intro.js
+102 −79 src/manipulation.js
+16 −11 src/offset.js
+9 −5 src/queue.js
+101 −0 src/serialize.js
+1 −1 src/sizzle
+1 −1 src/sizzle-jquery.js
+13 −15 src/support.js
+23 −26 src/traversing.js
+57 −0 test/.jshintrc
+0 −31 test/data/event/asyncReady.html
+0 −6 test/data/event/longLoad.php
+4 −0 test/data/event/longLoadScript.php
+1 −1 test/data/event/promiseReady.html
+9 −4 test/data/event/syncReady.html
+36 −0 test/data/manipulation/iframe-denied.html
+8 −5 test/data/testinit.js
+129 −5 test/data/testrunner.js
+4 −1 test/data/testsuite.css
+2 −2 test/data/ua.txt
+11 −2 test/index.html
+13 −2 test/polluted.php
+1 −1 test/qunit
+115 −197 test/unit/ajax.js
+95 −62 test/unit/attributes.js
+37 −15 test/unit/callbacks.js
+139 −140 test/unit/core.js
+88 −36 test/unit/css.js
+30 −19 test/unit/data.js
+24 −6 test/unit/deferred.js
+28 −0 test/unit/deprecated.js
+44 −32 test/unit/dimensions.js
+307 −56 test/unit/effects.js
+159 −80 test/unit/event.js
+99 −27 test/unit/manipulation.js
+226 −204 test/unit/offset.js
+29 −2 test/unit/queue.js
+11 −4 test/unit/selector.js
+145 −0 test/unit/serialize.js
+2 −2 test/unit/support.js
+11 −4 test/unit/traversing.js
+0 −1 version.txt

0 comments on commit b9f73dc

Please sign in to comment.