spiderfw 0.6.20 → 0.6.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/CHANGELOG +13 -0
  2. data/README.rdoc +8 -2
  3. data/Rakefile +49 -24
  4. data/VERSION +1 -1
  5. data/apps/app_server/controllers/app_server_controller.rb +3 -2
  6. data/apps/app_server/lib/git_app.rb +11 -2
  7. data/apps/config_editor/_init.rb +2 -1
  8. data/apps/config_editor/controllers/config_editor_controller.rb +7 -1
  9. data/apps/drb_server/script/start_server.rb +1 -1
  10. data/apps/servant/bin/spider-servant.rb +1 -1
  11. data/blueprints/home/{spider.gemfile → Gemfile} +18 -3
  12. data/blueprints/install/config.ru +1 -1
  13. data/lib/spiderfw/app.rb +7 -0
  14. data/lib/spiderfw/cmd/cmd.rb +1 -1
  15. data/lib/spiderfw/cmd/commands/app.rb +6 -2
  16. data/lib/spiderfw/cmd/commands/cert.rb +1 -0
  17. data/lib/spiderfw/cmd/commands/console.rb +1 -1
  18. data/lib/spiderfw/cmd/commands/content.rb +2 -2
  19. data/lib/spiderfw/cmd/commands/create.rb +1 -1
  20. data/lib/spiderfw/cmd/commands/model.rb +2 -2
  21. data/lib/spiderfw/cmd/commands/setup.rb +1 -1
  22. data/lib/spiderfw/cmd/commands/test.rb +1 -1
  23. data/lib/spiderfw/config/options/spider.rb +2 -1
  24. data/lib/spiderfw/controller/controller.rb +15 -4
  25. data/lib/spiderfw/controller/mixins/visual.rb +2 -0
  26. data/lib/spiderfw/http/adapters/cgi.rb +3 -3
  27. data/lib/spiderfw/http/adapters/mongrel.rb +2 -2
  28. data/lib/spiderfw/http/adapters/rack.rb +2 -2
  29. data/lib/spiderfw/http/adapters/webrick.rb +2 -2
  30. data/lib/spiderfw/http/server.rb +26 -11
  31. data/lib/spiderfw/i18n/cldr.rb +8 -6
  32. data/lib/spiderfw/i18n/javascript_parser.rb +1 -0
  33. data/lib/spiderfw/init.rb +2 -0
  34. data/lib/spiderfw/model/base_model.rb +13 -3
  35. data/lib/spiderfw/model/condition.rb +4 -0
  36. data/lib/spiderfw/model/mappers/db_mapper.rb +9 -8
  37. data/lib/spiderfw/model/mappers/mapper.rb +18 -10
  38. data/lib/spiderfw/model/migrations/drop_table.rb +20 -0
  39. data/lib/spiderfw/model/migrations/replace.rb +18 -13
  40. data/lib/spiderfw/model/migrations.rb +5 -0
  41. data/lib/spiderfw/model/mixins/tree.rb +1 -1
  42. data/lib/spiderfw/model/model.rb +3 -0
  43. data/lib/spiderfw/model/storage/db/adapters/oracle.rb +1 -1
  44. data/lib/spiderfw/model/storage/db/adapters/sqlite.rb +1 -1
  45. data/lib/spiderfw/model/storage/db/connectors/jdbc_oracle.rb +1 -1
  46. data/lib/spiderfw/model/storage/db/connectors/oci8.rb +1 -1
  47. data/lib/spiderfw/model/storage/db/db_schema.rb +4 -1
  48. data/lib/spiderfw/model/storage/db/dialects/no_total_rows.rb +1 -1
  49. data/lib/spiderfw/setup/app_manager.rb +11 -3
  50. data/lib/spiderfw/setup/app_server_client.rb +13 -7
  51. data/lib/spiderfw/setup/setup_task.rb +43 -0
  52. data/lib/spiderfw/setup/spider_setup_wizard.rb +1 -1
  53. data/lib/spiderfw/spider.rb +16 -3
  54. data/lib/spiderfw/templates/blocks/html.rb +2 -0
  55. data/lib/spiderfw/templates/layout.rb +10 -5
  56. data/lib/spiderfw/templates/resources/less.rb +11 -8
  57. data/lib/spiderfw/templates/template_blocks.rb +1 -1
  58. data/lib/spiderfw/test/capybara.rb +2 -1
  59. data/lib/spiderfw/test.rb +2 -1
  60. data/lib/spiderfw.rb +1 -4
  61. data/spider.gemspec +5 -2
  62. metadata +47 -18
  63. data/blueprints/home/Gemfile.disabled +0 -3
