joosy 1.2.0.alpha.41 → 1.2.0.alpha.51

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/Gruntfile.coffee +27 -7
  4. data/bin/joosy +1 -1
  5. data/bower.json +3 -2
  6. data/build/joosy/extensions/preloaders.js +189 -0
  7. data/build/joosy/extensions/resources-form.js +588 -0
  8. data/build/joosy/extensions/resources.js +673 -0
  9. data/build/joosy.js +2395 -0
  10. data/{src/joosy/generators → generators}/base.coffee +2 -2
  11. data/{src/joosy/generators → generators/command}/command.coffee +16 -3
  12. data/generators/command/help.coffee +38 -0
  13. data/{src/joosy/generators → generators}/layout.coffee +0 -0
  14. data/{src/joosy/generators → generators}/page.coffee +0 -0
  15. data/{src/joosy/generators → generators}/project/base.coffee +2 -4
  16. data/{src/joosy/generators → generators}/project/standalone.coffee +4 -3
  17. data/{src/joosy/generators → generators}/project.coffee +0 -0
  18. data/generators/templates/application/base/application.coffee +13 -0
  19. data/{templates → generators/templates}/application/base/helpers/application.coffee +0 -0
  20. data/{templates → generators/templates}/application/base/layouts/application.coffee +0 -0
  21. data/{templates → generators/templates}/application/base/pages/application.coffee +0 -0
  22. data/{templates → generators/templates}/application/base/pages/welcome/index.coffee +0 -0
  23. data/{templates → generators/templates}/application/base/routes.coffee +0 -0
  24. data/{templates → generators/templates}/application/base/templates/layouts/application.jst.hamlc +0 -0
  25. data/{templates → generators/templates}/application/base/templates/pages/welcome/index.jst.hamlc +0 -0
  26. data/{templates → generators/templates}/application/standalone/Gruntfile.coffee +1 -0
  27. data/{templates → generators/templates}/application/standalone/Procfile +0 -0
  28. data/{templates → generators/templates}/application/standalone/_gitignore +0 -0
  29. data/generators/templates/application/standalone/bower.json +17 -0
  30. data/{templates → generators/templates}/application/standalone/package.json +0 -0
  31. data/{templates → generators/templates}/application/standalone/source/haml/index.haml +0 -0
  32. data/{templates → generators/templates}/application/standalone/source/stylesheets/application.styl +0 -0
  33. data/{templates → generators/templates}/layout/basic.coffee +0 -0
  34. data/{templates → generators/templates}/layout/namespaced.coffee +0 -0
  35. data/{templates → generators/templates}/page/basic.coffee +0 -0
  36. data/{templates → generators/templates}/page/namespaced.coffee +0 -0
  37. data/{templates → generators/templates}/widget/basic.coffee +0 -0
  38. data/{templates → generators/templates}/widget/namespaced.coffee +0 -0
  39. data/{src/joosy/generators → generators}/widget.coffee +0 -0
  40. data/lib/joosy.rb +3 -3
  41. data/package.json +2 -3
  42. data/source/joosy/application.coffee +95 -0
  43. data/source/joosy/events/namespace.coffee +24 -0
  44. data/{src → source}/joosy/extensions/preloaders/caching.coffee +0 -0
  45. data/{src → source}/joosy/extensions/preloaders/index.coffee +0 -0
  46. data/{src → source}/joosy/extensions/preloaders/inline.coffee +0 -0
  47. data/{src → source}/joosy/extensions/resources/base.coffee +16 -8
  48. data/{src → source}/joosy/extensions/resources/collection.coffee +0 -0
  49. data/{src → source}/joosy/extensions/resources/index.coffee +0 -0
  50. data/{src → source}/joosy/extensions/resources/rest.coffee +0 -0
  51. data/{src → source}/joosy/extensions/resources/rest_collection.coffee +0 -0
  52. data/{src → source}/joosy/extensions/resources-form/form.coffee +18 -18
  53. data/{src → source}/joosy/extensions/resources-form/helpers/form.coffee +6 -6
  54. data/{src → source}/joosy/extensions/resources-form/index.coffee +0 -0
  55. data/source/joosy/helpers/routes.coffee +10 -0
  56. data/source/joosy/helpers/view.coffee +115 -0
  57. data/{src/joosy/core → source/joosy}/helpers/widgets.coffee +1 -1
  58. data/{src/joosy/core → source/joosy}/joosy.coffee +59 -19
  59. data/source/joosy/layout.coffee +73 -0
  60. data/{src/joosy/core → source/joosy}/module.coffee +7 -2
  61. data/{src/joosy/core/modules/container.coffee → source/joosy/modules/dom.coffee} +24 -17
  62. data/source/joosy/modules/events.coffee +156 -0
  63. data/source/joosy/modules/filters.coffee +67 -0
  64. data/{src/joosy/core → source/joosy}/modules/log.coffee +7 -3
  65. data/source/joosy/modules/page/scrolling.coffee +51 -0
  66. data/source/joosy/modules/page/title.coffee +18 -0
  67. data/{src/joosy/core → source/joosy}/modules/renderer.coffee +12 -13
  68. data/{src/joosy/core → source/joosy}/modules/time_manager.coffee +5 -1
  69. data/{src/joosy/core → source/joosy}/modules/widgets_manager.coffee +9 -5
  70. data/source/joosy/page.coffee +68 -0
  71. data/{src/joosy/core → source/joosy}/resources/watcher.coffee +5 -1
  72. data/source/joosy/router.coffee +305 -0
  73. data/{src/joosy/core → source/joosy}/templaters/jst.coffee +10 -7
  74. data/source/joosy/widget.coffee +385 -0
  75. data/source/joosy.coffee +1 -0
  76. data/{src/vendor → source}/metamorph.coffee +0 -0
  77. data/spec/helpers/matchers.coffee +8 -1
  78. data/spec/joosy/core/application_spec.coffee +121 -20
  79. data/spec/joosy/core/helpers/view_spec.coffee +3 -3
  80. data/spec/joosy/core/helpers/widgets_spec.coffee +3 -6
  81. data/spec/joosy/core/joosy_spec.coffee +0 -5
  82. data/spec/joosy/core/layout_spec.coffee +2 -28
  83. data/spec/joosy/core/modules/dom_spec.coffee +133 -0
  84. data/spec/joosy/core/modules/events_spec.coffee +16 -9
  85. data/spec/joosy/core/modules/filters_spec.coffee +232 -89
  86. data/spec/joosy/core/modules/log_spec.coffee +2 -2
  87. data/spec/joosy/core/modules/renderer_spec.coffee +8 -4
  88. data/spec/joosy/core/page_spec.coffee +2 -201
  89. data/spec/joosy/core/router_spec.coffee +295 -233
  90. data/spec/joosy/core/templaters/jst_spec.coffee +1 -1
  91. data/spec/joosy/core/widget_spec.coffee +373 -34
  92. data/spec/joosy/environments/amd_spec.coffee +38 -0
  93. data/spec/joosy/environments/global_spec.coffee +21 -0
  94. data/spec/joosy/extensions/form/form_spec.coffee +18 -18
  95. data/spec/joosy/extensions/form/helpers/forms_spec.coffee +1 -1
  96. data/spec/joosy/extensions/resources/base_spec.coffee +23 -11
  97. data/tasks/joosy.coffee +6 -9
  98. metadata +75 -69
  99. data/lib/extensions/preloaders.js +0 -193
  100. data/lib/extensions/resources-form.js +0 -592
  101. data/lib/extensions/resources.js +0 -675
  102. data/lib/joosy.js +0 -2199
  103. data/spec/joosy/core/modules/container_spec.coffee +0 -153
  104. data/spec/joosy/core/modules/widget_manager_spec.coffee +0 -96
  105. data/src/joosy/core/application.coffee +0 -59
  106. data/src/joosy/core/helpers/view.coffee +0 -52
  107. data/src/joosy/core/layout.coffee +0 -174
  108. data/src/joosy/core/modules/events.coffee +0 -188
  109. data/src/joosy/core/modules/filters.coffee +0 -42
  110. data/src/joosy/core/page.coffee +0 -383
  111. data/src/joosy/core/router.coffee +0 -313
  112. data/src/joosy/core/widget.coffee +0 -88
  113. data/src/joosy.coffee +0 -1
  114. data/templates/application/base/application.coffee +0 -9
  115. data/templates/application/standalone/bower.json +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 252dbaf8a2f50e26135188ca12a3d6151ae7da41
