spiderfw 0.6.23 → 0.6.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/CHANGELOG +10 -1
  2. data/README.rdoc +1 -1
  3. data/VERSION +1 -1
  4. data/apps/config_editor/_init.rb +1 -2
  5. data/apps/config_editor/controllers/config_editor_controller.rb +1 -7
  6. data/apps/core/admin/controllers/admin_controller.rb +1 -1
  7. data/apps/core/admin/public/css/sass/admin.css +35 -31
  8. data/apps/core/admin/public/sass/admin.scss +6 -1
  9. data/apps/core/components/widgets/crud/crud.shtml +2 -2
  10. data/apps/core/components/widgets/table/table.rb +5 -5
  11. data/apps/core/forms/tags/element_row.erb +15 -10
  12. data/apps/core/forms/widgets/form/form.rb +35 -22
  13. data/apps/core/forms/widgets/inputs/checkbox/checkbox.shtml +2 -2
  14. data/apps/core/forms/widgets/inputs/date_time/date_time.shtml +2 -2
  15. data/apps/core/forms/widgets/inputs/file_input/file_input.shtml +2 -2
  16. data/apps/core/forms/widgets/inputs/html_area/html_area.shtml +2 -2
  17. data/apps/core/forms/widgets/inputs/input/input.shtml +2 -2
  18. data/apps/core/forms/widgets/inputs/password/password.shtml +2 -2
  19. data/apps/core/forms/widgets/inputs/search_select/search_select.shtml +1 -1
  20. data/apps/core/forms/widgets/inputs/select/select.shtml +2 -2
  21. data/apps/core/forms/widgets/inputs/text/text.shtml +2 -2
  22. data/apps/core/forms/widgets/inputs/text_area/text_area.shtml +2 -2
  23. data/apps/core/forms/widgets/inputs/time_span/time_span.shtml +1 -1
  24. data/blueprints/home/config.ru +8 -0
  25. data/lib/spiderfw/app.rb +416 -224
  26. data/lib/spiderfw/cmd/commands/app.rb +243 -239
  27. data/lib/spiderfw/cmd/commands/cert.rb +421 -417
  28. data/lib/spiderfw/cmd/commands/config.rb +85 -82
  29. data/lib/spiderfw/cmd/commands/console.rb +64 -40
  30. data/lib/spiderfw/cmd/commands/content.rb +29 -25
  31. data/lib/spiderfw/cmd/commands/create.rb +58 -54
  32. data/lib/spiderfw/cmd/commands/model.rb +118 -114
  33. data/lib/spiderfw/cmd/commands/setup.rb +55 -51
  34. data/lib/spiderfw/cmd/commands/test.rb +63 -59
  35. data/lib/spiderfw/cmd/commands/webserver.rb +56 -51
  36. data/lib/spiderfw/config/options/spider.rb +4 -3
  37. data/lib/spiderfw/controller/controller.rb +2 -0
  38. data/lib/spiderfw/controller/http_controller.rb +1 -2
  39. data/lib/spiderfw/controller/mixins/static_content.rb +3 -3
  40. data/lib/spiderfw/controller/mixins/visual.rb +30 -15
  41. data/lib/spiderfw/controller/response.rb +84 -0
  42. data/lib/spiderfw/controller/session/file_session.rb +2 -2
  43. data/lib/spiderfw/http/adapters/rack.rb +12 -13
  44. data/lib/spiderfw/http/server.rb +80 -46
  45. data/lib/spiderfw/i18n/cldr.rb +6 -9
  46. data/lib/spiderfw/model/base_model.rb +103 -23
  47. data/lib/spiderfw/model/condition.rb +110 -25
  48. data/lib/spiderfw/model/mappers/db_mapper.rb +14 -6
  49. data/lib/spiderfw/model/mappers/mapper.rb +440 -197
  50. data/lib/spiderfw/model/model.rb +105 -21
  51. data/lib/spiderfw/model/model_hash.rb +9 -1
  52. data/lib/spiderfw/model/query.rb +50 -9
  53. data/lib/spiderfw/model/query_set.rb +211 -44
  54. data/lib/spiderfw/model/request.rb +28 -21
  55. data/lib/spiderfw/model/storage/base_storage.rb +125 -10
  56. data/lib/spiderfw/model/storage/db/db_storage.rb +7 -4
  57. data/lib/spiderfw/model/storage.rb +8 -1
  58. data/lib/spiderfw/setup/spider_setup_wizard.rb +9 -7
  59. data/lib/spiderfw/spider.rb +270 -43
  60. data/lib/spiderfw/templates/layout.rb +9 -4
  61. data/lib/spiderfw/templates/resources/sass.rb +3 -2
  62. data/lib/spiderfw/templates/template.rb +1 -0
  63. data/lib/spiderfw/utils/annotations.rb +3 -1
  64. data/lib/spiderfw/utils/logger.rb +1 -1
  65. data/lib/spiderfw/utils/monkey/symbol.rb +4 -2
  66. data/lib/spiderfw/utils/shared_store/file_shared_store.rb +2 -2
  67. data/lib/spiderfw/utils/thread_out.rb +3 -1
  68. data/public/css/error_page.css +83 -0
  69. data/public/js/error_page.js +5 -0
  70. data/spider.gemspec +4 -1
  71. data/templates/email/error.erb +9 -0
  72. metadata +28 -12
  73. data/apps/config_editor/widgets/edit_bool/edit_bool.rb +0 -8
  74. data/apps/config_editor/widgets/edit_bool/edit_bool.shtml +0 -5
