joosy 1.2.0.alpha.25 → 1.2.0.alpha.27

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: eb41452972cac1239b34fd0ed756f463b448d760
4
- data.tar.gz: 2dc59bf15b79e29083ce2a5dde8b25bfd28c0eff
3
+ metadata.gz: 445715a823b5e9524c6cd2619b390ff7c44fa046
4
+ data.tar.gz: 760917203bffb205418dd1c7566f71384d7ff712
5
5
  SHA512:
6
- metadata.gz: af122c35f98c642ac85a99ce278f6264c528fcd37bc2fd197362d09cdb7c296e9f5cfdcbaee4c71bc7109459e49ef03f988bf46f1a26b62d75edec917775c120
7
- data.tar.gz: 73a607cc8a9993b0359786ef3d3683d8913582855281613df15288553b668c912612d1e2e53a3260918140d96691afdaf008aa86bdabfd271d09bac73ff72618
6
+ metadata.gz: d94e2669db0419d20268e0b615456e9046fb51efe44ce9c12b892f96d3a27587b172a7d36d07f91679c2956d6e9e3b7a5d8dad39bac309ebc2e530e97f794f9a
7
+ data.tar.gz: a873ba2dc170f0619ea90b6e5c96489bed49149f46c3280db97ce67ea9c17b4f6a31d8215f53da6642197b9cccd26e1c5de414eac6cd340c38569dc9fb9510db
data/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joosy",
3
- "version": "1.2.0-alpha.25",
3
+ "version": "1.2.0-alpha.27",
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.25",
7
+ "version": "1.2.0-alpha.27",
8
8
  "author": "Boris Staal <boris@staal.io>",
9
9
  "homepage": "http://joosy.ws/",
10
10
  "repository": {
@@ -26,11 +26,17 @@
26
26
  "prompt": "~0.2.9",
27
27
  "commander": "~1.2.0",
28
28
  "colors": "~0.6.0-1",
29
- "grunt": "~0.4.1"
30
- },
31
- "devDependencies": {
29
+ "grunt": "~0.4.1",
32
30
  "bower": "~0.9.2",
33
31
  "mincer": "~0.4.6",
32
+ "connect": "~2.7.11",
33
+ "haml-coffee": "~1.11.1",
34
+ "proxy-middleware": "~0.4.0",
35
+ "gzippo": "~0.2.0",
36
+ "stylus": "~0.32.1",
37
+ "nib": "~0.9.1"
38
+ },
39
+ "devDependencies": {
34
40
  "grunt-mincer": "~0.3.1",
35
41
  "grunt-contrib-jasmine": "~0.5.1",
36
42
  "grunt-contrib-watch": "~0.4.4",
data/tasks/joosy.coffee CHANGED
@@ -1,92 +1,143 @@
1
1
  module.exports = (grunt) ->
2
2
 
3
+ Sugar = require 'sugar'
4
+ Path = require 'path'
3
5
  connect = require 'connect'
6
+ Mincer = require 'mincer'
4
7
 
5
8
  grunt.joosy =
9
+ helpers:
10
+ list: (task, config, entry) ->
11
+ entries = grunt.config.get(config) || {}
12
+
13
+ return if entry
14
+ task.requiresConfig "#{config}.#{entry}"
15
+ [ entries[entry] ]
16
+ else
17
+ Object.values entries
18
+
19
+ assets:
20
+ instance: (environment='development') ->
21
+ Mincer.logger.use console
22
+ Mincer.StylusEngine.registerConfigurator (stylus) ->
23
+ stylus.options.paths.push Path.join(process.cwd(), 'public')
24
+ stylus.define '$environment', environment
25
+ stylus.define '$config', grunt.config.get('joosy.config') || {}
26
+ stylus.use require('nib')()
27
+
28
+ assets = new Mincer.Environment(process.cwd())
29
+ assets.appendPath 'source',
30
+ assets.appendPath 'stylesheets',
31
+ assets.appendPath 'components'
32
+ assets.appendPath 'vendor'
33
+ assets.appendPath 'node_modules/joosy/src'
34
+
35
+ assets
36
+
37
+ compile: (environment, map, callbacks) ->
38
+ assets = grunt.joosy.assets.instance(environment)
39
+ deepness = 0
40
+
41
+ for entry in map
42
+ do (entry) ->
43
+ deepness++
44
+ asset = assets.findAsset entry.src
45
+ callbacks.error? "Cannot find #{entry.src}" unless asset
46
+
47
+ asset.compile (err) ->
48
+ deepness--
49
+ callbacks.error? asset, err if err
50
+ grunt.file.write entry.dest, asset.toString()
51
+ callbacks.compiled? asset, entry.dest
52
+ callbacks.success?() if deepness == 0
53
+
54
+ haml:
55
+ compile: (file, environment='development') ->
56
+ HAMLC = require 'haml-coffee'
57
+
58
+ HAMLC.compile(grunt.file.read file)(
59
+ environment: environment
60
+ config: grunt.config.get('joosy.config') || {}
61
+ )
62
+
6
63
  server:
7
64
  start: (port, setup) ->
8
- console.log "=> Started on 4000"
9
65
  server = connect()
10
66
  setup?(server)
11
67
  server.listen port
12
68
 
69
+ console.log "=> Started on 4000"
70
+
13
71
  serveProxied: (server, map) ->
72
+ URL = require 'url'
73
+ proxy = require 'proxy-middleware'
74
+
14
75
  return unless map?
15
76
 
16
- proxy = require 'proxy-middleware'
17
- url = require 'url'
77
+ for entry in map
78
+ [from, to] = if entry.src
79
+ [entry.src, entry.dest]
80
+ else
81
+ key = Object.keys(entry).first()
82
+ [key, entry[key]]
18
83
 
19
- for from, to of map
84
+ server.use from, proxy(URL.parse to)
20
85
  console.log "=> Proxying #{from} to #{to}"
21
- server.use from, proxy(url.parse to)
22
86
 
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'
87
+ serveAssets: (server, path='/assets') ->
88
+ assets = grunt.joosy.assets.instance()
89
+ server.use path, Mincer.createServer(assets)
31
90
 
32
- server.use path, mincer.createServer(assets)
91
+ console.log "=> Serving assets from #{path}"
33
92
 
34
- servePlayground: (server, path='/') ->
35
- console.log "=> Serving playground from #{path}"
93
+ serveHAML: (server, path='/', source='source/index.haml') ->
36
94
  server.use path, (req, res, next) ->
37
95
  if req.url == path
38
- res.end grunt.joosy.compilePlayground()
96
+ res.end grunt.joosy.haml.compile(source)
39
97
  else
40
98
  next()
41
99
 
100
+ console.log "=> Serving HAML at #{path} from #{source}"
101
+
42
102
  serveStatic: (server, compress=false) ->
43
- console.log "=> Serving static from /public"
103
+ Gzippo = require 'gzippo'
104
+
44
105
  unless compress
45
106
  server.use connect.static('public')
46
107
  else
47
- server.use require('gzippo').staticGzip('public')
48
-
49
- mincer: (environment='development') ->
50
- mincer = require 'mincer'
108
+ server.use Gzippo.staticGzip('public')
51
109
 
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
- )
110
+ console.log "=> Serving static from /public"
63
111
 
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')()
112
+ bower: -> require('bower')
69
113
 
