golem_statemachine 1.1.0.pre2 → 1.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9e039578c647509b0da93ceab9dd5752eedf32f6
4
+ data.tar.gz: cb1dc3d4d48a8e3fcb0c1d39c25042e62801511c
5
+ SHA512:
6
+ metadata.gz: c65e76c7b42e8986f98cfe91aadbb14c1adbdf172ce35f7bd91f198afeda740b54ebdf5e2140d45ae3c59d650face545dbb770ed3b7f9035cbc2d75a0bf162a1
7
+ data.tar.gz: 0b0e81ac9697d06b4a7310253ce1e38df78139a5c3c5e3f80668d8c0e24b2d8ee92614011f0fa3380d917804dd4e081dbfea9c967de3f0fe5d12c6786d273337
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+ source "https://rubygems.org"
3
+
4
+ gemspec
5
+
6
+ group :development do
7
+ gem "activerecord"
8
+ gem "rake"
9
+ gem "test-unit"
10
+ gem "sqlite3"
11
+ end
@@ -0,0 +1,45 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ golem_statemachine (1.1.0.pre)
5
+ activesupport
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (5.1.2)
11
+ activesupport (= 5.1.2)
12
+ activerecord (5.1.2)
13
+ activemodel (= 5.1.2)
14
+ activesupport (= 5.1.2)
15
+ arel (~> 8.0)
16
+ activesupport (5.1.2)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (~> 0.7)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ arel (8.0.0)
22
+ concurrent-ruby (1.0.5)
23
+ i18n (0.8.6)
24
+ minitest (5.10.2)
25
+ power_assert (0.3.0)
26
+ rake (12.0.0)
27
+ sqlite3 (1.3.11)
28
+ test-unit (3.2.0)
29
+ power_assert
30
+ thread_safe (0.3.6)
31
+ tzinfo (1.2.3)
32
+ thread_safe (~> 0.1)
33
+
34
+ PLATFORMS
35
+ ruby
36
+
37
+ DEPENDENCIES
38
+ activerecord
39
+ golem_statemachine!
40
+ rake
41
+ sqlite3
42
+ test-unit
43
+
44
+ BUNDLED WITH
45
+ 1.13.7
@@ -1,7 +1,7 @@
1
1
  = Golem Statemachine
2
2
 