@@ -1,263 +1,267 @@
1
- class AppCommand < CmdParse::Command
1
+ module Spider::CommandLine
2
2
 
3
+ class AppCommand < CmdParse::Command
3
4
 
4
- def initialize
5
- super('app', true, true )
6
- @short_desc = _("Manage apps")
7
-
8
-
9
- self.options = CmdParse::OptionParserWrapper.new do |opt|
10
- opt.on("--proxy [SERVER]", _("Proxy server to use (http://user:pass@host:port)"), "-p"){ |p|
11
- ENV['http_proxy'] = p
12
- }
13
- opt.on("--server [SERVER]", _("App server"), "-s") { |s|
14
- @server_url = s
15
- }
16
- end
17
-
18
- @installed = true
19
-
20
- list = CmdParse::Command.new( 'list', false )
21
- list.short_desc = _("List installed and available apps")
22
- list.options = CmdParse::OptionParserWrapper.new do |opt|
23
- opt.on("--installed", _("List installed apps (the default)")) { |installed|
24
- @remote = false
25
- }
26
- opt.on("--remote", _("List only remote apps"), "-r"){ |r|
27
- @installed = false
28
- @remote = true
29
- }
30
- opt.on("--all", _("List both local and remote apps"), "-a"){ |a|
31
- @installed = true
32
- @remote = true
33
- @all = true
34
- }
35
- opt.on("--core", _("Include apps that come with spider"), "-c"){ |c|
36
- @core = true
37
- }
38
- end
39
- list.set_execution_block do |args|
40
- if @installed
41
- require 'spiderfw/home'
42
- home = Spider::Home.new(Dir.pwd)
43
- installed = {}
44
- Spider.init_base
45
- active = Spider.config.get('apps')
46
- Spider.home.apps.each do |app, info|
47
- installed[app] = {
48
- :active => active.include?(app)
49
- }
50
- if spec = info[:spec]
51
- installed[app].merge!({
52
- :version => spec.version
53
- })
54
- end
55
- end
5
+
6
+ def initialize
7
+ super('app', true, true )
8
+ @short_desc = _("Manage apps")
9
+
10
+
11
+ self.options = CmdParse::OptionParserWrapper.new do |opt|
12
+ opt.on("--proxy [SERVER]", _("Proxy server to use (http://user:pass@host:port)"), "-p"){ |p|
13
+ ENV['http_proxy'] = p
14
+ }
15
+ opt.on("--server [SERVER]", _("App server"), "-s") { |s|
16
+ @server_url = s
17
+ }
18
+ end
19
+
20
+ @installed = true
21
+
22
+ list = CmdParse::Command.new( 'list', false )
23
+ list.short_desc = _("List installed and available apps")
24
+ list.options = CmdParse::OptionParserWrapper.new do |opt|
25
+ opt.on("--installed", _("List installed apps (the default)")) { |installed|
26
+ @remote = false
27
+ }
28
+ opt.on("--remote", _("List only remote apps"), "-r"){ |r|
29
+ @installed = false
30
+ @remote = true
31
+ }
32
+ opt.on("--all", _("List both local and remote apps"), "-a"){ |a|
33
+ @installed = true
34
+ @remote = true
35
+ @all = true
36
+ }
37
+ opt.on("--core", _("Include apps that come with spider"), "-c"){ |c|
38
+ @core = true
39
+ }
56
40
  end