4
- data.tar.gz: 1c753810d56861515d9142086a55b6ef427f1979
3
+ metadata.gz: b90422b5c59c2c386ace9eabcf726a47bb99dbe5
4
+ data.tar.gz: 4387265d9e5f18513ce1907c5087107788fa9a5f
5
5
  SHA512:
6
- metadata.gz: c5e488a95b25e278757fd05c4176e92987630798e8e423723917787b6931744fd621154220dcde2e80229fabfd15d7b8be8f38f4a5be26ee5d268a0ca36595d8
7
- data.tar.gz: 4ede038e7ce8d2dc41e0f160462f64bd71d9d6fa9801361259e168b1f99edc7b133228756ed1338b8e442d69c8a30f8a3dedc709ab9a5fa2b325b8fd3514652e
6
+ metadata.gz: f772dbaeb5a05bdbf69e05efe7ac84ebe2dd3154e6cc26aef8c0b5c32744d59d18279bf16221d1c320882692489b80412106a29457c3e0be9c798a23af76bfa2
7
+ data.tar.gz: 61f5379eebaf2b6fcaee915780a8168cbc462d237de7f2dcde06c41d1ee98e6f8022e6c0547a8e2c8629afc07c984e7b19a69dab9362ccca095a35de0a057e36
data/.gitignore CHANGED
@@ -2,5 +2,7 @@ node_modules
2
2
  bower_components