3
3
  Golem adds {Finite State Machine (FSM)}[http://en.wikipedia.org/wiki/Finite_state_machine] behaviour to Ruby classes.
4
- Basically, you get a nice DSL (domain-specific language) for defining the FSM rules, and some functionality to enforce
4
+ Basically, you get a nice DSL for defining the FSM rules, and some functionality to enforce
5
5
  those rules in your objects. Although Golem was designed specifically with ActiveRecord in mind, it should work with
6
6
  any Ruby object.
7
7
 
@@ -13,13 +13,13 @@ also includes the ability to automatically generate UML sequence diagrams from s
13
13
 
14
14
  ==== Contents
15
15
 
16
- 1. <b>Installation</b>
17
- 2. <b>A Trivial Example: The ON/OFF Switch</b>
18
- 3. <b>The DSL Syntax: A Tutorial</b>
19
- 4. <b>Using Golem with ActiveRecord</b>
20
- 5. <b>A Real-World Example: Seminar Registration</b>
21
- 6. <b>Multiple Statemachines in the Same Class/Model</b>
22
- 7. <b>Gollem vs. AASM</b>
16
+ 1. <b>{Installation}[https://github.com/zuk/golem_statemachine#1-installation]</b>
17
+ 2. <b>{A Trivial Example: The ON/OFF Switch}[https://github.com/zuk/golem_statemachine#2-a-trivial-example-the-onoff-switch]</b>
18
+ 3. <b>{The DSL Syntax: A Tutorial}[https://github.com/zuk/golem_statemachine#3-the-dsl-syntax-a-tutorial]</b>
19
+ 4. <b>{Using Golem with ActiveRecord}[https://github.com/zuk/golem_statemachine#4-using-golem-with-activerecord]</b>
20
+ 5. <b>{A Real-World Example: Seminar Registration}[https://github.com/zuk/golem_statemachine#5-a-real-world-example-seminar-registration]</b>
21
+ 6. <b>{Multiple Statemachines in the Same Class/Model}[https://github.com/zuk/golem_statemachine#6-multiple-statemachines-in-the-same-classmodel]</b>
22
+ 7. <b>{Gollem vs. AASM}[https://github.com/zuk/golem_statemachine#7-golem-vs-aasm]</b>
23
23
 
24
24
  == 1. Installation
25
25
 
@@ -71,7 +71,7 @@ A light switch is initially in an "off" state. When you flip the switch, it tran
71
71
 
72
72
  Here's the UML state machine diagram of an on/off switch:
73
73
 
74
- http://github.com/zuk/golem_statemachine/raw/master/examples/UML/on_off_switch_UML.png
74
+ {rdoc-image:http://roughest.net/golem_statemachine/on_off_switch_UML.png}[http://roughest.net/golem_statemachine/on_off_switch_UML.png]
75
75
 
76
76
  And here's what this looks like in Ruby code using Golem:
77
77
 
@@ -119,7 +119,7 @@ inside the <tt>define_statemachine</tt> block:
119
119
 
120
120
  Now to create some states:
121
121
 
122
- http://github.com/zuk/golem_statemachine/raw/master/examples/UML/monster_1_UML.png
122
+ {rdoc-image:http://roughest.net/golem_statemachine/monster_1_UML.png?raw=true}[http://roughest.net/golem_statemachine/monster_1_UML.png]
123
123
 
124
124
  class Monster
125
125
  include Golem
@@ -132,7 +132,7 @@ http://github.com/zuk/golem_statemachine/raw/master/examples/UML/monster_1_UML.p
132
132
 
133
133
  And an event:
134
134
 
135
- http://github.com/zuk/golem_statemachine/raw/master/examples/UML/monster_2_UML.png
135
+ {rdoc-image:http://roughest.net/golem_statemachine/monster_2_UML.png?raw=true}[http://roughest.net/golem_statemachine/monster_2_UML.png]
136
136
 
137
137
  class Monster
138
138
  include Golem
@@ -151,7 +151,7 @@ The block for each state describes what will happen when a given event occurs. I
151
151
 
152
152
  Now to make things a bit more interesting:
153
153
 
154
- http://github.com/zuk/golem_statemachine/raw/master/examples/UML/monster_3_UML.png
154
+ {rdoc-image:http://roughest.net/golem_statemachine/monster_3_UML.png?raw=true}[http://roughest.net/golem_statemachine/monster_3_UML.png]
155
155
 
156
156
  class Monster
157
157
  include Golem
@@ -207,7 +207,7 @@ Finally, every state can have an <tt>enter</tt> and <tt>exit</tt> action that wi
207
207
  is entered or exited. This can be a block, a callback method (as a Symbol), or a Proc/lambda. Also, in the interest
208
208
  of leaner code, we rewrite things using more compact syntax:
209
209
 
210
- http://github.com/zuk/golem_statemachine/raw/master/examples/UML/monster_4_UML.png
210
+ {rdoc-image:http://roughest.net/golem_statemachine/monster_4_UML.png?raw=true}[http://roughest.net/golem_statemachine/monster_4_UML.png]
211
211
 
212
212
  class Monster
213
213
  include Golem
@@ -273,7 +273,8 @@ from {Scott W. Ambler's primer on UML2 State Machine Diagrams}[http://www.agilem
273
273
 
274
274
  The UML state machine diagram:
275
275
 
276
- http://github.com/zuk/golem_statemachine/raw/master/examples/UML/seminar_enrollment_UML.png
276
+
277
+ {rdoc-image:http://roughest.net/golem_statemachine/seminar_enrollment_UML.png?raw=true}[http://roughest.net/golem_statemachine/seminar_enrollment_UML.png]
277
278
 
278
279
  The Ruby implementation (see blow for discussion):
279
280
 
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
- require 'rake/rdoctask'
3
+ require 'rdoc/task'
4
4
 
5
5
  desc 'Default: run unit tests.'
6
6
  task :default => :test
@@ -14,7 +14,7 @@ Rake::TestTask.new(:test) do |t|
14
14
  end
15
15
 
16
16
  desc 'Generate documentation for the golem_statemachine plugin.'
17
- Rake::RDocTask.new(:rdoc) do |rdoc|
17
+ RDoc::Task.new do |rdoc|
18
18
  rdoc.rdoc_dir = 'rdoc'
19
19
  rdoc.title = 'GolemStatemachine'
20
20
  rdoc.options << '--line-numbers' << '--inline-source'
@@ -1,7 +1,7 @@
1
1
 
2
2
  $gemspec = Gem::Specification.new do |s|
3
3
  s.name = 'golem_statemachine'
4
- s.version = '1.1.0.pre2'
4
+ s.version = '1.1.1'
5
5
  s.authors = ["Matt Zukowski"]
6
6
  s.email = ["matt@roughest.net"]
7
7
  s.homepage = 'http://github.com/zuk/golem_statemachine'
@@ -43,7 +43,7 @@ module Golem
43
43
  def define_statemachine(statemachine_name = nil, options = {}, &block)
44
44
  default_statemachine_name = :statemachine
45
45
 
46
- class_inheritable_hash(:statemachines) unless respond_to?(:statemachines)
46
+ class_attribute :statemachines unless respond_to?(:statemachines)
47
47
  self.statemachines ||= {}
48
48
 
49
49
  if statemachines.has_key?(statemachine_name || default_statemachine_name)
@@ -98,7 +98,7 @@ module Golem
98
98
  state ||= statemachine.initial_state
99
99
  state = state.to_sym if state.is_a?(String)
100
100
 
101
- raise InvalidStateError, "#{state} is in an unrecognized state (#{state.inspect})" unless statemachine.states[state]
101
+ raise InvalidStateError, "#{self} is in an unrecognized state (#{state.inspect})" unless statemachine.states[state]
102
102
 
103
103
  state = statemachine.states[state].name
104
104
 
@@ -2,10 +2,8 @@ require 'test_helper'
2
2
  require 'statemachine_assertions'
3
3
  require File.dirname(__FILE__)+'/../lib/golem'
4
4
 
5
- # Because Monster has two statemachines, 'affect' and 'mouth', this test
6
- # allows for validating statemachine behaviour when there are multiple
7
- # statemachines defined within the same class.
8
- class MonsterTest < Test::Unit::TestCase
5
+
6
+ class DslTest < Test::Unit::TestCase
9
7
  include StatemachineAssertions
10
8
 
11
9
  def setup
metadata CHANGED
@@ -1,47 +1,42 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: golem_statemachine
3
- version: !ruby/object:Gem::Version
4
- prerelease: true
5
- segments:
6
- - 1
7
- - 1
8
- - 0
9
- - pre2
10
- version: 1.1.0.pre2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Matt Zukowski
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2012-02-13 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2017-07-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: activesupport
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
26
17
  - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
31
20
  type: :runtime
32
- version_requirements: *id001
33
- description: Adds finite state machine behaviour to Ruby classes. Meant as an alternative to acts_as_state_machine/AASM.
34
- email:
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Adds finite state machine behaviour to Ruby classes. Meant as an alternative
28
+ to acts_as_state_machine/AASM.
29
+ email:
35
30
  - matt@roughest.net
36
31
  executables: []
37
-
38
32
  extensions: []
39
-
40
- extra_rdoc_files:
33
+ extra_rdoc_files:
41
34
  - README.rdoc
42
35
  - MIT-LICENSE
43
- files:
44
- - .gitignore
36
+ files:
37
+ - ".gitignore"
38
+ - Gemfile
39
+ - Gemfile.lock
45
40
  - MIT-LICENSE
46
41
  - README.rdoc
47
42
  - Rakefile
@@ -81,45 +76,36 @@ files:
81
76
  - test/statemachine_assertions.rb
82
77
  - test/test_helper.rb
83
78
  - uninstall.rb
84
- has_rdoc: true
85
79
  homepage: http://github.com/zuk/golem_statemachine
86
80
  licenses: []
87
-
81
+ metadata: {}
88
82
  post_install_message:
89
- rdoc_options:
90
- - --quiet
91
- - --title
83
+ rdoc_options:
84
+ - "--quiet"
85
+ - "--title"
92
86
  - Golem Statmeachine Docs
93
- - --opname
87
+ - "--opname"
94
88
  - index.html
95
- - --line-numbers
96
- - --main
89
+ - "--line-numbers"
90
+ - "--main"
97
91
  - README.rdoc
98
- - --inline-source
99
- require_paths:
92
+ - "--inline-source"
93
+ require_paths:
100
94
  - lib
101
- required_ruby_version: !ruby/object:Gem::Requirement
102
- requirements:
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
103
102
  - - ">="
104
- - !ruby/object:Gem::Version
105
- segments:
106
- - 0
107
- version: "0"
108
- required_rubygems_version: !ruby/object:Gem::Requirement
109
- requirements:
110
- - - ">"
111
- - !ruby/object:Gem::Version
112
- segments:
113
- - 1
114
- - 3
115
- - 1
116
- version: 1.3.1
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
117
105
  requirements: []
118
-
119
106
  rubyforge_project:
120
- rubygems_version: 1.3.6
107
+ rubygems_version: 2.4.5.1
121
108
  signing_key:
122
- specification_version: 3
109
+ specification_version: 4
123
110
  summary: Adds finite state machine behaviour to Ruby classes.
124
111
  test_files: []
125
-