microfsm 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: f001afae7bd77ec4b88a0d8e4d1ff5cab0c3f0ee03f3db230fb2e6ae9124b47b
4
- data.tar.gz: ed4b2860cca3cfe1b8f1f135a4180c77d2da8c2a6013191dfe60ea11c0dc74ec
3
+ metadata.gz: 50fe926fce3c8dbbf1d292a87c9b7e5fe2704a1e9b1f46bda0789654d3833b55
4
+ data.tar.gz: 363d50112d184a3a7c4c7f7698a48318377091d9001ac0afa2bb545973943293
5
5
  SHA512:
6
- metadata.gz: 59659548f32f60823744f452cad8ebb4a5d2a193d2fc63c37978844056ac89f7592e95d32ac4da12bf5571fb8e6302415952c455b8a8d8cbcfab8764f5eb55f8
7
- data.tar.gz: ca69ff6bf93b10d190b522998091474288e56ae2b8569010b558ecf206d7235f02a72f6a1f00ade1bd68fe8d934d8f0e0d6886e3bdd796e69e55785a48012fb2
6
+ metadata.gz: 3b33f83aae371a7158cac6d858228a3c754cfad2817d7e800290f03f7f618708e051264ee8b1e580115c019dc93d085e733027d33df0d45bc772be238ff6de93
7
+ data.tar.gz: 97f593eb80c36b86cbcb4e6d08f953e4f39d8f63ae7a2d020513926876e613efb5512d4df1986f54fb876873a1554fd918ab5f29169b51411dcb340653f67624
@@ -0,0 +1,24 @@
1
+ name: Rake
2
+
3
+ #on: [push, pull_request]
4
+ on: [push]
5
+
6
+ jobs:
7
+ test:
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ # os: [ubuntu-latest, macos-latest]
12
+ os: [ubuntu-latest]
13
+ # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
14
+ # ruby: [2.5, 2.6, 2.7, '3.0', head, jruby, jruby-head, truffleruby, truffleruby-head]
15
+ ruby: [2.7]
16
+ runs-on: ${{ matrix.os }}
17
+
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby }}
23
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
24
+ - run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  inherit_from:
2
- - ~/configs/.rubocop.yml
2
+ - '~/configs/.rubocop.yml'
3
3
 
4
4
  AllCops:
5
+ NewCops: enable
5
6
  Include:
6
7
  - 'lib/**/*.rb'
7
8
 
data/.watchr CHANGED
@@ -1,3 +1,4 @@
1
+ TESTING = %w[test]
1
2
  HH = '#' * 22 unless defined?(HH)
2
3
  H = '#' * 5 unless defined?(H)
3
4
 
@@ -16,36 +17,37 @@ end
16
17
 
17
18
  def run_it(type, file)
18
19
  case type