data/CHANGELOG CHANGED
@@ -1,3 +1,16 @@
1
+ = 0.6.21
2
+ == 03 November, 2011
3
+ * require 'spidefw' no longer runs Spider.init(); use require 'spiderfw/init' instead
4
+ * Support for home Gettext translations
5
+ * Fixed stupid memory leak
6
+ * Avoid some useless queries and joins in DbMapper
7
+ * Enabled home Gemfile
8
+ * Ruby 1.9.3 support
9
+ * Updated test for new Capybara
10
+ * Fixed unescaped text in views variables
11
+ * Added BaseModel#own_elements method to list non-integrated elements
12
+ * Changed Controller before and after calling to avoid problems in subclassed controllers
13
+
1
14
  = 0.6.20
2
15
  == 05 October, 2011
3
16
  * Added support for aggregate functions in DB conditions
data/README.rdoc CHANGED
@@ -6,6 +6,7 @@ Its main features are:
6
6
 
7
7
  * A model layer that is easy to use, yet flexible enough to adapt to legacy schemas.
8
8
  Models are defined in Ruby: schemas are autogenerated, but can be specified manually when needed.
9
+ Direct sql is almost never used, but you can embed custom sql behaviour per model for each storage.
9
10
 
10
11
  Deep loading and deep querying are supported, through a simple pure-Ruby query language:
11
12
 
@@ -20,7 +21,8 @@ Its main features are:
20
21
 
21
22
  * A view layer based on HTML, with reusable widgets that are easy to extend in both their controller and their view.
22
23
 
23
- Templates are mostly valid HTML, but implement variable substitution, widget instantiation, conditional and iteration logic.
24
+ Templates are mostly HTML, but implement variable substitution, widget instantiation, conditional and iteration logic.
25
+ They are valid XML, though the namespace is implied.
24
26
 
25
27
  <div id="my-view">
26
28
  <h1>Hello, { @my_name }</h1>
@@ -98,7 +100,11 @@ In addition, Spider provides:
98
100
 
99
101
  * Full internazionalization using gettext and CLDR, even for Javascript files.
100
102
 
101
- You can dive in by running
103
+ To install:
104
+
105
+ $ gem install spiderfw
106
+
107
+ Dive in by running
102
108
 
103
109
  $ spider create home test
104
110
  $ cd test
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ def check_app_path(full, partial)
9
9
  return true if rel.to_s == partial
10
10
  if Spider.paths[:apps]
11
11
  rel = p.relative_path_from(Pathname.new(Spider.paths[:apps]))
12
- return true if rel.to_s == partial
12
+ return true if rel.to_s == partial || (partial == 'home' && !rel.to_s.blank?)
13
13
  end
14
14
  return false
15
15
  end
@@ -20,21 +20,42 @@ task :updatepo, [:app] do |t, args|
20
20
  require 'spiderfw/i18n/shtml_parser'
21
21
  require 'spiderfw/i18n/javascript_parser'
22
22
  require 'gettext/tools'
