spiderfw 0.6.23 → 0.6.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +10 -1
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/apps/config_editor/_init.rb +1 -2
- data/apps/config_editor/controllers/config_editor_controller.rb +1 -7
- data/apps/core/admin/controllers/admin_controller.rb +1 -1
- data/apps/core/admin/public/css/sass/admin.css +35 -31
- data/apps/core/admin/public/sass/admin.scss +6 -1
- data/apps/core/components/widgets/crud/crud.shtml +2 -2
- data/apps/core/components/widgets/table/table.rb +5 -5
- data/apps/core/forms/tags/element_row.erb +15 -10
- data/apps/core/forms/widgets/form/form.rb +35 -22
- data/apps/core/forms/widgets/inputs/checkbox/checkbox.shtml +2 -2
- data/apps/core/forms/widgets/inputs/date_time/date_time.shtml +2 -2
- data/apps/core/forms/widgets/inputs/file_input/file_input.shtml +2 -2
- data/apps/core/forms/widgets/inputs/html_area/html_area.shtml +2 -2
- data/apps/core/forms/widgets/inputs/input/input.shtml +2 -2
- data/apps/core/forms/widgets/inputs/password/password.shtml +2 -2
- data/apps/core/forms/widgets/inputs/search_select/search_select.shtml +1 -1
- data/apps/core/forms/widgets/inputs/select/select.shtml +2 -2
- data/apps/core/forms/widgets/inputs/text/text.shtml +2 -2
- data/apps/core/forms/widgets/inputs/text_area/text_area.shtml +2 -2
- data/apps/core/forms/widgets/inputs/time_span/time_span.shtml +1 -1
- data/blueprints/home/config.ru +8 -0
- data/lib/spiderfw/app.rb +416 -224
- data/lib/spiderfw/cmd/commands/app.rb +243 -239
- data/lib/spiderfw/cmd/commands/cert.rb +421 -417
- data/lib/spiderfw/cmd/commands/config.rb +85 -82
- data/lib/spiderfw/cmd/commands/console.rb +64 -40
- data/lib/spiderfw/cmd/commands/content.rb +29 -25
- data/lib/spiderfw/cmd/commands/create.rb +58 -54
- data/lib/spiderfw/cmd/commands/model.rb +118 -114
- data/lib/spiderfw/cmd/commands/setup.rb +55 -51
- data/lib/spiderfw/cmd/commands/test.rb +63 -59
- data/lib/spiderfw/cmd/commands/webserver.rb +56 -51
- data/lib/spiderfw/config/options/spider.rb +4 -3
- data/lib/spiderfw/controller/controller.rb +2 -0
- data/lib/spiderfw/controller/http_controller.rb +1 -2
- data/lib/spiderfw/controller/mixins/static_content.rb +3 -3
- data/lib/spiderfw/controller/mixins/visual.rb +30 -15
- data/lib/spiderfw/controller/response.rb +84 -0
- data/lib/spiderfw/controller/session/file_session.rb +2 -2
- data/lib/spiderfw/http/adapters/rack.rb +12 -13
- data/lib/spiderfw/http/server.rb +80 -46
- data/lib/spiderfw/i18n/cldr.rb +6 -9
- data/lib/spiderfw/model/base_model.rb +103 -23
- data/lib/spiderfw/model/condition.rb +110 -25
- data/lib/spiderfw/model/mappers/db_mapper.rb +14 -6
- data/lib/spiderfw/model/mappers/mapper.rb +440 -197
- data/lib/spiderfw/model/model.rb +105 -21
- data/lib/spiderfw/model/model_hash.rb +9 -1
- data/lib/spiderfw/model/query.rb +50 -9
- data/lib/spiderfw/model/query_set.rb +211 -44
- data/lib/spiderfw/model/request.rb +28 -21
- data/lib/spiderfw/model/storage/base_storage.rb +125 -10
- data/lib/spiderfw/model/storage/db/db_storage.rb +7 -4
- data/lib/spiderfw/model/storage.rb +8 -1
- data/lib/spiderfw/setup/spider_setup_wizard.rb +9 -7
- data/lib/spiderfw/spider.rb +270 -43
- data/lib/spiderfw/templates/layout.rb +9 -4
- data/lib/spiderfw/templates/resources/sass.rb +3 -2
- data/lib/spiderfw/templates/template.rb +1 -0
- data/lib/spiderfw/utils/annotations.rb +3 -1
- data/lib/spiderfw/utils/logger.rb +1 -1
- data/lib/spiderfw/utils/monkey/symbol.rb +4 -2
- data/lib/spiderfw/utils/shared_store/file_shared_store.rb +2 -2
- data/lib/spiderfw/utils/thread_out.rb +3 -1
- data/public/css/error_page.css +83 -0
- data/public/js/error_page.js +5 -0
- data/spider.gemspec +4 -1
- data/templates/email/error.erb +9 -0
- metadata +28 -12
- data/apps/config_editor/widgets/edit_bool/edit_bool.rb +0 -8
- data/apps/config_editor/widgets/edit_bool/edit_bool.shtml +0 -5
@@ -1,89 +1,92 @@
|
|
1
|
-
|
1
|
+
module Spider::CommandLine
|
2
2
|
|
3
|
+
class ConfigCommand < CmdParse::Command
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
choices = choices
|
54
|
-
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
super( 'config', true, true )
|
8
|
+
@short_desc = _("Manage configuration")
|
9
|
+
|
10
|
+
list = CmdParse::Command.new( 'list', false )
|
11
|
+
list.short_desc = _("List configuration options")
|
12
|
+
list.options = CmdParse::OptionParserWrapper.new do |opt|
|
13
|
+
opt.on("--info", _("Show info"), "-i"){ |i|
|
14
|
+
@info = true
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
list.set_execution_block do |args|
|
19
|
+
require 'spiderfw/spider'
|
20
|
+
Spider.init_base
|
21
|
+
search = args.first
|
22
|
+
max_len = 0
|
23
|
+
opts = Spider.config.options_list
|
24
|
+
opts.each{ |o| max_len = o.length if o.length > max_len }
|
25
|
+
opts.sort.each{ |o|
|
26
|
+
next if search && o.index(search) != 0
|
27
|
+
str = o.ljust(max_len + 2)
|
28
|
+
if @info
|
29
|
+
option = Spider.config.option(o)
|
30
|
+
str += " #{option[:description]}" if option
|
31
|
+
end
|
32
|
+
puts str
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
self.add_command(list)
|
37
|
+
|
38
|
+
info = CmdParse::Command.new('info', false)
|
39
|
+
info.short_desc = _("Get information about a configuration option")
|
40
|
+
info.set_execution_block do |args|
|
41
|
+
require 'spiderfw/spider'
|
42
|
+
Spider.init_base
|
43
|
+
option = Spider.config.option(args.first)
|
44
|
+
if option && option[:params]
|
45
|
+
print args[0]
|
46
|
+
print ":\n"+option[:description]+"\n" if option[:description] && !option[:description].empty?
|
47
|
+
puts
|
48
|
+
puts "#{( _('Type') +':').ljust(10)} #{option[:params][:type]}" if option[:params][:type]
|
49
|
+
default_str = nil
|
50
|
+
if default = option[:params][:default]
|
51
|
+
default_str = default.is_a?(Proc) ? _('Dynamic') : default
|
52
|
+
end
|
53
|
+
puts "#{( _('Default') +':').ljust(10)} #{default_str}" if default_str
|
54
|
+
if choices = option[:params][:choices]
|
55
|
+
choices = choices.call if choices.is_a?(Proc)
|
56
|
+
puts "#{( _('Choices') +':').ljust(10)} #{choices.join(', ')}"
|
57
|
+
end
|
58
|
+
else
|
59
|
+
puts _("Configuration option not found")
|
55
60
|
end
|
56
|
-
else
|
57
|
-
puts _("Configuration option not found")
|
58
61
|
end
|
62
|
+
|
63
|
+
self.add_command(info)
|
64
|
+
|
65
|
+
get = CmdParse::Command.new('get', false)
|
66
|
+
get.short_desc = _("Get the current value of a configuration option")
|
67
|
+
get.set_execution_block do |args|
|
68
|
+
require 'spiderfw/spider'
|
69
|
+
Spider.init_base
|
70
|
+
puts Spider.conf.get(args.first)
|
71
|
+
end
|
72
|
+
|
73
|
+
self.add_command(get)
|
74
|
+
|
75
|
+
set = CmdParse::Command.new('set', false)
|
76
|
+
set.short_desc = _("Set the value of a configuration option")
|
77
|
+
set.set_execution_block do |args|
|
78
|
+
require 'spiderfw/spider'
|
79
|
+
require 'lib/spiderfw/config/configuration_editor'
|
80
|
+
Spider.init_base
|
81
|
+
editor = Spider.config.get_editor
|
82
|
+
editor.set(*args)
|
83
|
+
editor.save
|
84
|
+
end
|
85
|
+
|
86
|
+
self.add_command(set)
|
87
|
+
|
59
88
|
end
|
60
89
|
|
61
|
-
self.add_command(info)
|
62
|
-
|
63
|
-
get = CmdParse::Command.new('get', false)
|
64
|
-
get.short_desc = _("Get the current value of a configuration option")
|
65
|
-
get.set_execution_block do |args|
|
66
|
-
require 'spiderfw/spider'
|
67
|
-
Spider.init_base
|
68
|
-
puts Spider.conf.get(args.first)
|
69
|
-
end
|
70
|
-
|
71
|
-
self.add_command(get)
|
72
|
-
|
73
|
-
set = CmdParse::Command.new('set', false)
|
74
|
-
set.short_desc = _("Set the value of a configuration option")
|
75
|
-
set.set_execution_block do |args|
|
76
|
-
require 'spiderfw/spider'
|
77
|
-
require 'lib/spiderfw/config/configuration_editor'
|
78
|
-
Spider.init_base
|
79
|
-
editor = Spider.config.get_editor
|
80
|
-
editor.set(*args)
|
81
|
-
editor.save
|
82
|
-
end
|
83
|
-
|
84
|
-
self.add_command(set)
|
85
|
-
|
86
90
|
end
|
87
|
-
|
88
|
-
end
|
89
|
-
|
91
|
+
|
92
|
+
end
|
@@ -1,47 +1,71 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
set_execution_block do
|
19
|
-
unless @opts[:irb]
|
20
|
-
begin
|
21
|
-
require 'rubygems'
|
22
|
-
require 'ripl'
|
23
|
-
rescue LoadError
|
24
|
-
@opts[:irb] = 'irb'
|
25
|
-
end
|
1
|
+
module Spider::CommandLine
|
2
|
+
|
3
|
+
class ConsoleCommand < CmdParse::Command
|
4
|
+
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
super( 'console', false )
|
8
|
+
@short_desc = _("Open a console")
|
9
|
+
# @description = _("")
|
10
|
+
@opts = {}
|
11
|
+
|
12
|
+
self.options = CmdParse::OptionParserWrapper.new do |opt|
|
13
|
+
opt.on("--irb [IRB]", _("Use irb (you can specify the executable to use)"), "-i"){ |irb|
|
14
|
+
@opts[:irb] = irb ? irb : 'irb'
|
15
|
+
}
|
16
|
+
opt.on('--ripl' ,_("User ripl"), "-r"){ |ripl| @opts[:ripl] = true }
|
17
|
+
opt.on('--pry', _("Use Pry if available (the default)"))
|
26
18
|
end
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
19
|
+
|
20
|
+
set_execution_block do
|
21
|
+
if @opts[:ripl]
|
22
|
+
begin
|
23
|
+
require 'rubygems'
|
24
|
+
require 'ripl'
|
25
|
+
rescue LoadError
|
26
|
+
@opts[:irb] = 'irb'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
unless @opts[:irb]
|
30
|
+
begin
|
31
|
+
require 'rubygems'
|
32
|
+
require 'pry'
|
33
|
+
rescue LoadError
|
34
|
+
@opts[:irb] = 'irb'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
if @opts[:irb]
|
38
|
+
ENV['SPIDER_RUNMODE'] = $SPIDER_RUNMODE if ($SPIDER_RUNMODE)
|
39
|
+
ENV['SPIDER_CONFIG_SETS'] = $SPIDER_CONFIG_SETS.join(',') if ($SPIDER_CONFIG_SETS)
|
40
|
+
exec("#{@opts[:irb]} -I #{$SPIDER_LIB} -r spiderfw")
|
41
|
+
elsif @opts[:ripl]
|
42
|
+
require 'ripl/irb'
|
43
|
+
require 'ripl/multi_line'
|
44
|
+
|
45
|
+
Ripl.config[:irb_verbose] = false
|
46
|
+
Ripl::Runner.load_rc(Ripl.config[:riplrc])
|
47
|
+
|
48
|
+
require 'spiderfw/init'
|
49
|
+
Object.send(:remove_const, :IRB) if Object.const_defined?(:IRB)
|
50
|
+
Ripl.shell.loop
|
51
|
+
else
|
52
|
+
try_require 'pry-nav'
|
53
|
+
try_require 'pry-stack_explorer'
|
54
|
+
require 'spiderfw/init'
|
55
|
+
Pry.start
|
56
|
+
end
|
41
57
|
end
|
58
|
+
|
59
|
+
|
42
60
|
end
|
43
61
|
|
62
|
+
def try_require(lib)
|
63
|
+
begin
|
64
|
+
require lib
|
65
|
+
rescue LoadError => e
|
66
|
+
end
|
67
|
+
end
|
44
68
|
|
45
69
|
end
|
46
70
|
|
47
|
-
end
|
71
|
+
end
|
@@ -1,33 +1,37 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
|
-
|
3
|
+
module Spider::CommandLine
|
4
4
|
|
5
|
+
class ContentCommand < CmdParse::Command
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
super( 'content', true, true )
|
10
|
+
@short_desc = _("Manage static content")
|
11
|
+
|
12
|
+
publish = CmdParse::Command.new( 'publish', false )
|
13
|
+
publish.short_desc = _("Publish apps static content to home public folder")
|
14
|
+
publish.options = CmdParse::OptionParserWrapper.new do |opt|
|
15
|
+
end
|
16
|
+
|
17
|
+
publish.set_execution_block do |args|
|
18
|
+
require 'spiderfw/init'
|
19
|
+
Spider::StaticContent.publish
|
20
|
+
end
|
21
|
+
|
22
|
+
self.add_command(publish)
|
23
|
+
|
24
|
+
compress = CmdParse::Command.new('compress', false)
|
25
|
+
compress.short_desc = _("Compress Javascript files")
|
26
|
+
compress.set_execution_block do |args|
|
27
|
+
require 'spiderfw/init'
|
28
|
+
Spider::ContentUtils.compress(*args)
|
29
|
+
end
|
30
|
+
|
31
|
+
self.add_command(compress)
|
32
|
+
|
27
33
|
end
|
28
34
|
|
29
|
-
self.add_command(compress)
|
30
|
-
|
31
35
|
end
|
32
|
-
|
36
|
+
|
33
37
|
end
|
@@ -1,69 +1,73 @@
|
|
1
1
|
require 'spiderfw/spider'
|
2
2
|
require 'spiderfw/create'
|
3
3
|
|
4
|
-
|
4
|
+
module Spider::CommandLine
|
5
5
|
|
6
|
+
class CreateCommand < CmdParse::Command
|
6
7
|
|
7
|
-
def initialize
|
8
|
-
super( 'create', true, true )
|
9
|
-
@short_desc = _("Create a working dir for development or installation")
|
10
|
-
# @description = _("")
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
Spider.output "Created app #{name} at #{@path}/#{name}" if ($verbose)
|
9
|
+
def initialize
|
10
|
+
super( 'create', true, true )
|
11
|
+
@short_desc = _("Create a working dir for development or installation")
|
12
|
+
# @description = _("")
|
13
|
+
|
14
|
+
app = CmdParse::Command.new( 'app', false )
|
15
|
+
app.short_desc = _("Create a new application")
|
16
|
+
app.options = CmdParse::OptionParserWrapper.new do |opt|
|
17
|
+
opt.on("--path",
|
18
|
+
_("The path where to create the app (defaults to the app folder under the current path)"),
|
19
|
+
"-p"){ |path|
|
20
|
+
@path = path
|
21
|
+
}
|
22
|
+
opt.on("--module", _("The module name; by default, the app name will be camelized"), "-m"){ |module_name|
|
23
|
+
@module_name = module_name
|
24
|
+
}
|
29
25
|
end
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
26
|
+
app.set_execution_block do |names|
|
27
|
+
@path ||= Dir.pwd+'/apps'
|
28
|
+
names.each do |name|
|
29
|
+
Spider::Create.app(name, @path, @module_name)
|
30
|
+
Spider.output "Created app #{name} at #{@path}/#{name}" if ($verbose)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
self.add_command(app, false)
|
34
|
+
|
35
|
+
install = CmdParse::Command.new('home', false)
|
36
|
+
install.short_desc = _("Create an installation")
|
37
|
+
install.options = CmdParse::OptionParserWrapper.new do |opt|
|
38
|
+
opt.on("--path [PATH]",
|
39
|
+
_("The path where to create the installation (defaults to the path)"),
|
40
|
+
"-p"){ |path|
|
41
|
+
@path = path
|
42
|
+
}
|
43
|
+
opt.on("--no-wizard", _("Don't launch wizard"), "-W"){ |w| @no_wizard = true }
|
44
|
+
opt.on("--non-interactive", _("Non interactive"), "-i"){ |i|
|
45
|
+
@no_wizard = true
|
46
|
+
}
|
47
|
+
end
|
48
|
+
install.set_execution_block do |installs|
|
49
|
+
@path ||= Dir.pwd
|
50
|
+
installs.each do |inst|
|
51
|
+
Spider::Create.home(inst, @path)
|
52
|
+
unless @no_wizard
|
53
|
+
Dir.chdir(inst) do
|
54
|
+
$SPIDER_RUN_PATH = Dir.pwd
|
55
|
+
$:.push($SPIDER_RUN_PATH)
|
56
|
+
require 'spiderfw/init'
|
57
|
+
require 'lib/spiderfw/setup/spider_setup_wizard'
|
58
|
+
wizard = Spider::SpiderSetupWizard.new
|
59
|
+
wizard.first_run = true
|
60
|
+
wizard.implementation(Spider::ConsoleWizard)
|
61
|
+
wizard.run
|
62
|
+
end
|
60
63
|
end
|
61
64
|
end
|
62
65
|
end
|
63
|
-
|
64
|
-
self.add_command(install, false)
|
66
|
+
self.add_command(install, false)
|
65
67
|
|
66
68
|
|
69
|
+
end
|
70
|
+
|
67
71
|
end
|
68
72
|
|
69
73
|
end
|