statemachine 2.0.1 → 2.1.0

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/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use ruby-1.9.2-p290@statemachine
1
+ rvm use ruby-1.9.3-p194@statemachine --create
data/CHANGES CHANGED
@@ -1,5 +1,14 @@
1
1
  = Statemachine Changelog
2
2
 
3
+ == Version 2.1.0
4
+
5
+ * Do not perform transitions if context method returns false | by @zombor (https://github.com/slagyr/statemachine/pull/11)
6
+
7
+ == Version 2.0.1
8
+
9
+ * initialize ivars so that runtimes running with -d don't complain about uninitialized ivars (chuckremes)
10
+ * updated to use Bundler and Rspec 2 (ericmeyer)
11
+
3
12
  == Version 1.1.0
4
13
 
5
14
  DotGraph
data/Gemfile CHANGED
@@ -2,5 +2,5 @@ source :rubygems
2
2
 
3
3
  group :development do
4
4
  gem 'rake'
5
- gem 'rspec', "1.3.0"
5
+ gem 'rspec', ">= 2.0.0"
6
6
  end
data/Gemfile.lock CHANGED
@@ -1,12 +1,20 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ diff-lcs (1.1.3)
4
5
  rake (0.9.2)
5
- rspec (1.3.0)
6
+ rspec (2.12.0)
7
+ rspec-core (~> 2.12.0)
8
+ rspec-expectations (~> 2.12.0)
9
+ rspec-mocks (~> 2.12.0)
10
+ rspec-core (2.12.1)
11
+ rspec-expectations (2.12.0)
12
+ diff-lcs (~> 1.1.3)
13
+ rspec-mocks (2.12.0)
6
14
 
7
15
  PLATFORMS
8
16
  ruby
9
17
 
10
18
  DEPENDENCIES
11
19
  rake
12
- rspec (= 1.3.0)
20
+ rspec (>= 2.0.0)
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake/gempackagetask'
4
4
  require 'rake/clean'
5
5
  require 'rake/rdoctask'
6
- require 'spec/rake/spectask'
6
+ require 'rspec/core/rake_task'
7
7
  require 'statemachine'
8
8
  require "bundler/gem_tasks"
9
9
 
@@ -19,10 +19,8 @@ PKG_FILES = FileList[
19
19
 
20
20
  task :default => :spec
21
21
 
22
- desc "Run all specs"
23
- Spec::Rake::SpecTask.new do |t|
24
- t.spec_files = FileList['spec/**/*_spec.rb']
25
- end
22
+ RSpec::Core::RakeTask.new(:spec)
23
+
26
24
 
27
25
  WEB_ROOT = File.expand_path('~/Projects/slagyr.github.com/statemachine/')
28
26
 
@@ -17,12 +17,19 @@ module Statemachine
17
17
  exits, entries = exits_and_entries(origin, destination)
18
18
  exits.each { |exited_state| exited_state.exit(args) }
19
19
 
20
- origin.statemachine.invoke_action(@action, args, "transition action from #{origin} invoked by '#{@event}' event") if @action
20
+ if @action
21
+ result = origin.statemachine.invoke_action(@action, args, "transition action from #{origin} invoked by '#{@event}' event") if @action
22
+ transition = !(result === false)
23
+ else
24
+ transition = true
25
+ end
21
26
 
22
- terminal_state = entries.last
23
- terminal_state.activate if terminal_state
27
+ if transition
28
+ terminal_state = entries.last
29
+ terminal_state.activate if terminal_state
24
30
 
25
- entries.each { |entered_state| entered_state.enter(args) }
31
+ entries.each { |entered_state| entered_state.enter(args) }
32
+ end
26
33
  end
27
34
 
28
35
  def exits_and_entries(origin, destination)
@@ -61,4 +68,4 @@ module Statemachine
61
68
 
62
69
  end
63
70
 
64
- end
71
+ end
@@ -2,8 +2,8 @@ module Statemachine
2
2
  module VERSION #:nodoc:
3
3
  unless defined? MAJOR
4
4
  MAJOR = 2
5
- MINOR = 0
6
- TINY = 1
5
+ MINOR = 1
6
+ TINY = 0
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
9
9
  TAG = "REL_" + [MAJOR, MINOR, TINY].join('_')
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  $:.unshift(File.dirname(__FILE__) + '/../lib')
2
2
  require 'rubygems'
3
- require 'spec'
3
+ require 'rspec'
4
4
  require 'statemachine'
5
5
 
6
6
  $IS_TEST = true
@@ -33,12 +33,12 @@ module TurnstileStatemachine
33
33
  @alarm_status = false
34
34
  @thankyou_status = false
35
35
  @lock = "@locked = true"
36
- @unlock = "@locked = false"
36
+ @unlock = "@locked = false; nil"
37
37
  @alarm = "@alarm_status = true"
38
38
  @thankyou = "@thankyou_status = true"
39
39
 
40
40
  @sm = Statemachine.build do
41
- trans :locked, :coin, :unlocked, "@locked = false"
41
+ trans :locked, :coin, :unlocked, "@locked = false; nil"
42
42
  trans :unlocked, :pass, :locked, "@locked = true"
43
43
  trans :locked, :pass, :locked, "@alarm_status = true"
44
44
  trans :unlocked, :coin, :locked, "@thankyou_status = true"
metadata CHANGED
@@ -1,34 +1,24 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: statemachine
3
- version: !ruby/object:Gem::Version
4
- hash: 13
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.0
5
5
  prerelease:
6
- segments:
7
- - 2
8
- - 0
9
- - 1
10
- version: 2.0.1
11
6
  platform: ruby
12
- authors:
13
- - "'Micah Micah'"
7
+ authors:
8
+ - ! '''Micah Micah'''
14
9
  autorequire: statemachine
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-02 00:00:00 +01:00
19
- default_executable:
12
+ date: 2012-12-13 00:00:00.000000000 Z
20
13
  dependencies: []
21
-
22
- description: Statemachine is a ruby library for building Finite State Machines (FSM), also known as Finite State Automata (FSA).
23
- email:
24
- - "'micah@8thlight.com'"
14
+ description: Statemachine is a ruby library for building Finite State Machines (FSM),
15
+ also known as Finite State Automata (FSA).
16
+ email:
17
+ - ! '''micah@8thlight.com'''
25
18
  executables: []
26
-
27
19
  extensions: []
28
-
29
20
  extra_rdoc_files: []
30
-
31
- files:
21
+ files:
32
22
  - .gitignore
33
23
  - .rvmrc
34
24
  - CHANGES
@@ -192,41 +182,31 @@ files:
192
182
  - spec/spec_helper.rb
193
183
  - spec/transition_spec.rb
194
184
  - statemachine.gemspec
195
- has_rdoc: true
196
185
  homepage: http://statemachine.rubyforge.org
197
186
  licenses: []
198
-
199
187
  post_install_message:
200
188
  rdoc_options: []
201
-
202
- require_paths:
189
+ require_paths:
203
190
  - lib
204
- required_ruby_version: !ruby/object:Gem::Requirement
191
+ required_ruby_version: !ruby/object:Gem::Requirement
205
192
  none: false
206
- requirements:
207
- - - ">="
208
- - !ruby/object:Gem::Version
209
- hash: 3
210
- segments:
211
- - 0
212
- version: "0"
213
- required_rubygems_version: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ! '>='
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
197
+ required_rubygems_version: !ruby/object:Gem::Requirement
214
198
  none: false
215
- requirements:
216
- - - ">="
217
- - !ruby/object:Gem::Version
218
- hash: 3
219
- segments:
220
- - 0
221
- version: "0"
199
+ requirements:
200
+ - - ! '>='
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
222
203
  requirements: []
223
-
224
204
  rubyforge_project: statemachine
225
- rubygems_version: 1.6.2
205
+ rubygems_version: 1.8.24
226
206
  signing_key:
227
207
  specification_version: 3
228
- summary: Statemachine-2.0.1 - Statemachine Library for Ruby http://slagyr.github.com/statemachine
229
- test_files:
208
+ summary: Statemachine-2.1.0 - Statemachine Library for Ruby http://slagyr.github.com/statemachine
209
+ test_files:
230
210
  - spec/action_invokation_spec.rb
231
211
  - spec/builder_spec.rb
232
212
  - spec/default_transition_spec.rb