joosy 1.2.0.alpha.24 → 1.2.0.alpha.25

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: 208ba81c8cb99f14cf0196cd40b4c92967318eab
4
- data.tar.gz: 8940f87ea8ec7c8a32b7bc8ec3b9bb038db018b4
3
+ metadata.gz: eb41452972cac1239b34fd0ed756f463b448d760
4
+ data.tar.gz: 2dc59bf15b79e29083ce2a5dde8b25bfd28c0eff
5
5
  SHA512:
6
- metadata.gz: e50bc41ae73661119bc4f49fed20b6b7261b5220eb3fadcab36923b7a7bdcedc9c51d508e344fd90f7cf30433ba36df16f8481255f3d683619666c4fdbdebfdd
7
- data.tar.gz: 5b575e8b165e69892d35a7e4cea2a1a7ae05383cb9deaa22051f85a1e1e312125a2d456c364bc5fd36f668206913133389c8500875186db6a8e037d6b5b8bf3b
6
+ metadata.gz: af122c35f98c642ac85a99ce278f6264c528fcd37bc2fd197362d09cdb7c296e9f5cfdcbaee4c71bc7109459e49ef03f988bf46f1a26b62d75edec917775c120
7
+ data.tar.gz: 73a607cc8a9993b0359786ef3d3683d8913582855281613df15288553b668c912612d1e2e53a3260918140d96691afdaf008aa86bdabfd271d09bac73ff72618
data/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joosy",
3
- "version": "1.2.0-alpha.24",
3
+ "version": "1.2.0-alpha.25",
4
4
  "main": "lib/joosy.js",