23
- GetText.update_pofiles("spider", Dir.glob("{lib,bin,views,public}/**/*.{rb,rhtml,shtml,js}"), "Spider #{Spider::VERSION}") if !args[:app] || args[:app] == 'spider'
24
- apps = Spider.find_all_apps
25
- apps.each do |path|
26
- next if args[:app] && !check_app_path(path, args[:app])
27
- require path+'/_init.rb' if File.directory?(path+'/po')
28
- end
29
- Spider.apps.each do |name, mod|
30
- next unless File.directory?(mod.path+'/po')
31
- next if args[:app] && !check_app_path(mod.path, args[:app])
32
- Dir.chdir(mod.path)
33
- mod.gettext_parsers.each do |p|
34
- require p
23
+
24
+ if !args[:app] || args[:app] == 'spider'
25
+ Dir.chdir($SPIDER_PATH)
26
+ GetText.update_pofiles("spider", Dir.glob("{lib,bin,views,public}/**/*.{rb,rhtml,shtml,js}"), "Spider #{Spider::VERSION}")
27
+ else
28
+ if args[:app] == 'home'
29
+ Spider.init
30
+ else
31
+ Spider.init
32
+ apps = Spider.find_all_apps
33
+ apps.each do |path|
34
+ next if args[:app] && !check_app_path(path, args[:app])
35
+ require path+'/_init.rb' if File.directory?(path+'/po')
36
+ end
37
+ end
38
+ Spider.apps.each do |name, mod|
39
+ if args[:app] == 'home'
40
+ next unless File.directory?(File.join(Spider.paths[:apps], mod.relative_path))
41
+ rel_path = File.join(Spider.paths[:root], 'views', mod.relative_path)
42
+ next unless File.directory?(rel_path)
43
+ mod.gettext_parsers.each do |p|
44
+ require p
45
+ end
46
+ files = Dir.glob(File.join(rel_path, '**', '*{.shtml}'))
47
+ GetText.update_pofiles(mod.short_name, files, File.join(Spider.paths[:root], 'po', mod.relative_path))
48
+ else
49
+ next unless File.directory?(mod.path+'/po')
50
+ next if args[:app] && !check_app_path(mod.path, args[:app])
51
+ Dir.chdir(mod.path)
52
+ mod.gettext_parsers.each do |p|
53
+ require p
54
+ end
55
+ GetText.update_pofiles(mod.short_name, Dir.glob("{#{mod.gettext_dirs.join(',')}}/**/*.{#{mod.gettext_extensions.join(',')}}"), "#{mod.name} #{mod.version}")
56
+ print "\n"
57
+ end
35
58
  end
36
- GetText.update_pofiles(mod.short_name, Dir.glob("{#{mod.gettext_dirs.join(',')}}/**/*.{#{mod.gettext_extensions.join(',')}}"), "#{mod.name} #{mod.version}")
37
- print "\n"
38
59
  end
39
60
 
40
61
  end
@@ -42,21 +63,25 @@ end
42
63
  desc "Create mo-files. To create for a single app, call rake makemo[app_relative_path], where app_relative_path is the path relative to the apps folder (or 'spider')."
43
64
  task :makemo, [:app] do |t, args|
44
65
  require 'gettext/tools'
45
- GetText.create_mofiles(:verbose => true) if !args[:app] || args[:app] == 'spider'
46
- require 'spiderfw/spider'
47
- apps = Spider.find_all_apps
48
- apps.each do |path|
49
- next if args[:app] && !check_app_path(path, args[:app])
50
- if File.directory?(path+'/po')
51
- Dir.chdir(path)
52
- GetText.create_mofiles(:verbose => true, :po_root => './po', :mo_root => "#{path}/data/locale")
66
+ if !args[:app] || args[:app] == 'spider' || args[:app] == 'home'
67
+ GetText.create_mofiles(:verbose => true)
68
+ else
69
+ require 'spiderfw/spider'
70
+ Spider.setup_paths(Dir.pwd)
71
+ apps = Spider.find_all_apps
72
+ apps.each do |path|
73
+ next if args[:app] && !check_app_path(path, args[:app])
74
+ if File.directory?(path+'/po')
75
+ Dir.chdir(path)
76
+ GetText.create_mofiles(:verbose => true, :po_root => './po', :mo_root => "#{path}/data/locale")
77
+ end
53
78
  end
54
79
  end
55
80
  end
56
81
 
57
82
  task :test do
58
83
  Dir.chdir("test")
59
- require 'spiderfw'
84
+ require 'spiderfw/init'
60
85
  require 'test/unit/collector/dir'
