Class: Reactor::Tools::WorkflowGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/reactor/tools/workflow_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ WorkflowGenerator

Returns a new instance of WorkflowGenerator.



6
7
8
9
10
11
12
13
14
# File 'lib/reactor/tools/workflow_generator.rb', line 6

def initialize(options)
  @editors    = options[:editors]
  @correctors = options[:correctors]
  @users      = @editors + @correctors
  @groups     = personal_groups(@users)
  @class_name = options[:obj_class] || generate_obj_class_name
  @workflow_name = options[:workflow_name] || generate_workflow_name
  @obj_name = options[:obj_name] || generate_obj_name
end

Instance Attribute Details

#correctorsObject (readonly)

Returns the value of attribute correctors.



4
5
6
# File 'lib/reactor/tools/workflow_generator.rb', line 4

def correctors
  @correctors
end

#editorsObject (readonly)

Returns the value of attribute editors.



4
5
6
# File 'lib/reactor/tools/workflow_generator.rb', line 4

def editors
  @editors
end

#groupsObject (readonly)

Returns the value of attribute groups.



4
5
6
# File 'lib/reactor/tools/workflow_generator.rb', line 4

def groups
  @groups
end

#objObject (readonly)

Returns the value of attribute obj.



4
5
6
# File 'lib/reactor/tools/workflow_generator.rb', line 4

def obj
  @obj
end

#usersObject (readonly)

Returns the value of attribute users.



4
5
6
# File 'lib/reactor/tools/workflow_generator.rb', line 4

def users
  @users
end

#workflow_nameObject (readonly)

Returns the value of attribute workflow_name.



4
5
6
# File 'lib/reactor/tools/workflow_generator.rb', line 4

def workflow_name
  @workflow_name
end

Instance Method Details

#destroy!Object



27
28
29
30
31
32
33
34
# File 'lib/reactor/tools/workflow_generator.rb', line 27

def destroy!
  destroy_objs
  destroy_obj_class
  destroy_workflow
  destroy_users
  destroy_groups
  destroy_signatures
end

#generate!Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/reactor/tools/workflow_generator.rb', line 16

def generate!
  create_groups
  create_users
  create_signatures
  create_workflow
  create_obj_class
  create_obj
  set_permissions
  start_workflow
end

#personal_group(user) ⇒ Object



36
37
38
# File 'lib/reactor/tools/workflow_generator.rb', line 36

def personal_group(user)
  "#{user}_group"
end