olelo 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,7 @@ rvm:
6
6
  matrix:
7
7
  allow_failures:
8
8
  - rvm: rbx-19mode
9
+ - rvm: ruby-head
9
10
  # HACK: Fix problems with native libraries on ruby-head
10
11
  before_install:
11
12
  - gem install rugged -v 0.17.0.b7 -- --with-cflags='--std=gnu99'
data/config.ru CHANGED
@@ -11,7 +11,7 @@ require 'rack/relative_redirect'
11
11
  require 'rack/static_cache'
12
12
  require 'olelo'
13
13
  require 'olelo/middleware/degrade_mime_type'
14
- require 'olelo/middleware/flash'
14
+ require 'olelo/middleware/ua_header'
15
15
  require 'olelo/middleware/force_encoding'
16
16
  require 'securerandom'
17
17
 
@@ -79,7 +79,7 @@ Olelo::Initializer.initialize(logger)
79
79
  # end
80
80
 
81
81
  use Rack::Runtime
82
- use Rack::ShowExceptions if !Olelo::Config['production']
82
+ use Rack::ShowExceptions unless Olelo::Config['production']
83
83
 
84
84
  if Olelo::Config['rack.deflater']
85
85
  use Rack::Deflater
@@ -88,6 +88,7 @@ end
88
88
  use Rack::StaticCache, urls: ['/static'], root: app_path
89
89
  use Rack::Session::Cookie, key: 'olelo.session', secret: Olelo::Config['rack.session_secret']
90
90
  use Olelo::Middleware::DegradeMimeType
91
+ use Olelo::Middleware::UAHeader
91
92
 
92
93
  class LoggerOutput
93
94
  def initialize(logger); @logger = logger; end
@@ -96,9 +97,8 @@ end
96
97
 
97
98
  use Rack::MethodOverride
98
99
  use Rack::CommonLogger, LoggerOutput.new(logger)
99
- use Olelo::Middleware::ForceEncoding
100
- use Olelo::Middleware::Flash, set_accessors: %w(error warn info)
101
100
  use Rack::RelativeRedirect
101
+ use Olelo::Middleware::ForceEncoding
102
102
  run Olelo::Application.new
103
103
 
104
104
  logger.info "Olelo started in #{Olelo::Config['production'] ? 'production' : 'development'} mode"
@@ -115,6 +115,7 @@ disabled_plugins:
115
115
  - editor/recaptcha
116
116
  - editor/ace
117
117
  - filters/remind
118
+ - tags/fortune
118
119
 
119
120
  ##################################################
120
121
  # Rack middleware configurations
@@ -28,10 +28,90 @@ module Olelo
28
28
  end
29
29
 
30
30
  module FlashHelper
31
+ # Implements bracket accessors for storing and retrieving flash entries.
32
+ class FlashHash
33
+ class << self
34
+ def define_accessors(*accessors)
35
+ accessors.compact.each do |key|
36
+ key = key.to_sym
37
+ class_eval do
38
+ define_method(key) {|*a| a.size > 0 ? (self[key] = a[0]) : self[key] }
39
+ define_method("#{key}=") {|val| self[key] = val }
40
+ define_method("#{key}!") {|val| cache[key] = val }
41
+ end
42
+ end
43
+ end
44
+
45
+ def define_set_accessors(*accessors)
46
+ accessors.compact.each do |key|
47
+ key = key.to_sym
48
+ class_eval do
49
+ define_method(key) {|*val| val.size > 0 ? (self[key] ||= Set.new).merge(val) : self[key] }
50
+ define_method("#{key}!") {|*val| val.size > 0 ? (cache[key] ||= Set.new).merge(val) : cache[key] }
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ define_set_accessors :error, :warn, :info
57
+
58
+ def initialize(session)
59
+ @session = session
60
+ raise 'No session available' if !session
61
+ end
62
+
63
+ # Remove an entry from the session and return its value. Cache result in
64
+ # the instance cache.
65
+ def [](key)
66
+ key = key.to_sym
67
+ cache[key] ||= values.delete(key)
68
+ end
69
+
70
+ # Store the entry in the session, updating the instance cache as well.
71
+ def []=(key,val)
72
+ key = key.to_sym
73
+ cache[key] = values[key] = val
74
+ end
75
+
76
+ # Store a flash entry for only the current request, swept regardless of
77
+ # whether or not it was actually accessed
78
+ def now
79
+ cache
80
+ end
81
+
82
+ # Checks for the presence of a flash entry without retrieving or removing
83
+ # it from the cache or store.
84
+ def include?(key)
85
+ key = key.to_sym
86
+ cache.keys.include?(key) || values.keys.include?(key)
87
+ end
88
+
89
+ # Clear the hash
90
+ def clear
91
+ cache.clear
92
+ @session.delete(:olelo_flash)
93
+ end
94
+
95
+ private
96
+
97
+ # Maintain an instance-level cache of retrieved flash entries. These
98
+ # entries will have been removed from the session, but are still available
99
+ # through the cache.
100
+ def cache
101
+ @cache ||= {}
102
+ end
103
+
104
+ # Helper to access flash entries from session value. This key
105
+ # is used to prevent collisions with other user-defined session values.
106
+ def values
107
+ @session[:olelo_flash] ||= {}
108
+ end
109
+ end
110
+
31
111
  include Util