5
5
  "ignore": [
6
6
  "bin",
data/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "keywords": [
5
5
  "joosy"
6
6
  ],
7
- "version": "1.2.0-alpha.24",
7
+ "version": "1.2.0-alpha.25",
8
8
  "author": "Boris Staal <boris@staal.io>",
9
9
  "homepage": "http://joosy.ws/",
10
10
  "repository": {
data/tasks/joosy.coffee CHANGED
@@ -1,78 +1,102 @@
1
1
  module.exports = (grunt) ->
2
2
 
3
+ connect = require 'connect'
4
+
5
+ grunt.joosy =
6
+ server:
7
+ start: (port, setup) ->
8
+ console.log "=> Started on 4000"
9
+ server = connect()
10
+ setup?(server)
11
+ server.listen port
12
+
13
+ serveProxied: (server, map) ->
14
+ return unless map?
15
+
16
+ proxy = require 'proxy-middleware'
17
+ url = require 'url'
18
+
19
+ for from, to of map
20
+ console.log "=> Proxying #{from} to #{to}"
21
+ server.use from, proxy(url.parse to)
22
+
23
+ serveAssets: (server, mincer, path='/assets') ->
24
+ console.log "=> Serving assets from #{path}"
25
+ assets = new mincer.Environment(process.cwd())
26
+ assets.appendPath 'source',
27
+ assets.appendPath 'stylesheets',
28
+ assets.appendPath 'components'
29
+ assets.appendPath 'vendor'
30
+ assets.appendPath 'node_modules/joosy/src'
31
+
32
+ server.use path, mincer.createServer(assets)
33
+
34
+ servePlayground: (server, path='/') ->
35
+ console.log "=> Serving playground from #{path}"
36
+ server.use path, (req, res, next) ->
37
+ if req.url == path
38
+ res.end grunt.joosy.compilePlayground()
39
+ else
40
+ next()
41
+
42
+ serveStatic: (server, compress=false) ->
43
+ console.log "=> Serving static from /public"
44
+ unless compress
45
+ server.use connect.static('public')
46
+ else
47
+ server.use require('gzippo').staticGzip('public')
48
+
49
+ mincer: (environment='development') ->
50
+ mincer = require 'mincer'
51
+
52
+ mincer.logger.use console
53
+ mincer.StylusEngine.registerConfigurator (stylus) ->
54
+ grunt.joosy.setupStylus stylus, environment
55
+
56
+ mincer
57
+
58
+ compilePlayground: (environment='development') ->
59
+ require('haml-coffee').compile(grunt.file.read 'source/index.haml')(
60
+ environment: environment
61
+ config: grunt.config.get('joosy.config') || {}
62
+ )
63
+
64
+ setupStylus: (stylus, environment='production') ->
65
+ stylus.options.paths.push require('path').join(process.cwd(), 'public')
66
+ stylus.define '$environment', environment
67
+ stylus.define '$config', grunt.config.get('joosy.config') || {}
68
+ stylus.use require('nib')()
69
+
70
+ # Dependencies
3
71
  grunt.loadNpmTasks 'grunt-mincer'
4
72
  grunt.loadNpmTasks 'grunt-contrib-connect'
5
73
  grunt.loadNpmTasks 'grunt-contrib-uglify'
6
74
  grunt.loadNpmTasks 'grunt-contrib-cssmin'
7
75
  grunt.loadNpmTasks 'grunt-bower-task'
8
76
 
9
- grunt.registerTask 'joosy:compile', ['mince', 'uglify', 'cssmin', 'joosy:compile:playground']
10
- grunt.registerTask 'joosy:compile:code', ['mince:code', 'uglify:application']
77
+ grunt.registerTask 'joosy:compile', ['mince', 'uglify', 'cssmin', 'joosy:compile:playground']
78
+ grunt.registerTask 'joosy:compile:code', ['mince:code', 'uglify:application']
11
79
  grunt.registerTask 'joosy:compile:styles', ['mince:styles', 'cssmin:application']
12
80
 
13
81
  grunt.registerTask 'joosy:compile:playground', ->
14
- hamlc = require 'haml-coffee'
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
- )
82
+ grunt.file.write 'public/index.html', grunt.joosy.compilePlayground('production')
19
83
 
20
84
  grunt.registerTask 'joosy:server', ->
21
85
  @async()
22
- connect = require 'connect'
23
- mincer = require 'mincer'
24
- hamlc = require 'haml-coffee'
25
- path = require 'path'
26
-
27
- mincer.logger.use console
28
-
29
- mincer.StylusEngine.registerConfigurator (stylus) ->
30
- stylus.options.paths.push path.join(process.cwd(), 'public')
31
- stylus.define '$environment', 'development'
32
- stylus.define '$config', config: grunt.config.get('joosy.config') || {}
33
- stylus.use require('nib')()
34
-
35
- server = connect()
36
- assets = new mincer.Environment(process.cwd())
37
- assets.appendPath 'source',
38
- assets.appendPath 'stylesheets',
39
- assets.appendPath 'components'
40
- assets.appendPath 'vendor'
41
- assets.appendPath 'node_modules/joosy/src'
42
-
43
- server.use '/assets', mincer.createServer(assets)
44
-
45
- server.use '/', (req, res, next) ->
46
- if req.url == '/'
47
- res.end hamlc.compile(grunt.file.read 'source/index.haml')(
48
- environment: 'development'
49
- config: grunt.config.get('joosy.config') || {}
50
- )
51
- else
52
- next()
53
-
54
- if grunt.config.get('joosy.server.proxy')
55
- proxy = require 'proxy-middleware'
56
- url = require 'url'
57
-
58
- for from, to of grunt.config.get('joosy.server.proxy')
59
- console.log "-> Proxying #{from} to #{to}"
60
- server.use from, proxy(url.parse to)
61
-
62
- server.use connect.static('public')
63
- server.listen 4000
64
- console.log "-> Started on 4000\n"
86
+
87
+ grunt.joosy.server.start 4000, (server) ->
88
+ grunt.joosy.server.serveAssets server, grunt.joosy.mincer()
89
+ grunt.joosy.server.servePlayground server
90
+ grunt.joosy.server.serveProxied server, grunt.config.get('joosy.server.proxy')
91
+ grunt.joosy.server.serveStatic server
65
92
 
66
93
  grunt.registerTask 'joosy:server:production', ->
67
94
  @async()
68
- connect = require('connect')
69
- server = connect()
70
- server.use require('gzippo').staticGzip('public')
71
- server.listen process.env['PORT'] ? 4000
72
95
 
73
- grunt.registerTask 'joosy:postinstall', ->
74
- @async
96
+ grunt.joosy.server.start process.env['PORT'] ? 4000, (server) ->
97
+ grunt.joosy.server.serveStatic server, true
75
98
 
99
+ grunt.registerTask 'joosy:postinstall', ->
76
100
  if grunt.file.exists('bower.json')
77
101
  grunt.task.run 'bower:install'
78
102
 
@@ -30,7 +30,7 @@ module.exports = (grunt) ->
30
30
  configure: (mincer) ->
31
31
  mincer.StylusEngine.registerConfigurator (stylus) ->
32
32
  stylus.define '$environment', 'development'
33
- stylus.define '$config', config: grunt.config.get('joosy.config') || {}
33
+ stylus.define '$config', grunt.config.get('joosy.config') || {}
34
34
  stylus.use require('nib')()
35
35
 
36
36
  uglify:
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.24
4
+ version: 1.2.0.alpha.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Staal
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-07-02 00:00:00.000000000 Z
14
+ date: 2013-07-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: sprockets