joosy 1.2.0.alpha.20 → 1.2.0.alpha.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a2eba06949a89c5471f59cdf54ba26f81b4886e
4
- data.tar.gz: fbd1fce102a579917a0779658c34ea506552d051
3
+ metadata.gz: 9faeb080979ca702273c6e5eb971899925e2056e
4
+ data.tar.gz: d17e7c30af87b1ec7ee2df13d9b3a96dd9cf28c1
5
5
  SHA512:
6
- metadata.gz: b4643deb50cb0d32b2e0a9f9dd43d88640ebdb9db3450378d702880e26fe220c6e5b33294b21f94c0178678b74689a0e4cca91d8ef5d0f4d446d672e4b524fb7
7
- data.tar.gz: f09cfd1be504620f65041c429c7aabed52a52b75176b5b569d0715ab4e4f6fe874930d9bc8e8f636a1e9c0a57a8ac02605a2fc03441bb7c4c3302d0da2292b26
6
+ metadata.gz: 20d5d31fe50f9a65076aeb087e178bb498d4d14d8bd9cc5f962ca0403827b474ec5c0bd01d43736e3650fc7cc3e1472f28e33aa8390462de51abde4363ef09e4
7
+ data.tar.gz: 5c426d803a35ba1a1d16fe19fa5ff93c9963bd9819958d833e8cf862dd007874bcd8ac2c5fd994f7034ce081bb151a85cb9f8554bc90ca9a79c33af55c2572ef
data/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joosy",
3
- "version": "1.2.0-alpha.20",
3
+ "version": "1.2.0-alpha.21",
4
4
  "main": "lib/joosy.js",