57
- if @remote
58
- require 'spiderfw/setup/app_server_client'
59
- unless @server_url
60
- require 'spiderfw/spider'
41
+ list.set_execution_block do |args|
42
+ if @installed
43
+ require 'spiderfw/home'
44
+ home = Spider::Home.new(Dir.pwd)
45
+ installed = {}
61
46
  Spider.init_base
62
- @server_url = Spider.config.get('app_server.url')
47
+ active = Spider.config.get('apps')
48
+ Spider.home.apps.each do |app, info|
49
+ installed[app] = {
50
+ :active => active.include?(app)
51
+ }
52
+ if spec = info[:spec]
53
+ installed[app].merge!({
54
+ :version => spec.version
55
+ })
56
+ end
57
+ end
63
58
  end
64
- client = Spider::AppServerClient.new(@server_url)
65
- remote = {}
66
- client.specs.each do |app|
67
- remote[app.app_id] = {
68
- :version => app.version
69
- }
70
- if installed && installed[app] && installed[app][:version]
71
- v = Gem::Version.new(installed[app][:version])
72
- if v < app.version
73
- installed[app][:available] = app.version
59
+ if @remote
60
+ require 'spiderfw/setup/app_server_client'
61
+ unless @server_url
62
+ require 'spiderfw/spider'
63
+ Spider.init_base
64
+ @server_url = Spider.config.get('app_server.url')
65
+ end
66
+ client = Spider::AppServerClient.new(@server_url)
67
+ remote = {}
68
+ client.specs.each do |app|
69
+ remote[app.app_id] = {
70
+ :version => app.version
71
+ }
72
+ if installed && installed[app] && installed[app][:version]
73
+ v = Gem::Version.new(installed[app][:version])
74
+ if v < app.version
75
+ installed[app][:available] = app.version
76
+ end
74
77
  end
75
78
  end
76
79
  end
77
- end
78
- if @installed
79
- puts
80
- puts "*** "+_('INSTALLED APPS')+" ***"
81
- puts
82
- installed.keys.sort.each do |app|
83
- details = installed[app]
84
- str = app
85
- str += " #{details[:version]}" if details[:version]
86
- str += " (#{_('not loaded')})" unless details[:active]
87
- puts str
80
+ if @installed
81
+ puts
82
+ puts "*** "+_('INSTALLED APPS')+" ***"
83
+ puts
84
+ installed.keys.sort.each do |app|
85
+ details = installed[app]
86
+ str = app
87
+ str += " #{details[:version]}" if details[:version]
88
+ str += " (#{_('not loaded')})" unless details[:active]
89
+ puts str
90
+ end
88
91
  end
89
- end
90
- if @remote
91
- puts
92
- puts "*** "+_('REMOTE APPS')+" ***"
93
- puts
94
- remote.keys.sort.each do |app|
95
- details = remote[app]
96
- str = app
97
- str += " #{details[:version]}" if details[:version]
98
- puts str
92
+ if @remote
93
+ puts
94
+ puts "*** "+_('REMOTE APPS')+" ***"
95
+ puts
96
+ remote.keys.sort.each do |app|
97
+ details = remote[app]
98
+ str = app
99
+ str += " #{details[:version]}" if details[:version]
100
+ puts str
101
+ end
99
102
  end
