distil 0.14.1 → 0.14.2.a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/assets/distil.js +34 -27
  3. data/distil.gemspec +3 -3
  4. metadata +10 -7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.14.1
1
+ 0.14.2.a
data/assets/distil.js CHANGED
@@ -232,6 +232,7 @@
232
232
  resource = resource.parent;
233
233
  }
234
234
 
235
+ window.__filename__ = null;
235
236
  currentResource = resource ? resource : rootResource;
236
237
  };
237
238
 
@@ -395,26 +396,42 @@
395
396
 
396
397
  distil.kick = distil.moduleDidLoad;
397
398
 
399
+ /**
400
+ pathToAssetInModule(asset, module) -> String
401
+ - asset (String): The name or path of the asset.
402
+ - module (Object): The module definition from which to pull the asset
403
+ */
404
+ var pathToAssetInModule = function(asset, module)
405
+ {
406
+ // If the asset is in the asset_map, it is presumed to be relative to the
407
+ // module rather than the currently running script.
408
+ if (module.asset_map && module.asset_map[asset])
409
+ return module.path + module.asset_map[asset];
410
+
411
+ var path, url;
412
+
413
+ if (distil.sync)
414
+ url = getRunningScriptSource();
415
+ else
416
+ url = window.__filename__;
417
+
418
+ if (url)
419
+ {
420
+ var lastSlash = url.lastIndexOf('/');
421
+ path = url.substring(0, lastSlash + 1);
422
+ }
423
+ else
424
+ path= module.path;
425
+
426
+ return path + asset;
427
+ };
428
+
398
429
  distil.urlForAssetWithNameInModule = function(asset, moduleName)
399
430
  {
400
431
  var module = moduleName ? moduleIndex[moduleName] : distil.mainModule;
401
432
  if (!module)
402
433
  throw new Error(NO_MODULE_ERROR + moduleName);
403
-
404
- var path;
405
- if (distil.sync)
406
- {
407
- var url = getRunningScriptSource();
408
- var lastSlash = url.lastIndexOf('/');
409
- path = url.substring(0, lastSlash + 1);
410
- }
411
- else
412
- path = module.path;
413
-
414
- if (!module.asset_map)
415
- return path + asset;
416
-
417
- return path + (module.asset_map[asset] || asset);
434
+ return pathToAssetInModule(asset, module);
418
435
  }
419
436
 
420
437
  distil.dataForAssetWithNameInModule = function(asset, moduleName)
@@ -433,23 +450,13 @@
433
450
  if (!module.asset_map)
434
451
  return null;
435
452
 
436
- var path;
437
- if (distil.sync)
438
- {
439
- var url = getRunningScriptSource();
440
- var lastSlash = url.lastIndexOf('/');
441
- path = url.substring(0, lastSlash + 1);
442
- }
443
- else
444
- path = module.path;
445
-
446
- var assetUrl = path + (module.asset_map[asset] || asset);
453
+ var path= pathToAssetInModule(asset, module);
447
454
 
448
455
  function oncomplete(unused, xhr)
449
456
  {
450
457
  module.assets[asset] = data = xhr.responseText;
451
458
  }
452
- fetchAsset(assetUrl, oncomplete, null, null, true);
459
+ fetchAsset(path, oncomplete, null, null, true);
453
460
  return data;
454
461
  }
455
462
 
data/distil.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{distil}
8
- s.version = "0.14.1"
8
+ s.version = "0.14.2.a"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Watkins"]
12
- s.date = %q{2011-04-20}
12
+ s.date = %q{2011-05-06}
13
13
  s.description = %q{A build tool for Javascript and CSS that takes advantage of best-of-breed helper applications Javascript Lint and JSDoc Toolkit}
14
14
  s.executables = ["distil", "jsl"]
15
15
  s.extensions = ["vendor/extconf.rb"]
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distil
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
6
  - 0
7
7
  - 14
8
- - 1
9
- version: 0.14.1
8
+ - 2
9
+ - a
10
+ version: 0.14.2.a
10
11
  platform: ruby
11
12
  authors:
12
13
  - Jeff Watkins
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-04-20 00:00:00 -07:00
18
+ date: 2011-05-06 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -847,11 +848,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
847
848
  version: "0"
848
849
  required_rubygems_version: !ruby/object:Gem::Requirement
849
850
  requirements:
850
- - - ">="
851
+ - - ">"
851
852
  - !ruby/object:Gem::Version
852
853
  segments:
853
- - 0
854
- version: "0"
854
+ - 1
855
+ - 3
856
+ - 1
857
+ version: 1.3.1
855
858
  requirements: []
856
859
 
857
860
  rubyforge_project: