diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2c5b7ba --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +public/javascripts/jsus \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2fc2300 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vendor/js/mootools-ckeditor"] + path = vendor/js/mootools-ckeditor + url = git://github.com/Inviz/mootools-ckeditor.git diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..8c38bba --- /dev/null +++ b/Gemfile @@ -0,0 +1,15 @@ +source :rubygems + +# Use local clones if possible. +def custom_gem(name, options = Hash.new) + local_path = File.expand_path("../../#{name}", __FILE__) + if ENV["USE_JSUS_CUSTOM_GEMS"] && File.directory?(local_path) + gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) } + else + gem name, options + end +end + +gem "rack" +gem "sinatra" +custom_gem "jsus" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..ce17d65 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,31 @@ +PATH + remote: /Users/mark/Code/jsus + specs: + jsus (0.2.7) + activesupport + json_pure + rgl + +GEM + remote: http://rubygems.org/ + specs: + activesupport (3.0.6) + json_pure (1.5.1) + rack (1.2.2) + rake (0.8.7) + rgl (0.4.0) + rake + stream (>= 0.5) + sinatra (1.2.3) + rack (~> 1.1) + tilt (>= 1.2.2, < 2.0) + stream (0.5) + tilt (1.2.2) + +PLATFORMS + ruby + +DEPENDENCIES + jsus! + rack + sinatra diff --git a/README.md b/README.md new file mode 100644 index 0000000..134cfbf --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +Description +=========== + +Live example for [jsus](https://github.com/markiz/jsus) rack middleware. + +Installation +============ + +1. `bundle install` +2. `rackup` +3. Go to [http://localhost:4567/jsus/javasacripts/require/CKEditor](http://localhost:4567/jsus/javasacripts/require/CKEditor) +and see the file being built +4. Experiment with urls. E.g.: /jsus/javascripts/require/CKEditor:plugins.about.plugin+CKEditor:plugins.adobeair.plugin.js + + +Things to notice +================ + +Caching is on by default, but sinatra lets middleware do its work before serving +static files. This leads to regeneration per request. Use caching proxy, like +kick-ass [nginx](http://nginx.org/) before your sinatra in order to succeed. + + +License +======= + +Application and libraries: UNLICENSE, same as jsus. + +CKEditor and other files: look in the respective sources. \ No newline at end of file diff --git a/app.rb b/app.rb new file mode 100644 index 0000000..cc8a38d --- /dev/null +++ b/app.rb @@ -0,0 +1,25 @@ +require 'rubygems' +require 'bundler' +Bundler.setup(:default, :development) +require 'jsus' +require 'sinatra/base' + +Jsus::Middleware.settings = { + :cache => true, + :cache_path => File.expand_path("../public/javascripts/jsus/require", __FILE__), + :packages_dir => File.expand_path("../vendor/js", __FILE__) +} + +class JsusApplication < Sinatra::Base + use Jsus::Middleware + set :static, true + get '/' do + [ + 200, {"Content-Type" => "text/plain"}, + "Ping! Use jsus urls to see some magic.\n\n" << + "E.g.: /javascripts/jsus/require/CKEditor.js\n" << + "/javascripts/jsus/require/CKEditor~CKEditor:core.config~CKEditor:core.command.js\n" << + "/javascripts/jsus/require/CKEditor:plugins.div.plugin+CKEditor:plugins.domiterator.plugin.js" + ] + end +end # class JsusApplication \ No newline at end of file diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..2925d69 --- /dev/null +++ b/config.ru @@ -0,0 +1,2 @@ +require './app.rb' +run JsusApplication \ No newline at end of file diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..6137477 Binary files /dev/null and b/public/favicon.ico differ diff --git a/vendor/js/mootools-ckeditor b/vendor/js/mootools-ckeditor new file mode 160000 index 0000000..97e566c --- /dev/null +++ b/vendor/js/mootools-ckeditor @@ -0,0 +1 @@ +Subproject commit 97e566c489b4fdea1a7d9f6db7a2872329159d0b