103
+ puts
100
104
  end
101
- puts
102
- end
103
- self.add_command( list )
104
-
105
-
106
- install = CmdParse::Command.new( 'install', false )
107
- install.short_desc = _("Install an app")
108
- install.options = CmdParse::OptionParserWrapper.new do |opt|
109
- opt.on("--git", _("Use git for installing apps"), "-g"){ |r| @git = true }
110
- opt.on("--no-dependencies", _("Don't install other apps this one depends on"), "-d"){ |d|
111
- @no_deps = true
112
- }
113
- opt.on("--no-gems", _("Don't install ruby gems this app depends on"), "-g"){ |g| @no_gems = true }
114
- opt.on("--optional", _("Install optional app dependencies"), "-o"){ |o| @optional = true }
115
- opt.on("--no-optional-gems", _("Don't install optional gem dependencies"), "-G"){ |g|
116
- @no_optional_gems = true
117
- }
118
- opt.on("--ssh-user [USERNAME]", _("SSH user")){ |s| @ssh_user = s }
119
- opt.on("--no-activate", _("Don't activate installed apps")){ |s| @no_activate = true }
120
- opt.on("--branch [BRANCH]", _("Install app from specific branch"), "-b"){ |b| @branch = b }
121
- end
122
- install.set_execution_block do |args|
123
- $SPIDER_INTERACTIVE = true
124
- unless File.exist?('init.rb') && File.directory?('apps')
125
- puts _("Please execute this command from the home folder")
126
- exit
127
- end
128
- require 'spiderfw/setup/app_manager'
129
- options = {
130
- :use_git => @git, :all => @all, :no_deps => @no_deps, :optional => @optional,
131
- :no_gems => @no_gems, :no_optional_gems => @no_optional_gems, :no_activate => @no_activate
132
- }
133
- options[:url] = @server_url if @server_url
134
- options[:branch] = @branch if @branch
135
- if @git && !Spider::AppManager.git_available?
136
- puts _("git gem not available; install git gem for Git support")
137
- exit
138
- end
139
- apps = args
140
- installed = []
141
- apps.each do |app|
142
- installed << app if Spider::AppManager.installed?(app)
143
- end
144
- unless installed.empty?
145
- puts _("%s already installed") % installed.join(', ')
105
+ self.add_command( list )
106
+
107
+
108
+ install = CmdParse::Command.new( 'install', false )
109
+ install.short_desc = _("Install an app")
110
+ install.options = CmdParse::OptionParserWrapper.new do |opt|
111
+ opt.on("--[no-]git", _("Use git for installing apps"), "-g"){ |r| @git = r }
112
+ opt.on("--no-dependencies", _("Don't install other apps this one depends on"), "-d"){ |d|
113
+ @no_deps = true
114
+ }
115
+ opt.on("--no-gems", _("Don't install ruby gems this app depends on"), "-g"){ |g| @no_gems = true }
116
+ opt.on("--optional", _("Install optional app dependencies"), "-o"){ |o| @optional = true }
117
+ opt.on("--no-optional-gems", _("Don't install optional gem dependencies"), "-G"){ |g|
118
+ @no_optional_gems = true
119
+ }
120
+ opt.on("--ssh-user [USERNAME]", _("SSH user")){ |s| @ssh_user = s }
121
+ opt.on("--no-activate", _("Don't activate installed apps")){ |s| @no_activate = true }
122
+ opt.on("--branch [BRANCH]", _("Install app from specific branch"), "-b"){ |b| @branch = b }
146
123
  end
147
- specs = Spider::AppManager.resolve(apps, options)
148
- iapps = specs[:install].map{ |spec| spec.app_id }
149
- deps = iapps - apps
150
- unless deps.empty?
151
- puts _("The following apps will be installed as a dependency: %s") % deps.join(', ')
124
+ install.set_execution_block do |args|
125
+ $SPIDER_INTERACTIVE = true
126
+ unless File.exist?('init.rb') && File.directory?('apps')
127
+ puts _("Please execute this command from the home folder")
128
+ exit
129
+ end
130
+ require 'spiderfw/setup/app_manager'
131
+ options = {
132
+ :use_git => @git, :all => @all, :no_deps => @no_deps, :optional => @optional,
133
+ :no_gems => @no_gems, :no_optional_gems => @no_optional_gems, :no_activate => @no_activate
134
+ }
135
+ options[:url] = @server_url if @server_url
136
+ options[:branch] = @branch if @branch
137
+ if @git && !Spider::AppManager.git_available?
138
+ puts _("git gem not available; install git gem for Git support")
139
+ exit
140
+ end
141
+ apps = args
142
+ installed = []
143
+ apps.each do |app|
144
+ installed << app if Spider::AppManager.installed?(app)
145
+ end
146
+ unless installed.empty?
147
+ puts _("%s already installed") % installed.join(', ')
148
+ end
149
+ specs = Spider::AppManager.resolve(apps, options)
150
+ iapps = specs[:install].map{ |spec| spec.app_id }
151
+ deps = iapps - apps
152
+ unless deps.empty?
153
+ puts _("The following apps will be installed as a dependency: %s") % deps.join(', ')
154
+ end
155
+ unless specs[:update].empty?
156
+ puts _("The following apps will be updated as a dependency: %s") % specs[:update].map{ |s| s.app_id }.join(', ')
157
+ end
158
+ Spider::AppManager.new(:interactive => true).install(specs, options)
152
159
  end
153
- unless specs[:update].empty?
154
- puts _("The following apps will be updated as a dependency: %s") % specs[:update].map{ |s| s.app_id }.join(', ')
160
+ self.add_command(install)
161
+
162
+ activate = CmdParse::Command.new('activate', false )
163
+ activate.short_desc = _("Activate an app")
164
+ activate.set_execution_block do |args|
165
+ $SPIDER_INTERACTIVE = true
166
+ apps = args
167
+ require 'spiderfw/spider'
168
+ apps = Spider.get_app_deps(apps)
169
+ Spider.activate_apps(apps)
155
170
  end
156
- Spider::AppManager.new(:interactive => true).install(specs, options)
157
- end
158
- self.add_command(install)
159
-
160
- activate = CmdParse::Command.new('activate', false )
161
- activate.short_desc = _("Activate an app")
162
- activate.set_execution_block do |args|
163
- $SPIDER_INTERACTIVE = true
164
- apps = args
165
- require 'spiderfw/spider'
166
- apps = Spider.get_app_deps(apps)
167
- Spider.activate_apps(apps)
168
- end
169
- self.add_command(activate)
170
-
171
- update = CmdParse::Command.new( 'update', false )
172
- update.short_desc = _("Update an app")
173
- update.options = CmdParse::OptionParserWrapper.new do |opt|
174
- opt.on("--all", _("Update all apps"), "-a"){ |a| @all = true }
175
- opt.on("--no-git", _("Don't use git for updating apps"), "-g"){ |r| @no_git = true }
176
- opt.on("--no-dependencies", _("Don't install/update other apps this one depends on"), "-d"){ |d|
177
- @no_deps = true
178
- }
179
- opt.on("--no-gems", _("Don't install ruby gems this app depends on"), "-g"){ |g| @no_gems = true }
180
- opt.on("--no-optional", _("Don't install optional app dependencies"), "-D"){ |o| @no_optional = true }
181
- opt.on("--no-optional-gems", _("Don't install optional gem dependencies"), "-G"){ |g|
182
- @no_optional_gems = true
183
- }
184
- opt.on("--no-activate", _("Don't activate installed apps, if any")){ |s| @no_activate = true }
185
- opt.on("--refresh", _("Update apps even if the version has not changed"), "-r"){ |r| @refresh = true }
186
- opt.on("--no-clear-cache", _("Don't clear cache"), "-C"){ |c| @no_clear_cache = true }
187
- opt.on("--no-restart", _("Don't restart the server after the udpate"), "-R"){ |r| @no_restart = true }
188
- opt.on("--branch [BRANCH]", _("Install app from specific branch"), "-b"){ |b| @branch = b }
189
- end
190
- update.set_execution_block do |args|
191
- $SPIDER_INTERACTIVE = true
192
- unless File.exist?('init.rb') && File.directory?('apps')
193
- puts _("Please execute this command from the home folder")
194
- exit
171
+ self.add_command(activate)
172
+
173
+ update = CmdParse::Command.new( 'update', false )
174
+ update.short_desc = _("Update an app")
175
+ update.options = CmdParse::OptionParserWrapper.new do |opt|
176
+ opt.on("--all", _("Update all apps"), "-a"){ |a| @all = true }
177
+ opt.on("--no-git", _("Don't use git for updating apps"), "-g"){ |r| @no_git = true }
178
+ opt.on("--no-dependencies", _("Don't install/update other apps this one depends on"), "-d"){ |d|
179
+ @no_deps = true
180
+ }
181
+ opt.on("--no-gems", _("Don't install ruby gems this app depends on"), "-g"){ |g| @no_gems = true }
182
+ opt.on("--no-optional", _("Don't install optional app dependencies"), "-D"){ |o| @no_optional = true }
183
+ opt.on("--no-optional-gems", _("Don't install optional gem dependencies"), "-G"){ |g|
184
+ @no_optional_gems = true
185
+ }
186
+ opt.on("--no-activate", _("Don't activate installed apps, if any")){ |s| @no_activate = true }
187
+ opt.on("--refresh", _("Update apps even if the version has not changed"), "-r"){ |r| @refresh = true }
188
+ opt.on("--no-clear-cache", _("Don't clear cache"), "-C"){ |c| @no_clear_cache = true }
189
+ opt.on("--no-restart", _("Don't restart the server after the udpate"), "-R"){ |r| @no_restart = true }
190
+ opt.on("--branch [BRANCH]", _("Install app from specific branch"), "-b"){ |b| @branch = b }
195
191
  end
