-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/curljs #92
Merged
Merged
Feature/curljs #92
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
737d79f
simplify sqwidget layout to be more suitable for module
purge 4b0504a
prepackage to compile
purge 84a03da
works via npm install
purge b45f984
produce optimized rjs blob
purge c135d52
prepublish dist
purge 6ad530f
test helper
purge 4780dd7
add to DOM
purge c645990
read optimized package instead
purge d851058
import correct index
purge abfe7ad
don't use subdirectory for prepublish
purge ea23890
temporarily add built file
purge a4268d9
remove big deps
purge ece554c
domready
purge b532ffa
domready
purge dfb9032
sigh.
purge a461611
start of scaffold
purge 3df627b
use grunt task for rendering rjs
purge 2fb7e83
scaffold
purge ddcc507
install grunt scaffold globally
purge 194152f
force overwrite
purge 0d1d2fe
use symlink instead
purge fc843f9
i18n generator
purge 1ffb841
demo of i18n support
purge e3b3c1e
clean up
purge ab61760
convert to curljs
purge 5b187eb
build example for test
purge 69b06b6
use patched grunt init. fix postinstall
purge 2ffc011
auto build from template, use curljs, i18n port
purge 2e6650c
working ractive plugin
purge 4da1321
compile less
purge 666eb96
cross domain test
purge 822aa03
i18n rewrite (untested)
purge 9d06740
ignore if not available
purge 7120997
scaffold doesn't have any explicit names now and is entirely rjs comp…
purge 4185522
clean up
purge 5282116
move i18n to sqwidget plugin
purge e424660
put back locale
purge da26630
move around
purge a0c121b
more optional deps
purge 3658f0e
coffee -> js
purge d93ef8b
add moment as a optioanl dep
purge 53dd0d2
correct path
purge 87933ef
fixed a bug whereby bower creates the eventEmitter directory whilst m…
csolar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"directory": "sqwidget/lib" | ||
"directory": "app/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
.DS_Store | ||
node_modules/ | ||
config.js | ||
|
||
# temporary! | ||
compiled/**/*.* | ||
app/lib/ | ||
dist/ | ||
compiled/ | ||
example-widget/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
npm-debug.log | ||
node_modules | ||
src | ||
test | ||
compiled |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module.exports = function(grunt) { | ||
grunt.loadNpmTasks('grunt-contrib-clean'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-contrib-connect'); | ||
grunt.loadNpmTasks('grunt-karma'); | ||
grunt.loadNpmTasks('grunt-shell'); | ||
grunt.initConfig({ | ||
clean: { | ||
all: { | ||
src: ["compiled", "dist"] | ||
} | ||
}, | ||
connect: { | ||
publisher: { | ||
options: { | ||
port: 8000, | ||
base: '.' | ||
} | ||
}, | ||
sqwidget: { | ||
options: { | ||
port: 8002, | ||
base: 'example-widget' | ||
} | ||
} | ||
}, | ||
karma: { | ||
integration: { | ||
configFile: 'karma.conf.js' | ||
} | ||
}, | ||
shell: { | ||
build_example: { | ||
command: "./build_example.sh" | ||
} | ||
}, | ||
watch: { | ||
scaffold: { | ||
files: ["grunt-scaffold/root/main.js", "grunt-scaffold/root/app/**/*.js", "grunt-scaffold/**/*.tmpl"], | ||
tasks: ["build"] | ||
} | ||
} | ||
}); | ||
grunt.registerTask("build", ["shell:build_example"]); | ||
grunt.registerTask("test", ["clean", "build", "karma"]); | ||
grunt.registerTask("default", ["clean", "build", "connect", "watch"]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
PATH := ./node_modules/.bin:${PATH} | ||
|
||
.PHONY : init bower build test dist publish | ||
|
||
init: bower | ||
npm install | ||
|
||
build: | ||
grunt build | ||
|
||
test: | ||
grunt test | ||
|
||
bower: | ||
bower install | ||
|
||
dist: | ||
grunt dist | ||
|
||
publish: dist | ||
npm publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
define(['./lib/bonzo/bonzo', './lib/qwery/qwery', './lib/eventEmitter/EventEmitter', 'domReady!'], | ||
function(bonzo, qwery, Emitter) { | ||
|
||
var SqwidgetCore = (function() { | ||
|
||
function SqwidgetCore() {} | ||
|
||
for (var key in Emitter.prototype) { | ||
SqwidgetCore.prototype[key] = Emitter.prototype[key]; | ||
} | ||
|
||
SqwidgetCore.prototype.packages = {}; | ||
|
||
//convert data-sqwidget to dictionary | ||
SqwidgetCore.prototype.getWidgetParams = function($el) { | ||
var data, key, val, _ref; | ||
data = {}; | ||
_ref = $el.data(); | ||
|
||
for (key in _ref) { | ||
val = _ref[key]; | ||
if (!(key.match("sqwidget"))) { | ||
continue; | ||
} | ||
key = key.replace("sqwidget", "").toLowerCase(); | ||
data[key || "url"] = val; | ||
} | ||
return data; | ||
}; | ||
|
||
SqwidgetCore.prototype.guid = function() { | ||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | ||
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); | ||
return v.toString(16); | ||
}); | ||
}; | ||
|
||
SqwidgetCore.prototype.register = function(el) { | ||
var opts, pkg, _this = this, id = this.guid(); | ||
|
||
pkg = new Emitter(); | ||
var $el = bonzo(el).addClass('sqwidget').addClass(id); | ||
pkg.opts = opts = this.getWidgetParams($el); | ||
opts.el = pkg.el = $el; | ||
opts.id = id; | ||
|
||
if (!opts.url) { | ||
throw new Error("No widget source defined (set data-sqwidget-url)"); | ||
} | ||
|
||
this.packages[id] = { | ||
location: opts.url, | ||
main: 'app/index', | ||
config: opts | ||
}; | ||
|
||
return pkg; | ||
}; | ||
|
||
SqwidgetCore.prototype.initialize = function() { | ||
var names = [], pkg, _this = this; | ||
|
||
for(var k in _this.packages) names.push(k); | ||
|
||
curl({ | ||
packages: _this.packages, | ||
}, names, function() { | ||
var loaded = Array.prototype.slice.call(arguments); | ||
for (var i = 0; i < loaded.length; i++) { | ||
var module = loaded[i]; | ||
|
||
if(module.Controller) { | ||
var widget = new module.Controller({ | ||
sqwidget: _this | ||
}); | ||
|
||
//bus events | ||
_this.trigger("rendered:" + _this.packages[names[i]].location); | ||
_this.trigger("rendered:" + _this.packages[names[i]].id); | ||
} else { | ||
console.log("controller not found for " + module.location); | ||
} | ||
} | ||
}); | ||
}; | ||
|
||
return SqwidgetCore; | ||
|
||
})(); | ||
|
||
sqwidget = new SqwidgetCore(); | ||
|
||
bonzo(qwery('div[data-sqwidget]')).each(function(el) { | ||
sqwidget.register(el); | ||
}); | ||
|
||
sqwidget.initialize(); | ||
|
||
return sqwidget; | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no task
dist
inGruntfile.coffee