61
86
  require 'test/unit'
62
87
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.20
1
+ 0.6.21
@@ -12,7 +12,6 @@ module Spider; module AppServer
12
12
  @scene.apps = AppServer.apps
13
13
  end
14
14
 
15
- __.text
16
15
  def list_json(names=nil)
17
16
  if names
18
17
  apps = names.split('+')
@@ -24,12 +23,13 @@ module Spider; module AppServer
24
23
 
25
24
  __.action
26
25
  def pack(name=nil)
26
+ branch = @request.params['branch'] || 'master'
27
27
  app = AppServer.apps_by_id[name]
28
28
  raise NotFound.new("App #{name}") unless app
29
29
  tmp = Tempfile.new("spider-app-archive")
30
30
  if app.is_a?(GitApp)
31
31
  repo = app.repo
32
- repo.archive_to_file('master', nil, tmp.path, nil, 'cat')
32
+ repo.archive_to_file(branch, nil, tmp.path, nil, 'cat')
33
33
  else
34
34
  # TODO
35
35
  end
@@ -39,6 +39,7 @@ module Spider; module AppServer
39
39
 
40
40
  __.json
41
41
  def deps(names)
42
+ AppServer.apps
42
43
  names = names.split('+')
43
44
  new_apps = names
44
45
  specs = {}
@@ -4,15 +4,24 @@ module Spider; module AppServer
4
4
 
5
5
  class GitApp < App
6
6
  attr_reader :repo
7
+ attr_reader :branches
7
8
 
8
9
  def initialize(path)
9
10
  super
10
11
  repo = Grit::Repo.new(path)
11
12
  spec = nil
12
- repo.tree.blobs.each do |blob|
13
+ repo_branches = repo.heads.map{ |h| h.name }
14
+ @branches = repo_branches
15
+ read_spec
16
+ @repo = repo
17
+ end
18
+
19
+ def read_spec(branch='master')
20
+ @repo.tree(branch).blobs.each do |blob|
13
21
  next unless blob.basename =~ /\.appspec$/
14
22
  spec = blob.data
15
23
  @spec = Spider::App::AppSpec.eval(spec)
24
+ @spec.branch = branch
16
25
  if repo_base = Spider.conf.get('app_server.git_repo_base')
17
26
  unless @spec.git_repo
18
27
  @spec.git_repo(repo_base+'/'+@spec.id)
@@ -26,7 +35,7 @@ module Spider; module AppServer
26
35
  @last_modified = repo.commits.first.authored_date # FIXME
27
36
  break
28
37
  end
29
- @repo = repo
38
+ @spec
30
39
  end
31
40
 
32
41
  def package
@@ -11,4 +11,5 @@ Spider::Template.register_namespace('config_editor', Spider::ConfigEditor)
11
11
 
12
12
 
13
13
  require 'apps/config_editor/controllers/config_editor_controller'
14
- require 'apps/config_editor/widgets/edit/edit'
14
+ require 'apps/config_editor/widgets/edit/edit'
15
+ require 'apps/config_editor/widgets/edit_bool/edit_bool'
@@ -75,7 +75,13 @@ module Spider; module ConfigEditor
75
75
  end
76
76
 
77
77
  def create_edit_widget(key, option)
78
- w = Edit.new(@request, @response, @scene)
78
+ wclass = case option[:params][:type].name
79
+ when 'Spider::Bool', 'Spider::DataTypes::Bool'
80
+ EditBool
81
+ else
82
+ Edit
83
+ end
84
+ w = wclass.new(@request, @response, @scene)
79
85
  w.attributes[:name] = key
80
86
  w.attributes[:option] = option
81
87
  w.widget_init
@@ -1,4 +1,4 @@
1
- require 'spiderfw'
1
+ require 'spiderfw/init'
2
2
  require 'apps/drb_server/lib/model_server'
3
3
 
4
4
  unless ARGV.length == 2
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
- require 'spiderfw'
3
+ require 'spiderfw/init'
4
4
  require 'cmdparse'