70
114
  # Dependencies
71
- grunt.loadNpmTasks 'grunt-mincer'
72
- grunt.loadNpmTasks 'grunt-contrib-connect'
73
115
  grunt.loadNpmTasks 'grunt-contrib-uglify'
74
116
  grunt.loadNpmTasks 'grunt-contrib-cssmin'
75
- grunt.loadNpmTasks 'grunt-bower-task'
76
117
 
77
- grunt.registerTask 'joosy:compile', ['mince', 'uglify', 'cssmin', 'joosy:compile:playground']
78
- grunt.registerTask 'joosy:compile:code', ['mince:code', 'uglify:application']
79
- grunt.registerTask 'joosy:compile:styles', ['mince:styles', 'cssmin:application']
118
+ # Tasks
119
+ grunt.registerTask 'joosy:postinstall', ->
120
+ complete = @async()
121
+ bowerized = ->
122
+ if process.env['NODE_ENV'] == 'production'
123
+ grunt.task.run 'joosy:compile'
124
+
125
+ complete()
80
126
 
81
- grunt.registerTask 'joosy:compile:playground', ->
82
- grunt.file.write 'public/index.html', grunt.joosy.compilePlayground('production')
127
+ if grunt.file.exists('bower.json')
128
+ grunt.joosy.bower().commands.install()
129
+ .on('data', (msg) -> grunt.log.ok msg)
130
+ .on('error', (error) -> grunt.fail.fatal(error))
131
+ .on('end', bowerized)
132
+ else
133
+ bowerized()
83
134
 
84
135
  grunt.registerTask 'joosy:server', ->
85
136
  @async()
86
137
 
87
138
  grunt.joosy.server.start 4000, (server) ->
88
- grunt.joosy.server.serveAssets server, grunt.joosy.mincer()
89
- grunt.joosy.server.servePlayground server
139
+ grunt.joosy.server.serveAssets server
140
+ grunt.joosy.server.serveHAML server
90
141
  grunt.joosy.server.serveProxied server, grunt.config.get('joosy.server.proxy')
