statesman 1.0.0.beta2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5acbb511b8785176c360bef3aa219e6032f04cea
4
- data.tar.gz: a3e42e31f916ce396904a0e5dc7a687643ee124a
3
+ metadata.gz: f0139bf848dacbe81fcca09b0efcbe931d773125
4
+ data.tar.gz: ef0b4400a4629ed4bebf641e5161e17b27901485
5
5
  SHA512:
6
- metadata.gz: 9df0ba4a9e60e6f9eab79a028d580f59f19b95cf8de5a95ca27b496f0ead46634b12160c3bb6984eee5ed4b9d763360a71172cee48159d15bb42987902291828
7
- data.tar.gz: 81796ee3bae3a594dedb93ad2c9d45793e955ca96501a3221de013d74d9ba8816889c7a219071b4660e2a8aaf9301f2f7c6759727d366e4d792a53b595dd5197
6
+ metadata.gz: 514b488888819643db51e1618b2109d6150aab9b4aa2bd7b5f21ac324523a0a4facc6a442e99ef7d486199bc140b9dc53eaa0d1ff0ffa5ed49fb988ac5d1dc06
7
+ data.tar.gz: 293d1464c01cb538666dc1f84393054209cbd6f0f243e48945bcf8d023b9076b0767805dcb89cf9017b1be23be80bc314e8442fff8c4e6131c891cb103b1d16c
data/.rubocop.yml CHANGED
@@ -10,9 +10,6 @@ AllCops:
10
10
  StringLiterals:
11
11
  Enabled: false
12
12
 
13
- LineEndConcatenation:
14
- Enabled: false
15
-
16
13
  Documentation:
17
14
  Enabled: false
18
15
 
@@ -24,6 +21,9 @@ MethodLength:
24
21
  CountComments: false # count full line comments?
25
22
  Max: 15
26
23
 
24
+ AbcSize:
25
+ Max: 25
26
+
27
27
  # Don't require utf-8 encoding comment
28
28
  Encoding:
29
29
  Enabled: false