5
5
  require $SPIDER_PATH+'/apps/servant/lib/servant.rb'
6
6
  require 'ruby-debug'
@@ -1,11 +1,23 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'fssm', :group => :devel
3
+ # Place your gems here
4
4
 
5
- gem "mysql", :groups => [:db, :mysql]
5
+
6
+ # Spider
7
+
8
+ gem "spiderfw" #, :path => ''
9
+
10
+
11
+ # Database gems
12
+
13
+ # gem "mysql", :group => :mysql
14
+ # gem "ruby-oci8", :group => :oci8
15
+
16
+ # Optional gems
6
17
 
7
18
  gem "json", :platforms => [:mri_18, :mri_19]
8
- gem "mongrel"
19
+ gem "mongrel", :platforms => [:ruby_18, :mingw_18]
20
+ # gem "mongrel", ">= 1.2.0.pre2" # replace previous line with this for Mongrel on 1.9
9
21
  gem "ripl", :platforms => [:ruby, :mingw]
10
22
  gem "ripl-irb", :platforms => [:ruby, :mingw]
11
23
  gem "ripl-multi_line", :platforms => [:ruby, :mingw]
@@ -17,6 +29,7 @@ gem "rspec", :group => :test
17
29
  gem "cucumber", '~> 0.10.0', :group => :test
18
30
  gem "capybara", :group => :test
19
31
  gem "yui-compressor", :group => :production
32
+ gem "fssm", :group => :devel
20
33
 
21
34
  if RUBY_PLATFORM =~ /darwin/
22
35
  gem "rb-fsevent", :group => :devel, :platforms => [:mri]
@@ -25,6 +38,8 @@ if RUBY_PLATFORM =~ /linux/
25
38
  gem "rb-inotify", :group => :devel, :platforms => [:mri]
26
39
  end
27
40
 
41
+ # Include app Gemfiles
42
+
28
43
  Dir.glob("apps/*/Gemfile") do |f|
29
44
  self.instance_eval(Bundler.read_file(f), f, 1)
30
45
  end
@@ -1,4 +1,4 @@
1
- require 'spiderfw'
1
+ require 'spiderfw/init'
2
2
  require 'spiderfw/http/adapters/rack'
3
3
  PhusionPassenger.on_event(:starting_worker_process) do
4
4
  Spider.start_loggers
data/lib/spiderfw/app.rb CHANGED
@@ -247,6 +247,9 @@ module Spider
247
247
  end
248
248
  alias :#{name}= :#{name}
249
249
  END_OF_EVAL
250
+ if options[:default].is_a?(TrueClass) || options[:default].is_a?(FalseClass)
251
+ str += "\nalias :#{name}? :#{name}\n"
252
+ end
250
253
  class_eval(str)
251
254
  end
252
255
 
@@ -276,6 +279,9 @@ END_OF_EVAL
276
279
  array_attribute :gems_optional
277
280
  attribute :version
278
281
  attribute :app_server
282
+ attribute :auto_update, :default => true
283
+
284
+ attr_accessor :branch
279
285
 
280
286
  def id(val=nil)
281
287
  self.app_id(val)
@@ -315,6 +321,7 @@ END_OF_EVAL
315
321
  @@attributes.each do |a|
316
322
  h[a] = send(a)
317
323
  end
324
+ h[:branch] = @branch unless @branch.blank?
318
325
  h
319
326
  end
320
327
 
@@ -70,7 +70,7 @@ module Spider; module CommandLine
70
70
  cmd_name ||= 'help'
71
71
  if !@cmd.main_command.commands[cmd_name]
72
72
  $SPIDER_CMD = true
73
- require 'spiderfw'
73
+ require 'spiderfw/init'
74
74
  if Spider.apps_by_short_name[cmd_name] && Spider.apps_by_short_name[cmd_name].const_defined?(:Cmd)
75
75
  app_cmd = Spider.apps_by_short_name[cmd_name].const_get(:Cmd).new
76
76
  @cmd.add_command(app_cmd)
@@ -117,6 +117,7 @@ class AppCommand < CmdParse::Command
117
117
  }