5
5
  "ignore": [
6
6
  "bin",
data/lib/joosy.js CHANGED
@@ -38,7 +38,11 @@ this.Joosy = {
38
38
  },
39
39
  synchronize: function() {
40
40
  var _ref;
41
- return (_ref = Joosy.Modules.Events).synchronize.apply(_ref, arguments);
41
+ if (!Joosy.Modules.Events) {
42
+ return console.error("Events module is required to use `Joosy.synchronize'!");
43
+ } else {
44
+ return (_ref = Joosy.Modules.Events).synchronize.apply(_ref, arguments);
45
+ }
42
46
  },
43
47
  uuid: function() {
44
48
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
@@ -542,20 +546,6 @@ Joosy.Modules.Container = {
542
546
  return this.__onRefreshes = [];
543
547
  }
544
548
  },
545
- __assignElements: function(root, entries) {
546
- var _this = this;
547
- root || (root = this);
548
- entries || (entries = this.__collectElements());
549
- return Object.each(entries, function(key, value) {
550
- if (Object.isObject(value)) {
551
- return _this.__assignElements(root['$' + key] = {}, value);
552
- } else {
553
- value = _this.__extractSelector(value);
554
- root['$' + key] = _this.$(value);
555
- return root['$' + key].selector = value;
556
- }
557
- });
558
- },
559
549
  reloadContainer: function(htmlCallback) {
560
550
  if (typeof this.__removeMetamorphs === "function") {
561
551
  this.__removeMetamorphs();
@@ -601,6 +591,20 @@ Joosy.Modules.Container = {
601
591
  });
602
592
  return selector.trim();
603
593
  },
594
+ __assignElements: function(root, entries) {
595
+ var _this = this;
596
+ root || (root = this);
597
+ entries || (entries = this.__collectElements());
598
+ return Object.each(entries, function(key, value) {
599
+ if (Object.isObject(value)) {
600
+ return _this.__assignElements(root['$' + key] = {}, value);
601
+ } else {
602
+ value = _this.__extractSelector(value);
603
+ root['$' + key] = _this.$(value);
604
+ return root['$' + key].selector = value;
605
+ }
606
+ });
607
+ },
604
608
  __delegateEvents: function() {
605
609
  var events, module,
606
610
  _this = this;
data/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "keywords": [
5
5
  "joosy"
6
6
  ],
7
- "version": "1.2.0-alpha.20",
7
+ "version": "1.2.0-alpha.21",
8
8
  "author": "Boris Staal <boris@staal.io>",
9
9
  "homepage": "http://joosy.ws/",
10
10
  "repository": {
@@ -69,7 +69,10 @@
69
69
  # @param [Function] block Configuration block (see example)
70
70
  #
71
71
  synchronize: ->
72
- Joosy.Modules.Events.synchronize arguments...
72
+ unless Joosy.Modules.Events
73
+ console.error "Events module is required to use `Joosy.synchronize'!"
74
+ else
75
+ Joosy.Modules.Events.synchronize arguments...
73
76
 
74
77
  #
75
78
  # Generates UUID
@@ -1,3 +1,5 @@
1
+ #= require joosy/core/joosy
2
+
1
3
  #
2
4
  # DOM container handling, DOM elements and DOM events bindings
3
5
  #
@@ -21,11 +23,6 @@ Joosy.Modules.Container =
21
23
  #
22
24
  # Rebinds selectors defined in 'elements' hash to object properties
23
25
  #
24
- # @example Sample elements
25
- # elements:
26
- # foo: '.foo'
27
- # bar: '.bar'
28
- #
29
26
  refreshElements: ->
30
27
  @__assignElements()
31
28
 
@@ -33,18 +30,6 @@ Joosy.Modules.Container =
33
30
  @__onRefreshes.each (callback) => callback.apply @
34
31
  @__onRefreshes = []
35
32
 
36
- __assignElements: (root, entries) ->
37
- root ||= @
38
- entries ||= @__collectElements()
39
-
40
- Object.each entries, (key, value) =>
41
- if Object.isObject(value)
42
- @__assignElements root['$'+key]={}, value
43
- else
44
- value = @__extractSelector value
45
- root['$'+key] = @$(value)
46
- root['$'+key].selector = value
47
-
48
33
  #
49
34
  # Clears old HTML links, set the new HTML from the callback and refreshes elements
50
35
  #
@@ -108,7 +93,27 @@ Joosy.Modules.Container =
108
93
  selector.trim()
109
94
 
110
95
  #
111
- # Bings events defined in 'events' to container
96
+ # Assigns elements defined in 'elements'
97
+ #
98
+ # @example Sample elements
99
+ # elements:
100
+ # foo: '.foo'
101
+ # bar: '.bar'
102
+ #
103
+ __assignElements: (root, entries) ->
104
+ root ||= @
105
+ entries ||= @__collectElements()
106
+
107
+ Object.each entries, (key, value) =>
108
+ if Object.isObject(value)
109
+ @__assignElements root['$'+key]={}, value
110
+ else
111
+ value = @__extractSelector value
112
+ root['$'+key] = @$(value)
113
+ root['$'+key].selector = value
114
+
115
+ #
116
+ # Binds events defined in 'events' to container
112
117
  #
113
118
  # @example Sample events
114
119
  # events:
@@ -1,3 +1,5 @@
1
+ #= require joosy/core/joosy
2
+
1
3
  #
2
4
  # Basic events implementation
3
5
  #
@@ -1,3 +1,5 @@
1
+ #= require joosy/core/joosy
2
+
1
3
  #
2
4
  # Filters registration routines
3
5
  #
@@ -1,3 +1,5 @@
1
+ #= require joosy/core/joosy
2
+
1
3
  #
2
4
  # Wrappers for console.log
3
5
  #
@@ -1,3 +1,4 @@
1
+ #= require joosy/core/joosy
1
2
  #= require_tree ../templaters
2
3
  #= require vendor/metamorph
3
4
 
@@ -1,3 +1,5 @@
1
+ #= require joosy/core/joosy
2
+
1
3
  #
2
4
  # Comfortable and clever wrappers for timeouts management
3
5
  #
@@ -1,3 +1,5 @@
1
+ #= require joosy/core/joosy
2
+
1
3
  #
2
4
  # Widgets management routines
3
5
  #
data/tasks/joosy.coffee CHANGED
@@ -1,7 +1,5 @@
1
1
  module.exports = (grunt) ->
2
2
 
3
- Path = require('path')
4
-
5
3
  grunt.loadNpmTasks 'grunt-mincer'
6
4
  grunt.loadNpmTasks 'grunt-contrib-connect'
7
5
  grunt.loadNpmTasks 'grunt-contrib-uglify'
@@ -14,16 +12,20 @@ module.exports = (grunt) ->
14
12
 
15
13
  grunt.registerTask 'joosy:compile:playground', ->
16
14
  hamlc = require 'haml-coffee'
17
- grunt.file.write 'public/index.html', hamlc.compile(grunt.file.read 'source/index.haml')(environment: 'production')
15
+ grunt.file.write 'public/index.html', hamlc.compile(grunt.file.read 'source/index.haml')(
16
+ environment: 'production'
17
+ config: grunt.config.get('joosy.config') || {}
18
+ )
18
19
 
19
20
  grunt.registerTask 'joosy:server', ->
20
21
  @async()
21
- connect = require('connect')
22
- mincer = require('mincer')
23
- hamlc = require('haml-coffee')
22
+ connect = require 'connect'
23
+ mincer = require 'mincer'
24
+ hamlc = require 'haml-coffee'
25
+ path = require 'path'
24
26
 
25
27
  mincer.StylusEngine.registerConfigurator (stylus) ->
26
- stylus.options.paths.push Path.join(process.cwd(), 'public')
28
+ stylus.options.paths.push path.join(process.cwd(), 'public')
27
29
  stylus.use require('nib')()
28
30
 
29
31
  server = connect()
@@ -38,12 +40,24 @@ module.exports = (grunt) ->
38
40
 
39
41
  server.use '/', (req, res, next) ->
40
42
  if req.url == '/'
41
- res.end hamlc.compile(grunt.file.read 'source/index.haml')(environment: 'development')
43
+ res.end hamlc.compile(grunt.file.read 'source/index.haml')(
44
+ environment: 'development'
45
+ config: grunt.config.get('joosy.config') || {}
46
+ )
42
47
  else
43
48
  next()
44
-
49
+
50
+ if grunt.config.get('joosy.proxy')
51
+ proxy = require 'proxy-middleware'
52
+ url = require 'url'
53
+
54
+ for from, to of grunt.config.get('joosy.proxy')
55
+ console.log "-> Proxying #{from} to #{to}"
56
+ server.use from, proxy(url.parse to)
57
+
45
58
  server.use connect.static('public')
46
59
  server.listen 4000
60
+ console.log "-> Started on 4000\n"
47
61
 
48
62
  grunt.registerTask 'joosy:server:production', ->
49
63
  @async()
@@ -2,7 +2,10 @@ module.exports = (grunt) ->
2
2
 
3
3
  grunt.loadNpmTasks 'joosy'
4
4
 
5
- grunt.initConfig
5
+ grunt.initConfig
6
+ joosy:
7
+ config: {}
8
+
6
9
  bower:
7
10
  install:
8
11
  options:
@@ -2,6 +2,7 @@
2
2
  "dependencies": {
3
3
  "joosy": "~<%= joosy_version %>",
4
4
  "connect": "~2.7.11",
5
+ "proxy-middleware": "~0.4.0",
5
6
  "gzippo": "~0.2.0",
6
7
  "mincer": "~0.4.6",
7
8
  "coffee-script": "~1.6.3",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joosy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.alpha.20
4
+ version: 1.2.0.alpha.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Staal