3
3
  .grunt
4
4
  *.html
5
+ spec/*.html
5
6
  *.gem
6
7
  Gemfile.lock
8
+ .idea/
data/Gruntfile.coffee CHANGED
@@ -10,13 +10,14 @@ module.exports = (grunt) ->
10
10
  locations =
11
11
  source:
12
12
  root: 'joosy.coffee'
13
- path: 'src'
14
- build: 'lib/joosy.js'
13
+ path: 'source'
14
+ build: 'build/joosy.js'
15
15
  extensions: (name) ->
16
16
  root: "joosy/extensions/#{name}"
17
- build: "lib/extensions/#{name}.js"
17
+ build: "build/joosy/extensions/#{name}.js"
18
18
  specs:
19
19
  units:
20
+ environments: 'spec/joosy/environments/*_spec.*'
20
21
  core: 'spec/joosy/core/**/*_spec.*'
21
22
  extensions: 'spec/joosy/extensions/**/*_spec.*'
22
23
  helpers: 'spec/helpers/**/*.*'
@@ -25,7 +26,7 @@ module.exports = (grunt) ->
25
26
  specOptions = (category, specs, vendor=[]) ->
26
27
  host: 'http://localhost:8888/'
27
28
  keepRunner: true
28
- outfile: "#{category}.html"
29
+ outfile: "spec/#{category}.html"
29
30
  vendor: [
30
31
  'bower_components/sinonjs/sinon.js',
31
32
  'bower_components/sugar/release/sugar-full.min.js'
@@ -36,7 +37,6 @@ module.exports = (grunt) ->
36
37
  #
37
38
  # Grunt extensions
38
39
  #
39
- grunt.loadNpmTasks 'grunt-mincer'
40
40
  grunt.loadNpmTasks 'grunt-contrib-connect'
41
41
  grunt.loadNpmTasks 'grunt-contrib-coffee'
42
42
  grunt.loadNpmTasks 'grunt-contrib-jasmine'
@@ -64,13 +64,13 @@ module.exports = (grunt) ->
64
64
  specs:
65
65
  options:
66
66
  nospawn: true
67
- files: [locations.specs.units.core, locations.specs.units.extensions, locations.specs.helpers]
67
+ files: [ locations.specs.helpers ].add(Object.values locations.specs.units)
68
68
  tasks: ['coffee']
69
69
 
70
70
  coffee:
71
71
  specs:
72
72
  expand: true
73
- src: [locations.specs.units.core, locations.specs.units.extensions, locations.specs.helpers]
73
+ src: [ locations.specs.helpers ].add(Object.values locations.specs.units)
74
74
  dest: locations.specs.build
75
75
  ext: '.js'
76
76
 
@@ -112,6 +112,20 @@ module.exports = (grunt) ->
112
112
  'bower_components/zepto/zepto.js'
113
113
  ])
114
114
  src: locations.source.build