118
118
  opt.on("--ssh-user [USERNAME]", _("SSH user")){ |s| @ssh_user = s }
119
119
  opt.on("--no-activate", _("Don't activate installed apps")){ |s| @no_activate = true }
120
+ opt.on("--branch", _("Install app from specific branch"), "-b"){ |b| @branch = b }
120
121
  end
121
122
  install.set_execution_block do |args|
122
123
  $SPIDER_INTERACTIVE = true
@@ -130,6 +131,7 @@ class AppCommand < CmdParse::Command
130
131
  :no_gems => @no_gems, :no_optional_gems => @no_optional_gems, :no_activate => @no_activate
131
132
  }
132
133
  options[:url] = @server_url if @server_url
134
+ options[:branch] = @branch if @branch
133
135
  if @git && !Spider::AppManager.git_available?
134
136
  puts _("git gem not available; install git gem for Git support")
135
137
  exit
@@ -151,7 +153,7 @@ class AppCommand < CmdParse::Command
151
153
  unless specs[:update].empty?
152
154
  puts _("The following apps will be updated as a dependency: %s") % specs[:update].map{ |s| s.app_id }.join(', ')
153
155
  end
154
- Spider::AppManager.new.install(specs, options)
156
+ Spider::AppManager.new(:interactive => true).install(specs, options)
155
157
  end
156
158
  self.add_command(install)
157
159
 
@@ -183,6 +185,7 @@ class AppCommand < CmdParse::Command
183
185
  opt.on("--refresh", _("Update apps even if the version has not changed"), "-r"){ |r| @refresh = true }
184
186
  opt.on("--no-clear-cache", _("Don't clear cache"), "-C"){ |c| @no_clear_cache = true }
185
187
  opt.on("--no-restart", _("Don't restart the server after the udpate"), "-R"){ |r| @no_restart = true }
188
+ opt.on("--branch", _("Install app from specific branch"), "-b"){ |b| @branch = b }
186
189
  end
187
190
  update.set_execution_block do |args|
188
191
  $SPIDER_INTERACTIVE = true
@@ -197,6 +200,7 @@ class AppCommand < CmdParse::Command
197
200
  :clear_cache => !@no_clear_cache, :restart => !@no_restart
198
201
  }
199
202
  options[:url] = @server_url if @server_url
203
+ options[:branch] = @branch if @branch
200
204
  apps = args
201
205
  options[:refresh] = apps if @refresh
202
206
  apps.each do |app|
@@ -243,7 +247,7 @@ class AppCommand < CmdParse::Command
243
247
  setup.set_execution_block do |args|
244
248
  $SPIDER_INTERACTIVE = true
245
249
  require 'spiderfw/setup/app_manager'
246
- tasks = Spider::AppManager.new.setup(name)
250
+ tasks = Spider::AppManager.new(:interactive => true).setup(name)
247
251
  unless @no_cleanup
248
252
  tasks.each do |t|
249
253
  begin
@@ -19,6 +19,7 @@ class CertCommand < CmdParse::Command
19
19
  end
20
20
  generate.set_execution_block do |args|
21
21
  require 'spiderfw'
22
+ Spider.init_base
22
23
  require 'openssl'
23
24
  @path ||= Spider.paths[:certs]
24
25
  @org ||= 'default'
@@ -35,7 +35,7 @@ class ConsoleCommand < CmdParse::Command
35
35
  Ripl.config[:irb_verbose] = false
36
36
  Ripl::Runner.load_rc(Ripl.config[:riplrc])
37
37
 
38
- require 'spiderfw'
38
+ require 'spiderfw/init'
39
39
  Object.send(:remove_const, :IRB) if Object.const_defined?(:IRB)
40
40
  Ripl.shell.loop
41
41
  end
@@ -13,7 +13,7 @@ class ContentCommand < CmdParse::Command
13
13
  end
14
14
 
15
15
  publish.set_execution_block do |args|
16
- require 'spiderfw'
16
+ require 'spiderfw/init'
17
17
  Spider::StaticContent.publish
18
18
  end