196
- require 'spiderfw/setup/app_manager'
197
- options = {
198
- :no_git => @no_git, :all => @all, :no_deps => @no_deps, :no_optional => @no_optional,
199
- :no_gems => @no_gems, :no_optional_gems => @no_optional_gems, :no_activate => @no_activate,
200
- :clear_cache => !@no_clear_cache, :restart => !@no_restart
201
- }
202
- options[:url] = @server_url if @server_url
203
- options[:branch] = @branch if @branch
204
- apps = args
205
- options[:refresh] = apps if @refresh
206
- apps.each do |app|
207
- unless Spider::AppManager.installed?(app)
208
- puts _("App %s is not installed") % app
192
+ update.set_execution_block do |args|
193
+ $SPIDER_INTERACTIVE = true
194
+ unless File.exist?('init.rb') && File.directory?('apps')
195
+ puts _("Please execute this command from the home folder")
209
196
  exit
210
197
  end
198
+ require 'spiderfw/setup/app_manager'
199
+ options = {
200
+ :no_git => @no_git, :all => @all, :no_deps => @no_deps, :no_optional => @no_optional,
201
+ :no_gems => @no_gems, :no_optional_gems => @no_optional_gems, :no_activate => @no_activate,
202
+ :clear_cache => !@no_clear_cache, :restart => !@no_restart
203
+ }
204
+ options[:url] = @server_url if @server_url
205
+ options[:branch] = @branch if @branch
206
+ apps = args
207
+ options[:refresh] = apps if @refresh
208
+ apps.each do |app|
209
+ unless Spider::AppManager.installed?(app)
210
+ puts _("App %s is not installed") % app
211
+ exit
212
+ end
213
+ end
214
+ specs = Spider::AppManager.resolve(apps, options)
215
+ unless specs[:install].empty?
216
+ puts _("The following apps will be installed as a dependency: %s") % specs[:install].map{ |s| s.app_id }.join(', ')
217
+ end
218
+ uapps = specs[:update].map{ |spec| spec.app_id }
219
+ udeps = uapps - apps
220
+ unless udeps.empty?
221
+ puts _("The following apps will be updated as a dependency: %s") % udeps.join(', ')
222
+ end
223
+ noupdate = apps - uapps
224
+ unless noupdate.empty?
225
+ puts _("Already up-to-date: %s") % noupdate.join(', ')
226
+ end
227
+ Spider::AppManager.new(:interactive => true).install(specs, options)
211
228
  end