32
112
 
33
113
  def flash
34
- env['olelo.flash']
114
+ @flash ||= FlashHash.new(env['rack.session'])
35
115
  end
36
116
 
37
117
  def flash_messages
@@ -246,7 +326,7 @@ module Olelo
246
326
  @@script_link ||=
247
327
  begin
248
328
  path = build_path "static/script.js?#{File.mtime(File.join(Config['app_path'], 'static', 'script.js')).to_i}"
249
- %{<script src="#{escape_html path}" type="text/javascript"/>}
329
+ %{<script src="#{escape_html path}" type="text/javascript"></script>}
250
330
  end
251
331
  base_path = if page && page.root?
252
332
  url = request.base_url
@@ -0,0 +1,15 @@
1
+ module Olelo
2
+ module Middleware
3
+ class UAHeader
4
+ def initialize(app)
5
+ @app = app
6
+ end
7
+
8
+ def call(env)
9
+ status, headers, body = @app.call(env)
10
+ headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
11
+ [status, headers, body]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Olelo
2
- VERSION = '0.9.5'
2
+ VERSION = '0.9.6'
3
3
  end
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  description 'Filter pipeline aspect'
2
3
  dependencies 'aspects'
3
4
 
@@ -41,7 +42,7 @@ class Filter
41
42
 
42
43
  # Print filter definition. For debugging purposes.
43
44
  def definition
44
- previous ? "#{previous.definition} > #{name}" : name
45
+ previous ? "#{previous.definition} #{name}" : name
45
46
  end
46
47
 
47
48
  # Register a filter class
@@ -156,11 +156,13 @@ ul.tabs
156
156
  thead
157
157
  tr
158
158
  th Name
159
+ th Accepted mime types
159
160
  th Filters
160
161
  tbody
161
162
  - Olelo::Plugin::Aspects::Aspect.aspects.values.flatten.select {|aspect| Olelo::Plugin::Filters::FilterAspect === aspect }.sort_by(&:name).each do |aspect|
162
163
  tr
163
164
  td= aspect.name
165
+ td= aspect.accepts ? aspect.accepts.inspect : '*'
164
166
  td= aspect.definition
165
167
  - if defined?(Olelo::Plugin::Tags::Tag)
166
168
  #tab-tags.tab
@@ -25,6 +25,6 @@ end
25
25
  # Export variables to javascript for client extensions
26
26
  Application.hook :head, 1 do
27
27
  vars = page ? params.merge(PLUGIN.exported_variables(page)) : params
