Skip to content

Commit

Permalink
Adapt to Paw JS API version 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mittsh committed Sep 10, 2015
1 parent 30bef3d commit b2c859f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Cakefile
Expand Up @@ -29,7 +29,12 @@ build_copy = () ->
fs.writeFileSync "#{ build_dir }/LICENSE", fs.readFileSync("./LICENSE")
fs.writeFileSync "#{ build_dir }/httpie.mustache", fs.readFileSync("./httpie.mustache")
fs.writeFileSync "#{ build_dir }/mustache.js", fs.readFileSync("./node_modules/mustache/mustache.js")
fs.writeFileSync "#{ build_dir }/URI.js", fs.readFileSync("./node_modules/URIjs/src/URI.min.js")
fs.writeFileSync "#{ build_dir }/URI.js", fs.readFileSync("./node_modules/URIjs/src/URI.js")
fs.writeFileSync "#{ build_dir }/punycode.js", fs.readFileSync("./node_modules/URIjs/src/punycode.js")
fs.writeFileSync "#{ build_dir }/IPv6.js", fs.readFileSync("./node_modules/URIjs/src/IPv6.js")
fs.writeFileSync "#{ build_dir }/SecondLevelDomains.js", fs.readFileSync("./node_modules/URIjs/src/SecondLevelDomains.js")
# legacy
fs.writeFileSync "#{ build_dir }/URI.min.js", fs.readFileSync("./node_modules/URIjs/src/URI.min.js")

# build: build CoffeeScript and copy files to build directory
build = (callback) ->
Expand Down
11 changes: 9 additions & 2 deletions HTTPieCodeGenerator.coffee
@@ -1,5 +1,12 @@
require "mustache.js"
require "URI.js"
# in API v0.2.0 and below (Paw 2.2.2 and below), require had no return value
((root) ->
if root.bundle?.minApiVersion('0.2.0')
root.URI = require("./URI")
root.Mustache = require("./mustache")
else
require("URI.min.js")
require("mustache.js")
)(this)

addslashes = (str) ->
("#{str}").replace(/[\\"]/g, '\\$&')
Expand Down

0 comments on commit b2c859f

Please sign in to comment.