19
- when 'test'; run %Q(ruby -I"lib:test" -r rubygems #{file})
20
+ when 'test'; run %(bundle exec ruby -I test #{file})
21
+ # when 'spec'; run %(rspec -X #{file})
20
22
  else; puts "#{H} unknown type: #{type}, file: #{file}"
21
23
  end
22
24
  end
23
25
 
24
26
  def run_all_tests
25
27
  puts "\n#{HH} Running all tests #{HH}\n"
26
- %w[test].each { |dir| run "rake #{dir}" if File.exist?(dir) }
28
+ TESTING.each { |dir| run "bundle exec rake #{dir}" if File.exist?(dir) }
27
29
  end
28
30
 
29
31
  def run_matching_files(base)
30
32
  base = base.split('_').first
31
- %w[test spec].each { |type|
33
+ TESTING.each { |type|
32
34
  files = Dir["#{type}/**/*.rb"].select { |file| file =~ /#{base}_.*\.rb/ }
33
35
  run_it type, files.join(' ') unless files.empty?
34
36
  }
35
37
  end
36
38
 
37
- %w[test spec].each { |type|
39
+ TESTING.each { |type|
38
40
  watch("#{type}/#{type}_helper\.rb") { run_all_tests }
41
+ watch('lib/.*\.rb') { run_all_tests }
39
42
  watch("#{type}/.*/*_#{type}\.rb") { |match| run_it type, match[0] }
40
43
  watch("#{type}/data/(.*)\.rb") { |match|
41
44
  m1 = match[1]
42
45
  run_matching_files("#{type}/#{m1}/#{m1}_#{type}.rb")
43
46
  }
44
47
  }
48
+
45
49
  %w[rb erb haml slim].each { |type|
46
- # watch("app/.*/(.*)\.#{type}") { |match|
47
50
  watch(".*/(.*)\.#{type}") { |match|
48
- p [11, match]
49
51
  run_matching_files(match[1])
50
52
  }
51
53
  }
data/Gemfile CHANGED
@@ -1,5 +1,4 @@
1
1
  source 'https://rubygems.org'
2
-
3
2
  gemspec
4
3
 
5
4
  group :test do
data/Gemfile.lock CHANGED
@@ -1,40 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- microfsm (0.0.2)
4
+ microfsm (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.2)
10
- docile (1.3.5)
11
- minitest (5.14.3)
10
+ docile (1.4.0)
11
+ minitest (5.14.4)
12
12
  observr (1.0.5)
13
13
  parallel (1.20.1)
14
- parser (3.0.0.0)
14
+ parser (3.0.1.1)
15
15
  ast (~> 2.4.1)
16
16
  rainbow (3.0.0)
17
17
  rake (13.0.3)
18
- regexp_parser (2.0.3)
19
- rexml (3.2.4)
20
- rubocop (1.9.1)
18
+ regexp_parser (2.1.1)
19
+ rexml (3.2.5)
20
+ rubocop (1.17.0)
21
21
  parallel (~> 1.10)
22
22
  parser (>= 3.0.0.0)
23
23
  rainbow (>= 2.2.2, < 4.0)
24
24
  regexp_parser (>= 1.8, < 3.0)
25
25
  rexml
26
- rubocop-ast (>= 1.2.0, < 2.0)
26
+ rubocop-ast (>= 1.7.0, < 2.0)
27
27
  ruby-progressbar (~> 1.7)
28
28
  unicode-display_width (>= 1.4.0, < 3.0)
29
- rubocop-ast (1.4.1)
30
- parser (>= 2.7.1.5)
29
+ rubocop-ast (1.7.0)
30
+ parser (>= 3.0.1.1)
31
31
  ruby-progressbar (1.11.0)
32
32
  simplecov (0.21.2)
33
33
  docile (~> 1.1)
34
34
  simplecov-html (~> 0.11)
35
35
  simplecov_json_formatter (~> 0.1)
36
36
  simplecov-html (0.12.3)
37
- simplecov_json_formatter (0.1.2)
37
+ simplecov_json_formatter (0.1.3)
38
38
  unicode-display_width (2.0.0)
39
39
 
40
40
  PLATFORMS
@@ -50,4 +50,4 @@ DEPENDENCIES
50
50
  simplecov
51
51
 
52
52
  BUNDLED WITH
53
- 2.2.6
53
+ 2.2.17
data/README.md CHANGED
@@ -2,7 +2,6 @@ MicroFSM
2
2
  ========
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/microfsm.svg)](https://badge.fury.io/rb/microfsm)
5
- [![Build Status](https://travis-ci.org/matique/microfsm.svg?branch=master)](https://travis-ci.org/matique/microfsm)
6
5
 
7
6
  MicroFSM implements a minimal/simple Finite-State Machine (FSM).
8
7
  Transitions are triggered by events.
data/lib/microfsm.rb CHANGED
@@ -5,7 +5,7 @@ class MicroFSM
5
5
  InvalidState = Class.new(ArgumentError)
6
6
  InvalidTransition = Class.new(ArgumentError)
7
7
 
8
- attr_reader :state
8
+ attr_accessor :state
9
9
 
10
10
  def initialize(initial_state)
11
11
  @state = initial_state
@@ -23,7 +23,7 @@ class MicroFSM
23
23
 
24
24
  @transitions_for[event][from] = to
25
25
  @callbacks_for[event][from] ||= []
26
- @callbacks_for[event][from] << block if block_given?
26
+ @callbacks_for[event][from] << block if block
27
27
  end
28
28
  self
29
29
  end
@@ -55,10 +55,6 @@ class MicroFSM
55
55
  @transitions_for.values.map(&:to_a).flatten.uniq.sort
56
56
  end
57
57
 
58
- def state=(state)
59
- @state = state
60
- end
61
-
62
58
  private
63
59
  def transit(event)
64
60
  callbacks = @callbacks_for[event][@state]
data/lib/version.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class MicroFSM
4
- VERSION = '0.1.2' # 2021-02-10
4
+ VERSION = '0.1.3' # 2021-06-22
5
+ # VERSION = '0.1.2' # 2021-02-10
5
6
  # VERSION = '0.1.1' # 2021-02-08
6
7
  # VERSION = '0.0.1' # 2021-01-24
7
8
  end
data/test/test_helper.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  if ENV['COVERAGE']
2
2
  require 'simplecov'
3
3
  SimpleCov.start do
4
- add_filter 'test'
5
- command_name 'Minitest'
4
+ add_filter '/test/'
6
5
  end
7
6
  end
8
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microfsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dittmar Krall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-11 00:00:00.000000000 Z
11
+ date: 2021-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -59,10 +59,10 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".github/workflows/rake.yml"
62
63
  - ".rubocop.yml"
63
64
  - ".ruby-gemset"
64
65
  - ".ruby-version"
65
- - ".travis.yml"
66
66
  - ".watchr"
67
67
  - Gemfile
68
68
  - Gemfile.lock
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- language: ruby
2
- sudo: false
3
-
4
- bundler_args: --without production
5
- # bundle config set without production
6
- script: 'bundle exec rake test'
7
-
8
- rvm:
9
- - 2.7.2 # 2020-10-26
10
-
11
- matrix:
12
- fast_finish: true
13
-
14
- notifications:
15
- email: false