91
142
  grunt.joosy.server.serveStatic server
92
143
 
@@ -96,9 +147,18 @@ module.exports = (grunt) ->
96
147
  grunt.joosy.server.start process.env['PORT'] ? 4000, (server) ->
97
148
  grunt.joosy.server.serveStatic server, true
98
149
 
99
- grunt.registerTask 'joosy:postinstall', ->
100
- if grunt.file.exists('bower.json')
101
- grunt.task.run 'bower:install'
150
+ grunt.registerTask 'joosy:compile', ['joosy:mince', 'joosy:haml', 'uglify', 'cssmin']
151
+
152
+ grunt.registerTask 'joosy:mince', ->
153
+ complete = @async()
154
+ assets = grunt.joosy.helpers.list(@, 'joosy.assets', @args[0])
155
+
156
+ grunt.joosy.assets.compile 'production', assets,
157
+ error: (msg) -> grunt.fail.fatal msg
158
+ compiled: (asset, dest) -> grunt.log.ok "Compiled #{dest}"
159
+ success: complete
102
160
 
103
- if process.env['NODE_ENV'] == 'production'
104
- grunt.task.run 'joosy:compile'
161
+ grunt.registerTask 'joosy:haml', ->
162
+ for _, entry of grunt.joosy.helpers.list(@, 'joosy.haml', @args[0])
163
+ grunt.file.write entry.dest, grunt.joosy.haml.compile("source/#{entry.src}", 'production')
164
+ grunt.log.ok "Compiled #{entry.dest}"
@@ -5,33 +5,17 @@ module.exports = (grunt) ->
5
5
  grunt.initConfig
6
6
  joosy:
7
7
  config: {}
8
-
9
- bower:
10
- install:
11
- options:
12
- copy: false
13
- verbose: true
14
-
15
- connect:
16
- server:
17
- options:
18
- port: 4000
19
- base: 'public'
20
-
21
- mince:
22
- code:
23
- include: ['source', 'components', 'vendor', 'node_modules/joosy/src']
24
- src: 'application.coffee'
25
- dest: 'public/assets/application.js'
26
- styles:
27
- include: ['stylesheets', 'public']
28
- src: 'application.styl'
29
- dest: 'public/assets/application.css'
30
- configure: (mincer) ->
31
- mincer.StylusEngine.registerConfigurator (stylus) ->
32
- stylus.define '$environment', 'development'
33
- stylus.define '$config', grunt.config.get('joosy.config') || {}
34
- stylus.use require('nib')()
8
+ assets:
9
+ application:
10
+ src: 'application.coffee'
11
+ dest: 'public/assets/application.js'
12
+ styles:
13
+ src: 'application.styl'
14
+ dest: 'public/assets/application.css'
15
+ haml:
16
+ application:
17
+ src: 'index.haml'
18
+ dest: 'public/index.html'
35
19
 
36
20
  uglify:
37
21
  application:
@@ -41,6 +25,6 @@ module.exports = (grunt) ->
41
25
  'public/assets/application.js': 'public/assets/application.js'
42
26
 
43
27
  cssmin:
44
- application:
28
+ styles:
45
29
  files:
46
30
  'public/assets/application.css': 'public/assets/application.css'
@@ -1,22 +1,10 @@
1
1
  {
2
2
  "dependencies": {
3
3
  "joosy": "~<%= joosy_version %>",
4
- "connect": "~2.7.11",
5
- "proxy-middleware": "~0.4.0",
6
- "gzippo": "~0.2.0",
7
- "mincer": "~0.4.6",
8
- "coffee-script": "~1.6.3",
9
- "stylus": "~0.32.1",
10
- "nib": "~0.9.1",
11
- "haml-coffee": "~1.11.1",
12
4
  "grunt": "~0.4.1",
13
- "grunt-mincer": "~0.3.2",
14
- "grunt-contrib-connect": "~0.3.0",
5
+ "grunt-cli": "~0.1.9",
15
6
  "grunt-contrib-uglify": "~0.2.2",
16
- "grunt-contrib-watch": "~0.4.4",
17
- "grunt-contrib-cssmin": "~0.6.1",
18
- "grunt-bower-task": "~0.2.3",
19
- "grunt-cli": "~0.1.9"
7
+ "grunt-contrib-cssmin": "~0.6.1"
20
8
  },
21
9
  "scripts": {
22
10
  "postinstall": "node_modules/.bin/grunt joosy:postinstall"
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.25
4
+ version: 1.2.0.alpha.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Staal