omf_web 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,11 +7,16 @@ use ::Rack::ShowExceptions
7
7
  OMF::Web::Runner.instance.life_cycle(:pre_rackup)
8
8
  options = OMF::Web::Runner.instance.options
9
9
 
10
- require 'omf-web/rack/session_authenticator'
11
- use OMF::Web::Rack::SessionAuthenticator, #:expire_after => 10,
10
+ require 'omf-web/rack/session_authenticator'
11
+ use OMF::Web::Rack::SessionAuthenticator, #:expire_after => 10,
12
12
  #:login_url => '/tab/login',
13
13
  :no_session => ['^/resource/', '^/login', '^/logout']
14
14
 
15
+ map "/resource/vendor/" do
16
+ require 'omf-web/rack/multi_file'
17
+ run OMF::Web::Rack::MultiFile.new(options[:static_dirs], :sub_path => 'vendor', :version => true)
18
+ end
19
+
15
20
 
16
21
  map "/resource" do
17
22
  require 'omf-web/rack/multi_file'
@@ -48,7 +53,7 @@ end
48
53
  # end
49
54
 
50
55
  map '/login' do
51
- handler = Proc.new do |env|
56
+ handler = Proc.new do |env|
52
57
  # req = ::Rack::Request.new(env)
53
58
  # #puts ">>> post?: #{req.post?} - #{req.params.inspect}"
54
59
  # if req.post?
@@ -63,7 +68,7 @@ map '/login' do
63
68
  end
64
69
 
65
70
  map '/logout' do
66
- handler = Proc.new do |env|
71
+ handler = Proc.new do |env|
67
72
  OMF::Web::Rack::SessionAuthenticator.logout
68
73
  [301, {'Location' => '/tab', "Content-Type" => ""}, ['Next window!']]
69
74
  end
@@ -71,7 +76,7 @@ map '/logout' do
71
76
  end
72
77
 
73
78
  map "/" do
74
- handler = Proc.new do |env|
79
+ handler = Proc.new do |env|
75
80
  req = ::Rack::Request.new(env)
76
81
  case req.path_info
77
82
  when '/'
@@ -81,7 +86,7 @@ map "/" do
81
86
  else
82
87
  OMF::Common::Loggable.logger('rack').warn "Can't handle request '#{req.path_info}'"
83
88
  [401, {"Content-Type" => ""}, "Sorry!"]
84
- end
89
+ end
85
90
  end
86
91
  run handler
87
92
  end
@@ -10,14 +10,40 @@ module OMF::Web::Rack
10
10
  # like sendfile on the +path+.
11
11
  #
12
12
  class MultiFile < ::Rack::File
13
- def initialize(roots, cache_control = nil)
14
- super nil, cache_control
13
+ def initialize(roots, opts = {})
14
+ super nil, opts[:cache_control]
15
15
  @roots = roots
16
+ if opts[:sub_path]
17
+ @sub_path = opts[:sub_path].split SEPS
18
+ end
19
+ if @version = opts[:version]
20
+ # read VERSION_MAP.yaml files
21
+ @version_map = {}
22
+ require 'yaml'
23
+ yml = File.join((@sub_path || []), 'VERSION_MAP.yaml')
24
+ @roots.reverse.each do |dir|
25
+ fn = File.join(dir, yml)
26
+ #puts "Checking for #{fn}"
27
+ if File.readable?(fn)
28
+ mh = YAML.load_file(fn)
29
+ #puts "VERSIONS: #{mh.inspect}"
30
+ @version_map.merge!(mh)
31
+ end
32
+ end
33
+ end
16
34
  end
17
-
35
+
18
36
  def _call(env)
19
37
  @path_info = ::Rack::Utils.unescape(env["PATH_INFO"])
20
38
  parts = @path_info.split SEPS
39
+ if @version_map
40
+ if pkg_name = @version_map[parts[1]]
41
+ parts[1] = pkg_name # replace with version
42
+ end
43
+ end
44
+ if @sub_path
45
+ parts = @sub_path + parts
46
+ end
21
47
 
22
48
  return fail(403, "Forbidden") if parts.include? ".."
23
49
 
@@ -36,7 +62,7 @@ module OMF::Web::Rack
36
62
  end
37
63
  fail(404, "File not found: #{@path_info}")
38
64
  end # _call
39
-
65
+
40
66
  end # MultiFile
41
67
  end # module
42
68
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  module OMF
3
3
  module Web
4
- VERSION = '0.9.8'
4
+ VERSION = '0.9.9'
5
5
  # Used for finding the example directory
6
6
  TOP_DIR = File.dirname(File.dirname(File.dirname(__FILE__)))
7
7
  end
