shuriken 0.1.3.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -50,7 +50,8 @@
50
50
 
51
51
  base.getRootNS: ->
52
52
  current: @
53
- current: current.parent while current.parent?
53
+ while current.parent?
54
+ current: current.parent
54
55
  current
55
56
 
56
57
  base.hasNS: (namespace) ->
@@ -129,4 +130,4 @@
129
130
  Shuriken.root: @
130
131
  @['Shuriken']: Shuriken
131
132
 
132
- )()
133
+ )()
@@ -8,19 +8,19 @@ var __slice = Array.prototype.slice, __bind = function(func, obj, args) {
8
8
  // First off, add our dataAttr extensions.
9
9
  (typeof jQuery !== "undefined" && jQuery !== null) ? (function($) {
10
10
  var stringToDataKey;
11
- stringToDataKey = function stringToDataKey(key) {
11
+ stringToDataKey = function(key) {
12
12
  return ("data-" + key).replace(/_/g, '-');
13
13
  };
14
- $.fn.dataAttr = function dataAttr(key, value) {
14
+ $.fn.dataAttr = function(key, value) {
15
15
  return this.attr(stringToDataKey(key), value);
16
16
  };
17
- $.fn.removeDataAttr = function removeDataAttr(key) {
17
+ $.fn.removeDataAttr = function(key) {
18
18
  return this.removeAttr(stringToDataKey(key));
19
19
  };
20
- $.fn.hasDataAttr = function hasDataAttr(key) {
20
+ $.fn.hasDataAttr = function(key) {
21
21
  return this.is(("[" + (stringToDataKey(key)) + "]"));
22
22
  };
23
- $.metaAttr = function metaAttr(key) {
23
+ $.metaAttr = function(key) {
24
24
  return $(("meta[name='" + key + "']")).attr("content");
25
25
  };
26
26
  return $.metaAttr;
@@ -33,22 +33,23 @@ var __slice = Array.prototype.slice, __bind = function(func, obj, args) {
33
33
  namespaces: {},
34
34
  extensions: []
35
35
  };
36
- Shuriken.Util.underscoreize = function underscoreize(s) {
36
+ Shuriken.Util.underscoreize = function(s) {
37
37
  return s.replace(/\./g, '/').replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2').replace(/([a-z\d])([A-Z])/g, '$1_$2').replace(/-/g, '_').toLowerCase();
38
38
  };
39
- scopedClosure = function scopedClosure(closure, scope) {
39
+ scopedClosure = function(closure, scope) {
40
40
  if ($.isFunction(closure)) {
41
41
  return closure.call(scope, scope);
42
42
  }
43
43
  };
44
44
  // Base is the prototype for all namespaces.
45
45
  base = Shuriken.Base;
46
- base.hasChildNamespace = function hasChildNamespace(child) {
46
+ base.hasChildNamespace = function(child) {
47
47
  return this.children.push(child);
48
48
  };
49
- base.toNSName = function toNSName() {
49
+ base.toNSName = function() {
50
50
  var children, current, parts;
51
- children = __slice.call(arguments, 0, arguments.length - 0);
51
+ var _a = arguments.length, _b = _a >= 1;
52
+ children = __slice.call(arguments, 0, _a - 0);
52
53
  parts = children;
53
54
  current = this;
54
55
  while ((typeof current !== "undefined" && current !== null)) {
@@ -57,7 +58,7 @@ var __slice = Array.prototype.slice, __bind = function(func, obj, args) {
57
58
  }
58
59
  return parts.join(".");
59
60
  };
60
- base.getNS = function getNS(namespace) {
61
+ base.getNS = function(namespace) {
61
62
  var _a, _b, _c, _d, currentNS, name, parts;
62
63
  parts = namespace.split(".");
63
64
  currentNS = this;
@@ -71,7 +72,7 @@ var __slice = Array.prototype.slice, __bind = function(func, obj, args) {
71
72
  }
72
73
  return currentNS;
73
74
  };
74
- base.getRootNS = function getRootNS() {
75
+ base.getRootNS = function() {
75
76
  var _a, current;
76
77
  current = this;
77
78
  while ((typeof (_a = current.parent) !== "undefined" && _a !== null)) {
@@ -79,11 +80,11 @@ var __slice = Array.prototype.slice, __bind = function(func, obj, args) {
79
80
  }
80
81
  return current;
81
82
  };
82
- base.hasNS = function hasNS(namespace) {
83
+ base.hasNS = function(namespace) {
83
84
  var _a;
84
85
  return (typeof (_a = this.getNS(namespace)) !== "undefined" && _a !== null);
85
86
  };
86
- base.withNS = function withNS(key, initializer) {
87
+ base.withNS = function(key, initializer) {
87
88
  var _a, _b, _c, _d, currentNS, hadSetup, name, parts;
88
89
  parts = key.split(".");
89
90
  currentNS = this;
@@ -102,27 +103,29 @@ var __slice = Array.prototype.slice, __bind = function(func, obj, args) {
102
103
  }
103
104
  return currentNS;
104
105
  };
105
- base.withBase = function withBase(closure) {
106
+ base.withBase = function(closure) {
106
107
  return scopedClosure(closure, this.baseNS);
107
108
  };
108
- base.extend = function extend(closure) {
109
+ base.extend = function(closure) {
109
110
  return scopedClosure(closure, this);
110
111
  };
111
- base.isRoot = function isRoot() {
112
+ base.isRoot = function() {
112
113
  var _a;
113
114
  return !(typeof (_a = this.parent) !== "undefined" && _a !== null);
114
115
  };
115
- base.log = function log() {
116
+ base.log = function() {
116
117
  var args;
117
- args = __slice.call(arguments, 0, arguments.length - 0);
118
+ var _a = arguments.length, _b = _a >= 1;
119
+ args = __slice.call(arguments, 0, _a - 0);
118
120
  return console.log.apply(console, [("[" + (this.toNSName()) + "]")].concat(args));
119
121
  };
120
- base.debug = function debug() {
122
+ base.debug = function() {
121
123
  var args;
122
- args = __slice.call(arguments, 0, arguments.length - 0);
124
+ var _a = arguments.length, _b = _a >= 1;
125
+ args = __slice.call(arguments, 0, _a - 0);
123
126
  return console.log.apply(console, [("[Debug - " + (this.toNSName()) + "]")].concat(args));
124
127
  };
125
- base.setupVia = function setupVia(f) {
128
+ base.setupVia = function(f) {
126
129
  return $(document).ready(__bind(function() {
127
130
  var _a;
128
131
  if ((typeof (_a = this.autosetup) !== "undefined" && _a !== null)) {
@@ -130,7 +133,7 @@ var __slice = Array.prototype.slice, __bind = function(func, obj, args) {
130
133
  }
131
134
  }, this));
132
135
  };
133
- base.require = function require(key, callback) {
136
+ base.require = function(key, callback) {
134
137
  var ns, path, script, url;
135
138
  ns = this.getNS(key);
136
139
  if ((typeof ns !== "undefined" && ns !== null)) {
@@ -150,12 +153,12 @@ var __slice = Array.prototype.slice, __bind = function(func, obj, args) {
150
153
  };
151
154
  base.autosetup = true;
152
155
  // Used as a part of the prototype chain.
153
- Shuriken.Namespace = function Namespace() { };
156
+ Shuriken.Namespace = function() { };
154
157
  Shuriken.Namespace.prototype = Shuriken.Base;
155
- makeNS = function makeNS(name, parent, sharedPrototype) {
158
+ makeNS = function(name, parent, sharedPrototype) {
156
159
  var namespace;
157
160
  sharedPrototype = (typeof sharedPrototype !== "undefined" && sharedPrototype !== null) ? sharedPrototype : new Shuriken.Namespace();
158
- namespace = function namespace() {
161
+ namespace = function() {
159
162
  this.name = name;
160
163
  this.parent = parent;
161
164
  this.baseNS = sharedPrototype;
@@ -168,7 +171,7 @@ var __slice = Array.prototype.slice, __bind = function(func, obj, args) {
168
171
  namespace.prototype = sharedPrototype;
169
172
  return new namespace(name, parent);
170
173
  };
171
- Shuriken.defineExtension = function defineExtension(closure) {
174
+ Shuriken.defineExtension = function(closure) {
172
175
  var _a, _b, _c, namespace;
173
176
  _b = Shuriken.namespaces;
174
177
  for (_a = 0, _c = _b.length; _a < _c; _a++) {
@@ -177,7 +180,7 @@ var __slice = Array.prototype.slice, __bind = function(func, obj, args) {
177
180
  }
178
181
  return Shuriken.extensions.push(closure);
179
182
  };
180
- Shuriken.as = function as(name) {
183
+ Shuriken.as = function(name) {
181
184
  var _a, _b, _c, extension, ns;
182
185
  ns = makeNS(name);
183
186
  Shuriken.namespaces[name] = ns;
@@ -5,18 +5,18 @@ Shuriken.defineExtension(function(baseNS) {
5
5
  ns.mixins = {};
6
6
  root.mixins = {};
7
7
  root.withBase(function(base) {
8
- base.mixin = function mixin(mixins) {
8
+ base.mixin = function(mixins) {
9
9
  return ns.mixin(this, mixins);
10
10
  };
11
11
  return base.mixin;
12
12
  });
13
- defineMixin = function defineMixin(key, mixin) {
13
+ defineMixin = function(key, mixin) {
14
14
  this.mixins[key] = mixin;
15
15
  return this.mixins[key];
16
16
  };
17
17
  root.defineMixin = defineMixin;
18
18
  ns.define = defineMixin;
19
- ns.lookupMixin = function lookupMixin(mixin) {
19
+ ns.lookupMixin = function(mixin) {
20
20
  var _a, _b, _c;
21
21
  if ((_a = typeof mixin) === "string") {
22
22
  if ((typeof (_b = ns.mixins[mixin]) !== "undefined" && _b !== null)) {
@@ -31,7 +31,7 @@ Shuriken.defineExtension(function(baseNS) {
31
31
  return mixin;
32
32
  }
33
33
  };
34
- ns.invokeMixin = function invokeMixin(scope, mixin) {
34
+ ns.invokeMixin = function(scope, mixin) {
35
35
  var _a;
36
36
  if ((_a = typeof mixin) === "string") {
37
37
  return ns.invokeMixin(scope, ns.lookupMixin(mixin));
@@ -41,7 +41,7 @@ Shuriken.defineExtension(function(baseNS) {
41
41
  return $.extend(scope, mixin);
42
42
  }
43
43
  };
44
- ns.mixin = function mixin(scope, mixins) {
44
+ ns.mixin = function(scope, mixins) {
45
45
  var _a, _b, _c, mixin;
46
46
  if (!($.isArray(mixins))) {
47
47
  mixins = [mixins];
@@ -2,24 +2,25 @@ var __slice = Array.prototype.slice;
2
2
  Shuriken.defineExtension(function(baseNS) {
3
3
  return baseNS.defineMixin('Callbacks', function(mixin) {
4
4
  mixin.callbacks = {};
5
- mixin.defineCallback = function defineCallback(key) {
5
+ mixin.defineCallback = function(key) {
6
6
  this[("on" + key)] = function(callback) {
7
7
  return this.hasCallback(key, callback);
8
8
  };
9
9
  this[("invoke" + key)] = function() {
10
10
  var args;
11
- args = __slice.call(arguments, 0, arguments.length - 0);
11
+ var _a = arguments.length, _b = _a >= 1;
12
+ args = __slice.call(arguments, 0, _a - 0);
12
13
  return this.invokeCallbacks.apply(this, [key].concat(args));
13
14
  };
14
15
  return true;
15
16
  };
16
- mixin.hasCallback = function hasCallback(name, callback) {
17
+ mixin.hasCallback = function(name, callback) {
17
18
  var _a, callbacks;
18
19
  callbacks = mixin.callbacks[name] = (typeof (_a = mixin.callbacks[name]) !== "undefined" && _a !== null) ? mixin.callbacks[name] : [];
19
20
  callbacks.push(callback);
20
21
  return true;
21
22
  };
22
- mixin.callbacksFor = function callbacksFor(name) {
23
+ mixin.callbacksFor = function(name) {
23
24
  var existing;
24
25
  existing = mixin.callbacks[name];
25
26
  if ((typeof existing !== "undefined" && existing !== null)) {
@@ -28,12 +29,13 @@ Shuriken.defineExtension(function(baseNS) {
28
29
  return [];
29
30
  }
30
31
  };
31
- mixin.invokeCallbacks = function invokeCallbacks(name) {
32
- var _a, _b, _c, args, callback;
33
- args = __slice.call(arguments, 1, arguments.length - 0);
34
- _b = mixin.callbacksFor(name);
35
- for (_a = 0, _c = _b.length; _a < _c; _a++) {
36
- callback = _b[_a];
32
+ mixin.invokeCallbacks = function(name) {
33
+ var _c, _d, _e, args, callback;
34
+ var _a = arguments.length, _b = _a >= 2;
35
+ args = __slice.call(arguments, 1, _a - 0);
36
+ _d = mixin.callbacksFor(name);
37
+ for (_c = 0, _e = _d.length; _c < _e; _c++) {
38
+ callback = _d[_c];
37
39
  if (callback.apply(this, args) === false) {
38
40
  return false;
39
41
  }
data/lib/shuriken.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Shuriken
2
2
 
3
- VERSION = "0.1.3.1".freeze
3
+ VERSION = "0.1.4".freeze
4
4
 
5
5
  def self.register_framework!
6
6
  Barista::Framework.register 'shuriken', File.expand_path('../coffeescripts', File.dirname(__FILE__))
@@ -8,4 +8,4 @@ module Shuriken
8
8
 
9
9
  register_framework! if defined? Barista::Framework
10
10
 
11
- end
11
+ end
data/shuriken.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{shuriken}
8
- s.version = "0.1.3.1"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Darcy Laycock"]
12
- s.date = %q{2010-05-04}
12
+ s.date = %q{2010-06-11}
13
13
  s.description = %q{Simple Namespace support for JS + Other niceties, packaged as a Barista framework}
14
14
  s.email = %q{sutto@sutto.net}
15
15
  s.extra_rdoc_files = [
@@ -105,14 +105,14 @@ Gem::Specification.new do |s|
105
105
  s.homepage = %q{http://github.com/Sutto/shuriken}
106
106
  s.rdoc_options = ["--charset=UTF-8"]
107
107
  s.require_paths = ["lib"]
108
- s.rubygems_version = %q{1.3.6}
108
+ s.rubygems_version = %q{1.3.7}
109
109
  s.summary = %q{Simple Namespace support for JS + Other niceties, packaged as a Barista framework}
110
110
 
111
111
  if s.respond_to? :specification_version then
112
112
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
113
113
  s.specification_version = 3
114
114
 
115
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
115
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
116
116
  else
117
117
  end
118
118
  else
@@ -4,6 +4,7 @@ Shuriken.Test = {
4
4
 
5
5
  Shuriken.withObject: (object, block) ->
6
6
  `with(object) { block.apply(object); }`
7
+ true
7
8
 
8
9
  ((test) ->
9
10
 
@@ -95,6 +95,7 @@ Shuriken.Test.Assertions: ((ns) ->
95
95
 
96
96
  Shuriken.Test.withAssertions: (closure) ->
97
97
  `with(Shuriken.Test.Assertions) { closure() }`
98
+ true
98
99
 
99
100
  Shuriken.Test.catchingAssertions: (closure) ->
100
101
  ac: Shuriken.Test.AssertionCatcher
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shuriken
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
- - 3
9
- - 1
10
- version: 0.1.3.1
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Darcy Laycock
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-04 00:00:00 +08:00
18
+ date: 2010-06-11 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -123,23 +123,27 @@ rdoc_options:
123
123
  require_paths:
124
124
  - lib
125
125
  required_ruby_version: !ruby/object:Gem::Requirement
126
+ none: false
126
127
  requirements:
127
128
  - - ">="
128
129
  - !ruby/object:Gem::Version
130
+ hash: 3
129
131
  segments:
130
132
  - 0
131
133
  version: "0"
132
134
  required_rubygems_version: !ruby/object:Gem::Requirement
135
+ none: false
133
136
  requirements:
134
137
  - - ">="
135
138
  - !ruby/object:Gem::Version
139
+ hash: 3
136
140
  segments:
137
141
  - 0
138
142
  version: "0"
139
143
  requirements: []
140
144
 
141
145
  rubyforge_project:
142
- rubygems_version: 1.3.6
146
+ rubygems_version: 1.3.7
143
147
  signing_key:
144
148
  specification_version: 3
145
149
  summary: Simple Namespace support for JS + Other niceties, packaged as a Barista framework