state_jacket 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a1c5c0ff06fe58828c8984d5fad9dd05037efe01
4
+ data.tar.gz: 920fc4959884ca82671059d467ea32bf7dfdb6fa
5
+ SHA512:
6
+ metadata.gz: 6773afef2dd5fce13ac220f6b412f378a23346dda5794b44e8be28f2ccb28ffa842e9d2daffc8e91c2f105ec0b71ca56dd018db82d5836eb8fcee93416797c1a
7
+ data.tar.gz: c3fb9ffb3c98b38f075f4c3d158a6ab547cae5f348f111e48317d971d227d0866441f81cda4d84bad64d2e8b9711986847a3f5af953e466bf515885d0d1ae829
data/Gemfile.lock CHANGED
@@ -1,35 +1,61 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- state_jacket (0.1.0)
4
+ state_jacket (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- binding_of_caller (0.7.1)
9
+ binding_of_caller (0.7.2)
10
10
  debug_inspector (>= 0.0.1)
11
- coderay (1.0.9)
11
+ coderay (1.1.0)
12
+ coveralls (0.7.2)
13
+ multi_json (~> 1.3)
14
+ rest-client (= 1.6.7)
15
+ simplecov (>= 0.7)
16
+ term-ansicolor (= 1.2.2)
17
+ thor (= 0.18.1)
12
18
  debug_inspector (0.0.2)
13
- method_source (0.8.1)
14
- micro_test (0.3.5)
15
- os
19
+ docile (1.1.5)
20
+ interception (0.5)
21
+ method_source (0.8.2)
22
+ mime-types (2.4.3)
23
+ multi_json (1.10.1)
16
24
  os (0.9.6)
17
- pry (0.9.12)
18
- coderay (~> 1.0.5)
19
- method_source (~> 0.8)
25
+ pry (0.10.1)
26
+ coderay (~> 1.1.0)
27
+ method_source (~> 0.8.1)
20
28
  slop (~> 3.4)
21
- pry-stack_explorer (0.4.9)
29
+ pry-rescue (1.4.1)
30
+ interception (>= 0.5)
31
+ pry
32
+ pry-stack_explorer (0.4.9.1)
22
33
  binding_of_caller (>= 0.7)
23
- pry (~> 0.9.11)
24
- rake (10.0.4)
25
- slop (3.4.4)
34
+ pry (>= 0.9.11)
35
+ pry-test (0.5.5)
36
+ os
37
+ rake (10.4.2)
38
+ rest-client (1.6.7)
39
+ mime-types (>= 1.16)
40
+ simplecov (0.9.1)
41
+ docile (~> 1.1.0)
42
+ multi_json (~> 1.0)
43
+ simplecov-html (~> 0.8.0)
44
+ simplecov-html (0.8.0)
45
+ slop (3.6.0)
46
+ term-ansicolor (1.2.2)
47
+ tins (~> 0.8)
48
+ thor (0.18.1)
49
+ tins (0.13.2)
26
50
 
27
51
  PLATFORMS
28
52
  ruby
29
53
 
30
54
  DEPENDENCIES
31
- micro_test
55
+ coveralls
32
56
  pry
57
+ pry-rescue
33
58
  pry-stack_explorer
59
+ pry-test
34
60
  rake
35
61
  state_jacket!
data/README.md CHANGED
@@ -1,8 +1,11 @@
1
- # StateJacket
1
+ [![Lines of Code](http://img.shields.io/badge/lines_of_code-60-brightgreen.svg?style=flat)](http://blog.codinghorror.com/the-best-code-is-no-code-at-all/)
2
+ [![Code Status](http://img.shields.io/codeclimate/github/hopsoft/state_jacket.svg?style=flat)](https://codeclimate.com/github/hopsoft/state_jacket)
3
+ [![Dependency Status](http://img.shields.io/gemnasium/hopsoft/state_jacket.svg?style=flat)](https://gemnasium.com/hopsoft/state_jacket)
4
+ [![Build Status](http://img.shields.io/travis/hopsoft/state_jacket.svg?style=flat)](https://travis-ci.org/hopsoft/state_jacket)
5
+ [![Coverage Status](https://img.shields.io/coveralls/hopsoft/state_jacket.svg?style=flat)](https://coveralls.io/r/hopsoft/state_jacket?branch=master)
6
+ [![Downloads](http://img.shields.io/gem/dt/state_jacket.svg?style=flat)](http://rubygems.org/gems/state_jacket)
2
7
 
3
- [![Build Status](https://travis-ci.org/hopsoft/state_jacket.png)](https://travis-ci.org/hopsoft/state_jacket)
4
- [![Dependency Status](https://gemnasium.com/hopsoft/state_jacket.png)](https://gemnasium.com/hopsoft/state_jacket)
5
- [![Code Climate](https://codeclimate.com/github/hopsoft/state_jacket.png)](https://codeclimate.com/github/hopsoft/state_jacket)
8
+ # StateJacket
6
9
 
7
10
  ## An Intuitive [State Transition System](http://en.wikipedia.org/wiki/State_transition_system)
8
11
 
@@ -13,14 +16,14 @@ StateJacket simplifies things by isolating the management of states & transition
13
16
  Events are left out, making it much easier to reason about what states exist
14
17
  and how they transition to other states.
15
18
 
16
- *The examples below are somewhat contrived, but should clearly illustrate the usage.*
19
+ *The examples below are somewhat contrived, but should clearly illustrate usage.*
17
20
 
18
21
  ## The Basics
19
22
 
20
23
  #### Install
21
24
 
22
- ```
23
- $ gem install state_jacket
25
+ ```sh
26
+ gem install state_jacket
24
27
  ```
25
28
 
26
29
  #### Define states & transitions for a simple [turnstyle](http://en.wikipedia.org/wiki/Finite-state_machine#Example:_a_turnstile).
data/Rakefile CHANGED
@@ -4,9 +4,6 @@ task :default => [:test]
4
4
 
5
5
  desc "Runs the test suite."
6
6
  task :test do
7
- ENV["TEST"] = "1"
8
- output = `bundle exec mt`
9
- puts output
10
- exit output.index(/tests\sfinished.*failed/).nil?
7
+ exec "bundle exec pry-test --disable-pry"
11
8
  end
12
9
 
@@ -1,3 +1,3 @@
1
1
  module StateJacket
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/test/catalog_test.rb CHANGED
@@ -1,7 +1,10 @@
1
- require "micro_test"
1
+ require "pry-test"
2
+ require "coveralls"
3
+ Coveralls.wear!
4
+ SimpleCov.command_name "pry-test"
2
5
  require_relative "../lib/state_jacket/catalog"
3
6
 
4
- class CatalogTest < MicroTest::Test
7
+ class CatalogTest < PryTest::Test
5
8
  before do
6
9
  @catalog = StateJacket::Catalog.new
7
10
  end
@@ -12,46 +15,65 @@ class CatalogTest < MicroTest::Test
12
15
  end
13
16
 
14
17
  test "terminators" do
15
- @catalog.add :start
16
- assert @catalog.terminators.include?("start")
18
+ @catalog.add :start => [:finish]
19
+ @catalog.add :finish
20
+ @catalog.lock
21
+ assert @catalog.terminators == ["finish"]
22
+ end
23
+
24
+ test "terminator" do
25
+ @catalog.add :start => [:finish]
26
+ @catalog.add :finish
27
+ @catalog.lock
28
+ assert @catalog.terminator?(:finish)
17
29
  end
18
30
 
19
31
  test "transitioners" do
20
32
  @catalog.add :start => [:finish]
33
+ @catalog.add :finish
34
+ @catalog.lock
21
35
  assert @catalog.transitioners == ["start"]
22
36
  end
23
37
 
38
+ test "transitioner" do
39
+ @catalog.add :start => [:finish]
40
+ @catalog.add :finish
41
+ @catalog.lock
42
+ assert @catalog.transitioner?(:start)
43
+ end
44
+
24
45
  test "can transition" do
25
46
  @catalog.add :start => [:finish]
47
+ @catalog.add :finish
48
+ @catalog.lock
26
49
  assert @catalog.can_transition?(:start => :finish)
27
50
  end
28
51
 
29
52
  test "supports state" do
30
53
  @catalog.add :start => [:finish]
54
+ @catalog.add :finish
55
+ @catalog.lock
31
56
  assert @catalog.supports_state?(:start)
57
+ assert @catalog.supports_state?(:finish)
32
58
  end
33
59
 
34
60
  test "lock failure" do
35
61
  @catalog.add :start => [:finish]
36
- error = nil
37
62
  begin
38
63
  @catalog.lock
39
- rescue Exception => ex
40
- error = ex
64
+ rescue Exception => e
41
65
  end
42
- assert error.message.start_with?("Invalid StateJacket::Catalog!")
66
+ assert e.message.start_with?("Invalid StateJacket::Catalog!")
43
67
  end
44
68
 
45
69
  test "lock success" do
46
70
  @catalog.add :start => [:finish]
47
71
  @catalog.add :finish
48
- error = nil
49
72
  begin
50
73
  @catalog.lock
51
- rescue Exception => ex
52
- error = ex
74
+ rescue Exception => e
53
75
  end
54
- assert error.nil?
76
+ assert e.nil?
55
77
  end
56
78
 
57
79
  test "symbol state" do
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: state_jacket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nathan Hopkins
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-18 00:00:00.000000000 Z
11
+ date: 2014-12-18 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
- name: micro_test
28
+ name: pry
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
- name: pry
42
+ name: pry-test
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
- name: pry-stack_explorer
56
+ name: coveralls
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: Intuitively define state machine like states and transitions.
@@ -82,45 +73,39 @@ executables: []
82
73
  extensions: []
83
74
  extra_rdoc_files: []
84
75
  files:
85
- - lib/state_jacket/catalog.rb
86
- - lib/state_jacket/version.rb
87
- - lib/state_jacket.rb
88
76
  - Gemfile
89
77
  - Gemfile.lock
90
78
  - LICENSE.txt
91
- - Rakefile
92
79
  - README.md
80
+ - Rakefile
81
+ - lib/state_jacket.rb
82
+ - lib/state_jacket/catalog.rb
83
+ - lib/state_jacket/version.rb
93
84
  - test/catalog_test.rb
94
85
  homepage: https://github.com/hopsoft/state_jacket
95
86
  licenses:
96
87
  - MIT
88
+ metadata: {}
97
89
  post_install_message:
98
90
  rdoc_options: []
99
91
  require_paths:
100
92
  - lib
101
93
  required_ruby_version: !ruby/object:Gem::Requirement
102
- none: false
103
94
  requirements:
104
- - - ! '>='
95
+ - - ">="
105
96
  - !ruby/object:Gem::Version
106
97
  version: '0'
107
- segments:
108
- - 0
109
- hash: 1285070953252627057
110
98
  required_rubygems_version: !ruby/object:Gem::Requirement
111
- none: false
112
99
  requirements:
113
- - - ! '>='
100
+ - - ">="
114
101
  - !ruby/object:Gem::Version
115
102
  version: '0'
116
- segments:
117
- - 0
118
- hash: 1285070953252627057
119
103
  requirements: []
120
104
  rubyforge_project:
121
- rubygems_version: 1.8.25
105
+ rubygems_version: 2.2.2
122
106
  signing_key:
123
- specification_version: 3
107
+ specification_version: 4
124
108
  summary: Intuitively define state machine like states and transitions.
125
109
  test_files:
126
110
  - test/catalog_test.rb
111
+ has_rdoc: