spiderfw 0.5.17 → 0.5.18

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,10 +1,14 @@
1
+ = 0.5.18
2
+ == 23 December, 2010
3
+ * Ripl for spider console
4
+ * Ruby 1.9.2 support
5
+ * Bugfixes
6
+
1
7
  = 0.5.17
2
8
  == 20 December, 2010
3
9
  * Better assets compression; assets profiles
4
10
  * Bugfixes
5
11
 
6
-
7
-
8
12
  = 0.5.16
9
13
  == 07 December, 2010
10
14
  * Added app update command
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.17
1
+ 0.5.18
@@ -1,4 +1,6 @@
1
1
  require 'soap/mapping/registry'
2
+ require 'soap/mapping/factory'
3
+ require 'soap/rpc/router'
2
4
 
3
5
  module SOAP; module Mapping
4
6
 
data/lib/spiderfw/app.rb CHANGED
@@ -55,7 +55,11 @@ module Spider
55
55
 
56
56
  def http_url(action=nil)
57
57
  if u = Spider.conf.get("#{@dotted_name}.http_url")
58
- return u
58
+ if action
59
+ u += '/' if u[-1].chr != '/'
60
+ u += action
61
+ end
62
+ return u
59
63
  end
60
64
  return nil unless Spider.site
61
65
  u = "http://#{Spider.site.domain}"
@@ -5,20 +5,40 @@ class ConsoleCommand < CmdParse::Command
5
5
  super( 'console', false )
6
6
  @short_desc = _("Open a console")
7
7
  # @description = _("")
8
- @opts = {:irb => 'irb'}
8
+ @opts = {}
9
9
 
10
10
  self.options = CmdParse::OptionParserWrapper.new do |opt|
