MINT-statemachine 1.3.2 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,11 @@
1
1
  = Statemachine Changelog
2
2
 
3
+ == Version 1.4.0 (2013/07/02)
4
+
5
+ * Changed behavior: Entry into a parallel state that has been already entered before resets parallel state
6
+ contents to initial (no longer history by default for parallel states!).
7
+ * fixed requires and class names since new rake version has marked rdoc and package task class as depreciated.
8
+
3
9
  == Version 1.3.2 (2013/02/28)
4
10
 
5
11
  * Fixed bug with spontaneous transitions within parallel states.
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source :rubygems
2
2
 
3
3
  gem "rspec", "1.3.1"
4
- gem "rake","0.9.2"
4
+ gem "rake","0.9.2"
5
+ gem 'rdoc'
@@ -1,7 +1,10 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ json (1.7.7)
4
5
  rake (0.9.2)
6
+ rdoc (3.12.1)
7
+ json (~> 1.4)
5
8
  rspec (1.3.1)
6
9
 
7
10
  PLATFORMS
@@ -9,4 +12,5 @@ PLATFORMS
9
12
 
10
13
  DEPENDENCIES
11
14
  rake (= 0.9.2)
15
+ rdoc
12
16
  rspec (= 1.3.1)
data/LICENSE CHANGED
@@ -1,3 +1,4 @@
1
+ Copyright (C) 2013 Sebastian Feuerstack
1
2
  Copyright (C) 2010-2012 Sebastian Feuerstack, Jessica Colnago
2
3
  Copyright (C) 2006-2010 Micah Martin
3
4
 
@@ -2,18 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "MINT-statemachine"
5
- s.version = "1.3.1"
5
+ s.version = "1.4.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sebastian Feuerstack"]
9
- s.date = "2013-02-26"
9
+ s.date = "2013-07-02"
10
10
  s.description = "The MINT Statemachine is a ruby library for building Finite State Machines, based on the Statemachine gem by Micah Martin."
11
11
  s.email = "Sebastian@Feuerstack.org"
12
12
  s.files = ["TODO", "Gemfile.lock", "LICENSE", "CHANGES", "Rakefile", "Gemfile", "README.rdoc", "MINT-statemachine.gemspec", "lib/statemachine.rb", "lib/statemachine/builder.rb", "lib/statemachine/statemachine.rb", "lib/statemachine/generate/util.rb", "lib/statemachine/generate/dot_graph/dot_graph_statemachine.rb", "lib/statemachine/generate/java/java_statemachine.rb", "lib/statemachine/generate/dot_graph.rb", "lib/statemachine/generate/src_builder.rb", "lib/statemachine/generate/java.rb", "lib/statemachine/transition.rb", "lib/statemachine/version.rb", "lib/statemachine/parallelstate.rb", "lib/statemachine/action_invokation.rb", "lib/statemachine/superstate.rb", "lib/statemachine/state.rb", "lib/statemachine/stub_context.rb", "spec/default_transition_spec.rb", "spec/spec_helper.rb", "spec/sm_super_state_spec.rb", "spec/sm_action_parameterization_spec.rb", "spec/generate/dot_graph/dot_graph_stagemachine_spec.rb", "spec/generate/java/java_statemachine_spec.rb", "spec/sm_entry_exit_actions_spec.rb", "spec/sm_simple_spec.rb", "spec/sm_parallel_state_spec.rb", "spec/transition_spec.rb", "spec/noodle.rb", "spec/sm_activation_spec.rb", "spec/builder_spec.rb", "spec/action_invokation_spec.rb", "spec/sm_turnstile_spec.rb", "spec/history_spec.rb", "spec/sm_odds_n_ends_spec.rb"]
13
13
  s.homepage = "http://www.multi-access.de"
14
14
  s.require_paths = ["lib"]
15
15
  s.rubygems_version = "1.8.15"
16
- s.summary = "MINT-Statemachine-1.3.1 - Statemachine Library for Ruby based on statemachine from http://slagyr.github.com/statemachine http://www.multi-access.de/open-source-software/third-party-software-extensions/"
16
+ s.summary = "MINT-Statemachine-1.4.0 - Statemachine Library for Ruby based on statemachine from http://slagyr.github.com/statemachine http://www.multi-access.de/open-source-software/third-party-software-extensions/"
17
17
  s.test_files = ["spec/default_transition_spec.rb", "spec/sm_super_state_spec.rb", "spec/sm_action_parameterization_spec.rb", "spec/sm_entry_exit_actions_spec.rb", "spec/sm_simple_spec.rb", "spec/sm_parallel_state_spec.rb", "spec/transition_spec.rb", "spec/sm_activation_spec.rb", "spec/builder_spec.rb", "spec/action_invokation_spec.rb", "spec/sm_turnstile_spec.rb", "spec/history_spec.rb", "spec/sm_odds_n_ends_spec.rb"]
18
18
 
19
19
  if s.respond_to? :specification_version then
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
1
  $:.unshift('lib')
2
2
  require 'rubygems'
3
- require 'rake/gempackagetask'
3
+ require 'rubygems/package_task'
4
4
  require 'rake/clean'