212
- specs = Spider::AppManager.resolve(apps, options)
213
- unless specs[:install].empty?
214
- puts _("The following apps will be installed as a dependency: %s") % specs[:install].map{ |s| s.app_id }.join(', ')
215
- end
216
- uapps = specs[:update].map{ |spec| spec.app_id }
217
- udeps = uapps - apps
218
- unless udeps.empty?
219
- puts _("The following apps will be updated as a dependency: %s") % udeps.join(', ')
220
- end
221
- noupdate = apps - uapps
222
- unless noupdate.empty?
223
- puts _("Already up-to-date: %s") % noupdate.join(', ')
229
+ self.add_command(update)
230
+
231
+ setup = CmdParse::Command.new( 'setup', false )
232
+ setup.short_desc = _("Setup an app")
233
+ setup.options = CmdParse::OptionParserWrapper.new do |opt|
234
+ opt.on("--from [VERSION]", _("Assume a specific version is installed"), "-f"){ |from|
235
+ @from = Gem::Version.new(from)
236
+ }
237
+ opt.on("--to [VERSION]", _("Setup to a specific version"), "-t"){ |to|
238
+ @to = Gem::Version.new(to)
239
+ }
240
+ opt.on("--version [VERSION]", _("Only run the setup script for the given version"), "-v"){ |v|
241
+ @version = Gem::Version.new(v)
242
+ }
243
+ opt.on("--all", _("Setup all active apps")){ |all|
244
+ @all = true
245
+ }
246
+ opt.on("--no-cleanup", _("Don't cleanup"), "-C"){ |no_cleanup| @no_cleanup = true }
224
247
  end
225
- Spider::AppManager.new(:interactive => true).install(specs, options)
226
- end
227
- self.add_command(update)
228
-
229
- setup = CmdParse::Command.new( 'setup', false )
230
- setup.short_desc = _("Setup an app")
231
- setup.options = CmdParse::OptionParserWrapper.new do |opt|
232
- opt.on("--from [VERSION]", _("Assume a specific version is installed"), "-f"){ |from|
233
- @from = Gem::Version.new(from)
234
- }
235
- opt.on("--to [VERSION]", _("Setup to a specific version"), "-t"){ |to|
236
- @to = Gem::Version.new(to)
237
- }
238
- opt.on("--version [VERSION]", _("Only run the setup script for the given version"), "-v"){ |v|
239
- @version = Gem::Version.new(v)
240
- }
241
- opt.on("--all", _("Setup all active apps")){ |all|
242
- @all = true
243
- }
244
- opt.on("--no-cleanup", _("Don't cleanup"), "-C"){ |no_cleanup| @no_cleanup = true }
245
- end
246
-
247
- setup.set_execution_block do |args|
248
- $SPIDER_INTERACTIVE = true
249
- require 'spiderfw/setup/app_manager'
250
- tasks = Spider::AppManager.new(:interactive => true).setup(name)
251
- unless @no_cleanup
252
- tasks.each do |t|
253
- begin
254
- t.do_cleanup
255
- rescue => exc
256
- Spider.logger.error(exc)
248
+
249
+ setup.set_execution_block do |args|
250
+ $SPIDER_INTERACTIVE = true
251
+ require 'spiderfw/setup/app_manager'
252
+ tasks = Spider::AppManager.new(:interactive => true).setup(name)
253
+ unless @no_cleanup
254
+ tasks.each do |t|
255
+ begin
256
+ t.do_cleanup
257
+ rescue => exc
258
+ Spider.logger.error(exc)
259
+ end
257
260
  end
258
261
  end
259
262
  end
263
+
260
264
  end
261
-
262
265
  end
263
- end
266
+
267
+ end