data/README.md CHANGED
@@ -5,6 +5,8 @@ A statesmanlike state machine library for Ruby 1.9.3 and 2.0.
5
5
  [![Gem Version](https://badge.fury.io/rb/statesman.png)](http://badge.fury.io/rb/statesman)
6
6
  [![Build Status](https://travis-ci.org/gocardless/statesman.png?branch=master)](https://travis-ci.org/gocardless/statesman)
7
7
  [![Code Climate](https://codeclimate.com/github/gocardless/statesman.png)](https://codeclimate.com/github/gocardless/statesman)
8
+ [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/gocardless/statesman?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
9
+
8
10
 
9
11
  Statesman is a little different from other state machine libraries which tack
10
12
  state behaviour directly onto a model. A statesman state machine is defined as a
@@ -28,7 +28,7 @@ module Statesman
28
28
  create_transition(from, to, metadata)
29
29
  rescue ::ActiveRecord::RecordNotUnique => e
30
30
  if e.message.include?('sort_key') &&
31
- e.message.include?(@transition_class.table_name)
31
+ e.message.include?(@transition_class.table_name)
32
32
  raise TransitionConflictError, e.message
33
33
  else raise
34
34
  end
@@ -27,7 +27,7 @@ module Statesman
27
27
  private
28
28
 
29
29
  def transition_class
30
- raise NotImplementedError, "A transition_class method should be " +
30
+ raise NotImplementedError, "A transition_class method should be " \
31
31
  "defined on the model"
32
32
  end
33
33
 
@@ -28,9 +28,9 @@ module Statesman
28
28
 
29
29
  def matches(from, to)
30
30
  matches_all_transitions ||
31
- matches_to_state(from, to) ||
32
- matches_from_state(from, to) ||
33
- matches_both_states(from, to)
31
+ matches_to_state(from, to) ||
32
+ matches_from_state(from, to) ||
33
+ matches_both_states(from, to)
34
34
  end
35
35
 
36
36
  def matches_all_transitions
@@ -162,7 +162,7 @@ module Statesman
162
162
 
163
163
  def validate_initial_state(state)
164
164
  unless initial_state.nil?
165
- raise InvalidStateError, "Cannot set initial state to '#{state}', " +
165
+ raise InvalidStateError, "Cannot set initial state to '#{state}', " \
166
166
  "already defined as #{initial_state}."
167
167
  end
168
168
  end
@@ -182,8 +182,8 @@ module Statesman
182
182
  })
183
183
  @object = object
184
184
  @transition_class = options[:transition_class]
185
- @storage_adapter = adapter_class(@transition_class)
186
- .new(@transition_class, object, self)
185
+ @storage_adapter = adapter_class(@transition_class).new(
186
+ @transition_class, object, self)
187
187
  send(:after_initialize) if respond_to? :after_initialize
188
188
  end
189
189
 
@@ -1,3 +1,3 @@
1
1
  module Statesman
2
- VERSION = "1.0.0.beta2"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -18,8 +18,8 @@ class MyActiveRecordModel < ActiveRecord::Base
18
18
  has_many :my_active_record_model_transitions
19
19
 
20
20
  def state_machine
21
- @state_machine ||= MyStateMachine
22
- .new(self, transition_class: MyActiveRecordModelTransition)
21
+ @state_machine ||= MyStateMachine.new(
22
+ self, transition_class: MyActiveRecordModelTransition)
23
23
  end
24
24
  end
25
25
 
data/statesman.gemspec CHANGED
@@ -21,10 +21,10 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "rspec", "~> 3.1"
24
- spec.add_development_dependency "rspec-its", "~> 1.0"
24
+ spec.add_development_dependency "rspec-its", "~> 1.1"
25
25
  spec.add_development_dependency "guard-rspec", "~> 4.3"
26
- spec.add_development_dependency "rubocop", "~> 0.26"
27
- spec.add_development_dependency "guard-rubocop", "~> 1.1"
26
+ spec.add_development_dependency "rubocop", "~> 0.27"
27
+ spec.add_development_dependency "guard-rubocop", "~> 1.2"
28
28
  spec.add_development_dependency "sqlite3", "~> 1.3"
29
29
  spec.add_development_dependency "mongoid", "~> 4.0"
30
30
  spec.add_development_dependency "activerecord", "~> 4.1"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statesman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Marr
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-10 00:00:00.000000000 Z
12
+ date: 2014-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -59,14 +59,14 @@ dependencies:
59
59
  requirements:
60
60
  - - ~>
61
61
  - !ruby/object:Gem::Version
62
- version: '1.0'
62
+ version: '1.1'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: '1.0'
69
+ version: '1.1'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: guard-rspec
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -87,28 +87,28 @@ dependencies:
87
87
  requirements:
88
88
  - - ~>
89
89
  - !ruby/object:Gem::Version
90
- version: '0.26'
90
+ version: '0.27'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ~>
96
96
  - !ruby/object:Gem::Version
97
- version: '0.26'
97
+ version: '0.27'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: guard-rubocop
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - ~>
103
103
  - !ruby/object:Gem::Version
104
- version: '1.1'
104
+ version: '1.2'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - ~>
110
110
  - !ruby/object:Gem::Version
111
- version: '1.1'
111
+ version: '1.2'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: sqlite3
114
114
  requirement: !ruby/object:Gem::Requirement
@@ -240,9 +240,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
240
240
  version: '0'
241
241
  required_rubygems_version: !ruby/object:Gem::Requirement
242
242
  requirements:
243
- - - '>'
243
+ - - '>='
244
244
  - !ruby/object:Gem::Version
245
- version: 1.3.1
245
+ version: '0'
246
246
  requirements: []
247
247
  rubyforge_project:
248
248
  rubygems_version: 2.4.1
@@ -268,3 +268,4 @@ test_files:
268
268
  - spec/support/active_record.rb
269
269
  - spec/support/generators_shared_examples.rb
270
270
  - spec/support/mongoid.rb
271
+ has_rdoc: