infopark_reactor 1.6.3 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -24,7 +24,7 @@ So, here you have it: REACTOR, writing layer for `RailsConnector`, tightly integ
24
24
  not_a_page.release! if not_a_page.valid?(:release)
25
25
 
26
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
27
+ * all standard ActiveModel callbacks + `*_release` callbacks
28
28
  * Validations in three contexts: create, update, release
29
29
  * If something works with ActiveRecord, there is a high chance it works with REACTOR too!
30
30
  * Rails 3 API
@@ -79,7 +79,6 @@ Awesome! What is missing/WHAT I NEED TO BE AWARE OF:
79
79
  - Therefore link operations are slow.
80
80
  - Link position cannot be directly manipulated (it is implicit through array order)
81
81
  - Validations are implemented completely in Rails, there is no call to CM, so all you TCL validation callbacks aren't executed
82
- - There are no validations for `enum`/`multienum` field (but mandatory fields are supported)
83
82
  - 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`)
84
83
  - You have to save an object before you can upload data (i.e. upload works only on existing objects)
85
84
 
@@ -91,7 +90,8 @@ HOW TO INSTALL
91
90
  3. Add initializer for Reactor if you haven't done so already
92
91
  4. Include modules into your Obj
93
92
 
94
- Sample code for points 3. and 4.
93
+ CONFIGURING CMS ACCESS
94
+ ======================
95
95
 
96
96
  **config/initializers/reactor.rb:**
97
97
 
@@ -104,6 +104,41 @@ Sample code for points 3. and 4.
104
104
  :secret => 'password' # instance secret
105
105
  }
106
106
 
107
+ USING WITH THE NEWEST RAILS CONNECTOR
108
+ =====================================
109
+
110
+ 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`!
111
+
112
+ **app/models/obj.rb:**
113
+
114
+ require 'meta'
115
+ class Obj < RailsConnector::BasicObj
116
+ include RailsConnector::Meta
117
+
118
+ include Reactor::Legacy::Base # core module
119
+ include Reactor::Attributes::Base # core module
120
+ include Reactor::Persistence::Base # core module
121
+
122
+ include Reactor::Validations::Base # optional module,
123
+ # enables Rails validations
124
+
125
+ include Reactor::Permission::Base # optional module,
126
+ # enables permission checking
127
+
128
+ include Reactor::Workflow::Base # optional module,
129
+ # enables workflow API
130
+
131
+ include Reactor::StreamingUpload::Base
132
+ # optional module,
133
+ # enables streaming interface for
134
+ # uploads (strongly recommended!)
135
+ end
136
+
137
+ USING WITH OLDER RAILS CONNECTOR
138
+ ================================
139
+
140
+ Older version of Rails Connector support extensions to the RailsConnector::Obj class through `ObjExtensions` module. Use following code for the best compatibility.
141
+
107
142
  **lib/obj_extensions.rb:**
108
143
 
109
144
  require 'meta'
@@ -139,4 +174,4 @@ Core and optional modules are pretty well documented. If you are looking for exa
139
174
 
140
175
  BUGS, FEATURE REQUESTS?
141
176
  =======================
142
- Open issue on github or make a pull request! Don't be shy :)
177
+ Open issue on github or make a pull request! Don't be shy :)
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
21
  s.require_paths = ["lib", "lib/tools"]
22
22
 
23
- s.add_dependency 'rails', '<= 3.2.12', '>= 3.0.10'
23
+ s.add_dependency 'rails', '<= 3.3', '>= 3.0.10'
24
24
  s.add_dependency 'infopark_reactor_migrations', '>= 1.2.0'
25
25
  s.add_dependency 'infopark_rails_connector'
26
26
  s.add_dependency 'infopark_rails_connector_meta', '>= 0.0.3'
@@ -90,6 +90,7 @@ module Reactor
90
90
  end
91
91
 
92
92
  def ensure_create_permission_granted(obj_id)
93
+ raise RuntimeError, "Permission check for object with id=#{obj_id.inspect} which does not exist" unless Obj.exists?(obj_id)
93
94
  raise Reactor::NotPermitted, 'Obj lacks neccessary permissions for creation' unless Obj.find(obj_id).permission.create_children?
94
95
  return true
95
96
  end
@@ -99,11 +99,11 @@ module Reactor
99
99
  crul_obj.get('hasSuperLinks') == '1'
100
100
  end
101
101
 
102
- # Return an array of RailsConnector::Obj that contain a link
102
+ # Return an array of RailsConnector::AbstractObj that contain a link
103
103
  # to this file.
104
104
  # @raise [Reactor::Cm::XmlRequestError] generic error occoured
105
105
  def super_objects
106
- RailsConnector::Obj.where(:obj_id => crul_obj.get('superObjects')).to_a
106
+ RailsConnector::AbstractObj.where(:obj_id => crul_obj.get('superObjects')).to_a
107
107
  end
108
108
 
109
109
  # Returns true if this object hasn't been saved yet -- that is, a record
@@ -194,7 +194,7 @@ module Reactor
194
194
  # It should excactly match ActiveRecord::Base.new in it's behavior
195
195
  # @see ActiveRecord::Base.new
196
196
  def initialize(attributes = nil, &block)
197
- if !self.class.send(:attribute_methods_overriden?)
197
+ if true || !self.class.send(:attribute_methods_overriden?) # FIXME !!!!
198
198
  ignored_attributes = ignore_attributes(attributes)
199
199
  # supress block hijacking!
200
200
  super(attributes) {}
@@ -208,7 +208,7 @@ module Reactor
208
208
  # It should excactly match ActiveRecord::Base.new in it's behavior
209
209
  # @see ActiveRecord::Base.new
210
210
  def initialize(attributes = nil, options={}, &block)
211
- if !self.class.send(:attribute_methods_overriden?)
211
+ if true || !self.class.send(:attribute_methods_overriden?) #FIXME !!!
212
212
  ignored_attributes = ignore_attributes(attributes)
213
213
  # supress block hijacking!
214
214
  super(attributes, options) {}
@@ -465,8 +465,9 @@ module Reactor
465
465
  end
466
466
 
467
467
  protected
468
+ # TODO: TESTME!!!!
468
469
  def attribute_methods_overriden?
469
- self.name != 'RailsConnector::Obj'
470
+ self.name != 'RailsConnector::AbstractObj'
470
471
  end
471
472
  end
472
473
  end
@@ -125,7 +125,7 @@ module Reactor
125
125
 
126
126
  def set_permissions
127
127
  # get RC object
128
- @rc_obj = RailsConnector::Obj.find(@obj.obj_id)
128
+ @rc_obj = RailsConnector::AbstractObj.find(@obj.obj_id)
129
129
 
130
130
  # use nice API to set permissions
131
131
  @groups.each do |group|
@@ -145,7 +145,7 @@ module Reactor
145
145
  end
146
146
 
147
147
  def destroy_objs
148
- RailsConnector::Obj.find_all_by_obj_class(@class_name).each(&:destroy)
148
+ RailsConnector::AbstractObj.find_all_by_obj_class(@class_name).each(&:destroy)
149
149
  end
150
150
 
151
151
  def destroy_obj_class
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Reactor
3
- VERSION = "1.6.3"
3
+ VERSION = "1.7.0"
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_reactor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 6
9
- - 3
10
- version: 1.6.3
8
+ - 7
9
+ - 0
10
+ version: 1.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tomasz Przedmojski
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-02-13 00:00:00 +01:00
18
+ date: 2013-02-21 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,11 @@ dependencies:
26
26
  requirements:
27
27
  - - <=
28
28
  - !ruby/object:Gem::Version
29
- hash: 23
29
+ hash: 1
30
30
  segments:
31
31
  - 3
32
- - 2
33
- - 12
34
- version: 3.2.12
32
+ - 3
33
+ version: "3.3"
35
34
  - - ">="
36
35
  - !ruby/object:Gem::Version
37
36
  hash: 19