Skip to content

Commit

Permalink
Rename ActiveTrail gem to Floristry
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrioux committed Nov 18, 2018
1 parent 4c666e3 commit 4568e32
Show file tree
Hide file tree
Showing 88 changed files with 271 additions and 214 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ActiveTrail
# Floristry

The goal of this gem is to help you represent [Ruote's workflows](http://ruote.rubyforge.org/) using standard Rails
facilities, e.g. partials, helpers, render, models, etc.
Expand All @@ -9,7 +9,7 @@ set. Obviously, you can override their default behaviors and representations by

To override a view, simply create a new one in:

/app/views/active_trail/_participant.html.erb.
/app/views/floristry/_participant.html.erb.

## Hierarchy

Expand Down Expand Up @@ -45,9 +45,9 @@ Then register the service in the ruote engine:

```ruby
RuoteKit.engine.add_service('trail',
'active_trail/observer',
'ActiveTrail::Observer',
'archive' => 'ActiveTrail::Archive::ActiveRecord')
'floristry/observer',
'Floristry::Observer',
'archive' => 'Floristry::Archive::ActiveRecord')
```

## Usage
Expand Down Expand Up @@ -75,18 +75,18 @@ Create a file called /config/initializers/active-trail.rb containing modules wit
use the following config to define which module will be included in the which low-level Expression.

```ruby
module ActiveTrailBranchBehavior
module FloristryBranchBehavior
def xyz
# ...
end

# ...
end

ActiveTrail.configure do |config|
config.add_branch_expression_behavior = ActiveTrailBranchBehavior
#config.add_leaf_expression_behavior = ActiveTrailLeafBehavior
#config.add_expression_behavior = ActiveTrailBehavior
Floristry.configure do |config|
config.add_branch_expression_behavior = FloristryBranchBehavior
#config.add_leaf_expression_behavior = FloristryLeafBehavior
#config.add_expression_behavior = FloristryBehavior
end
```

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end

RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'ActiveTrail'
rdoc.title = 'Floristry'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class ApplicationController < ::ApplicationController
helper ::ApplicationHelper
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class HookhandlerController < ::ApplicationController

skip_before_action :verify_authenticity_token
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module ActiveTrail
module Floristry
class WebparticipantController < ::ApplicationController

skip_before_action :verify_authenticity_token

def create

model = "ActiveTrail::Web::#{params['message']['attd']['model'].classify}".constantize
model = "Floristry::Web::#{params['message']['attd']['model'].classify}".constantize

model.create(params['message'])
render nothing: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class WorkflowsController < ::ApplicationController
# layout 'application'

Expand Down Expand Up @@ -38,7 +38,7 @@ def update

def workflow_params(wf)

attrs = wf.wi.attributes.keys - ActiveTrail::ActiveRecord::Base::ATTRIBUTES_TO_EXCLUDE
attrs = wf.wi.attributes.keys - Floristry::ActiveRecord::Base::ATTRIBUTES_TO_EXCLUDE
params.require("#{wf.wi.module_name}_#{wf.wi.name}".underscore.to_sym).permit(attrs)
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
module ApplicationHelper
end
end
9 changes: 0 additions & 9 deletions app/models/active_trail/participant.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/models/active_trail/task.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail::ActiveRecord
module Floristry::ActiveRecord

# This is the Backend listener Participant of Web participants - the only backend participant implemented by Rails
# It is called by the transient REST Participant.
Expand All @@ -8,9 +8,9 @@ class Base < ::ActiveRecord::Base

self.abstract_class = true

include ActiveTrail::CommonMixin
include ActiveTrail::ExpressionMixin
include ActiveTrail::ParticipantExpressionMixin
include Floristry::CommonMixin
include Floristry::ExpressionMixin
include Floristry::ParticipantExpressionMixin

ATTRIBUTES_TO_EXCLUDE = %w(id __feid__ __msg__ )

Expand Down Expand Up @@ -91,7 +91,7 @@ def return

begin

ActiveTrail::WorkflowEngine.return(@fei.exid, @fei.nid, merged_msg)
Floristry::WorkflowEngine.return(@fei.exid, @fei.nid, merged_msg)
trigger!(:return)
end

Expand Down Expand Up @@ -199,5 +199,5 @@ def current_state(force_reload: false)
end
end

mixin = ActiveTrail.configuration.add_active_record_base_behavior
ActiveTrail::ActiveRecord::Base.send(:include, mixin) if mixin
mixin = Floristry.configuration.add_active_record_base_behavior
Floristry::ActiveRecord::Base.send(:include, mixin) if mixin
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'forwardable'

module ActiveTrail
module Floristry
class BranchExpression < Expression
include Enumerable
extend Forwardable
Expand All @@ -14,7 +14,7 @@ def initialize (id, name, payload, vars, era)

@children = Array.new

mixin = ActiveTrail.configuration.add_branch_expression_behavior
mixin = Floristry.configuration.add_branch_expression_behavior
self.class.send(:include, mixin) if mixin
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail::CommonMixin
module Floristry::CommonMixin

CHILDREN = 1 # Where branch expressions stores children expressions
ROOT_EXPID = '0' # Root expression id - yes, it's a string (e.g. 0_1_0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class Concurrence < BranchExpression
def spacer_template
'active-trail/concurrence_spacer'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class Cron < BranchExpression
def spacer_template
'ruote_trail/sequence_spacer'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module ActiveTrail
module Floristry
class Expression

include ActiveTrail::CommonMixin
include Floristry::CommonMixin
include ExpressionMixin

attr_reader :id, :name, :payload, :era
Expand All @@ -22,7 +22,7 @@ def initialize(id, name, payload, vars, era)
@payload = payload
@era = era

mixin = ActiveTrail.configuration.add_expression_behavior
mixin = Floristry.configuration.add_expression_behavior
self.class.send(:include, mixin) if mixin
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class If < LeafExpression
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry

class LeafExpression < Expression

Expand All @@ -14,10 +14,10 @@ def initialize(id, name, params, payload, era)
super

@payload = payload
@parameters = ActiveTrail::ParametersInterpreter.new(params)
@parameters = Floristry::ParametersInterpreter.new(params)
end
end
end

mixin = ActiveTrail.configuration.add_leaf_expression_behavior
ActiveTrail::LeafExpression.send(:include, mixin) if mixin
mixin = Floristry.configuration.add_leaf_expression_behavior
Floristry::LeafExpression.send(:include, mixin) if mixin
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class ParametersInterpreter

attr_reader :params
Expand Down
9 changes: 9 additions & 0 deletions app/models/floristry/participant.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Floristry
class Participant < LeafExpression

include ParticipantExpressionMixin
end
end

mixin = Floristry.configuration.add_participant_behavior
Floristry::Participant.send(:include, mixin) if mixin
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class Sequence < BranchExpression
def spacer_template
'ruote_trail/sequence_spacer'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class Set < LeafExpression

end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class Sleep < LeafExpression

end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module ActiveTrail::Ssh
module Floristry::Ssh

# This is the frontend participant for ssh_participant.
#
class Participant < ActiveTrail::Participant
class Participant < Floristry::Participant

PREFIX = 'ssh'
REGEX = /^#{PREFIX}/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class Stall < LeafExpression

end
Expand Down
5 changes: 5 additions & 0 deletions app/models/floristry/task.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Floristry
class Task < Floristry::Participant

end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class Trail < ::ActiveRecord::Base

serialize :tree, JSON
Expand Down Expand Up @@ -83,8 +83,8 @@ def self.insert_in_tree(tree, nid, payload)
end
end

mixin = ActiveTrail.configuration.add_trail_behavior
ActiveTrail::Trail.send(:include, mixin) if mixin
mixin = Floristry.configuration.add_trail_behavior
Floristry::Trail.send(:include, mixin) if mixin

class WorkflowError < StandardError
def initialize(msg='An error occurred in the workflow engine')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActiveTrail
module Floristry
class Wait < LeafExpression

end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module ActiveTrail::Web
module Floristry::Web

# This is the frontend participant for web_participants.
# The corresponding backend participant are models which inherit from ActiveTrail::ActiveRecord::Base
# The corresponding backend participant are models which inherit from Floristry::ActiveRecord::Base
#
class Participant < ActiveTrail::Participant
class Participant < Floristry::Participant

PREFIX = 'web'
REGEX = /^#{PREFIX}/
Expand Down Expand Up @@ -39,7 +39,7 @@ def instance
def klass

k = @name.sub(PREFIX, '').camelize
ActiveTrail::Web.const_get k
Floristry::Web.const_get k
end
end
end
Loading

0 comments on commit 4568e32

Please sign in to comment.