spiderfw 0.5.9 → 0.5.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. data/apps/app_server/_init.rb +8 -0
  2. data/apps/app_server/app_server.rb +60 -0
  3. data/apps/app_server/config/options.rb +2 -0
  4. data/apps/app_server/controllers/app_server_controller.rb +20 -0
  5. data/apps/app_server/lib/app.rb +21 -0
  6. data/apps/app_server/lib/git_app.rb +22 -0
  7. data/apps/app_server/views/app_list.shtml +8 -0
  8. data/apps/app_server/views/app_server.layout.shtml +14 -0
  9. data/apps/cas_server/_init.rb +1 -1
  10. data/apps/config_editor/_init.rb +14 -0
  11. data/apps/config_editor/config_editor.appspec +3 -0
  12. data/apps/config_editor/controllers/config_editor_controller.rb +88 -0
  13. data/apps/config_editor/views/config_editor.layout.shtml +20 -0
  14. data/apps/config_editor/views/index.shtml +23 -0
  15. data/apps/config_editor/widgets/edit/edit.rb +13 -0
  16. data/apps/config_editor/widgets/edit/edit.shtml +4 -0
  17. data/apps/core/auth/models/group.rb +2 -2
  18. data/apps/core/components/public/js/jquery/plugins/jtree/jquery.jtree.1.0.js +187 -0
  19. data/apps/core/components/public/js/jquery/plugins/jtree/jquery.jtree.1.0.min.js +1 -0
  20. data/apps/core/components/public/js/jquery/plugins/jtree/jquery.jtree.spider.1.0.js +193 -0
  21. data/apps/core/components/widgets/table/table.rb +19 -9
  22. data/apps/core/components/widgets/table/table.shtml +2 -2
  23. data/apps/core/forms/widgets/inputs/subform/subform.rb +10 -0
  24. data/apps/core/forms/widgets/inputs/subform/subform.shtml +5 -0
  25. data/apps/hippo/script/converti_strutture.rb +335 -0
  26. data/apps/master/_init.rb +12 -0
  27. data/apps/master/controllers/master_controller.rb +110 -0
  28. data/apps/master/master.appspec +5 -0
  29. data/apps/master/models/customer.rb +13 -0
  30. data/apps/master/models/installation.rb +10 -0
  31. data/apps/master/models/resource.rb +10 -0
  32. data/apps/master/models/servant.rb +25 -0
  33. data/apps/master/views/customer.shtml +20 -0
  34. data/apps/master/views/customers.shtml +10 -0
  35. data/apps/master/views/index.shtml +4 -0
  36. data/apps/master/views/installation.shtml +36 -0
  37. data/apps/master/views/master.layout.shtml +14 -0
  38. data/apps/master/views/servant.shtml +26 -0
  39. data/apps/master/views/servants.shtml +7 -0
  40. data/apps/servant/_init.rb +5 -0
  41. data/apps/servant/bin/spider-servant.rb +47 -0
  42. data/apps/servant/lib/resource.rb +11 -0
  43. data/apps/servant/lib/resources/db/mysql.rb +31 -0
  44. data/apps/servant/lib/resources/db.rb +54 -0
  45. data/apps/servant/lib/servant.rb +82 -0
  46. data/apps/servant/servant.appspec +4 -0
  47. data/apps/servant/var/log/error.log +1 -0
  48. data/apps/worker/worker.rb +1 -1
  49. data/blueprints/install/config.ru +12 -0
  50. data/lib/spiderfw/app.rb +8 -0
  51. data/lib/spiderfw/cmd/cmd.rb +4 -2
  52. data/lib/spiderfw/cmd/commands/content.rb +33 -0
  53. data/lib/spiderfw/cmd/commands/{init.rb → create.rb} +4 -4
  54. data/lib/spiderfw/config/options/spider.rb +4 -0
  55. data/lib/spiderfw/controller/controller.rb +11 -1
  56. data/lib/spiderfw/controller/dispatcher.rb +2 -0
  57. data/lib/spiderfw/controller/home_controller.rb +7 -1
  58. data/lib/spiderfw/controller/mixins/static_content.rb +17 -3
  59. data/lib/spiderfw/controller/mixins/visual.rb +2 -2
  60. data/lib/spiderfw/controller/session.rb +2 -0
  61. data/lib/spiderfw/create.rb +2 -2
  62. data/lib/spiderfw/model/base_model.rb +11 -0
  63. data/lib/spiderfw/model/condition.rb +37 -7
  64. data/lib/spiderfw/model/mappers/db_mapper.rb +67 -71
  65. data/lib/spiderfw/model/mappers/mapper.rb +92 -31
  66. data/lib/spiderfw/model/model.rb +1 -0
  67. data/lib/spiderfw/model/query.rb +1 -3
  68. data/lib/spiderfw/model/query_funcs.rb +51 -0
  69. data/lib/spiderfw/model/storage/db/adapters/oci8.rb +4 -1
  70. data/lib/spiderfw/model/storage/db/db_schema.rb +15 -1
  71. data/lib/spiderfw/model/storage/db/db_storage.rb +8 -2
  72. data/lib/spiderfw/static_content.rb +84 -0
  73. data/lib/spiderfw/utils/monkey/date_time.rb +4 -0
  74. data/lib/spiderfw/utils/monkey/hpricot_compat.rb +0 -0
  75. data/lib/spiderfw/utils/monkey/object.rb +25 -0
  76. data/lib/spiderfw/utils/test_case.rb +24 -0
  77. metadata +54 -24
  78. data/apps/cms/models/content.rb +0 -16
  79. data/apps/cms/models/news_item.rb +0 -7
  80. data/apps/cms/models/translation.rb +0 -14
  81. data/apps/cms/views/admin/admin.shtml +0 -16
  82. data/apps/cms/views/admin/content.shtml +0 -4
  83. data/apps/core/acl/_init.rb +0 -10
  84. data/apps/core/acl/controllers/acl_controller.rb +0 -14
  85. data/apps/core/acl/models/permission.rb +0 -11
  86. data/apps/core/acl/views/acl.layout.shtml +0 -8
  87. data/apps/core/acl/views/index.shtml +0 -3
  88. data/apps/git_model_versioning/models/mixins/git_versioned.rb +0 -91
  89. data/apps/master/controllers/git.rb +0 -32
  90. data/apps/saml/_init.rb +0 -13
  91. data/apps/saml/controllers/saml2idp.rb +0 -18
  92. data/apps/saml/lib/bindings/http_redirect_binding.rb +0 -14
  93. data/apps/saml/lib/messages/authn_request.rb +0 -52
  94. data/apps/saml/lib/saml.rb +0 -10
  95. data/apps/soap/soap.gemspec +0 -10
  96. data/blueprints/model.rb +0 -15
  97. /data/blueprints/{install → home}/config/config.yml +0 -0
  98. /data/blueprints/{install → home}/init.rb +0 -0
