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 +4 -4
- data/bower.json +1 -1
- data/package.json +10 -4
- data/tasks/joosy.coffee +113 -53
- data/templates/application/standalone/Gruntfile.coffee +12 -28
- data/templates/application/standalone/package.json +2 -14
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 445715a823b5e9524c6cd2619b390ff7c44fa046
|
4
|
+
data.tar.gz: 760917203bffb205418dd1c7566f71384d7ff712
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d94e2669db0419d20268e0b615456e9046fb51efe44ce9c12b892f96d3a27587b172a7d36d07f91679c2956d6e9e3b7a5d8dad39bac309ebc2e530e97f794f9a
|
7
|
+
data.tar.gz: a873ba2dc170f0619ea90b6e5c96489bed49149f46c3280db97ce67ea9c17b4f6a31d8215f53da6642197b9cccd26e1c5de414eac6cd340c38569dc9fb9510db
|
data/bower.json
CHANGED
data/package.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"keywords": [
|
5
5
|
"joosy"
|
6
6
|
],
|
7
|
-
"version": "1.2.0-alpha.
|
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
|
-
|
17
|
-
|
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
|
-
|
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,
|
24
|
-
|
25
|
-
|
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
|
-
|
91
|
+
console.log "=> Serving assets from #{path}"
|
33
92
|
|
34
|
-
|
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.
|
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
|
-
|
103
|
+
Gzippo = require 'gzippo'
|
104
|
+
|
44
105
|
unless compress
|
45
106
|
server.use connect.static('public')
|
46
107
|
else
|
47
|
-
server.use
|
48
|
-
|
49
|
-
mincer: (environment='development') ->
|
50
|
-
mincer = require 'mincer'
|
108
|
+
server.use Gzippo.staticGzip('public')
|
51
109
|
|
52
|
-
|
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
|
-
|
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
|
-
|
78
|
-
grunt.registerTask 'joosy:
|
79
|
-
|
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
|
-
|
82
|
-
|
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
|
89
|
-
grunt.joosy.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:
|
100
|
-
|
101
|
-
|
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
|
-
|
104
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
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-
|
14
|
-
"grunt-contrib-connect": "~0.3.0",
|
5
|
+
"grunt-cli": "~0.1.9",
|
15
6
|
"grunt-contrib-uglify": "~0.2.2",
|
16
|
-
"grunt-contrib-
|
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"
|