5
- require 'rake/rdoctask'
5
+ require 'rdoc/task'
6
6
  require 'spec/rake/spectask'
7
7
  require 'statemachine'
8
8
 
@@ -24,7 +24,7 @@ Spec::Rake::SpecTask.new do |t|
24
24
  end
25
25
 
26
26
  desc 'Generate RDoc'
27
- rd = Rake::RDocTask.new do |rdoc|
27
+ rd = RDoc::Task.new do |rdoc|
28
28
  rdoc.options << '--title' << 'Statemachine' << '--line-numbers' << '--inline-source' << '--main' << 'README.rdoc'
29
29
  rdoc.rdoc_files.include('README.rdoc', 'CHANGES', 'lib/**/*.rb')
30
30
  end
@@ -43,8 +43,7 @@ spec = Gem::Specification.new do |s|
43
43
  s.email = "Sebastian@Feuerstack.org"
44
44
  s.homepage = "http://www.multi-access.de"
45
45
  end
46
-
47
- Rake::GemPackageTask.new(spec) do |pkg|
46
+ Gem::PackageTask.new(spec) do |pkg|
48
47
  pkg.need_zip = true
49
48
  pkg.need_tar = true
50
49
  end
@@ -196,8 +196,8 @@ module Statemachine
196
196
  end
197
197
 
198
198
  def spontaneous_transition
199
- nil
200
- end
199
+ nil
200
+ end
201
201
 
202
202
 
203
203
  def exit(args)
@@ -213,10 +213,17 @@ module Statemachine
213
213
  @parallel_statemachines.each_with_index do |s,i|
214
214
  as = s.get_state(s.state)
215
215
  while as and as != self do
216
- as.exit(args)
217
- as = as.superstate
218
- end
216
+ as.exit(args)
217
+ as = as.superstate
218
+ end
219
+
220
+ end
221
+ end
219
222
 
223
+ # explicit reset on parallel state entry
224
+ def reset
225
+ @parallel_statemachines.each_with_index do |s,i|
226
+ s.reset(@startstate_ids[i])
220
227
  end
221
228
  end
222
229
 
@@ -43,6 +43,11 @@ module Statemachine
43
43
  #entries.each { |entered_state| entered_state.activate(terminal_state.id) if entered_state.is_parallel }
44
44
  statemachine.state = terminal_state if statemachine.has_state(terminal_state.id) and statemachine.is_parallel
45
45
 
46
+ # on transition to parallel state, all nested parallel runnign states are reseted -> no histoy TODO implement history
47
+ if terminal_state.is_parallel
48
+ terminal_state.reset
49
+ end
50
+
46
51
  if is_self_transition? # handle special case of self transition
47
52
  new_states = [@destination_id]
48
53
  else
@@ -2,8 +2,8 @@ module Statemachine
2
2
  module VERSION #:nodoc:
3
3
  unless defined? MAJOR
4
4
  MAJOR = 1
5
- MINOR = 3
6
- TINY = 2
5
+ MINOR = 4
6
+ TINY = 0
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
9
9
  TAG = "REL_" + [MAJOR, MINOR, TINY].join('_')
@@ -9,7 +9,8 @@ describe "Parallel states" do
9
9
 
10
10
  @sm = Statemachine.build do
11
11
  trans :start,:go,:p
12
- state :maintenance
12
+ # state :maintenance
13
+ trans :maintenance,:go,:p
13
14
 
14
15
  parallel :p do
15
16
  event :activate_exit, :maintain
@@ -123,10 +124,14 @@ describe "Parallel states" do
123
124
  @noodle2.cooked.should equal(true)
124
125
  end
125
126
 
126
- it "should support state recovery" do
127
- @sm.states=[:locked,:off]
127
+ it "should support state recovery to initial state if without history state" do
128
+ @sm.states=[:locked,:on]
128
129
  @sm.toggle
129
- puts @sm.abstract_states
130
+ @sm.states_id.should == [:locked,:off]
131
+ @sm.maintain
132
+ @sm.states_id.should == [:maintenance]
133
+ @sm.go
134
+ @sm.states_id.should == [:locked,:on]
130
135
  end
131
136
 
132
137
  it "should support parallel states inside superstates" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MINT-statemachine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
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: 2013-02-28 00:00:00.000000000Z
12
+ date: 2013-07-02 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: The MINT Statemachine is a ruby library for building Finite State Machines,
15
15
  based on the Statemachine gem by Micah Martin.
@@ -73,7 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
73
  version: '0'
74
74
  segments:
75
75
  - 0
76
- hash: 744247185
76
+ hash: 725809469
77
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  none: false
79
79
  requirements:
@@ -85,7 +85,7 @@ rubyforge_project:
85
85
  rubygems_version: 1.8.15
86
86
  signing_key:
87
87
  specification_version: 3
88
- summary: MINT-Statemachine-1.3.2 - Statemachine Library for Ruby based on statemachine
88
+ summary: MINT-Statemachine-1.4.0 - Statemachine Library for Ruby based on statemachine
89
89
  from http://slagyr.github.com/statemachine http://www.multi-access.de/open-source-software/third-party-software-extensions/
90
90
  test_files:
91
91
  - spec/default_transition_spec.rb