infopark_reactor 1.10.0.beta → 1.11.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/rails_connector/abstract_model.rb +7 -0
- data/app/models/rails_connector/abstract_obj.rb +31 -0
- data/app/models/rails_connector/attribute.rb +94 -0
- data/app/models/rails_connector/blob_mapping.rb +12 -0
- data/app/models/rails_connector/channel.rb +41 -0
- data/app/models/rails_connector/content.rb +12 -0
- data/app/models/rails_connector/meta/eager_loader.rb +41 -0
- data/app/models/rails_connector/obj_class.rb +143 -0
- data/app/models/rails_connector/object_with_meta_data.rb +18 -0
- data/infopark_reactor.gemspec +4 -4
- data/lib/generators/cm/migration/USAGE +8 -0
- data/lib/generators/cm/migration/migration_generator.rb +16 -0
- data/lib/generators/cm/migration/templates/template.rb +8 -0
- data/lib/infopark_reactor.rb +35 -1
- data/lib/reactor/attributes.rb +2 -4
- data/lib/reactor/cm/attribute.rb +91 -0
- data/lib/reactor/cm/bridge.rb +50 -0
- data/lib/reactor/cm/channel.rb +18 -0
- data/lib/reactor/cm/editorial_group.rb +23 -0
- data/lib/reactor/cm/group.rb +241 -0
- data/lib/reactor/cm/language.rb +57 -0
- data/lib/reactor/cm/link.rb +136 -0
- data/lib/reactor/cm/live_group.rb +23 -0
- data/lib/reactor/cm/log_entry.rb +64 -0
- data/lib/reactor/cm/missing_credentials.rb +8 -0
- data/lib/reactor/cm/multi_xml_request.rb +102 -0
- data/lib/reactor/cm/obj.rb +544 -0
- data/lib/reactor/cm/obj_class.rb +187 -0
- data/lib/reactor/cm/object_base.rb +165 -0
- data/lib/reactor/cm/permissions.rb +44 -0
- data/lib/reactor/cm/user.rb +139 -0
- data/lib/reactor/cm/workflow.rb +41 -0
- data/lib/reactor/cm/xml_attribute.rb +36 -0
- data/lib/reactor/cm/xml_markup.rb +86 -0
- data/lib/reactor/cm/xml_multi_request_error.rb +10 -0
- data/lib/reactor/cm/xml_request.rb +83 -0
- data/lib/reactor/cm/xml_request_error.rb +11 -0
- data/lib/reactor/cm/xml_response.rb +43 -0
- data/lib/reactor/cm/xml_single_request_error.rb +21 -0
- data/lib/reactor/configuration.rb +8 -0
- data/lib/{engine.rb → reactor/engine.rb} +16 -1
- data/lib/reactor/legacy.rb +3 -3
- data/lib/reactor/link/temporary_link.rb +8 -4
- data/lib/reactor/migration.rb +87 -0
- data/lib/reactor/permission.rb +2 -2
- data/lib/reactor/persistence.rb +14 -12
- data/lib/reactor/plans/common_attribute.rb +33 -0
- data/lib/reactor/plans/common_channel.rb +32 -0
- data/lib/reactor/plans/common_group.rb +45 -0
- data/lib/reactor/plans/common_obj_class.rb +70 -0
- data/lib/reactor/plans/create_attribute.rb +33 -0
- data/lib/reactor/plans/create_channel.rb +24 -0
- data/lib/reactor/plans/create_group.rb +35 -0
- data/lib/reactor/plans/create_obj.rb +49 -0
- data/lib/reactor/plans/create_obj_class.rb +29 -0
- data/lib/reactor/plans/delete_attribute.rb +24 -0
- data/lib/reactor/plans/delete_channel.rb +22 -0
- data/lib/reactor/plans/delete_group.rb +29 -0
- data/lib/reactor/plans/delete_obj.rb +23 -0
- data/lib/reactor/plans/delete_obj_class.rb +23 -0
- data/lib/reactor/plans/prepared.rb +16 -0
- data/lib/reactor/plans/rename_group.rb +33 -0
- data/lib/reactor/plans/rename_obj_class.rb +25 -0
- data/lib/reactor/plans/update_attribute.rb +24 -0
- data/lib/reactor/plans/update_group.rb +31 -0
- data/lib/reactor/plans/update_obj.rb +31 -0
- data/lib/reactor/plans/update_obj_class.rb +27 -0
- data/lib/reactor/rails_connector_meta.rb +144 -0
- data/lib/reactor/tools/migrator.rb +136 -0
- data/lib/reactor/tools/response_handler/base.rb +23 -0
- data/lib/reactor/tools/response_handler/string.rb +20 -0
- data/lib/reactor/tools/response_handler/xml_attribute.rb +53 -0
- data/lib/reactor/tools/smart_xml_logger.rb +70 -0
- data/lib/reactor/tools/sower.rb +90 -0
- data/lib/reactor/tools/uploader.rb +134 -0
- data/lib/reactor/tools/versioner.rb +121 -0
- data/lib/reactor/tools/workflow_generator.rb +1 -1
- data/lib/reactor/tools/xml_attributes.rb +71 -0
- data/lib/reactor/version.rb +1 -1
- data/lib/tasks/cm_migrate.rake +8 -0
- data/lib/tasks/cm_seeds.rake +41 -0
- metadata +82 -13
- data/README.md +0 -186
@@ -0,0 +1,71 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'reactor/cm/xml_attribute'
|
3
|
+
require 'reactor/tools/response_handler/xml_attribute'
|
4
|
+
|
5
|
+
module Reactor
|
6
|
+
|
7
|
+
module XmlAttributes
|
8
|
+
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
|
11
|
+
included do
|
12
|
+
class_attribute :_attributes
|
13
|
+
self._attributes = {}
|
14
|
+
|
15
|
+
class_attribute :response_handler
|
16
|
+
self.response_handler = ResponseHandler::XmlAttribute.new
|
17
|
+
end
|
18
|
+
|
19
|
+
module ClassMethods
|
20
|
+
|
21
|
+
# This method can act as both getter and setter.
|
22
|
+
# I admit, that it is not the best design ever.
|
23
|
+
# But it makes a pretty good DSL
|
24
|
+
def primary_key(new_value = nil)
|
25
|
+
if new_value.nil?
|
26
|
+
@primary_key
|
27
|
+
else
|
28
|
+
@primary_key = new_value.to_s
|
29
|
+
@primary_key
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def attribute(name, options = {})
|
34
|
+
xml_name = options.delete(:name).presence || name
|
35
|
+
type = options.delete(:type).presence
|
36
|
+
|
37
|
+
attribute = Reactor::Cm::XmlAttribute.new(xml_name, type, options)
|
38
|
+
|
39
|
+
self._attributes[name.to_sym] = attribute
|
40
|
+
|
41
|
+
attr_accessor name
|
42
|
+
end
|
43
|
+
|
44
|
+
def attributes(scopes = [])
|
45
|
+
scopes = Array(scopes)
|
46
|
+
attributes = self._attributes
|
47
|
+
|
48
|
+
if scopes.present?
|
49
|
+
attributes.reject { |_, xml_attribute| (xml_attribute.scopes & scopes).blank? }
|
50
|
+
else
|
51
|
+
attributes
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def xml_attribute(name)
|
56
|
+
self._attributes[name.to_sym]
|
57
|
+
end
|
58
|
+
|
59
|
+
def xml_attribute_names
|
60
|
+
self._attributes.values.map(&:name)
|
61
|
+
end
|
62
|
+
|
63
|
+
def attribute_names
|
64
|
+
self._attributes.keys
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
data/lib/reactor/version.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
namespace :cm do
|
2
|
+
|
3
|
+
desc "Load the seed data from cm/seeds.rb"
|
4
|
+
task :seed => :environment do
|
5
|
+
require 'reactor/tools/sower'
|
6
|
+
sower = Reactor::Sower.new("#{Rails.root}/cm/seeds.rb")
|
7
|
+
sower.sow
|
8
|
+
end
|
9
|
+
|
10
|
+
namespace :seed do
|
11
|
+
|
12
|
+
desc "Load the seed data from cm/seeds-develop.rb"
|
13
|
+
task :develop => :environment do
|
14
|
+
require 'reactor/tools/sower'
|
15
|
+
sower = Reactor::Sower.new("#{Rails.root}/cm/seeds-develop.rb")
|
16
|
+
sower.sow
|
17
|
+
end
|
18
|
+
|
19
|
+
task :test => :environment do
|
20
|
+
require 'reactor/tools/sower'
|
21
|
+
sower = Reactor::Sower.new("#{Rails.root}/cm/seeds-test.rb")
|
22
|
+
sower.sow
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
namespace :maintenance do
|
27
|
+
|
28
|
+
Dir["#{Rails.root}/cm/maintenance-scripts/*.rb"].each do |maint_script|
|
29
|
+
|
30
|
+
desc "Execute seed in cm/maintenance-scripts/#{File.basename(maint_script)}"
|
31
|
+
task File.basename(maint_script, '.rb').to_sym => :environment do
|
32
|
+
require 'reactor/tools/sower'
|
33
|
+
sower = Reactor::Sower.new(maint_script)
|
34
|
+
sower.sow
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infopark_reactor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Przedmojski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 3.0.10
|
20
20
|
- - <=
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 4.
|
22
|
+
version: 4.2.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,35 +29,35 @@ dependencies:
|
|
29
29
|
version: 3.0.10
|
30
30
|
- - <=
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 4.
|
32
|
+
version: 4.2.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: nokogiri
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - '>='
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: '0'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: '0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: term-ansicolor
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: '0'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - '>='
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: '0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rspec
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,12 +97,22 @@ files:
|
|
97
97
|
- .gitignore
|
98
98
|
- Gemfile
|
99
99
|
- LICENSE
|
100
|
-
- README.md
|
101
100
|
- Rakefile
|
102
101
|
- app/controllers/reactor_controller.rb
|
102
|
+
- app/models/rails_connector/abstract_model.rb
|
103
|
+
- app/models/rails_connector/abstract_obj.rb
|
104
|
+
- app/models/rails_connector/attribute.rb
|
105
|
+
- app/models/rails_connector/blob_mapping.rb
|
106
|
+
- app/models/rails_connector/channel.rb
|
107
|
+
- app/models/rails_connector/content.rb
|
108
|
+
- app/models/rails_connector/meta/eager_loader.rb
|
109
|
+
- app/models/rails_connector/obj_class.rb
|
110
|
+
- app/models/rails_connector/object_with_meta_data.rb
|
103
111
|
- config/routes.rb
|
104
112
|
- infopark_reactor.gemspec
|
105
|
-
- lib/
|
113
|
+
- lib/generators/cm/migration/USAGE
|
114
|
+
- lib/generators/cm/migration/migration_generator.rb
|
115
|
+
- lib/generators/cm/migration/templates/template.rb
|
106
116
|
- lib/infopark_reactor.rb
|
107
117
|
- lib/reactor/already_released.rb
|
108
118
|
- lib/reactor/attributes.rb
|
@@ -112,14 +122,63 @@ files:
|
|
112
122
|
- lib/reactor/attributes/link_list_serializer.rb
|
113
123
|
- lib/reactor/cache/permission.rb
|
114
124
|
- lib/reactor/cache/user.rb
|
125
|
+
- lib/reactor/cm/attribute.rb
|
126
|
+
- lib/reactor/cm/bridge.rb
|
127
|
+
- lib/reactor/cm/channel.rb
|
128
|
+
- lib/reactor/cm/editorial_group.rb
|
129
|
+
- lib/reactor/cm/group.rb
|
130
|
+
- lib/reactor/cm/language.rb
|
131
|
+
- lib/reactor/cm/link.rb
|
132
|
+
- lib/reactor/cm/live_group.rb
|
133
|
+
- lib/reactor/cm/log_entry.rb
|
134
|
+
- lib/reactor/cm/missing_credentials.rb
|
135
|
+
- lib/reactor/cm/multi_xml_request.rb
|
136
|
+
- lib/reactor/cm/obj.rb
|
137
|
+
- lib/reactor/cm/obj_class.rb
|
138
|
+
- lib/reactor/cm/object_base.rb
|
139
|
+
- lib/reactor/cm/permissions.rb
|
140
|
+
- lib/reactor/cm/user.rb
|
141
|
+
- lib/reactor/cm/workflow.rb
|
142
|
+
- lib/reactor/cm/xml_attribute.rb
|
143
|
+
- lib/reactor/cm/xml_markup.rb
|
144
|
+
- lib/reactor/cm/xml_multi_request_error.rb
|
145
|
+
- lib/reactor/cm/xml_request.rb
|
146
|
+
- lib/reactor/cm/xml_request_error.rb
|
147
|
+
- lib/reactor/cm/xml_response.rb
|
148
|
+
- lib/reactor/cm/xml_single_request_error.rb
|
149
|
+
- lib/reactor/configuration.rb
|
150
|
+
- lib/reactor/engine.rb
|
115
151
|
- lib/reactor/legacy.rb
|
116
152
|
- lib/reactor/link/external.rb
|
117
153
|
- lib/reactor/link/internal.rb
|
118
154
|
- lib/reactor/link/temporary_link.rb
|
155
|
+
- lib/reactor/migration.rb
|
119
156
|
- lib/reactor/no_working_version.rb
|
120
157
|
- lib/reactor/not_permitted.rb
|
121
158
|
- lib/reactor/permission.rb
|
122
159
|
- lib/reactor/persistence.rb
|
160
|
+
- lib/reactor/plans/common_attribute.rb
|
161
|
+
- lib/reactor/plans/common_channel.rb
|
162
|
+
- lib/reactor/plans/common_group.rb
|
163
|
+
- lib/reactor/plans/common_obj_class.rb
|
164
|
+
- lib/reactor/plans/create_attribute.rb
|
165
|
+
- lib/reactor/plans/create_channel.rb
|
166
|
+
- lib/reactor/plans/create_group.rb
|
167
|
+
- lib/reactor/plans/create_obj.rb
|
168
|
+
- lib/reactor/plans/create_obj_class.rb
|
169
|
+
- lib/reactor/plans/delete_attribute.rb
|
170
|
+
- lib/reactor/plans/delete_channel.rb
|
171
|
+
- lib/reactor/plans/delete_group.rb
|
172
|
+
- lib/reactor/plans/delete_obj.rb
|
173
|
+
- lib/reactor/plans/delete_obj_class.rb
|
174
|
+
- lib/reactor/plans/prepared.rb
|
175
|
+
- lib/reactor/plans/rename_group.rb
|
176
|
+
- lib/reactor/plans/rename_obj_class.rb
|
177
|
+
- lib/reactor/plans/update_attribute.rb
|
178
|
+
- lib/reactor/plans/update_group.rb
|
179
|
+
- lib/reactor/plans/update_obj.rb
|
180
|
+
- lib/reactor/plans/update_obj_class.rb
|
181
|
+
- lib/reactor/rails_connector_meta.rb
|
123
182
|
- lib/reactor/rc_independent.rb
|
124
183
|
- lib/reactor/session.rb
|
125
184
|
- lib/reactor/session/observers.rb
|
@@ -127,12 +186,23 @@ files:
|
|
127
186
|
- lib/reactor/streaming_upload.rb
|
128
187
|
- lib/reactor/sudo.rb
|
129
188
|
- lib/reactor/support/link_matcher.rb
|
189
|
+
- lib/reactor/tools/migrator.rb
|
190
|
+
- lib/reactor/tools/response_handler/base.rb
|
191
|
+
- lib/reactor/tools/response_handler/string.rb
|
192
|
+
- lib/reactor/tools/response_handler/xml_attribute.rb
|
193
|
+
- lib/reactor/tools/smart_xml_logger.rb
|
194
|
+
- lib/reactor/tools/sower.rb
|
195
|
+
- lib/reactor/tools/uploader.rb
|
196
|
+
- lib/reactor/tools/versioner.rb
|
130
197
|
- lib/reactor/tools/workflow_generator.rb
|
198
|
+
- lib/reactor/tools/xml_attributes.rb
|
131
199
|
- lib/reactor/validations.rb
|
132
200
|
- lib/reactor/version.rb
|
133
201
|
- lib/reactor/workflow.rb
|
134
202
|
- lib/reactor/workflow/empty.rb
|
135
203
|
- lib/reactor/workflow/standard.rb
|
204
|
+
- lib/tasks/cm_migrate.rake
|
205
|
+
- lib/tasks/cm_seeds.rake
|
136
206
|
homepage: ''
|
137
207
|
licenses:
|
138
208
|
- LGPL-3
|
@@ -141,7 +211,6 @@ post_install_message:
|
|
141
211
|
rdoc_options: []
|
142
212
|
require_paths:
|
143
213
|
- lib
|
144
|
-
- lib/tools
|
145
214
|
required_ruby_version: !ruby/object:Gem::Requirement
|
146
215
|
requirements:
|
147
216
|
- - '>='
|
data/README.md
DELETED
@@ -1,186 +0,0 @@
|
|
1
|
-
REACTOR
|
2
|
-
=======
|
3
|
-
|
4
|
-
RailsConnector EnhAnCements for TCL lOveRs. You all love RailsConnector. I know you do. It delivers nice features and great performance. And yet... An yet you always knew that something is missing. You had this feeling when writing TCL code. You had this feeling when fiddling in Fiona GUI. Yes. You know it. You are a Rails coder: `BeatufiulPage.create(:name => 'Better page', :parent => '/best/pages', :title => 'Yes, it is better')`. Write layer is missing in RailsConnector. And it shows.
|
5
|
-
|
6
|
-
So, here you have it: REACTOR, writing layer for `RailsConnector`, tightly integrated with `ActiveRecord`. Maybe some of you don't like long and creative descriptions. Maybe some of you are convinced with running code:
|
7
|
-
|
8
|
-
BeatufiulPage.create(:name => 'Better page', :parent => '/best/pages', :title => 'Yes, it is better') do |page|
|
9
|
-
page.body = '<a href="/can/handle/links/too">link</a>'
|
10
|
-
page.save!
|
11
|
-
page.release!
|
12
|
-
end
|
13
|
-
|
14
|
-
other_page = OtherPage.last
|
15
|
-
other_page.take!
|
16
|
-
|
17
|
-
not_a_page = SomeObject.first
|
18
|
-
not_a_page.some_attribute = 'a value' # types: string, html, enum
|
19
|
-
not_a_page.multienum_attr = ['somevalue'] # multienum
|
20
|
-
not_a_page.some_date_attribute = Time.now # date
|
21
|
-
not_a_page.some_date_attribute = '20111011083526' # date
|
22
|
-
not_a_page.some_date_attribute = '2011-11-11'
|
23
|
-
|
24
|
-
not_a_page.release! if not_a_page.valid?(:release)
|
25
|
-
|
26
|
-
All of the above are examples of what can be done with `Persistence`, `Validations`, `Attributes`. There is more:
|
27
|
-
* all standard ActiveModel callbacks + `*_release` callbacks
|
28
|
-
* Validations in three contexts: create, update, release
|
29
|
-
* If something works with ActiveRecord, there is a high chance it works with REACTOR too!
|
30
|
-
* Rails 3 API
|
31
|
-
|
32
|
-
What about links? Every object on my page is linked with 1000 other objects! I need links! Don't worry, they are there. Not perfectly supported yet, but you can set them:
|
33
|
-
|
34
|
-
some_obj.link_list_attr = 'http://google.com'
|
35
|
-
some_obj.link_list_attr = Obj.last
|
36
|
-
some_obj.link_list_attr = '/path/to/obj'
|
37
|
-
|
38
|
-
And I haven't forgotten that they are lists of links:
|
39
|
-
|
40
|
-
some_obj.link_list_attr = ['http://google.com', Obj.last, '/path/to/obj']
|
41
|
-
|
42
|
-
Yes, that is nice, you say, but what if I also wan't to set a link title? No problem, here is how:
|
43
|
-
|
44
|
-
some_obj.link_list_attr = {:url => 'http://google.com', :title => 'title of my link'}
|
45
|
-
some_obj.link_list_attr = {:destination_object => Obj.last, :title => 'title of my link'}
|
46
|
-
some_obj.link_list_attr = {:destination_object => '/path/to/obj', :title => 'title of my link'}
|
47
|
-
|
48
|
-
This also works for multiple links:
|
49
|
-
|
50
|
-
some_obj.link_list_attr = [ {:url => 'http://google.com', :title => 'title of my link'}, {:destination_object => Obj.last, :title => 'other title'}]
|
51
|
-
|
52
|
-
You can also manipulate linklist with array methods (for example `#delete_at`) and
|
53
|
-
|
54
|
-
some_obj.link_list_attr << '/path/to/obj'
|
55
|
-
some_obj.link_list_attr << {:url => 'http://yahoo.com', :title => 'yahoo link'}
|
56
|
-
|
57
|
-
One more thing: you can upload files too!
|
58
|
-
|
59
|
-
binary_obj.upload(File.open('/my/file'), 'txt')
|
60
|
-
binary_obj.save!
|
61
|
-
|
62
|
-
Or:
|
63
|
-
|
64
|
-
binary_obj.upload(File.read('/my/file'), 'txt')
|
65
|
-
binary_obj.save!
|
66
|
-
|
67
|
-
**WARNING** If your are planning to upload anything larger than 10kB it is strongly advised to use `Reactor::StreamingUpload` module. This module
|
68
|
-
allows to stream files of any size (provided you supply them through `File.open` and not read them yourself into memory). It is also much,
|
69
|
-
much more efficient than the traditional method.
|
70
|
-
|
71
|
-
Permissions are checked also! And your user is automatically set according to `JSESSIONID` cookie.
|
72
|
-
|
73
|
-
Workflow support is provided together with comments (just pass your comment as string to the relevant method):
|
74
|
-
|
75
|
-
obj.edit!('draft version created')
|
76
|
-
obj.forward!('please add your text')
|
77
|
-
# as other user
|
78
|
-
obj.take!
|
79
|
-
obj.release!('text added and released')
|
80
|
-
|
81
|
-
|
82
|
-
KNOWN BUGS/ISSUES
|
83
|
-
=================
|
84
|
-
|
85
|
-
Awesome! What is missing/WHAT I NEED TO BE AWARE OF:
|
86
|
-
|
87
|
-
- When setting a `linklist` all links are overwritten. Don't do it like 10 million times if you don't want to risk reaching billion ids.
|
88
|
-
- Therefore link operations are slow.
|
89
|
-
- Link position cannot be directly manipulated (it is implicit through array order)
|
90
|
-
- Validations are implemented completely in Rails, there is no call to CM, so all you TCL validation callbacks aren't executed
|
91
|
-
- You can change the `obj_class` of an obj, but after save you should get yourself a new instance. (it's a bug of `rails_connector_meta`)
|
92
|
-
- You have to save an object before you can upload data (i.e. upload works only on existing objects)
|
93
|
-
|
94
|
-
HOW TO INSTALL
|
95
|
-
==============
|
96
|
-
|
97
|
-
1. Include in your Gemfile
|
98
|
-
2. bundle
|
99
|
-
3. Add initializer for Reactor if you haven't done so already
|
100
|
-
4. Include modules into your Obj
|
101
|
-
|
102
|
-
CONFIGURING CMS ACCESS
|
103
|
-
======================
|
104
|
-
|
105
|
-
**config/initializers/reactor.rb:**
|
106
|
-
|
107
|
-
Reactor::Configuration.xml_access = {
|
108
|
-
:host => 'localhost', # Fiona host
|
109
|
-
:port => 6001, # CM http port (TCL port + 1)
|
110
|
-
:id => '1234', # leave it as is
|
111
|
-
|
112
|
-
:username => 'root', # default user for all requests
|
113
|
-
:secret => 'password' # instance secret
|
114
|
-
}
|
115
|
-
|
116
|
-
USING WITH THE NEWEST RAILS CONNECTOR
|
117
|
-
=====================================
|
118
|
-
|
119
|
-
Recent versions of Rails Connector deprecated the usage of `ObjExtenions` module. Therefore, you have to create an `Obj` model which inherits the `RailsConnector::BasicObj` class. **For best compatibility do not call that model anything other that `Obj`!
|
120
|
-
|
121
|
-
**app/models/obj.rb:**
|
122
|
-
|
123
|
-
require 'meta'
|
124
|
-
class Obj < RailsConnector::BasicObj
|
125
|
-
include RailsConnector::Meta
|
126
|
-
|
127
|
-
include Reactor::Legacy::Base # core module
|
128
|
-
include Reactor::Attributes::Base # core module
|
129
|
-
include Reactor::Persistence::Base # core module
|
130
|
-
|
131
|
-
include Reactor::Validations::Base # optional module,
|
132
|
-
# enables Rails validations
|
133
|
-
|
134
|
-
include Reactor::Permission::Base # optional module,
|
135
|
-
# enables permission checking
|
136
|
-
|
137
|
-
include Reactor::Workflow::Base # optional module,
|
138
|
-
# enables workflow API
|
139
|
-
|
140
|
-
include Reactor::StreamingUpload::Base
|
141
|
-
# optional module,
|
142
|
-
# enables streaming interface for
|
143
|
-
# uploads (strongly recommended!)
|
144
|
-
end
|
145
|
-
|
146
|
-
USING WITH OLDER RAILS CONNECTOR
|
147
|
-
================================
|
148
|
-
|
149
|
-
Older version of Rails Connector support extensions to the RailsConnector::Obj class through `ObjExtensions` module. Use following code for the best compatibility.
|
150
|
-
|
151
|
-
**lib/obj_extensions.rb:**
|
152
|
-
|
153
|
-
require 'meta'
|
154
|
-
module ObjExtensions
|
155
|
-
def self.enable
|
156
|
-
Obj.class_eval do
|
157
|
-
include RailsConnector::Meta
|
158
|
-
|
159
|
-
include Reactor::Legacy::Base # core module
|
160
|
-
include Reactor::Attributes::Base # core module
|
161
|
-
include Reactor::Persistence::Base # core module
|
162
|
-
|
163
|
-
include Reactor::Validations::Base # optional module,
|
164
|
-
# enables Rails validations
|
165
|
-
|
166
|
-
include Reactor::Permission::Base # optional module,
|
167
|
-
# enables permission checking
|
168
|
-
|
169
|
-
include Reactor::Workflow::Base # optional module,
|
170
|
-
# enables workflow API
|
171
|
-
|
172
|
-
include Reactor::StreamingUpload::Base
|
173
|
-
# optional module,
|
174
|
-
# enables streaming interface for
|
175
|
-
# uploads (strongly recommended!)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
DOCUMENTATION
|
181
|
-
=============
|
182
|
-
Core and optional modules are pretty well documented. If you are looking for example usages, you will find plenty of them in test app under spec folder.
|
183
|
-
|
184
|
-
BUGS, FEATURE REQUESTS?
|
185
|
-
=======================
|
186
|
-
Open issue on github or make a pull request! Don't be shy :)
|