19
19
 
@@ -22,7 +22,7 @@ class ContentCommand < CmdParse::Command
22
22
  compress = CmdParse::Command.new('compress', false)
23
23
  compress.short_desc = _("Compress Javascript files")
24
24
  compress.set_execution_block do |args|
25
- require 'spiderfw'
25
+ require 'spiderfw/init'
26
26
  Spider::ContentUtils.compress(*args)
27
27
  end
28
28
 
@@ -51,7 +51,7 @@ class CreateCommand < CmdParse::Command
51
51
  Dir.chdir(inst) do
52
52
  $SPIDER_RUN_PATH = Dir.pwd
53
53
  $:.push($SPIDER_RUN_PATH)
54
- require 'spiderfw'
54
+ require 'spiderfw/init'
55
55
  require 'lib/spiderfw/setup/spider_setup_wizard'
56
56
  wizard = Spider::SpiderSetupWizard.new
57
57
  wizard.first_run = true
@@ -28,7 +28,7 @@ class ModelCommand < CmdParse::Command
28
28
  end
29
29
 
30
30
  sync_cmd.set_execution_block do |req_models|
31
- require 'spiderfw'
31
+ require 'spiderfw/init'
32
32
  require 'spiderfw/model/mappers/db_mapper'
33
33
  req_models || []
34
34
  unsafe_fields = {}
@@ -98,7 +98,7 @@ class ModelCommand < CmdParse::Command
98
98
  }
99
99
  end
100
100
  dump_cmd.set_execution_block do |req_models|
101
- require 'spiderfw'
101
+ require 'spiderfw/init'
102
102
  req_models || []
103
103
  req_models.each do |model_or_app|
104
104
  models = []
@@ -42,7 +42,7 @@ class SetupCommand < CmdParse::Command
42
42
  tasks = []
43
43
  apps.each do |name|
44
44
  require 'spiderfw/setup/app_manager'
45
- tasks += Spider::AppManager.new.setup(name)
45
+ tasks += Spider::AppManager.new(:interactive => true).setup(name)
46
46
  end
47
47
  unless @no_cleanup
48
48
  tasks.each do |t|
@@ -34,7 +34,7 @@ class TestCommand < CmdParse::Command
34
34
  require 'test/unit/collector/dir'
35
35
  require 'test/unit'
36
36
  $SPIDER_RUNMODE = 'test'
37
- require 'spiderfw'
37
+ require 'spiderfw/init'
38
38
  test_env = "#{$SPIDER_PATH}/test"
39
39
  # Dir.cwd(test_env)
40
40
  $:.push(test_env)
@@ -181,7 +181,8 @@ module Spider
181
181
  :do => lambda{ |val| ENV['http_proxy'] = val }
182
182
 
183
183
  config_option 'resources.disable_custom', _("Disable resource overriding in home"), :type => Spider::Bool, :default => false
184
-
184
+
185
+ config_option 'migrations.window', _("Fetch window to use when migrating models"), :type => Fixnum, :default => 100
185
186
 
186
187
 
187
188
  end
@@ -215,6 +215,10 @@ module Spider
215
215
  return do_dispatch(:execute, action) if d_next.dest != self
216
216
  arguments = d_next.params
217
217
  end
218
+ if d_next && d_next.dest == self
219
+ @executed_method = d_next.action.to_sym
220
+ @executed_method_arguments = []
221
+ end
218
222
  if (@executed_method)
219
223
  meth = self.method(@executed_method)
220
224
  args = arguments + @executed_method_arguments
@@ -233,19 +237,23 @@ module Spider
233
237
  end
234
238
  end
235
239
 
236
- def before(action='', *arguments)
240
+ def call_before(action='', *arguments)
237
241
  @call_path = action
242
+ before(action, *arguments)
238
243
  catch(:done) do
239
244
  #debug("#{self} before")
240
- do_dispatch(:before, action, *arguments)
245
+ do_dispatch(:call_before, action, *arguments)
241
246
  end
242
247
  end
243
248
 
249
+ def before(action='', *arguments)
250
+ end
244
251
 