11
- opt.on("--irb",
12
- _("Irb executable to use"),
11
+ opt.on("--irb [IRB]",
12
+ _("Use irb instead of ripl (use given executable if supplied)"),
13
13
  "-i"){ |irb|
14
- @opts[:irb] = irb
14
+ @opts[:irb] = irb ? irb : 'irb'
15
15
  }
16
16
  end
17
17
 
18
18
  set_execution_block do
19
- ENV['SPIDER_RUNMODE'] = $SPIDER_RUNMODE if ($SPIDER_RUNMODE)
20
- ENV['SPIDER_CONFIG_SETS'] = $SPIDER_CONFIG_SETS.join(',') if ($SPIDER_CONFIG_SETS)
21
- exec("#{@opts[:irb]} -I #{$SPIDER_LIB} -r spiderfw")
19
+ unless @opts[:irb]
20
+ begin
21
+ require 'rubygems'
22
+ require 'ripl'
23
+ rescue LoadError
24
+ @opts[:irb] = 'irb'
25
+ end
26
+ end
27
+ if @opts[:irb]
28
+ ENV['SPIDER_RUNMODE'] = $SPIDER_RUNMODE if ($SPIDER_RUNMODE)
29
+ ENV['SPIDER_CONFIG_SETS'] = $SPIDER_CONFIG_SETS.join(',') if ($SPIDER_CONFIG_SETS)
30
+ exec("#{@opts[:irb]} -I #{$SPIDER_LIB} -r spiderfw")
31
+ else
32
+ require 'ripl/irb'
33
+ require 'ripl/multi_line'
34
+
35
+ Ripl.config[:irb_verbose] = false
36
+ Ripl::Runner.load_rc(Ripl.config[:riplrc])
37
+
38
+ require 'spiderfw'
39
+ Object.send(:remove_const, :IRB) if Object.const_defined?(:IRB)
40
+ Ripl.shell.loop
41
+ end
22
42
  end
23
43
 
24
44
 
@@ -97,7 +97,6 @@ module Spider; module Model
97
97
  each_element do |el|
98
98
  subclass.add_element(el.clone) unless el.attributes[:local_pk]
99
99
  end
100
- subclass.instance_variable_set("@mapper_procs_subclass", @mapper_procs_subclass.clone) if @mapper_procs_subclass
101
100
  subclass.instance_variable_set("@mapper_modules", @mapper_modules.clone) if @mapper_modules
102
101
  subclass.instance_variable_set("@extended_models", @extended_models.clone) if @extended_models
103
102
  em = subclass.const_set(:ElementMethods, Module.new)
@@ -968,6 +967,7 @@ module Spider; module Model
968
967
  end
969
968
 
970
969
  def self.mapper_include_for(params, mod)
970
+ params = [params] unless params.is_a?(Array)
971
971
  @mapper_modules_for ||= []
972
972
  @mapper_modules_for << [params, mod]
973
973
  end
@@ -975,25 +975,21 @@ module Spider; module Model
975
975
  # The given proc will be mixed in the mapper used by this class
976
976
  # Note that the proc will be converted to a Module, so any overridden methods will still have
977
977
  # access to the super method.
978
- def self.with_mapper(*params, &proc)
979
- # @mapper_procs ||= []
980
- # @mapper_procs << proc
981
- mod = Module.new(&proc)
978
+ def self.with_mapper(&proc)
979
+ mod = Module.new
980
+ mod.send(:include, Spider::Model::MapperIncludeModule)
981
+ mod.module_eval(&proc)
982
982
  mapper_include(mod)
983
983
  end
984
-
985
- # FIXME: remove
986
- def self.with_mapper_subclasses(*params, &proc) #:nodoc:
987
- @mapper_procs_subclass ||= []
988
- @mapper_procs_subclass << proc
989
- end
990
-
984
+
991
985
  # Like #with_mapper, but will mixin the block only if the mapper matches params.
992
986
  # Possible params are:
993
987
  # - a String, matching the class' use_storage
994
988
  def self.with_mapper_for(*params, &proc)
995
- @mapper_procs_for ||= []
996
- @mapper_procs_for << [params, proc]
989
+ mod = Module.new
990
+ mod.send(:include, Spider::Model::MapperIncludeModule)
991
+ mod.module_eval(&proc)
992
+ mapper_include_for(params, mod)
997
993
  end
998
994
 
999
995
  # Sets the url or the name of the storage to use
@@ -1050,24 +1046,11 @@ module Spider; module Model
1050
1046
  end
1051
1047
  if (@mapper_modules_for)
1052
1048
  @mapper_modules_for.each do |params, mod|
1053
- if params.is_a?(String)
1054
- mapper.extend(mod) if self.use_storage == params
1055
- end
1056
- end
1057
- end
1058
- if (@mapper_procs)
1059
- @mapper_procs.each{ |proc| mapper.instance_eval(&proc) }
1060
- end
1061
- if (@mapper_procs_for)
1062
- @mapper_procs_for.each do |params, proc|
1063
1049
  if (params.length == 1 && params[0].class == String)
1064
- mapper.instance_eval(&proc) if (self.use_storage == params[0])
1050
+ mapper.extend(mod) if self.use_storage == params[0]
1065
1051
  end
1066
1052
  end
1067
1053
  end
1068
- if (@mapper_procs_subclass)
1069
- @mapper_procs_subclass.each{ |proc| mapper.instance_eval(&proc) }
1070
- end
1071
1054
  return mapper
1072
1055
  end
1073
1056
 
@@ -20,7 +20,7 @@ module Spider; module Model
20
20
  end
21
21
 
22
22
  def target_element
23
- @owner.elements[@integrated_element].type.elements[@integrated_element_element]
23
+ @target_element ||= @owner.elements[@integrated_element].type.elements[@integrated_element_element]
24
24
  end
25
25
 
26
26
  def type
@@ -923,14 +923,16 @@ module Spider; module Model; module Mappers
923
923
 
924
924
  # Extend schema. Given block will be instance_eval'd after schema auto generation.
925
925
  # See also #define_schema.
926
- def with_schema(*params, &proc)
927
- @schema_proc = proc
926
+ def with_schema(&proc)
927
+ @schema_procs ||= []
928
+ @schema_procs << proc
928
929
  end
929
930
 
930
931
  # Define schema. Given block will be instance_eval'd before schema auto generation.
931
932
  # See also #with_schema.
932
- def define_schema(*params, &proc)
933
- @schema_define_proc = proc
933
+ def define_schema(&proc)
934
+ @schema_define_procs ||= []
935
+ @schema_define_procs << proc
934
936
  end
935
937
 
936
938
  # Returns @schema, or creates one.
@@ -942,13 +944,17 @@ module Spider; module Model; module Mappers
942
944
  # Returns the schema, as defined or autogenerated.
943
945
  def get_schema
944
946
  schema = @model.superclass.mapper.get_schema() if (@model.attributes[:inherit_storage])
945
- if (@schema_define_proc)
947
+ if @schema_define_procs
946
948
  schema = DbSchema.new
947
- schema.instance_eval(&@schema_define_proc)
949
+ @schema_define_procs.each do |schema_proc|
950
+ schema.instance_eval(&schema_proc)
951
+ end
948
952
  end
949
953
  schema = generate_schema(schema)
950
- if (@schema_proc)
951
- schema.instance_eval(&@schema_proc)
954
+ if @schema_procs
955
+ @schema_procs.each do |schema_proc|
956
+ schema.instance_eval(&schema_proc)
957
+ end
952
958
  end
953
959
  return schema
954
960
  end
@@ -996,7 +1002,7 @@ module Spider; module Model; module Mappers
996
1002
  column.primary_key = true if element.primary_key?
997
1003
  schema.set_column(element.name, column)
998
1004
  elsif (true) # FIXME: must have condition element.storage == @storage in some of the subcases
999
- if (!element.multiple? && !element.attributes[:junction]) # 1/n <-> 1
1005
+ if (!element.multiple? && !element.attributes[:junction] && !element.attributes[:condition]) # 1/n <-> 1
1000
1006
  current_schema = schema.foreign_keys[element.name] || {}
1001
1007
  foreign_key_constraints = {}
1002
1008
  element.type.primary_keys.each do |key|
@@ -1074,18 +1074,21 @@ module Spider; module Model
1074
1074
 
1075
1075
  module MapperIncludeModule
1076
1076
 
1077
- def self.extended(klass)
1078
- klass.define_schema(&@schema_define_proc) if @schema_define_proc
1079
- klass.with_schema(&@schema_proc) if @schema_proc
1080
- super
1081
- end
1082
-
1083
1077
  def self.included(mod)
1084
1078
  mod.extend(ModuleMethods)
1085
1079
  end
1086
1080
 
1087
1081
  module ModuleMethods
1088
1082
 
1083
+ def extended(obj)
1084
+ obj.define_schema &@schema_define_proc if @schema_define_proc
1085
+ obj.with_schema &@schema_proc if @schema_proc
1086
+ end
1087
+
1088
+ def no_map(*els)
1089
+ @no_map_elements ||= {}
1090
+ els.each{ |el| @no_map_elements[el] = true }
1091
+ end
1089
1092
 
1090
1093
 
1091
1094
  def define_schema(&proc)
@@ -347,6 +347,7 @@ end
347
347
 
348
348
  require 'spiderfw/model/query_funcs'
349
349
  require 'spiderfw/model/base_model'
350
+ require 'spiderfw/model/mappers/mapper'
350
351
  require 'spiderfw/model/mixins/mixins'
351
352
  require 'spiderfw/model/extended_models/managed'
352
353
  require 'spiderfw/model/inline_model'
data/spider.gemspec CHANGED
@@ -39,6 +39,9 @@ Gem::Specification.new do |s|
39
39
  s.add_dependency("locale", ["> 2.0"])
40
40
  s.add_dependency("builder", ["> 2.1"])
41
41
  s.add_dependency("macaddr", [">= 1.0.0"])
42
+ s.add_dependency("ripl", [">= 0.2.8"])
43
+ s.add_dependency("ripl-irb", [">= 0.2.1"])
44
+ s.add_dependency("ripl-multi_line", [">= 0.2.1"])
42
45
  s.add_development_dependency("rake", ["> 0.7.3"])
43
46
  s.add_development_dependency("ruby-debug", ["> 0.9.3"])
44
47
  s.requirements << "Optional dependencies: json, openssl, sqlite3, webrick, mongrel, ruby-oci8 >2.0, mysql, yui-compressor, home_run, cldr"
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: 41
4
+ hash: 47
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 17
10
- version: 0.5.17
9
+ - 18
10
+ version: 0.5.18
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: 2010-12-20 00:00:00 +01:00
18
+ date: 2010-12-23 00:00:00 +01:00
19
19
  default_executable: spider
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -172,9 +172,57 @@ dependencies:
172
172
  type: :runtime
173
173
  version_requirements: *id010
174
174
  - !ruby/object:Gem::Dependency
175
- name: rake
175
+ name: ripl
176
176
  prerelease: false
177
177
  requirement: &id011 !ruby/object:Gem::Requirement
178
+ none: false
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ hash: 7
183
+ segments:
184
+ - 0
185
+ - 2
186
+ - 8
187
+ version: 0.2.8
188
+ type: :runtime
189
+ version_requirements: *id011
190
+ - !ruby/object:Gem::Dependency
191
+ name: ripl-irb
192
+ prerelease: false
193
+ requirement: &id012 !ruby/object:Gem::Requirement
194
+ none: false
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ hash: 21
199
+ segments:
200
+ - 0
201
+ - 2
202
+ - 1
203
+ version: 0.2.1
204
+ type: :runtime
205
+ version_requirements: *id012
206
+ - !ruby/object:Gem::Dependency
207
+ name: ripl-multi_line
208
+ prerelease: false
209
+ requirement: &id013 !ruby/object:Gem::Requirement
210
+ none: false
211
+ requirements:
212
+ - - ">="
213
+ - !ruby/object:Gem::Version
214
+ hash: 21
215
+ segments:
216
+ - 0
217
+ - 2
218
+ - 1
219
+ version: 0.2.1
220
+ type: :runtime
221
+ version_requirements: *id013
222
+ - !ruby/object:Gem::Dependency
223
+ name: rake
224
+ prerelease: false
225
+ requirement: &id014 !ruby/object:Gem::Requirement
178
226
  none: false
179
227
  requirements:
180
228
  - - ">"
@@ -186,11 +234,11 @@ dependencies:
186
234
  - 3
187
235
  version: 0.7.3
188
236
  type: :development
189
- version_requirements: *id011
237
+ version_requirements: *id014
190
238
  - !ruby/object:Gem::Dependency
191
239
  name: ruby-debug
192
240
  prerelease: false
193
- requirement: &id012 !ruby/object:Gem::Requirement
241
+ requirement: &id015 !ruby/object:Gem::Requirement
194
242
  none: false
195
243
  requirements:
196
244
  - - ">"
@@ -202,7 +250,7 @@ dependencies:
202
250
  - 3
203
251
  version: 0.9.3
204
252
  type: :development
205
- version_requirements: *id012
253
+ version_requirements: *id015
206
254
  description: Spider is yet another Ruby framework.
207
255
  email: abmajor7@gmail.com
208
256
  executables: