dynflow 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +7 -1
- data/lib/dynflow/action.rb +15 -4
- data/lib/dynflow/execution_plan.rb +2 -1
- data/lib/dynflow/execution_plan/steps/abstract.rb +7 -1
- data/lib/dynflow/testing/assertions.rb +2 -1
- data/lib/dynflow/testing/factories.rb +1 -1
- data/lib/dynflow/version.rb +1 -1
- data/web/assets/javascripts/application.js +25 -20
- data/web/assets/stylesheets/application.css +34 -30
- data/web/views/plan_step.erb +6 -2
- metadata +2 -2
    
        data/README.md
    CHANGED
    
    | @@ -28,13 +28,19 @@ implementations as well). | |
| 28 28 | 
             
            * [Related projects](#related-projects)
         | 
| 29 29 |  | 
| 30 30 | 
             
            Current status
         | 
| 31 | 
            -
             | 
| 31 | 
            +
            --------------
         | 
| 32 32 |  | 
| 33 33 | 
             
            Dynflow has been under heavy development for several months to be able
         | 
| 34 34 | 
             
            to support the services orchestration in the
         | 
| 35 35 | 
             
            [Katello](http://katello.org) and [Foreman](http://theforeman.org/)
         | 
| 36 36 | 
             
            projects, getting to production-ready state in couple of weeks.
         | 
| 37 37 |  | 
| 38 | 
            +
            Requirements
         | 
| 39 | 
            +
            ------------
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            -   Ruby MRI 1.9.3, 2.0, or 2.1.
         | 
| 42 | 
            +
            -   It does not work on JRuby nor Rubinius yet.
         | 
| 43 | 
            +
             | 
| 38 44 | 
             
            How it works
         | 
| 39 45 | 
             
            ------------
         | 
| 40 46 |  | 
    
        data/lib/dynflow/action.rb
    CHANGED
    
    | @@ -64,6 +64,12 @@ module Dynflow | |
| 64 64 | 
             
                  end
         | 
| 65 65 | 
             
                end
         | 
| 66 66 |  | 
| 67 | 
            +
                module Phase
         | 
| 68 | 
            +
                  def to_s_humanized
         | 
| 69 | 
            +
                    to_s.split('::').last
         | 
| 70 | 
            +
                  end
         | 
| 71 | 
            +
                end
         | 
| 72 | 
            +
             | 
| 67 73 | 
             
                def self.constantize(action_name)
         | 
| 68 74 | 
             
                  super action_name
         | 
| 69 75 | 
             
                rescue NameError
         | 
| @@ -159,7 +165,7 @@ module Dynflow | |
| 159 165 | 
             
                end
         | 
| 160 166 |  | 
| 161 167 | 
             
                def steps
         | 
| 162 | 
            -
                  [plan_step, run_step,  | 
| 168 | 
            +
                  [plan_step, run_step, finalize_step]
         | 
| 163 169 | 
             
                end
         | 
| 164 170 |  | 
| 165 171 | 
             
                def to_hash
         | 
| @@ -215,7 +221,10 @@ module Dynflow | |
| 215 221 |  | 
| 216 222 | 
             
                def state=(state)
         | 
| 217 223 | 
             
                  phase! Executable
         | 
| 218 | 
            -
                  @world.logger.debug  | 
| 224 | 
            +
                  @world.logger.debug format('%13s %s:%2d %9s >> %9s in phase %8s %s',
         | 
| 225 | 
            +
                                             'Step', execution_plan_id, @step.id,
         | 
| 226 | 
            +
                                             self.state, state,
         | 
| 227 | 
            +
                                             phase.to_s_humanized, self.class)
         | 
| 219 228 | 
             
                  @step.state = state
         | 
| 220 229 | 
             
                end
         | 
| 221 230 |  | 
| @@ -276,7 +285,8 @@ module Dynflow | |
| 276 285 |  | 
| 277 286 | 
             
                def plan_self(input)
         | 
| 278 287 | 
             
                  phase! Plan
         | 
| 279 | 
            -
                  self.input  | 
| 288 | 
            +
                  self.input.update input
         | 
| 289 | 
            +
             | 
| 280 290 | 
             
                  if self.respond_to?(:run)
         | 
| 281 291 | 
             
                    run_step          = @execution_plan.add_run_step(self)
         | 
| 282 292 | 
             
                    @run_step_id      = run_step.id
         | 
| @@ -367,7 +377,8 @@ module Dynflow | |
| 367 377 |  | 
| 368 378 | 
             
                def execute_run(event)
         | 
| 369 379 | 
             
                  phase! Run
         | 
| 370 | 
            -
                  @world.logger.debug  | 
| 380 | 
            +
                  @world.logger.debug format('%13s %s:%2d got event %s',
         | 
| 381 | 
            +
                                             'Step', execution_plan_id, @step.id, event) if event
         | 
| 371 382 | 
             
                  @input = OutputReference.dereference @input, world.persistence
         | 
| 372 383 |  | 
| 373 384 | 
             
                  case
         | 
| @@ -62,7 +62,7 @@ module Dynflow | |
| 62 62 | 
             
                  end
         | 
| 63 63 |  | 
| 64 64 | 
             
                  def to_s
         | 
| 65 | 
            -
                    " | 
| 65 | 
            +
                    "#<#{self.class.name}:#{execution_plan_id}:#{id}>"
         | 
| 66 66 | 
             
                  end
         | 
| 67 67 |  | 
| 68 68 | 
             
                  def to_hash
         | 
| @@ -86,6 +86,12 @@ module Dynflow | |
| 86 86 | 
             
                    raise NotImplementedError, "Expected to be implemented in RunStep and FinalizeStep"
         | 
| 87 87 | 
             
                  end
         | 
| 88 88 |  | 
| 89 | 
            +
                  def action(execution_plan)
         | 
| 90 | 
            +
                    attributes = world.persistence.adapter.load_action(execution_plan_id, action_id)
         | 
| 91 | 
            +
                    Action.from_hash(attributes.update(phase: Action::Present, execution_plan: execution_plan),
         | 
| 92 | 
            +
                                     world)
         | 
| 93 | 
            +
                  end
         | 
| 94 | 
            +
             | 
| 89 95 | 
             
                  protected
         | 
| 90 96 |  | 
| 91 97 | 
             
                  def self.new_from_hash(hash, execution_plan_id, world)
         | 
| @@ -14,7 +14,8 @@ module Dynflow | |
| 14 14 | 
             
                    end
         | 
| 15 15 |  | 
| 16 16 | 
             
                    assert(!found.empty?,
         | 
| 17 | 
            -
                           "Action #{planned_action_class} with plan_input #{plan_input} was not planned,  | 
| 17 | 
            +
                           "Action #{planned_action_class} with plan_input #{plan_input} was not planned, " +
         | 
| 18 | 
            +
                               "there were only #{found_classes.map(&:plan_input)}")
         | 
| 18 19 | 
             
                    found
         | 
| 19 20 | 
             
                  end
         | 
| 20 21 |  | 
| @@ -63,7 +63,7 @@ module Dynflow | |
| 63 63 |  | 
| 64 64 | 
             
                  # @return [Action::FinalizePhase]
         | 
| 65 65 | 
             
                  def finalize_action(run_action, &stubbing)
         | 
| 66 | 
            -
                    Match! run_action.phase, Action::Run
         | 
| 66 | 
            +
                    Match! run_action.phase, Action::Plan, Action::Run
         | 
| 67 67 | 
             
                    step            = DummyStep.new
         | 
| 68 68 | 
             
                    finalize_action = run_action.class.new(
         | 
| 69 69 | 
             
                        { step:              step,
         | 
    
        data/lib/dynflow/version.rb
    CHANGED
    
    
| @@ -1,25 +1,30 @@ | |
| 1 | 
            -
            (function($) {
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 1 | 
            +
            (function ($) {
         | 
| 2 | 
            +
              $.fn.extend({
         | 
| 3 | 
            +
                postlink: function (options) {
         | 
| 4 | 
            +
                  return this.each(function () {
         | 
| 5 | 
            +
                    $(this).click(function (e) {
         | 
| 6 | 
            +
                      var frm = $("<form>");
         | 
| 7 | 
            +
                      frm.attr({'action': $(this).attr('href'), 'method': 'post'});
         | 
| 8 | 
            +
                      frm.appendTo("body");
         | 
| 9 | 
            +
                      frm.submit();
         | 
| 10 | 
            +
                      e.preventDefault();
         | 
| 11 | 
            +
                    });
         | 
| 12 | 
            +
                  });
         | 
| 13 | 
            +
                }
         | 
| 14 | 
            +
              });
         | 
| 15 15 |  | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 16 | 
            +
              $(function () {
         | 
| 17 | 
            +
                $('.postlink').postlink();
         | 
| 18 18 |  | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 19 | 
            +
                $('table.flow span.step-label').click(function (e) {
         | 
| 20 | 
            +
                  var stepData = $(this).siblings('div.action');
         | 
| 21 | 
            +
                  stepData.slideToggle();
         | 
| 22 | 
            +
                });
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                $('.plan-step .step-label').click(function (e) {
         | 
| 25 | 
            +
                  var stepData = $(this).siblings('div.action');
         | 
| 26 | 
            +
                  stepData.slideToggle();
         | 
| 23 27 | 
             
                });
         | 
| 28 | 
            +
              });
         | 
| 24 29 |  | 
| 25 30 | 
             
            })(jQuery);
         | 
| @@ -1,9 +1,9 @@ | |
| 1 1 | 
             
            body {
         | 
| 2 | 
            -
             | 
| 2 | 
            +
              margin: 1em;
         | 
| 3 3 | 
             
            }
         | 
| 4 4 |  | 
| 5 5 | 
             
            pre {
         | 
| 6 | 
            -
             | 
| 6 | 
            +
              white-space: pre;
         | 
| 7 7 | 
             
            }
         | 
| 8 8 |  | 
| 9 9 | 
             
            div.tab-pane {
         | 
| @@ -25,77 +25,81 @@ ul.plan-step span.error { | |
| 25 25 | 
             
            table.flow td.flow.sequence,
         | 
| 26 26 | 
             
            table.flow td.flow.concurrence,
         | 
| 27 27 | 
             
            table.flow-hint td.border {
         | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 28 | 
            +
              border-style: solid;
         | 
| 29 | 
            +
              border-width: 4px;
         | 
| 30 30 | 
             
            }
         | 
| 31 31 |  | 
| 32 32 | 
             
            table.flow-hint td {
         | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 33 | 
            +
              width: 6em;
         | 
| 34 | 
            +
              padding: 0.3em;
         | 
| 35 35 | 
             
            }
         | 
| 36 36 |  | 
| 37 37 | 
             
            table.flow-hint {
         | 
| 38 | 
            -
             | 
| 38 | 
            +
              margin: 1em 0 1em 0;
         | 
| 39 39 | 
             
            }
         | 
| 40 40 |  | 
| 41 41 | 
             
            table.flow td.sequence, table.flow-hint td.sequence {
         | 
| 42 | 
            -
             | 
| 42 | 
            +
              border-color: #FF6600;
         | 
| 43 43 | 
             
            }
         | 
| 44 44 |  | 
| 45 45 | 
             
            table.flow td.concurrence, table.flow-hint td.concurrence {
         | 
| 46 | 
            -
             | 
| 46 | 
            +
              border-color: #005CE6;
         | 
| 47 47 | 
             
            }
         | 
| 48 48 |  | 
| 49 49 | 
             
            td.atom {
         | 
| 50 | 
            -
             | 
| 50 | 
            +
              padding: 0;
         | 
| 51 51 | 
             
            }
         | 
| 52 52 |  | 
| 53 53 | 
             
            table.flow div.atom {
         | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 54 | 
            +
              margin-bottom: -1.6em;
         | 
| 55 | 
            +
              position: relative;
         | 
| 56 | 
            +
              height: 2.1em;
         | 
| 57 | 
            +
              top: 0;
         | 
| 58 | 
            +
              left: 0;
         | 
| 59 | 
            +
              z-index: -1;
         | 
| 60 60 | 
             
            }
         | 
| 61 61 |  | 
| 62 62 | 
             
            table.flow table {
         | 
| 63 | 
            -
             | 
| 63 | 
            +
              width: 100%;
         | 
| 64 64 | 
             
            }
         | 
| 65 65 |  | 
| 66 66 | 
             
            table.flow td.success span.step-label {
         | 
| 67 | 
            -
             | 
| 67 | 
            +
              color: #468847;
         | 
| 68 68 | 
             
            }
         | 
| 69 69 |  | 
| 70 70 | 
             
            table.flow div.success {
         | 
| 71 | 
            -
             | 
| 71 | 
            +
              background-color: #DFF0D8;
         | 
| 72 72 | 
             
            }
         | 
| 73 73 |  | 
| 74 74 | 
             
            table.flow div.error {
         | 
| 75 | 
            -
             | 
| 75 | 
            +
              background-color: #FF9D9D;
         | 
| 76 76 | 
             
            }
         | 
| 77 77 |  | 
| 78 78 | 
             
            table.flow td.skipped span.step-label {
         | 
| 79 | 
            -
             | 
| 79 | 
            +
              color: #C09853;
         | 
| 80 80 | 
             
            }
         | 
| 81 81 |  | 
| 82 82 | 
             
            table.flow div.skipped {
         | 
| 83 | 
            -
             | 
| 83 | 
            +
              background-color: #FCF8E3;
         | 
| 84 84 | 
             
            }
         | 
| 85 85 |  | 
| 86 86 | 
             
            table.flow span.step-label {
         | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 87 | 
            +
              cursor: pointer;
         | 
| 88 | 
            +
              margin-left: 4px;
         | 
| 89 | 
            +
              display: inline-block;
         | 
| 90 | 
            +
              height: 1.5em;
         | 
| 91 | 
            +
            }
         | 
| 92 | 
            +
             | 
| 93 | 
            +
            .plan-step div.action {
         | 
| 94 | 
            +
              display: none;
         | 
| 91 95 | 
             
            }
         | 
| 92 96 |  | 
| 93 97 | 
             
            table.flow div.action {
         | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 98 | 
            +
              background-color: white;
         | 
| 99 | 
            +
              padding: 10px;
         | 
| 100 | 
            +
              display: none;
         | 
| 97 101 | 
             
            }
         | 
| 98 102 |  | 
| 99 103 | 
             
            table.flow td.error div.step-data {
         | 
| 100 | 
            -
             | 
| 104 | 
            +
              display: block;
         | 
| 101 105 | 
             
            }
         | 
    
        data/web/views/plan_step.erb
    CHANGED
    
    | @@ -1,9 +1,13 @@ | |
| 1 1 | 
             
            <ul class="plan-step">
         | 
| 2 2 | 
             
              <li>
         | 
| 3 | 
            -
                <p>
         | 
| 3 | 
            +
                <p class="step-label">
         | 
| 4 4 | 
             
                  <span class="label label-<%= step_css_class(step) %>"><%= h("#{step.action_class}") %></span>
         | 
| 5 5 | 
             
                </p>
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                <div class="action">
         | 
| 7 | 
            +
                  <% action = step.action @plan %>
         | 
| 8 | 
            +
                  <%= show_action_data("Input:", action.input) %>
         | 
| 9 | 
            +
                  <%= step_error(step) %>
         | 
| 10 | 
            +
                </div>
         | 
| 7 11 | 
             
                <% step.children.each do |sub_step_id| %>
         | 
| 8 12 | 
             
                  <%= erb :plan_step, locals: { step: @plan.steps[sub_step_id] } %>
         | 
| 9 13 | 
             
                <% end %>
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: dynflow
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.4. | 
| 4 | 
            +
              version: 0.4.1
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2014-02- | 
| 12 | 
            +
            date: 2014-02-18 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: activesupport
         |