joosy 1.2.0.alpha.33 → 1.2.0.alpha.34
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 +1 -1
- data/tasks/joosy.coffee +84 -35
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e781a0e6f7a0255ee66c756961ad0943b0624d13
|
4
|
+
data.tar.gz: 5eec16f1b2513fa0076581c246b923bda1457cf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03cab6c257006474cd4672f4748c1cd34873c6996fce3dd64e7f6a8a2447f36f5341f52e61205267045631a6996c0381714a2633112120c67a3f87016157b53a
|
7
|
+
data.tar.gz: 52c3043ccdc1fcd8c3adc57bb7dee72e375307e8c4665b9f2c1cf92facb1a7c66fbb4fa51cae2406cebfe8316d7f1c829fe46eb6b90ad95a733632b57a246ace
|
data/bower.json
CHANGED
data/package.json
CHANGED
data/tasks/joosy.coffee
CHANGED
@@ -5,29 +5,49 @@ module.exports = (grunt) ->
|
|
5
5
|
connect = require 'connect'
|
6
6
|
Mincer = require 'mincer'
|
7
7
|
|
8
|
+
paths =
|
9
|
+
haml: Path.join('source', 'haml')
|
10
|
+
javascript: Path.join('source', 'javascript')
|
11
|
+
stylesheets: Path.join('source', 'stylesheets')
|
12
|
+
public: 'public'
|
13
|
+
|
8
14
|
grunt.joosy =
|
9
15
|
helpers:
|
10
|
-
|
11
|
-
entries = grunt.config.get(config) || {}
|
12
|
-
|
13
|
-
|
14
|
-
task.requiresConfig "#{config}.#{entry}"
|
16
|
+
normalizeFiles: (config, target) ->
|
17
|
+
entries = grunt.config.get(config) || {}
|
18
|
+
entries = if target
|
19
|
+
grunt.config.requires "#{config}.#{target}"
|
15
20
|
[ entries[entry] ]
|
16
21
|
else
|
17
22
|
Object.values entries
|
18
23
|
|
24
|
+
entries
|
25
|
+
|
26
|
+
expandFiles: (root, entry) ->
|
27
|
+
root = Path.join(root, entry.cwd) if entry.cwd?
|
28
|
+
files = grunt.file.expand({cwd: Path.join(process.cwd(), root)}, entry.src)
|
29
|
+
|
30
|
+
return {
|
31
|
+
cwd: root,
|
32
|
+
list: files.map (file) ->
|
33
|
+
src: file
|
34
|
+
extname: Path.extname file
|
35
|
+
filename: Path.basename file, Path.extname(file)
|
36
|
+
dirname: Path.dirname file
|
37
|
+
}
|
38
|
+
|
19
39
|
assets:
|
20
40
|
instance: (environment='development') ->
|
21
41
|
Mincer.logger.use console
|
22
42
|
Mincer.StylusEngine.registerConfigurator (stylus) ->
|
23
|
-
stylus.options.paths.push Path.join(process.cwd(),
|
43
|
+
stylus.options.paths.push Path.join(process.cwd(), paths.public)
|
24
44
|
stylus.define '$environment', environment
|
25
45
|
stylus.define '$config', grunt.config.get('joosy.config') || {}
|
26
46
|
stylus.use require('nib')()
|
27
47
|
|
28
48
|
assets = new Mincer.Environment(process.cwd())
|
29
|
-
assets.appendPath
|
30
|
-
assets.appendPath
|
49
|
+
assets.appendPath paths.javascript
|
50
|
+
assets.appendPath paths.stylesheets
|
31
51
|
assets.appendPath 'vendor'
|
32
52
|
assets.appendPath 'components'
|
33
53
|
assets.appendPath 'node_modules/joosy/src'
|
@@ -52,14 +72,14 @@ module.exports = (grunt) ->
|
|
52
72
|
callbacks.success?() if deepness == 0
|
53
73
|
|
54
74
|
haml:
|
55
|
-
compile: (file, partials=
|
75
|
+
compile: (file, partials=paths.haml, environment='development') ->
|
56
76
|
HAMLC = require 'haml-coffee'
|
57
77
|
|
58
78
|
HAMLC.compile(grunt.file.read file)(
|
59
79
|
environment: environment
|
60
80
|
config: grunt.config.get('joosy.config') || {}
|
61
81
|
partial: (location) ->
|
62
|
-
grunt.joosy.haml.compile(partials
|
82
|
+
grunt.joosy.haml.compile(Path.join(partials,location), environment)
|
63
83
|
)
|
64
84
|
|
65
85
|
server:
|
@@ -93,32 +113,42 @@ module.exports = (grunt) ->
|
|
93
113
|
console.log "=> Serving assets from #{path}"
|
94
114
|
|
95
115
|
serveHAML: (server, map) ->
|
96
|
-
|
116
|
+
serve = (urls, template, partials) ->
|
117
|
+
urls = [urls] unless Object.isArray(urls)
|
118
|
+
|
119
|
+
for url in urls
|
120
|
+
do (url) ->
|
121
|
+
server.use url, (req, res, next) ->
|
122
|
+
if req.originalUrl == url
|
123
|
+
res.end grunt.joosy.haml.compile(template, partials)
|
124
|
+
console.log "Served #{url} (#{template})"
|
125
|
+
else
|
126
|
+
next()
|
127
|
+
console.log "=> Serving #{template} from #{urls.join(', ')}"
|
97
128
|
|
98
|
-
for
|
99
|
-
do (
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
console.log "=> Serving #{entry.src} from #{paths.join(', ')}"
|
129
|
+
for entry in map
|
130
|
+
do (entry) ->
|
131
|
+
unless entry.expand
|
132
|
+
serve(entry.url, Path.join(paths.haml, entry.src), entry.partials)
|
133
|
+
else
|
134
|
+
files = grunt.joosy.helpers.expandFiles(paths.haml, entry)
|
135
|
+
|
136
|
+
for file in files.list
|
137
|
+
serve(
|
138
|
+
entry.url(file),
|
139
|
+
Path.join(files.cwd, file.src),
|
140
|
+
entry.partials
|
141
|
+
)
|
112
142
|
|
113
143
|
serveStatic: (server, compress=false) ->
|
114
144
|
Gzippo = require 'gzippo'
|
115
145
|
|
116
146
|
unless compress
|
117
|
-
server.use connect.static(
|
147
|
+
server.use connect.static(paths.public)
|
118
148
|
else
|
119
|
-
server.use Gzippo.staticGzip(
|
149
|
+
server.use Gzippo.staticGzip(paths.public)
|
120
150
|
|
121
|
-
console.log "=> Serving static from
|
151
|
+
console.log "=> Serving static from /#{paths.public}"
|
122
152
|
|
123
153
|
bower: -> require('bower')
|
124
154
|
|
@@ -144,7 +174,7 @@ module.exports = (grunt) ->
|
|
144
174
|
|
145
175
|
grunt.joosy.server.start 4000, (server) ->
|
146
176
|
grunt.joosy.server.serveAssets server
|
147
|
-
grunt.joosy.server.serveHAML server, grunt.
|
177
|
+
grunt.joosy.server.serveHAML server, grunt.joosy.helpers.normalizeFiles('joosy.haml')
|
148
178
|
grunt.joosy.server.serveProxied server, grunt.config.get('joosy.server.proxy')
|
149
179
|
grunt.joosy.server.serveStatic server
|
150
180
|
|
@@ -156,16 +186,35 @@ module.exports = (grunt) ->
|
|
156
186
|
|
157
187
|
grunt.registerTask 'joosy:compile', ['joosy:assets', 'joosy:haml']
|
158
188
|
|
159
|
-
grunt.registerTask 'joosy:assets', ->
|
189
|
+
grunt.registerTask 'joosy:assets', (target) ->
|
160
190
|
complete = @async()
|
161
|
-
assets = grunt.joosy.helpers.
|
191
|
+
assets = grunt.joosy.helpers.normalizeFiles('joosy.assets', target)
|
162
192
|
|
163
193
|
grunt.joosy.assets.compile 'production', assets,
|
164
194
|
error: (asset, msg) -> grunt.fail.fatal msg
|
165
195
|
compiled: (asset, dest) -> grunt.log.ok "Compiled #{dest}"
|
166
196
|
success: complete
|
167
197
|
|
168
|
-
grunt.registerTask 'joosy:haml', ->
|
169
|
-
for _, entry of grunt.joosy.helpers.
|
170
|
-
|
171
|
-
|
198
|
+
grunt.registerTask 'joosy:haml', (target) ->
|
199
|
+
for _, entry of grunt.joosy.helpers.normalizeFiles('joosy.haml', target)
|
200
|
+
unless entry.expand
|
201
|
+
grunt.file.write entry.dest, grunt.joosy.haml.compile(
|
202
|
+
Path.join(paths.haml, entry.src),
|
203
|
+
entry.partials,
|
204
|
+
'production'
|
205
|
+
)
|
206
|
+
|
207
|
+
grunt.log.ok "Compiled #{entry.dest}"
|
208
|
+
else
|
209
|
+
files = grunt.joosy.helpers.expandFiles(paths.haml, entry)
|
210
|
+
|
211
|
+
for file in files.list
|
212
|
+
destination = Path.join entry.dest, file.dirname, file.filename+(entry.ext || '.html')
|
213
|
+
|
214
|
+
grunt.file.write destination, grunt.joosy.haml.compile(
|
215
|
+
Path.join(files.cwd, file.src),
|
216
|
+
entry.partials,
|
217
|
+
'production'
|
218
|
+
)
|
219
|
+
|
220
|
+
grunt.log.ok "Compiled #{destination}"
|
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.
|
4
|
+
version: 1.2.0.alpha.34
|
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-
|
14
|
+
date: 2013-07-09 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: sprockets
|