245
252
 
246
- def after(action='', *arguments)
253
+ def call_after(action='', *arguments)
254
+ after(action, *arguments)
247
255
  catch(:done) do
248
- do_dispatch(:after, action, *arguments)
256
+ do_dispatch(:call_after, action, *arguments)
249
257
  end
250
258
  # begin
251
259
  # run_chain(:after)
@@ -254,6 +262,9 @@ module Spider
254
262
  # try_rescue(exc)
255
263
  # end
256
264
  end
265
+
266
+ def after(action='', *arguments)
267
+ end
257
268
 
258
269
  def done?
259
270
  @__done
@@ -558,6 +558,8 @@ module Spider; module ControllerMixins
558
558
  layout = Spider::Layout.new(resource.path)
559
559
  layout.definer_class = resource.definer
560
560
  layout.asset_set = params[:assets] if params[:assets]
561
+ layout.no_asset_profiles(*params[:no_asset_profiles]) if params[:no_asset_profiles]
562
+ layout.only_asset_profiles(params[:only_asset_profiles]) if params[:only_asset_profiles]
561
563
  layout
562
564
  end
563
565
 
@@ -1,5 +1,5 @@
1
1
  $:.push(ENV['SPIDER_PATH']+'/lib')
2
- require 'spiderfw'
2
+ require 'spiderfw/init'
3
3
  require 'spiderfw/controller/controller_io'
4
4
  require 'spiderfw/controller/http_controller'
5
5
  require 'spiderfw/http/adapters/cgi_io'
@@ -51,9 +51,9 @@ controller_response = Spider::Response.new
51
51
  controller_response.server_output = CGIIO.new(STDOUT, controller_response)
52
52
  begin
53
53
  controller = ::Spider::HTTPController.new(controller_request, controller_response)
54
- controller.before(path)
54
+ controller.call_before(path)
55
55
  controller.execute(path)
56
- controller.after(path)
56
+ controller.call_after(path)
57
57
  rescue => exc
58
58
  Spider.logger.error(exc)
59
59
  controller.ensure()
@@ -129,7 +129,7 @@ module Spider; module HTTP
129
129
  main_block = lambda do
130
130
  controller = ::Spider::HTTPController.new(controller_request, controller_response)
131
131
  controller.extend(Spider::FirstResponder)
132
- controller.before(path)
132
+ controller.call_before(path)
133
133
  MongrelIO.send_headers(controller_response, response) unless Spider.conf.get('http.auto_headers')
134
134
  controller.execute(path)
135
135
  Spider::Logger.debug("Response:")
@@ -157,7 +157,7 @@ module Spider; module HTTP
157
157
  Spider.request_finished
158
158
  end
159
159
  if controller
160
- controller.after(path)
160
+ controller.call_after(path)
161
161
  controller.ensure
162
162
  end
163
163
 
@@ -101,13 +101,13 @@ module Spider; module HTTP
101
101
  begin
102
102
  controller = ::Spider::HTTPController.new(controller_request, controller_response)
103
103
  controller.extend(Spider::FirstResponder)
104
- controller.before(path)
104
+ controller.call_before(path)
105
105
  controller.execute(path)
106
106
  if Spider.conf.get('webserver.force_threads')
107
107
  w.close
108
108
  controller_response.server_output.send_headers unless controller_response.server_output.headers_sent?
109
109
  end
110
- controller.after(path)
110
+ controller.call_after(path)
111
111
  controller_done = true
112
112
  Spider::Logger.debug("Controller done")
113
113
  rescue => exc
@@ -132,9 +132,9 @@ module Spider; module HTTP
132
132
  begin
133
133
  controller = ::Spider::HTTPController.new(controller_request, controller_response)
134
134
  controller.extend(Spider::FirstResponder)
135
- controller.before(path)
135
+ controller.call_before(path)
136
136
  controller.execute(path)
137
- controller.after(path)
137
+ controller.call_after(path)
138
138
  Spider::Logger.debug("Controller done")
139
139
  rescue => exc
140
140
  Spider.logger.debug("Error:")