115
+
116
+ 'environments-global':
117
+ options: specOptions('environments-global', ['spec/joosy/environments/global*'], [
118
+ 'bower_components/jquery/jquery.js'
119
+ ])
120
+ src: locations.source.build
121
+
122
+ 'environments-amd':
123
+ options: specOptions('environments-amd', ['spec/joosy/environments/amd*'], [
124
+ 'bower_components/jquery/jquery.js',
125
+ 'bower_components/requirejs/require.js'
126
+ ])
127
+ src: locations.source.build
128
+
115
129
  extensions:
116
130
  options: specOptions('extensions', locations.specs.units.extensions, [
117
131
  'bower_components/jquery/jquery.js',
@@ -123,6 +137,12 @@ module.exports = (grunt) ->
123
137
  #
124
138
  # Tasks
125
139
  #
140
+ grunt.registerMultiTask 'mince', ->
141
+ Mincer.CoffeeEngine.configure bare: false
142
+ environment = new Mincer.Environment
143
+ environment.appendPath x for x in @data.include
144
+ grunt.file.write @data.dest, environment.findAsset(@data.src).toString()
145
+
126
146
  grunt.registerTask 'default', ['connect', 'build', 'watch']
127
147
 
128
148
  grunt.registerTask 'build', ['mince', 'coffee', 'jasmine:core:build', 'jasmine:extensions:build', 'bowerize']
data/bin/joosy CHANGED
@@ -5,7 +5,7 @@
5
5
  var resolve = require('resolve').sync
6
6
  var path = require('path')
7
7
  var base = ''
8
- var location = path.join('src', 'joosy', 'generators', 'command')
8
+ var location = path.join('generators', 'command', 'command')
9
9
 
10
10
  try {
11
11
  base = resolve('joosy', {
data/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joosy",
3
- "version": "1.2.0-alpha.41",
3
+ "version": "1.2.0-alpha.51",
4
4
  "main": "lib/joosy.js",
5
5
  "ignore": [
6
6
  "bin",
@@ -16,7 +16,8 @@
16
16
  "dependencies": {
17
17
  "jquery": "~1.10.1",
18
18
  "sugar": "~1.3.9",
19
- "jquery-form": "~3.37.0"
19
+ "jquery-form": "~3.37.0",
20
+ "requirejs": "~2.1.8"
20
21
  },
21
22
  "devDependencies": {
22
23
  "sinonjs": "~1.7.1",
@@ -0,0 +1,189 @@
1
+ (function() {
2
+ this.CachingPreloader = {
3
+ force: false,
4
+ prefix: "cache:",
5
+ counter: 0,
6
+ load: function(libraries, options) {
7
+ var i, key, lib, val, _i, _len, _ref, _ref1;
8
+ if (options == null) {
9
+ options = {};
10
+ }
11
+ for (key in options) {
12
+ val = options[key];
13
+ this[key] = val;
14
+ }
15
+ this.libraries = libraries.slice();
16
+ _ref = this.libraries;
17
+ for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
18
+ lib = _ref[i];
19
+ this.libraries[i] = this.prefix + lib[0];
20
+ }
21
+ if (!this.force && this.check()) {
22
+ return this.restore();
23
+ } else {
24
+ if ((_ref1 = this.start) != null) {
25
+ _ref1.call(window);
26
+ }
27
+ this.clean();
28
+ return this.download(libraries);
29
+ }
30
+ },
31
+ check: function() {
32
+ var flag, i, name, _i, _len, _ref;
33
+ flag = true;
34
+ _ref = this.libraries;
35
+ for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
36
+ name = _ref[i];
37
+ flag && (flag = window.localStorage.getItem(name) != null);
38
+ }
39
+ return flag;
40
+ },
41
+ escapeStr: function(str) {
42
+ return str.replace(new RegExp("\u0001", 'g'), "\\u0001").replace(new RegExp("\u000B", 'g'), "\\u000B");
43
+ },
44
+ restore: function() {
45
+ var i, name, _i, _len, _ref, _ref1;
46
+ _ref = this.libraries;
47
+ for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
48
+ name = _ref[i];
49
+ window.evalGlobaly(window.localStorage.getItem(name));
50
+ }
51
+ return (_ref1 = this.complete) != null ? _ref1.call(window, true) : void 0;
52
+ },
53
+ download: function(libraries) {
54
+ var lib, size, url, _ref,
55
+ _this = this;
56
+ if (libraries.length > 0) {
57
+ this.counter += 1;
58
+ lib = libraries.shift();
59
+ url = lib[0];
60
+ size = lib[1];
61
+ return this.ajax(url, size, function(xhr) {
62
+ var code;
63
+ code = xhr.responseText;
64
+ if (window.navigator.appName === "Microsoft Internet Explorer") {
65
+ code = _this.escapeStr(code);
66
+ }
67
+ window.localStorage.setItem(_this.prefix + url, code);
68
+ window.evalGlobaly(xhr.responseText);
69
+ return _this.download(libraries);
70
+ });
71
+ } else {
72
+ return (_ref = this.complete) != null ? _ref.call(window) : void 0;
73
+ }
74
+ },
75
+ ajax: function(url, size, callback) {
76
+ var poller, x,
77
+ _this = this;
78
+ if (window.XMLHttpRequest) {
79
+ x = new XMLHttpRequest;
80
+ } else {
81
+ x = new ActiveXObject('Microsoft.XMLHTTP');
82
+ }
83
+ x.open('GET', url, 1);
84
+ x.onreadystatechange = function() {
85
+ if (x.readyState > 3) {
86
+ clearInterval(_this.interval);
87
+ return typeof callback === "function" ? callback(x) : void 0;
88
+ }
89
+ };
90
+ if (this.progress) {
91
+ poller = function() {
92
+ var e;
93
+ try {
94
+ return _this.progress.call(window, Math.round((x.responseText.length / size) * (_this.counter / _this.libraries.length) * 100));
95
+ } catch (_error) {
96
+ e = _error;
97
+ }
98
+ };
99
+ this.interval = setInterval(poller, 100);
100
+ }
101
+ return x.send();
102
+ },
103
+ clean: function() {
104
+ var find, i, key, _results;
105
+ i = 0;
106
+ find = function(arr, obj) {
107
+ var x, _i, _len;
108
+ for (_i = 0, _len = arr.length; _i < _len; _i++) {
109
+ x = arr[_i];
110
+ if (obj === x) {
111
+ return i;
112
+ }
113
+ }
114
+ return -1;
115
+ };
116
+ _results = [];
117
+ while (i < window.localStorage.length && (key = window.localStorage.key(i))) {
118
+ if (key.indexOf(this.prefix) === 0 && find(this.libraries, key) < 0) {
119
+ _results.push(window.localStorage.removeItem(key));
120
+ } else {
121
+ _results.push(i += 1);
122
+ }
123
+ }
124
+ return _results;
125
+ }
126
+ };
127
+
128
+ window.evalGlobaly = function(src) {
129
+ if (src.length === 0) {
130
+ return;
131
+ }
132
+ if (window.execScript) {
133
+ return window.execScript(src);
134
+ } else {
135
+ return window["eval"](src);
136
+ }
137
+ };
138
+
139
+ this.Preloader = this.CachingPreloader;
140
+
141
+ }).call(this);
142
+ (function() {
143
+ this.InlinePreloader = {
144
+ load: function(libraries, options) {
145
+ var key, val,
146
+ _this = this;
147
+ for (key in options) {
148
+ val = options[key];
149
+ this[key] = val;
150
+ }
151
+ if (typeof this.start === "function") {
152
+ this.start();
153
+ }
154
+ if (libraries.length > 0) {
155
+ return this.receive(libraries.shift()[0], function() {
156
+ return _this.load(libraries);
157
+ });
158
+ } else {
159
+ return typeof this.complete === "function" ? this.complete() : void 0;
160
+ }
161
+ },
162
+ receive: function(url, callback) {
163
+ var done, head, proceed, script;
164
+ head = document.getElementsByTagName("head")[0];
165
+ script = document.createElement("script");
166
+ script.src = url;
167
+ done = false;
168
+ proceed = function() {
169
+ if (!done && ((this.readyState == null) || this.readyState === "loaded" || this.readyState === "complete")) {
170
+ done = true;
171
+ if (typeof callback === "function") {
172
+ callback();
173
+ }
174
+ return script.onload = script.onreadystatechange = null;
175
+ }
176
+ };
177
+ script.onload = script.onreadystatechange = proceed;
178
+ head.appendChild(script);
179
+ return void 0;
180
+ }
181
+ };
182
+
183
+ this.Preloader = this.InlinePreloader;
184
+
185
+ }).call(this);
186
+ (function() {
187
+
188
+
189
+ }).call(this);