spiderfw 0.6.15 → 0.6.16
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/VERSION +1 -1
- data/apps/core/auth/controllers/mixins/auth_helper.rb +5 -2
- data/apps/servant/servant.rb +1 -1
- data/lib/spiderfw/app.rb +1 -1
- data/lib/spiderfw/controller/controller.rb +10 -6
- data/lib/spiderfw/controller/dispatcher.rb +5 -0
- data/lib/spiderfw/controller/mixins/http_mixin.rb +1 -1
- data/lib/spiderfw/http/adapters/rack.rb +1 -1
- data/lib/spiderfw/model/identity_mapper.rb +3 -1
- data/lib/spiderfw/model/storage/db/adapters/oracle.rb +2 -2
- data/lib/spiderfw/model/storage/db/connectors/oci8.rb +0 -4
- data/lib/spiderfw/model/storage.rb +2 -2
- data/lib/spiderfw/setup/app_manager.rb +12 -3
- data/lib/spiderfw/spider.rb +1 -1
- data/lib/spiderfw/templates/template.rb +1 -0
- data/lib/spiderfw/utils/json.rb +2 -1
- metadata +4 -4
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.16
|
@@ -45,13 +45,14 @@ module Spider; module Auth
|
|
45
45
|
user = klass.restore(@request)
|
46
46
|
if user
|
47
47
|
@request.security[:users] << user
|
48
|
-
if
|
48
|
+
if params[:authentication]
|
49
49
|
user = nil unless user.authenticated?(params[:authentication])
|
50
50
|
elsif (params[:check])
|
51
51
|
begin
|
52
52
|
c = params[:check].call(user)
|
53
53
|
user = nil unless c == true
|
54
54
|
raise Unauthorized.new(c, requested_class) if c.is_a?(String)
|
55
|
+
break
|
55
56
|
rescue => exc
|
56
57
|
user = nil
|
57
58
|
unauthorized_exception = exc
|
@@ -62,7 +63,9 @@ module Spider; module Auth
|
|
62
63
|
end
|
63
64
|
end
|
64
65
|
unless user
|
65
|
-
|
66
|
+
msg = Spider::GetText.in_domain('spider_auth'){ _("Please login first") }
|
67
|
+
kl = unauthorized_exception ? unauthorized_exception : Unauthorized
|
68
|
+
raise kl.new(msg, requested_class)
|
66
69
|
end
|
67
70
|
@request.user = user
|
68
71
|
end
|
data/apps/servant/servant.rb
CHANGED
data/lib/spiderfw/app.rb
CHANGED
@@ -37,7 +37,7 @@ module Spider
|
|
37
37
|
@version = Gem::Version.new(@version.to_s) if @version && !@version.is_a?(Gem::Version)
|
38
38
|
spec_path = File.join(@path, "#{@short_name}.appspec")
|
39
39
|
load_spec(spec_path) if File.exists?(spec_path)
|
40
|
-
@route_url ||= Inflector.underscore(self.
|
40
|
+
@route_url ||= Inflector.underscore(self.name)
|
41
41
|
@label ||= @short_name.split('_').each{ |p| p[0] = p[0].chr.upcase }.join(' ')
|
42
42
|
@gettext_parsers ||= []
|
43
43
|
@gettext_dirs ||= ['lib','bin','controllers','models','views','widgets','public']
|
@@ -117,12 +117,16 @@ module Spider
|
|
117
117
|
return res ? res.path : nil
|
118
118
|
end
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
120
|
+
# Returns the canonical url for this controller
|
121
|
+
def url(action=nil)
|
122
|
+
u = @default_route || ''
|
123
|
+
u += "/#{action}" if action
|
124
|
+
if @default_dispatcher
|
125
|
+
u = @default_dispatcher.url + '/' + u
|
126
|
+
elsif self.app
|
127
|
+
u = self.app.url + '/' + u
|
128
|
+
end
|
129
|
+
u
|
126
130
|
end
|
127
131
|
|
128
132
|
|
@@ -197,12 +197,17 @@ module Spider
|
|
197
197
|
end
|
198
198
|
|
199
199
|
module ClassMethods
|
200
|
+
attr_accessor :default_route, :default_dispatcher
|
200
201
|
|
201
202
|
def add_route(routes, path, dest=nil, options=nil)
|
202
203
|
if ( path.is_a? Hash )
|
203
204
|
path.each {|p,d| add_route(p, d)}
|
204
205
|
else
|
205
206
|
routes << [path, dest, options || {}]
|
207
|
+
if path.is_a?(String) && dest.respond_to?(:default_dispatcher=)
|
208
|
+
dest.default_dispatcher = self
|
209
|
+
dest.default_route = path
|
210
|
+
end
|
206
211
|
end
|
207
212
|
end
|
208
213
|
|
@@ -33,7 +33,7 @@ module Spider; module ControllerMixins
|
|
33
33
|
return url
|
34
34
|
end
|
35
35
|
|
36
|
-
# Returns the http path
|
36
|
+
# Returns the http path used to call the current controller & action.
|
37
37
|
# Reverses any proxy mappings to the Controller#request_path.
|
38
38
|
def request_path
|
39
39
|
HTTPMixin.reverse_proxy_mapping(super)
|
@@ -84,8 +84,8 @@ module Spider; module HTTP
|
|
84
84
|
controller_response.server_output = RackIO.new(rack_response_hash, controller_response, w)
|
85
85
|
else
|
86
86
|
w = StringIO.new
|
87
|
-
controller_response.server_output = w
|
88
87
|
rack_response_hash = {:body => w}
|
88
|
+
controller_response.server_output = RackIO.new(rack_response_hash, controller_response, w)
|
89
89
|
end
|
90
90
|
|
91
91
|
|
@@ -48,6 +48,7 @@ module Spider; module Model
|
|
48
48
|
has_pks = true if v
|
49
49
|
pks[k.name] = model.prepare_value(k, v)
|
50
50
|
end
|
51
|
+
orig_pks = pks.clone
|
51
52
|
normalize_pks(model, pks)
|
52
53
|
unless has_pks
|
53
54
|
raise IdentityMapperException, "Can't get #{model} from IdentityMapper without all primary keys, #{values.inspect} given"
|
@@ -59,7 +60,7 @@ module Spider; module Model
|
|
59
60
|
obj = current
|
60
61
|
else
|
61
62
|
# Spider.logger.debug("GETTING NEW #{model} FROM #{pks.inspect}")
|
62
|
-
obj = model.new(
|
63
|
+
obj = model.new(orig_pks)
|
63
64
|
#@objects[model][pks] = obj
|
64
65
|
end
|
65
66
|
# obj = (@objects[model][pks] ||= model.new(pks))
|
@@ -152,6 +153,7 @@ module Spider; module Model
|
|
152
153
|
model_pks.each do |k|
|
153
154
|
if keys[k] && keys[k].is_a?(BaseModel)
|
154
155
|
keys[k] = keys[k].class.primary_keys.length > 1 ? keys[k].primary_keys : keys[k].primary_keys[0]
|
156
|
+
keys[k] = keys[k].first if model.elements[k].type.primary_keys.length && keys[k].is_a?(Array)
|
155
157
|
end
|
156
158
|
end
|
157
159
|
keys.keys.each do |k|
|
@@ -26,8 +26,8 @@ module Spider; module Model; module Storage; module Db
|
|
26
26
|
def parse_url(url)
|
27
27
|
# db:oracle://<username:password>:connect_role@<database>
|
28
28
|
# where database is
|
29
|
-
# the net8 connect
|
30
|
-
# for Oracle client 10g or later,
|
29
|
+
# the net8 connect descriptor (TNS) or
|
30
|
+
# for Oracle client 10g or later, hostname_or_ip:port_no/oracle_sid
|
31
31
|
if (url =~ /.+:\/\/(?:(.+):(.+)(?::(.+))?@)?(.+)/)
|
32
32
|
@user = $1
|
33
33
|
@pass = $2
|
@@ -1,9 +1,5 @@
|
|
1
1
|
require 'oci8'
|
2
2
|
|
3
|
-
# The default mapping to BigDecimal doesn't seem to work (as of ruby-oci8 2.0.4), reverting to Float until it's fixed
|
4
|
-
OCI8::BindType::Mapping[:number_unknown_prec] = OCI8::BindType::Float
|
5
|
-
OCI8::BindType::Mapping[:number_no_prec_setting] = OCI8::BindType::Float
|
6
|
-
|
7
3
|
module Spider; module Model; module Storage; module Db; module Connectors
|
8
4
|
|
9
5
|
module OCI8
|
@@ -13,7 +13,7 @@ module Spider; module Model
|
|
13
13
|
matches = url.match(/^(.+?):\/\/(.+)/)
|
14
14
|
adapter = matches[1]
|
15
15
|
rest = matches[2]
|
16
|
-
if
|
16
|
+
if adapter =~ /(.+):(.+)/
|
17
17
|
connector = $1
|
18
18
|
adapter = $2
|
19
19
|
url = "#{adapter}://#{rest}"
|
@@ -37,7 +37,7 @@ module Spider; module Model
|
|
37
37
|
RUBY_PLATFORM =~ /java/ ? 'jdbc' : 'oci8'
|
38
38
|
end
|
39
39
|
end
|
40
|
-
if
|
40
|
+
if connector
|
41
41
|
conn_mod_name = case connector
|
42
42
|
when 'odbc'
|
43
43
|
:ODBC
|
@@ -124,10 +124,19 @@ module Spider
|
|
124
124
|
specs ||= []
|
125
125
|
pre_setup(specs, options)
|
126
126
|
specs.each do |spec|
|
127
|
-
|
128
|
-
|
127
|
+
app_path = File.join(home_path, "apps/#{spec.app_id}")
|
128
|
+
if File.directory?(app_path)
|
129
|
+
if File.directory?(File.join(app_path, '.git'))
|
130
|
+
git_update(spec, home_path, options)
|
131
|
+
else
|
132
|
+
pack_update(spec, home_path, options)
|
133
|
+
end
|
129
134
|
else
|
130
|
-
|
135
|
+
if spec.git_repo && options[:use_git]
|
136
|
+
git_install(spec, home_path, options)
|
137
|
+
else
|
138
|
+
pack_install(spec, home_path, options)
|
139
|
+
end
|
131
140
|
end
|
132
141
|
end
|
133
142
|
post_setup(specs, options)
|
data/lib/spiderfw/spider.rb
CHANGED
@@ -583,7 +583,7 @@ module Spider
|
|
583
583
|
elsif (cur_path)
|
584
584
|
if (path[0..1] == './')
|
585
585
|
return Resource.new(first_found(extensions, File.dirname(cur_path)+path[1..-1]), owner_class)
|
586
|
-
elsif (path[0..
|
586
|
+
elsif (path[0..2] == '../')
|
587
587
|
return Resource.new(first_found(extensions, File.dirname(File.dirname(cur_path))+path[2..-1]), owner_class)
|
588
588
|
end
|
589
589
|
end
|
@@ -528,6 +528,7 @@ module Spider
|
|
528
528
|
root.search('tpl:include').each do |incl|
|
529
529
|
resource = Spider.find_resource(:views, incl.get_attribute('src'), @path, [@owner.class, @definer_class])
|
530
530
|
src = resource.path
|
531
|
+
raise "Template #{@path} didn't find included '#{incl.get_attribute('src')}'" unless src
|
531
532
|
@dependencies << src
|
532
533
|
incl_el = self.get_el(src)
|
533
534
|
assets = incl_el.children ? incl_el.children_of_type('tpl:asset') : []
|
data/lib/spiderfw/utils/json.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spiderfw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 39
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 16
|
10
|
+
version: 0.6.16
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ivan Pirlik
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
18
|
+
date: 2011-08-22 00:00:00 +02:00
|
19
19
|
default_executable: spider
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|