@@ -1,7 +0,0 @@
1
- module Spider; module CMS
2
-
3
- class NewsItem < Content
4
- link :more
5
- end
6
-
7
- end; end
@@ -1,14 +0,0 @@
1
- module Spider; module CMS
2
-
3
- module Translation
4
-
5
- module ClassMethods
6
- attr_accessor :original
7
-
8
- element :lang, Language
9
- element :original, Content
10
-
11
- end
12
- end
13
-
14
- end
@@ -1,16 +0,0 @@
1
- <div class="admin">
2
- <sp:tree id="content_menu" qs="@qs" >
3
- <tpl:wrap-content search=".label">
4
- <a href="{ @actions[child] }">{ $1 }</a>
5
- </tpl:wrap-content>
6
- </sp:tree>
7
- <sp:run obj="@content" />
8
- </div>
9
-
10
-
11
- <ol>
12
- <li sp:each="@children |child|">
13
- <span id="label">{ @labels[child] }</span>
14
- <sp:tree id="$child.id" if="child.children" src="@child.children" />
15
- </li>
16
- </ol>
@@ -1,4 +0,0 @@
1
- <div id="content">
2
- <forms:form model="@content" />
3
- <admin:page src="@content">
4
- </div>
@@ -1,10 +0,0 @@
1
- #require 'apps/acl/controllers/acl_controller.rb'
2
-
3
- module Acl
4
- @description = ""
5
- @version = 0.1
6
- @path = File.dirname(__FILE__)
7
- @controller = :AclController
8
- include Spider::App
9
- end
10
-
@@ -1,14 +0,0 @@
1
- module Acl
2
-
3
- class AclController < Spider::PageController
4
-
5
- layout 'acl'
6
-
7
- __.html :template => 'index'
8
- def index
9
- @scene.msg = 'Hello!'
10
- end
11
-
12
- end
13
-
14
- end
@@ -1,11 +0,0 @@
1
- module ACL
2
-
3
- def self.Permission(user, model)
4
- klass = Class.new(Spider::Model::Managed)
5
- const_set("#{ACL}#{user}#{model} booh", klass)
6
- klass.element :user, :add_multiple_reverse => :"permissions_on_#{model}"
7
- klass.element :obj, :add_multiple_reverse => :"permitted_#{user}"
8
- klass.element :permission, String
9
- end
10
-
11
- end
@@ -1,8 +0,0 @@
1
- <html>
2
- <head></head>
3
- <body>
4
- <div id="content">
5
- <sp:yield />
6
- </div>
7
- </body>
8
- </html>
@@ -1,3 +0,0 @@
1
- <div id="message">
2
- { @msg }
3
- </div>
@@ -1,91 +0,0 @@
1
- require 'grit'
2
- require 'grit/git-ruby'
3
-
4
- module Spider; module GitModelVersioning;
5
-
6
- module GitVersioned
7
-
8
- def self.included(model)
9
- model.extend(ClassMethods)
10
- model.mapper_include(MapperMethods)
11
- end
12
-
13
- def git_sha1
14
- git_blob.sha1
15
- end
16
-
17
- def git_blob
18
- Grit::GitRuby::Blob.new(self.to_yaml)
19
- end
20
-
21
- def ClassMethods
22
-
23
- def git_root
24
- Spider.paths[:var]+'/model_git'
25
- end
26
-
27
- def git_repo
28
- @repo ||= Grit::GitRuby::Repository.new(git_root)
29
- end
30
-
31
- def git_tree
32
- commit = git_head
33
- tree = git_repo.get_object_by_sha1(commit.tree)
34
- tree.entry.each do |entry|
35
- return entry.sha1 if entry.name == self.name
36
- end
37
- return nil
38
- end
39
-
40
- def git_head(sha1=nil)
41
- if (sha1)
42
- File.open(git_root+'/refs/heads/master', 'w') do |f|
43
- f << sha1
44
- end
45
- else
46
- sha1 = File.read(git_repo.git_dir+'/refs/heads/master')
47
- end
48
- return git_repo.get_object_by_sha1(sha1) || ""
49
- end
50
- end
51
-
52
- module MapperMethods
53
-
54
- # def before_save(obj, mode)
55
- # repo = @model.git_repo
56
- # tree = @model.git_repo.get_object_by_sha1(@model.git_tree)
57
- # pks_string = obj.primary_keys.join('$')
58
- # if (mode == :insert)
59
- # tree.entry.push(Grit::GitRuby::DirectoryEntry.new('0100000', pks_string, obj.git_sha1))
60
- # else
61
- # cur = nil
62
- # tree.entry.each do |e|
63
- # if (e.name == pks_string)
64
- # cur = e
65
- # break
66
- # end
67
- # end
68
- # raise "Object #{obj} not found in tree" unless cur
69
- # cur.sha1 = obj.git_sha1
70
- # end
71
- # tree_real_raw = tree_contents.collect{ |e| e.raw }.join("")
72
- # tree = GitRuby::Tree.from_raw(RawObject.new(tree_real_raw), repo)
73
- # tree_sha1 = repo.put_raw_object(tree_real_raw, 'tree')
74
- # commit = GitRuby::Commit.new(tree_sha1, [], 'spider', 'spider', "#{mode} #{DateTime.now}", @model.git_head, repo)
75
- # repo.put_raw_object(commit.raw_content, 'commit')
76
- # @model.git_head(commit.sha1)
77
- # end
78
-
79
- def before_save(obj, mode)
80
- git_index.add(obj.git_path, obj.to_yaml)
81
- @model.write_git_index
82
- super
83
- end
84
-
85
- end
86
-
87
-
88
- end
89
-
90
-
91
- end
@@ -1,32 +0,0 @@
1
- require 'apps/webdav/lib/vfs/local'
2
-
3
- module Spider; module Master
4
-
5
- class GitController < Spider::WebDAV::WebDAVController
6
-
7
- def init_vfs
8
- Spider::WebDAV::VFS::Local.new(Spider.paths[:apps])
9
- end
10
-
11
- def before(action='', *params)
12
- action.gsub!(/[^a-zA-Z]+\//, '') # ??? sanitize
13
- app = find_app(action)
14
- if (app.access = :restricted)
15
- redirect 'https://'+@request.env['HTTP_HOST']+request_path if @request.protocol != 'https'
16
- raise Unauthorized.new(action) unless @request.ssl && @request.ssl.key
17
- key = @request.ssl.key
18
- host = Hosts.find1{ key == @request.ssl.key }
19
- raise Unauthorized.new(action) unless host && host.allowed?(app)
20
- end
21
-
22
- m.html, m.private
23
- def find_app(action)
24
- action =
25
- end
26
-
27
- def unauthorized
28
- end
29
-
30
- end
31
-
32
- end; end
data/apps/saml/_init.rb DELETED
@@ -1,13 +0,0 @@
1
- module Spider
2
-
3
- module SAML
4
-
5
- @description = ""
6
- @version = 0.1
7
- @path = File.dirname(__FILE__)
8
- include Spider::App
9
-
10
- end
11
-
12
-
13
- end
@@ -1,18 +0,0 @@
1
- module Spider; module SAML
2
-
3
- class Saml2IDP < Spider::PageController
4
-
5
- def auth
6
- if (@request.params['SAMLRequest'])
7
- process_request
8
- end
9
- end
10
-
11
- def process_request
12
-
13
- end
14
-
15
-
16
- end
17
-
18
- end; end
@@ -1,14 +0,0 @@
1
- module Spider; module SAML
2
-
3
- class HTTPRedirectBinding
4
-
5
-
6
- def self.decode_request(saml_request)
7
- request = Zlib::GzipReader.open(StringIO.new(Base64.decode(saml_request)){ |gz| gz.read }
8
- return AuthnRequest.new(request)
9
- end
10
-
11
- end
12
-
13
-
14
- end
@@ -1,52 +0,0 @@
1
- require 'base64'
2
- require 'stringio'
3
- require 'zlib'
4
-
5
- module Spider; module SAML
6
-
7
- class AuthnRequest
8
-
9
- def initialize(xml_string=nil)
10
- @version = '2.0'
11
- parse_xml(xml_string) if (xml_string)
12
- end
13
-
14
- def parse_xml(xml_string)
15
- xml = Nokogiri::XML(xml_string)
16
- @force_authn = xml.root['ForceAuthn'] == 'true'
17
- @assertion_consumer_service_url = xml.root['AssertionConsumerServiceURL']
18
- @attribute_consuming_service_index = xml.root['AttributeConsumingServiceIndex']
19
- @provider_name = xml.root['ProviderName']
20
- @id = xml.root['ID']
21
- @version = xml.root['Version']
22
- @issue_instant = DateTime.strptime(xml['IssueInstant'], '%Y-%m-%dT%H:%M:%S%Z')
23
- @destination = xml.root['Destination']
24
- @consent = xml.root['Consent']
25
- issuer = xml.xpath('//issuer')
26
- @issuer = issuer[0].content if issuer[0]
27
- end
28
-
29
- def to_xml
30
- xml = ''
31
- xm = Builder::XmlMarkup.new(:target => xml, :indent => 2)
32
- xm.samlp(:AuthnRequest,
33
- 'xmlns:samlp' => SAML::SAMLPNs,
34
- 'xmlns:saml' => SAML::SAMLNs,
35
- 'ID' => @id,
36
- 'Version' => @version,
37
- 'IssueInstant' => @issue_instant.strftime('%Y-%m-%dT%H:%M:%S%Z'),
38
- 'ForceAuthn' => @force_authn,
39
- 'IsPassive' => @is_passive,
40
- 'Destination' => @destination,
41
- 'Consent' => @consent
42
- ) do
43
- xm.saml(:Issuer, @issuer)
44
- end
45
- end
46
-
47
-
48
-
49
- end
50
-
51
-
52
- end; end
@@ -1,10 +0,0 @@
1
- module Spider;
2
-
3
- module Saml
4
-
5
- SAMLPNs = 'urn:oasis:names:tc:SAML:2.0:protocol'
6
- SAMLNs = 'urn:oasis:names:tc:SAML:2.0:assertion'
7
-
8
- end
9
-
10
- end
@@ -1,10 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = "Soap"
3
- s.version = "0.4.1"
4
- s.date = "2009-06-15"
5
- s.authors = ["Ivan Pirlik"]
6
- s.email = %q{ivan.pirlik@gmail.com}
7
- s.summary = %q{Soap controller}
8
- s.description = %q{Soap Controller}
9
- s.files = [ "README", "Changelog", "LICENSE", "demo.rb", "demo.conf", "lib/parseconfig.rb"]
10
- end
data/blueprints/model.rb DELETED
@@ -1,15 +0,0 @@
1
- <%= modules[0..-2].inject(""){ |s, mod| s+= "module #{mod}; "} %>module <%=modules[-1]%>
2
-
3
- class <%= model.name %> < Spider::Model::BaseModel
4
-
5
- layout '<%= app_name %>.layout'
6
-
7
- def index
8
- @scene.msg = 'Hello!'
9
- render('index')
10
- end
11
-
12
- end
13
-
14
-
15
- <%= modules[0..-2].inject("") { |str, mod| str+= 'end; '} %>end
File without changes
File without changes