-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example jsus application, with middleware and puppies
- Loading branch information
0 parents
commit 04e4883
Showing
9 changed files
with
107 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
public/javascripts/jsus |
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,3 @@ | ||
[submodule "vendor/js/mootools-ckeditor"] | ||
path = vendor/js/mootools-ckeditor | ||
url = git://github.com/Inviz/mootools-ckeditor.git |
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,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" |
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,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 |
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,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. |
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,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 |
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,2 @@ | ||
require './app.rb' | ||
run JsusApplication |
Binary file not shown.
Submodule mootools-ckeditor
added at
97e566