Permalink
Browse files

cleanup. add extras

  • Loading branch information...
1 parent bf1d249 commit aea710651ba8f9688985332d19765eb08b3f5919 @brentkirby brentkirby committed Sep 25, 2012
View
@@ -1,2 +1,3 @@
.sass-cache
node_modules
+gh-pages
View
@@ -19,6 +19,7 @@ CoffeeScript = require 'coffee-script'
cleanCSS = require 'clean-css'
less = require 'less'
async = require 'async'
+wrench = require 'wrench'
# Javascript sources
# Example configuration for two JS packages,
@@ -30,7 +31,10 @@ libraries = [
'src/core.coffee'
'src/core/browser.coffee'
'src/core/selection.coffee'
-
+ 'src/core/validate.coffee'
+
+ 'src/views/view.coffee'
+
'src/ui/manager.coffee'
'src/ui/modal.coffee'
'src/ui/notify.coffee'
@@ -43,10 +47,12 @@ libraries = [
'src/model/context.coffee'
'src/model/contexts.coffee'
'src/model/deliverable.coffee'
-
+
'src/views/asset_manager.coffee'
- 'src/views/view.coffee'
+ 'src/views/context.coffee'
'src/views/region.coffee'
+ 'src/views/form.coffee'
+
]
javascripts = []
@@ -61,6 +67,11 @@ javascripts.push
minify: false
javascripts.push
+ path: 'gh-pages/javascripts/transit.js'
+ files: libraries
+ minify: false
+
+javascripts.push
path: 'build/themes/bootstrap.js'
files: ['src/themes/bootstrap.coffee']
minify: true
@@ -69,6 +80,12 @@ javascripts.push
path: 'lib/themes/bootstrap.js'
files: ['src/themes/bootstrap.coffee']
minify: true
+
+
+javascripts.push
+ path: 'gh-pages/javascripts/transit-bootstrap.js'
+ files: ['src/themes/bootstrap.coffee']
+ minify: true
#
# do ()->
# specs = []
@@ -93,6 +110,10 @@ stylesheets = {
'build/transit.css': [
'src/css/transit.scss'
]
+ # ,
+ # 'gh-pages/stylesheets/transit.css': [
+ # 'src/css/transit.scss'
+ # ]
}
task 'test', 'Run mocha suite', ->
@@ -124,9 +145,20 @@ test = ->
# Build JS
-task 'build:js', 'Build JS from source', build = (cb) ->
+task 'build', 'Build JS from source', build = (cb) ->
file_name = null
file_contents = null
+ try
+ files = wrench.readdirSyncRecursive('src/extras/')
+ for extra in files
+ file_name = path.join('src', 'extras', extra)
+ file_contents = CoffeeScript.compile "#{fs.readFileSync(file_name)}"
+ fname = path.basename(file_name).replace(/\.coffee$/,'.js')
+ write_js "build/extras/#{fname}", file_contents
+ write_js "gh-pages/javascripts/extras/#{fname}", file_contents
+ catch e
+ print_error e, file_name, file_contents
+
getdata = (files)->
code = ""
for source in files
@@ -154,28 +186,6 @@ task 'build:js', 'Build JS from source', build = (cb) ->
print_error e, file_name, file_contents
-# Build CSS
-task 'build:css', 'Build CSS', build = (cb) ->
- file_name = null; file_contents = null
- try
- for stylesheet, sources of stylesheets
- code = ''
- for source in sources
- file_name = source
- file_contents = "#{fs.readFileSync source}"
-
- code += file_contents
-
- write_stylesheet stylesheet, code
- unless process.env.MINIFY is 'false'
- write_stylesheet stylesheet.replace(/\.css$/,'.min.css'), (
- cleanCSS.process code
- )
- cb() if typeof cb is 'function'
- catch e
- print_error e, file_name, file_contents
-
-
# Watch task
task 'watch', 'Watch source files and build JS & CSS', ->
console.log "Watching for changes..."
@@ -187,8 +197,15 @@ task 'watch', 'Watch source files and build JS & CSS', ->
fs.watchFile file, { interval: 100}, (curr, prev) ->
if +curr.mtime isnt +prev.mtime
console.log "Saw change in #{file}"
- invoke 'build:js'
+ invoke 'build'
)(file)
+
+
+ for file in wrench.readdirSyncRecursive('src/extras/')
+ file = path.join('src', 'extras', file)
+ fs.watchFile file, { interval: 100 }, (curr, prev) ->
+ if +curr.mtime isnt +prev.mtime
+ invoke "build"
fs.watchFile 'src/css/transit.scss', { interval: 100 }, (curr, prev)->
console.log "Compile transit.scss"
@@ -207,6 +224,15 @@ write_js = (filename, body) ->
"""
console.log "Wrote #{filename}"
+get_libs = (dir, callback)->
+ files = []
+ wrench.readdirSyncRecursive dir, (path)->
+ unless path is null
+ fs.stat path, (err, stat)->
+ if stat and !stat.isDirectory()
+ files.push(path)
+ callback?(files)
+ files
# Write stylesheet with a header
write_stylesheet = (filename, body) ->
Oops, something went wrong.
View
Oops, something went wrong.
Oops, something went wrong.
@@ -60,6 +60,27 @@
<i class="icon-ok"></i> {{#if text}}{{text}}{{else}}Save{{/if}}\
</button>');
+ Handlebars.registerPartial('transit_progress_bar', '\
+<div class="progress progress-striped active">\
+ <div class="bar" style="width:{{progress}}"></div>\
+</div>\
+');
+
+ Transit.AssetManager.prototype.template = Handlebars.compile('\
+<div class="add-asset">\
+ <button class="btn btn-small btn-primary"><i class="icon-plus icon-white"></i> Upload</button>\
+</div>\
+');
+
+ Transit.Uploader.prototype.template = Handlebars.compile('\
+ <h4>Upload Files</h4>\
+ <span class="ui-fileinput">\
+ <input type="file" name="file" />\
+ <var class="ui-value">Choose a file</var>\
+ <button class="btn btn-mini btn-primary">Choose</button>\
+ </span>\
+');
+
$.fn.modal.Constructor.prototype.removeBackdrop = function() {
this.$backdrop.remove();
return this.$backdrop = null;
Oops, something went wrong.
View
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit aea7106

Please sign in to comment.