@@ -0,0 +1,12 @@
1
+ backbone: backbone-0.5.3
2
+ bootstrap: bootstrap-2.3.1
3
+ codemirror: CodeMirror-2.32
4
+ d3: d3-2.9.2
5
+ jquery: jquery-1.7.2
6
+ jquery-ui: jquery-ui-1.8.23
7
+ mustache: mustache-0.7.0
8
+ raphael: raphael-2.1.0
9
+ silk_icons: silk_icons_v013
10
+ slickgrid: slickgrid-200512
11
+ stacktrace: stacktrace-0.3
12
+ underscore: underscore-1.2.1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omf_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -659,6 +659,7 @@ files:
659
659
  - share/htdocs/vendor/CodeMirror-2.32/theme/rubyblue.css
660
660
  - share/htdocs/vendor/CodeMirror-2.32/theme/vibrant-ink.css
661
661
  - share/htdocs/vendor/CodeMirror-2.32/theme/xq-dark.css
662
+ - share/htdocs/vendor/VERSION_MAP.yaml
662
663
  - share/htdocs/vendor/backbone-0.5.3/backbone.js
663
664
  - share/htdocs/vendor/bootstrap-2.3.1/css/bootstrap-responsive.css
664
665
  - share/htdocs/vendor/bootstrap-2.3.1/css/bootstrap-responsive.min.css
@@ -670,6 +671,15 @@ files:
670
671
  - share/htdocs/vendor/bootstrap-2.3.1/js/bootstrap.min.js
671
672
  - share/htdocs/vendor/d3-2.9.2/d3.js
672
673
  - share/htdocs/vendor/d3-2.9.2/d3.min.js
674
+ - share/htdocs/vendor/jquery-1.7.2/jquery.dataTables.js
675
+ - share/htdocs/vendor/jquery-1.7.2/jquery.event.drag-2.0.js
676
+ - share/htdocs/vendor/jquery-1.7.2/jquery.event.drag.js
677
+ - share/htdocs/vendor/jquery-1.7.2/jquery.jeditable.js
678
+ - share/htdocs/vendor/jquery-1.7.2/jquery.js
679
+ - share/htdocs/vendor/jquery-1.7.2/jquery.later.js
680
+ - share/htdocs/vendor/jquery-1.7.2/jquery.min.js
681
+ - share/htdocs/vendor/jquery-1.7.2/jquery.periodicalupdater.js
682
+ - share/htdocs/vendor/jquery-1.7.2/jquery.sparkline-2.0.js
673
683
  - share/htdocs/vendor/jquery-tipsy/css/tipsy.css
674
684
  - share/htdocs/vendor/jquery-tipsy/js/jquery.tipsy.js
675
685
  - share/htdocs/vendor/jquery-ui-1.8.23/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png
@@ -692,22 +702,6 @@ files:
692
702
  - share/htdocs/vendor/jquery-ui-1.8.23/js/jquery-ui.min.js
693
703
  - share/htdocs/vendor/jquery-ui-1.8.23/js/jquery.ui.draggable.js
694
704
  - share/htdocs/vendor/jquery-ui-1.8.23/js/jquery.ui.droppable.js
695
- - share/htdocs/vendor/jquery/jquery-1.4.3.js
696
- - share/htdocs/vendor/jquery/jquery-1.6.1.min.js
697
- - share/htdocs/vendor/jquery/jquery-1.7.2.js
698
- - share/htdocs/vendor/jquery/jquery-1.7.2.min.js
699
- - share/htdocs/vendor/jquery/jquery-ui-1.8.18.custom.min.js
700
- - share/htdocs/vendor/jquery/jquery-ui-1.8.4.custom.min.js
701
- - share/htdocs/vendor/jquery/jquery-ui-1.8.custom.min.js
702
- - share/htdocs/vendor/jquery/jquery-ui.custom.min.js
703
- - share/htdocs/vendor/jquery/jquery.dataTables.js
704
- - share/htdocs/vendor/jquery/jquery.event.drag-2.0.js
705
- - share/htdocs/vendor/jquery/jquery.event.drag.js
706
- - share/htdocs/vendor/jquery/jquery.jeditable.js
707
- - share/htdocs/vendor/jquery/jquery.js
708
- - share/htdocs/vendor/jquery/jquery.later.js
709
- - share/htdocs/vendor/jquery/jquery.periodicalupdater.js
710
- - share/htdocs/vendor/jquery/jquery.sparkline-2.0.js
711
705
  - share/htdocs/vendor/must_have_icon_set/.DS_Store
712
706
  - share/htdocs/vendor/must_have_icon_set/Add/Add.ico
713
707
  - share/htdocs/vendor/must_have_icon_set/Add/Add_16x16.png