28
- vars = vars.merge('user_logged_in' => !User.logged_in?, 'user_name' => User.current.name)
28
+ vars = vars.merge('user_name' => User.current.name) if User.logged_in?
29
29
  %{<script type="text/javascript">Olelo = #{escape_javascript MultiJson.dump(vars)};</script>}
30
30
  end
@@ -392,13 +392,11 @@ class RuggedRepository < Repository
392
392
 
393
393
  def path_changed?(c, path)
394
394
  return true if path.blank?
395
- new = [(c.tree.path(path) rescue nil),
396
- (c.tree.path(path + ATTRIBUTE_EXT) rescue nil),
397
- (c.tree.path(path + CONTENT_EXT) rescue nil)]
398
- (new.first && c.parents.empty?) || c.parents.any? do |parent|
399
- new != [(parent.tree.path(path) rescue nil),
400
- (parent.tree.path(path + ATTRIBUTE_EXT) rescue nil),
401
- (parent.tree.path(path + CONTENT_EXT) rescue nil)]
395
+ ref1, ref2, ref3 = nil, nil, nil
396
+ (c.parents.empty? && (ref1 ||= c.tree.path(path) rescue {})) || c.parents.any? do |parent|
397
+ (ref1 ||= c.tree.path(path) rescue {}) != (parent.tree.path(path) rescue {}) ||
398
+ (ref2 ||= c.tree.path(path + ATTRIBUTE_EXT) rescue {}) != (parent.tree.path(path + ATTRIBUTE_EXT) rescue {}) ||
399
+ (ref3 ||= c.tree.path(path + CONTENT_EXT) rescue {}) != (parent.tree.path(path + CONTENT_EXT) rescue {})
402
400
  end
403
401
  end
404
402
 
@@ -0,0 +1,6 @@
1
+ description 'Prints a fortune message (Dynamic example tag for development)'
2
+
3
+ Tag.define :fortune, :autoclose => true, :description => 'Show fortune message', :dynamic => true do |context, attrs|
4
+ text = `fortune`
5
+ "<blockquote>#{escape_html(text)}</blockquote>" if valid_xml_chars?(text)
6
+ end
@@ -350,4 +350,3 @@ end
350
350
  Tag.define :notags, description: 'Disable tag processing', immediate: true do |context, attrs, content|
351
351
  content
352
352
  end
353
-
@@ -101,7 +101,7 @@ class ::Olelo::Application
101
101
  hook :head do
102
102
  if page && Config['math_renderer'] == 'mathjax'
103
103
  %{<script type="text/x-mathjax-config">MathJax.Hub.Config({ TeX: { extensions: ['autoload-all.js'] } });</script>
104
- <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"/>}
104
+ <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>}
105
105
  end
106
106
  end
107
107
 
@@ -21,7 +21,7 @@ class ::Olelo::Application
21
21
  end
22
22
  if js
23
23
  path = build_path "_/assets/assets.js?#{js.first.to_i}"
24
- result << %{<script src="#{escape_html path}" type="text/javascript"/>}
24
+ result << %{<script src="#{escape_html path}" type="text/javascript"></script>}
25
25
  end
26
26
  result
27
27
  end
@@ -295,8 +295,8 @@ arguments)},_keyEvent:function(n,s){if(!this.isMultiLine||this.menu.element.is("
295
295
  (n>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(n){this._superApply(arguments);this.options.disabled||this.cancelSearch||this.liveRegion.text(n&&n.length?this.options.messages.results(n.length):this.options.messages.noResults)}})})(jQuery);(function(i){function v(o){if(typeof o!="string"&&typeof o!="number")throw new TypeError("Key name must be string or numeric");}function n(){try{s.oleloStorage=JSON.stringify(z)}catch(o){}}var s={},z={};try{if(window.localStorage)s=window.localStorage;if(s.oleloStorage)z=JSON.parse(s.oleloStorage)}catch(r){}i.storage={set:function(o,x){v(o);z[o]=x;n();return x},get:function(o,x){v(o);if(o in z)return z[o];return typeof x=="undefined"?null:x},remove:function(o){v(o);if(o in z){delete z[o];n();return true}return false}}})(jQuery);(function(i){function v(z,r){var o=s[z];return o&&o[r]}var n=null,s={};i.translations=function(z){for(var r in z)if(s[r])for(var o in z[r])s[r][o]=z[r][o];else s[r]=z[r]};i.t=function(z,r){if(!n){var o=i("html");n=o.attr("lang")||o.attr("xml:lang")||"en"}var x;o=v(n,z);if(!o&&(x=n.indexOf("-")))o=v(n.substr(0,x),z);if(o){for(var E in r)o=o.replace(RegExp("#{"+E+"}","g"),r[E]);return o}return"#"+z}})(jQuery);(function(i){function v(){var z=false;switch(this.type){case "checkbox":case "radio":z=this.checked!=this.defaultChecked;break;case "hidden":case "password":case "text":case "textarea":case "file":z=this.value!=this.defaultValue;break;case "select-one":case "select-multiple":for(var r=0;r<this.options.length&&!z;++r)z=this.options[r].selected!=this.options[r].defaultSelected;break}i("label[for="+this.id+"]").toggleClass("unsaved",z);i(this).toggleClass("unsaved",z)}function n(z){i("input.observe, textarea.observe, select.observe").each(function(){v.call(this)});
296
296
  return i(".unsaved",z).size()!==0}i.translations({en:{confirmUnsaved:"The page was not saved. Continue?",pageUnsaved:"The page was not saved."},de:{confirmUnsaved:"Die Seite wurde nicht gespeichert. Fortsetzen?",pageUnsaved:"Die Seite wurde nicht gespeichert."},cs:{confirmUnsaved:"Str\u00e1nka nebyla ulo\u017eena. Pokra\u010dovat?",pageUnsaved:"Str\u00e1nka nebyla ulo\u017eena."},fr:{confirmUnsaved:"La page n'a pas \u00e9t\u00e9 enregistr\u00e9e. Voulez vous continuer ?",pageUnsaved:"La page n'a pas \u00e9t\u00e9 enregistr\u00e9e."}});
297
297
  i.fn.confirmUnsaved=function(){return!n(this)||confirm(i.t("confirmUnsaved"))};i(document).on("change autocompletechange","input.observe, textarea.observe, select.observe",v);var s=false;i(document).on("submit","form",function(){s=true}).bind("reset",function(){i(".unsaved",this).removeClass("unsaved")});i(window).bind("beforeunload",function(){if(!s&&n(document))return i.t("pageUnsaved")})})(jQuery);(function(i){i.fn.historyTable=function(){function v(){var o=[];z.each(function(){this.checked&&o.push(this.name)});return o}i("thead tr",this).prepend('<th class="compare"><button>&#177;</button></th>');i("tbody tr",this).each(function(){var o=i(this).attr("id").substr(8);i(this).prepend('<td class="compare"><input type="checkbox" name="'+o+'"/></td>')});var n=i.storage.get("historyTable");if(n)for(var s=0;s<n.length;++s)i("input[name="+n[s]+"]").attr("checked","checked");var z=i("tbody input",this),
298
- r=i("th button",this);r.click(function(){var o=v();i.storage.set("historyTable",o);location.href=location.pathname.replace("/history","/compare/"+o[o.length-1]+"..."+o[0])});i("td input",this).change(function(){v().length>1?r.removeAttr("disabled"):r.attr("disabled","disabled")}).change()}})(jQuery);(function(i){i.fn.pagination=function(v){function n(z){s.load(z+(z.indexOf("?")<0?"?":"&")+"no_layout=1",function(){s.trigger("pageLoaded",[z])})}var s=this;i(document).on("click",v,function(){i(this).addClass("loading");History.enabled?History.pushState(null,document.title,this.href):n(this.href);return false});i(window).bind("statechange",function(){var z=History.getState();n(z.url)})}})(jQuery);(function(i){i.fn.tabWidget=function(v){var n=v&&v.store,s=null;i("> a[href^='#']",this).click(function(){if(s.data("tab")==i(this).data("tab"))return false;if(!s.data("tab").confirmUnsaved())return false;s.data("tab").hide();s.parent().removeClass("selected");s=i(this);s.data("tab").show();s.parent().addClass("selected");n&&i.storage.set(n,s.data("tab").attr("id"));return false});if(n)if(v=i.storage.get(n))s=i("> a[href='#"+v+"']",this);if(!s||s.size()===0)s=i(this).filter(".selected").find("> a[href^='#']");
299
- if(!s||s.size()===0)s=i(this).filter(":first").find("> a[href^='#']");i("> a[href^='#']",this).each(function(){var z=i(this.href.match(/(#.*)$/)[1]);z.hide();i(this).data("tab",z)});this.removeClass("selected");s.parent().addClass("selected");s.data("tab").show()}})(jQuery);(function(i){function v(n){n=Math.floor(((new Date).getTime()-new Date(n*1E3))/6E4);if(n<=0)return i.t("less_than_a_minute_ago");if(n==1)return i.t("a_minute_ago");if(n<45)return i.t("n_minutes_ago",{n:n});if(n<90)return i.t("one_hour_ago");if(n<1440)return i.t("n_hours_ago",{n:Math.round(n/60)});if(n<2880)return i.t("one_day_ago");if(n<43200)return i.t("n_days_ago",{n:Math.round(n/1440)});if(n<86400)return i.t("one_month_ago");if(n<525960)return i.t("n_months_ago",{n:Math.round(n/43200)});if(n<1051920)return i.t("one_year_ago");
298
+ r=i("th button",this);r.click(function(){var o=v();i.storage.set("historyTable",o);location.href=location.pathname.replace("/history","/compare/"+o[o.length-1]+"..."+o[0])});i("td input",this).change(function(){v().length>1?r.removeAttr("disabled"):r.attr("disabled","disabled")}).change()}})(jQuery);(function(i){i.fn.pagination=function(v){function n(z){s.load(z+(z.indexOf("?")<0?"?":"&")+"no_layout=1",function(){s.trigger("pageLoaded",[z])})}var s=this;i(document).on("click",v,function(){i(this).addClass("loading");History.enabled?History.pushState(null,document.title,this.href):n(this.href);return false});i(window).bind("statechange",function(){var z=History.getState();n(z.url)})}})(jQuery);(function(i){i.fn.tabWidget=function(v){var n=v&&v.store,s=null;i("> a[href^='#']",this).click(function(){if(s.data("tab")==i(this).data("tab"))return false;if(!s.data("tab").confirmUnsaved())return false;s.data("tab").hide();s.parent().removeClass("selected");s=i(this);s.data("tab").show();s.parent().addClass("selected");n&&i.storage.set(n,s.data("tab").attr("id"));return false}).each(function(){var z=i(this.href.match(/(#.*)$/)[1]);z.hide();i(this).data("tab",z)});if(n)if(v=i.storage.get(n))s=i("> a[href='#"+
299
+ v+"']",this);if(!s||s.size()===0)s=i(this).filter(".selected").find("> a[href^='#']");if(!s||s.size()===0)s=i(this).filter(":first").find("> a[href^='#']");if(s&&s.data("tab")){s.parent().addClass("selected");s.data("tab").show()}}})(jQuery);(function(i){function v(n){n=Math.floor(((new Date).getTime()-new Date(n*1E3))/6E4);if(n<=0)return i.t("less_than_a_minute_ago");if(n==1)return i.t("a_minute_ago");if(n<45)return i.t("n_minutes_ago",{n:n});if(n<90)return i.t("one_hour_ago");if(n<1440)return i.t("n_hours_ago",{n:Math.round(n/60)});if(n<2880)return i.t("one_day_ago");if(n<43200)return i.t("n_days_ago",{n:Math.round(n/1440)});if(n<86400)return i.t("one_month_ago");if(n<525960)return i.t("n_months_ago",{n:Math.round(n/43200)});if(n<1051920)return i.t("one_year_ago");
300
300
  return i.t("over_n_years_ago",{n:Math.round(n/525960)})}i.translations({en:{less_than_a_minute_ago:"less than a minute ago",a_minute_ago:"a minute ago",n_minutes_ago:"#{n} minutes ago",one_hour_ago:"1 hour ago",n_hours_ago:"#{n} hours ago",one_day_ago:"1 day ago",n_days_ago:"#{n} days ago",one_month_ago:"1 month ago",n_months_ago:"#{n} months ago",one_year_ago:"1 year ago",over_n_years_ago:"over #{n} years ago"},de:{less_than_a_minute_ago:"vor weniger als einer Minute",a_minute_ago:"vor einer Minute",
301
301
  n_minutes_ago:"vor #{n} Minuten",one_hour_ago:"vor einer Stunde",n_hours_ago:"vor #{n} Stunden",one_day_ago:"vor einem Tag",n_days_ago:"vor #{n} Tagen",one_month_ago:"vor einem Monat",n_months_ago:"vor #{n} Monaten",one_year_ago:"vor einem Jahr",over_n_years_ago:"vor \u00fcber #{n} Jahren"},cs:{less_than_a_minute_ago:"m\u00e9n\u011b ne\u017e 1 minuta",a_minute_ago:"p\u0159ed minutou",n_minutes_ago:"p\u0159ed #{n} minutami",one_hour_ago:"p\u0159ed hodinou",n_hours_ago:"p\u0159ed #{n} hodinami",one_day_ago:"jeden den",
302
302
  n_days_ago:"p\u0159ed #{n} dny",one_month_ago:"jeden m\u011bs\u00edc",n_months_ago:"p\u0159ed #{n} m\u011bs\u00edci",one_year_ago:"1 rok",over_n_years_ago:"p\u0159ed #{n} lety"},fr:{less_than_a_minute_ago:"il y a moins d'une minute",a_minute_ago:"il y a une minute",n_minutes_ago:"il y a #{n} minutes",one_hour_ago:"il y a 1 heure",n_hours_ago:"il y a #{n} heures",one_day_ago:"il y a 1 jour",n_days_ago:"il y a #{n} jours",one_month_ago:"il y a 1 mois",n_months_ago:"il y a #{n} mois",one_year_ago:"il y a 1 an",
@@ -4,9 +4,8 @@
4
4
  $.fn.tabWidget = function(options) {
5
5
  var store = options && options.store;
6
6
  var selected = null;
7
-
8
- // Handle tab clicks
9
7
  $("> a[href^='#']", this).click(function() {
8
+ // Handle tab clicks
10
9
  if (selected.data('tab') == $(this).data('tab')) {
11
10
  return false;
12
11
  }
@@ -22,6 +21,11 @@
22
21
  $.storage.set(store, selected.data('tab').attr('id'));
23
22
  }
24
23
  return false;
24
+ }).each(function() {
25
+ // Hide tabs
26
+ var tab = $(this.href.match(/(#.*)$/)[1]);
27
+ tab.hide();
28
+ $(this).data('tab', tab);
25
29
  });
26
30
 
27
31
  // Get selected tab from store
@@ -42,16 +46,10 @@
42
46
  selected = $(this).filter(':first').find("> a[href^='#']");
43
47
  }
44
48
 
45
- // Find all tabs and hide them
46
- $("> a[href^='#']", this).each(function() {
47
- var tab = $(this.href.match(/(#.*)$/)[1]);
48
- tab.hide();
49
- $(this).data('tab', tab);
50
- });
51
-
52
49
  // Show initially selected tab
53
- this.removeClass('selected');
54
- selected.parent().addClass('selected');
55
- selected.data('tab').show();
50
+ if (selected && selected.data('tab')) {
51
+ selected.parent().addClass('selected');
52
+ selected.data('tab').show();
53
+ }
56
54
  };
57
55
  })(jQuery);
@@ -1,5 +1,4 @@
1
1
  require 'helper'
2
- require 'olelo/middleware/flash'
3
2
  require 'olelo/middleware/force_encoding'
4
3
  require 'olelo/middleware/degrade_mime_type'
5
4
  require 'rack/relative_redirect'
@@ -75,7 +74,6 @@ describe 'requests' do
75
74
  use Rack::MethodOverride
76
75
  use Olelo::Middleware::ForceEncoding
77
76
  use Olelo::Middleware::DegradeMimeType
78
- use Olelo::Middleware::Flash, set_accessors: %w(error warn info)
79
77
  #use Rack::RelativeRedirect
80
78
  run Olelo::Application.new
81
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: olelo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-30 00:00:00.000000000 Z
12
+ date: 2012-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
16
- requirement: &6959180 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 1.3.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *6959180
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.3.6
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: slim
27
- requirement: &6957600 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 1.3.3
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *6957600
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.3.3
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: creole
38
- requirement: &6956440 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 0.5.0
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *6956440
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.5.0
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: nokogiri
49
- requirement: &6955340 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 1.5.5
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *6955340
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.5.5
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: mimemagic
60
- requirement: &7036260 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: 0.2.0
66
86
  type: :runtime
67
87
  prerelease: false
68
- version_requirements: *7036260
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.2.0
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: rack
71
- requirement: &7035140 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ~>
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: 1.4.1
77
102
  type: :runtime
78
103
  prerelease: false
79
- version_requirements: *7035140
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.4.1
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: redcarpet
82
- requirement: &7034360 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ~>
@@ -87,10 +117,15 @@ dependencies:
87
117
  version: 2.2.2
88
118
  type: :runtime
89
119
  prerelease: false
90
- version_requirements: *7034360
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 2.2.2
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: rugged
93
- requirement: &7033500 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
131
  - - ~>
@@ -98,10 +133,15 @@ dependencies:
98
133
  version: 0.17.0.b7
99
134
  type: :runtime
100
135
  prerelease: false
101
- version_requirements: *7033500
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 0.17.0.b7
102
142
  - !ruby/object:Gem::Dependency
103
143
  name: evaluator
104
- requirement: &7032780 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
105
145
  none: false
106
146
  requirements:
107
147
  - - ~>
@@ -109,10 +149,15 @@ dependencies:
109
149
  version: 0.1.6
110
150
  type: :runtime
111
151
  prerelease: false
112
- version_requirements: *7032780
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: 0.1.6
113
158
  - !ruby/object:Gem::Dependency
114
159
  name: rake
115
- requirement: &7031960 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
116
161
  none: false
117
162
  requirements:
118
163
  - - ! '>='
@@ -120,10 +165,15 @@ dependencies:
120
165
  version: 0.8.7
121
166
  type: :development
122
167
  prerelease: false
123
- version_requirements: *7031960
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: 0.8.7
124
174
  - !ruby/object:Gem::Dependency
125
175
  name: sass
126
- requirement: &7031420 !ruby/object:Gem::Requirement
176
+ requirement: !ruby/object:Gem::Requirement
127
177
  none: false
128
178
  requirements:
129
179
  - - ! '>='
@@ -131,10 +181,15 @@ dependencies:
131
181
  version: 3.1.0
132
182
  type: :development
133
183
  prerelease: false
134
- version_requirements: *7031420
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: 3.1.0
135
190
  - !ruby/object:Gem::Dependency
136
191
  name: bacon
137
- requirement: &7030900 !ruby/object:Gem::Requirement
192
+ requirement: !ruby/object:Gem::Requirement
138
193
  none: false
139
194
  requirements:
140
195
  - - ~>
@@ -142,10 +197,15 @@ dependencies:
142
197
  version: 1.1.0
143
198
  type: :development
144
199
  prerelease: false
145
- version_requirements: *7030900
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ~>
204
+ - !ruby/object:Gem::Version
205
+ version: 1.1.0
146
206
  - !ruby/object:Gem::Dependency
147
207
  name: rack-test
148
- requirement: &7030300 !ruby/object:Gem::Requirement
208
+ requirement: !ruby/object:Gem::Requirement
149
209
  none: false
150
210
  requirements:
151
211
  - - ~>
@@ -153,7 +213,12 @@ dependencies:
153
213
  version: 0.6.2
154
214
  type: :development
155
215
  prerelease: false
156
- version_requirements: *7030300
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ~>
220
+ - !ruby/object:Gem::Version
221
+ version: 0.6.2
157
222
  description: Olelo is a git-based wiki which supports many markup languages, tags,
158
223
  embedded TeX and much more. It can be extended through plugins.
159
224
  email:
@@ -190,8 +255,8 @@ files:
190
255
  - lib/olelo/locale.yml
191
256
  - lib/olelo/menu.rb
192
257
  - lib/olelo/middleware/degrade_mime_type.rb
193
- - lib/olelo/middleware/flash.rb
194
258
  - lib/olelo/middleware/force_encoding.rb
259
+ - lib/olelo/middleware/ua_header.rb
195
260
  - lib/olelo/page.rb
196
261
  - lib/olelo/patch.rb
197
262
  - lib/olelo/plugin.rb
@@ -303,6 +368,7 @@ files:
303
368
  - plugins/security/readonly_wiki.rb
304
369
  - plugins/tags/code.rb
305
370
  - plugins/tags/footnotes.rb
371
+ - plugins/tags/fortune.rb
306
372
  - plugins/tags/gist-embed.css
307
373
  - plugins/tags/gist.rb
308
374
  - plugins/tags/html.rb
@@ -467,7 +533,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
467
533
  version: '0'
468
534
  requirements: []
469
535
  rubyforge_project: olelo
470
- rubygems_version: 1.8.15
536
+ rubygems_version: 1.8.23
471
537
  signing_key:
472
538
  specification_version: 3
473
539
  summary: Olelo is a git-based wiki.
@@ -1,97 +0,0 @@
1
- module Olelo
2
- module Middleware
3
- class Flash
4
- # Implements bracket accessors for storing and retrieving flash entries.
5
- class FlashHash
6
- def initialize(session)
7
- @session = session
8
- raise 'No session available' if !session
9
- end
10
-
11
- # Remove an entry from the session and return its value. Cache result in
12
- # the instance cache.
13
- def [](key)
14
- key = key.to_sym
15
- cache[key] ||= values.delete(key)
16
- end
17
-
18
- # Store the entry in the session, updating the instance cache as well.
19
- def []=(key,val)
20
- key = key.to_sym
21
- cache[key] = values[key] = val
22
- end
23
-
24
- # Store a flash entry for only the current request, swept regardless of
25
- # whether or not it was actually accessed
26
- def now
27
- cache
28
- end
29
-
30
- # Checks for the presence of a flash entry without retrieving or removing
31
- # it from the cache or store.
32
- def include?(key)
33
- key = key.to_sym
34
- cache.keys.include?(key) || values.keys.include?(key)
35
- end
36
-
37
- # Clear the hash
38
- def clear
39
- cache.clear
40
- @session.delete(:olelo_flash)
41
- end
42
-
43
- # Hide the underlying olelo.flash session key and only expose values stored
44
- # in the flash.
45
- def inspect
46
- "#<FlashHash @values=#{values.inspect} @cache=#{cache.inspect}>"
47
- end
48
-
49
- # Human readable for logging.
50
- def to_s
51
- values.inspect
52
- end
53
-
54
- private
55
-
56
- # Maintain an instance-level cache of retrieved flash entries. These
57
- # entries will have been removed from the session, but are still available
58
- # through the cache.
59
- def cache
60
- @cache ||= {}
61
- end
62
-
63
- # Helper to access flash entries from olelo.flash session value. This key
64
- # is used to prevent collisions with other user-defined session values.
65
- def values
66
- @session[:olelo_flash] ||= {}
67
- end
68
- end
69
-
70
- def initialize(app, options = {})
71
- @app = app
72
- @hash = Class.new(FlashHash)
73
- [*options[:accessors]].compact.each do |key|
74
- key = key.to_sym
75
- @hash.class_eval do
76
- define_method(key) {|*a| a.size > 0 ? (self[key] = a[0]) : self[key] }
77
- define_method("#{key}=") {|val| self[key] = val }
78
- define_method("#{key}!") {|val| cache[key] = val }
79
- end
80
- end
81
- [*options[:set_accessors]].compact.each do |key|
82
- key = key.to_sym
83
- @hash.class_eval do
84
- define_method(key) {|*val| val.size > 0 ? (self[key] ||= Set.new).merge(val) : self[key] }
85
- define_method("#{key}!") {|*val| val.size > 0 ? (cache[key] ||= Set.new).merge(val) : cache[key] }
86
- end
87
- end
88
- end
89
-
90
- def call(env)
91
- session = env['rack.session']
92
- env['olelo.flash'] ||= @hash.new(session)
93
- @app.call(env)
94
- end
95
- end
96
- end
97
- end